diff --git a/bsp/essemi/es32f0271/.config b/bsp/essemi/es32f0271/.config deleted file mode 100644 index 15ed9fadcd..0000000000 --- a/bsp/essemi/es32f0271/.config +++ /dev/null @@ -1,439 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# RT-Thread 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=100 -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 is not set -CONFIG_RT_DEBUG=y -CONFIG_RT_DEBUG_COLOR=y -# 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_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_VER_NUM=0x40002 -# CONFIG_RT_USING_CPU_FFS is not set -# 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=1024 -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=2048 -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=y -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_PIN=y -# CONFIG_RT_USING_ADC 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 - -# -# RT-Thread online packages -# - -# -# IoT - internet of things -# -# CONFIG_PKG_USING_PAHOMQTT 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_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_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 - -# -# 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_IOTHUB is not set -# CONFIG_PKG_USING_JIOT-C-SDK 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_ONNX_PARSER is not set -# CONFIG_PKG_USING_ONNX_BACKEND 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 - -# -# security packages -# -# CONFIG_PKG_USING_MBEDTLS is not set -# CONFIG_PKG_USING_libsodium is not set -# CONFIG_PKG_USING_TINYCRYPT 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 - -# -# 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_RDB is not set -# CONFIG_PKG_USING_QRCODE is not set -# CONFIG_PKG_USING_ULOG_EASYFLASH 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_NR_MICRO_SHELL is not set - -# -# system packages -# -# CONFIG_PKG_USING_GUIENGINE is not set -# CONFIG_PKG_USING_CAIRO is not set -# CONFIG_PKG_USING_PIXMAN is not set -# CONFIG_PKG_USING_LWEXT4 is not set -# CONFIG_PKG_USING_PARTITION is not set -# CONFIG_PKG_USING_FAL 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_THREAD_POOL is not set -# CONFIG_PKG_USING_ROBOTS 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_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_WM_LIBRARIES is not set -# CONFIG_PKG_USING_KENDRYTE_SDK is not set -# CONFIG_PKG_USING_INFRARED is not set -# CONFIG_PKG_USING_ROSSERIAL 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_LCD_DRIVERS is not set -# CONFIG_PKG_USING_MAX17048 is not set -# CONFIG_PKG_USING_RPLIDAR 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_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_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_NNOM is not set -# CONFIG_PKG_USING_LIBANN is not set -# CONFIG_PKG_USING_ELAPACK is not set -# CONFIG_PKG_USING_ARMv7M_DWT is not set -# CONFIG_PKG_USING_VT100 is not set -# CONFIG_PKG_USING_ULAPACK is not set -# CONFIG_PKG_USING_UKAL is not set -CONFIG_SOC_ES32F0271LT=y - -# -# Hardware Drivers Config -# - -# -# On-chip Peripheral Drivers -# - -# -# PIN Drivers -# -CONFIG_BSP_USING_GPIO=y - -# -# UART Drivers -# -CONFIG_BSP_USING_UART1=y -# CONFIG_BSP_USING_UART2 is not set -# CONFIG_BSP_USING_UART3 is not set - -# -# SPI Drivers -# -# CONFIG_BSP_USING_SPI1 is not set -# CONFIG_BSP_USING_SPI2 is not set - -# -# I2C Drivers -# -# CONFIG_BSP_USING_I2C1 is not set -# CONFIG_BSP_USING_I2C2 is not set - -# -# HWtimer Drivers -# -# CONFIG_BSP_USING_HWTIMER1 is not set - -# -# PWM Drivers -# -# CONFIG_BSP_USING_PWM_GP16C2T1 is not set -# CONFIG_BSP_USING_PWM_GP16C2T4 is not set - -# -# RTC Drivers -# -# CONFIG_BSP_USING_RTC is not set - -# -# ADC Drivers -# -# CONFIG_BSP_USING_ADC is not set - -# -# Onboard Peripheral Drivers -# - -# -# Offboard Peripheral Drivers -# diff --git a/bsp/essemi/es32f0271/Kconfig b/bsp/essemi/es32f0271/Kconfig deleted file mode 100644 index 2065783042..0000000000 --- a/bsp/essemi/es32f0271/Kconfig +++ /dev/null @@ -1,27 +0,0 @@ -mainmenu "RT-Thread 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" - -config SOC_ES32F0271LT - bool - select RT_USING_COMPONENTS_INIT - select RT_USING_USER_MAIN - default y - -source "drivers/Kconfig" diff --git a/bsp/essemi/es32f0271/README.md b/bsp/essemi/es32f0271/README.md deleted file mode 100644 index c50443466b..0000000000 --- a/bsp/essemi/es32f0271/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# ES-PDS-ES32F0271 开发板 BSP 说明 -标签: EastSoft、国产MCU、Cortex-M0、ES32F0271LT - -## 1. 简介 - -本文档为上海东软载波微电子开发团队为 ES-PDS-ES32F0271 开发板提供的 BSP (板级支持包) 说明。 -通过阅读本文档,开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。 - -### 1.1 开发板介绍 - -主要内容如下: -ES-PDS-ES32F0271 是东软载波微电子官方推出的一款基于 ARM Cortex-M0 内核的开发板,最高主频为 48MHz,可满足基础功能测试及高端功能扩展等开发需求。 - -ES-PDS-ES32F0271-V1.1 - -该开发板常用 **板载资源** 如下: - -- MCU:ES32F0271LT,主频 48MHz,8KB SRAM,64KB FLASH -- 外部模块:SPI FLASH (MX25L64,8MB)、I2C EEPROM (M24C04,512B) -- 常用外设 - - 可调电阻:1个,(PC03) - - LED:2个,(PD03/PB08) - - 五轴按键: -- 常用接口:GPIO、UART、SPI、I2C -- 调试接口,ESLinkⅡ(EastSoft 官方推出的开发工具,有标准版和mini版两种版本,均自带 CDC 串口功能) SWD 下载 - -外设支持: - -本 BSP 目前对外设的支持情况如下: - -| **板载外设** | **支持情况** | **备注** | -| :---------------- | :----------: | :------------------------------------| -| **片上外设** | **支持情况** | **备注** | -| GPIO | 支持 | GPIOs | -| UART | 支持 | UART1/2/3 | -| SPI | 支持 | SPI1/2 | -| I2C | 支持 | I2C1/2 | -| PWM | 支持 | PWM1/2 | -| TIMER | 支持 | TIMER1 | -| RTC | 支持 | RTC | -| ADC | 支持 | ADC | - -### 1.2 注意事项 - -- 本BSP中,SPI2和PWM2不能同时使用 - -更多详细信息请咨询[上海东软载波微电子技术支持](http://www.essemi.com/) - -## 2. 快速上手 - -本 BSP 为开发者提供 MDK5 工程。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 - -### 硬件连接 - -使用 ESLinkⅡ (自带 CDC 串口)或 Jlink 等调试工具连接开发板到 PC端,拨动开关选择使用调试工具供电或使用外部电源供电。若使用 Jlink 等调试工具,还需要将 UART1_TX(PB06)、UART1_RX(PB07)、GND 接到串口工具上。 - -ESLinkⅡ(mini) + ES-PDS-ES32F0271-V1.1 - -### 编译下载 - -双击 project.uvprojx 文件,打开 MDK5 工程,工程默认配置使用 JLink 下载程序,在通过 JLink 连接开发板的基础上,点击下载按钮即可下载程序到开发板,如果使用 ESLinkⅡ,则选择 "CMSIS-DAP Debugger",连接正常后即可编译并下载程序到开发板。 - -### 运行结果 - -下载程序成功之后,系统会自动运行,观察串口输出的信息,同时开发板LED闪烁。 - -```bash - \ | / -- RT - Thread Operating System - / | \ 4.0.2 build Oct 31 2019 - 2006 - 2019 Copyright by rt-thread team -msh > -``` -## 3. 进阶使用 - -此 BSP 默认只开启了 GPIO 和 uart1 的功能,如果需使用 Flash 等更多高级功能,需要利用 ENV 工具对 BSP 进行配置,步骤如下: - -1. 在 bsp 下打开 env 工具。 - -2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 - -3. 输入`pkgs --update`命令更新软件包。 - -4. 输入`scons --target=mdk5/iar` 命令重新生成工程。 - -更多 Env 工具的详细介绍请参考 [RT-Thread 文档中心](https://www.rt-thread.org/document/site/) - -## 4. 联系人信息 - -- [yuzr](https://github.com/essemi-yuzr) - -## 5. 参考 - -- [ EastSoft 官网](http://www.essemi.com) - diff --git a/bsp/essemi/es32f0271/SConscript b/bsp/essemi/es32f0271/SConscript deleted file mode 100644 index 468297b6a9..0000000000 --- a/bsp/essemi/es32f0271/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# for module compiling -import os -Import('RTT_ROOT') - -objs = [] -cwd = str(Dir('#')) -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/essemi/es32f0271/SConstruct b/bsp/essemi/es32f0271/SConstruct deleted file mode 100644 index 164265293d..0000000000 --- a/bsp/essemi/es32f0271/SConstruct +++ /dev/null @@ -1,39 +0,0 @@ -import os -import sys -import rtconfig - -if os.getenv('RTT_ROOT'): - RTT_ROOT = os.getenv('RTT_ROOT') -else: - RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..') - -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 = 'rtthread.' + rtconfig.TARGET_EXT - -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 -objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) - -# make a building -DoBuilding(TARGET, objs) diff --git a/bsp/essemi/es32f0271/applications/SConscript b/bsp/essemi/es32f0271/applications/SConscript deleted file mode 100644 index e0c84e8f14..0000000000 --- a/bsp/essemi/es32f0271/applications/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -Import('RTT_ROOT') -Import('rtconfig') -from building import * - -cwd = os.path.join(str(Dir('#')), 'applications') -src = Glob('*.c') - -CPPPATH = [cwd, str(Dir('#'))] -group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') diff --git a/bsp/essemi/es32f0271/applications/main.c b/bsp/essemi/es32f0271/applications/main.c deleted file mode 100644 index 31e31d355d..0000000000 --- a/bsp/essemi/es32f0271/applications/main.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include - -#define LED_PIN 61 - -int main(void) -{ - /* LED pin configuration */ - rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT); - - while (1) - { - rt_pin_write(LED_PIN, PIN_HIGH); - rt_thread_mdelay(1000); - rt_pin_write(LED_PIN, PIN_LOW); - rt_thread_mdelay(1000); - } -} diff --git a/bsp/essemi/es32f0271/drivers/Kconfig b/bsp/essemi/es32f0271/drivers/Kconfig deleted file mode 100644 index 37265a5ba8..0000000000 --- a/bsp/essemi/es32f0271/drivers/Kconfig +++ /dev/null @@ -1,102 +0,0 @@ -menu "Hardware Drivers Config" - - menu "On-chip Peripheral Drivers" - menu "PIN Drivers" - config BSP_USING_GPIO - bool "Enable GPIO" - select RT_USING_PIN - default y - endmenu - - menu "UART Drivers" - config BSP_USING_UART1 - bool "Enable UART1 PB06/PB07(T/R)" - select RT_USING_SERIAL - default y - - config BSP_USING_UART2 - bool "Enable UART2 PA02/PA03(T/R)" - select RT_USING_SERIAL - default n - - config BSP_USING_UART3 - bool "Enable UART3 PC06/PC07(T/R)" - select RT_USING_SERIAL - default n - endmenu - - menu "SPI Drivers" - config BSP_USING_SPI1 - bool "Enable SPI1 BUS PB03/PB04/PB05(CLK/MISO/MOSI)" - select RT_USING_SPI - select RT_USING_PIN - default n - - config BSP_USING_SPI2 - bool "Enable SPI2 BUS PB13/PB14/PB15(CLK/MISO/MOSI)" - select RT_USING_SPI - select RT_USING_PIN - default n - depends on !BSP_USING_PWM_GP16C2T4 - endmenu - - menu "I2C Drivers" - config BSP_USING_I2C1 - bool "Enable I2C1 BUS PC12/PD02(SCL/SDA)" - select RT_USING_I2C - default n - - config BSP_USING_I2C2 - bool "Enable I2C2 BUS PB10/PB11(SCL/SDA)" - select RT_USING_I2C - default n - endmenu - - menu "HWtimer Drivers" - - config BSP_USING_HWTIMER1 - bool "Using timer1" - select RT_USING_HWTIMER - default n - endmenu - - menu "PWM Drivers" - - config BSP_USING_PWM_GP16C2T1 - bool "Using PWM_1(GP16C2T1) PB01/PB02" - select RT_USING_PWM - default n - - config BSP_USING_PWM_GP16C2T4 - bool "Using PWM2(GP16C2T4) PB12/PB14" - select RT_USING_PWM - default n - depends on !BSP_USING_SPI2 - - endmenu - - menu "RTC Drivers" - config BSP_USING_RTC - bool "Using RTC" - select RT_USING_RTC - default n - endmenu - - menu "ADC Drivers" - config BSP_USING_ADC - bool "Using ADC" - select RT_USING_ADC - default n - endmenu - - endmenu - - menu "Onboard Peripheral Drivers" - - endmenu - - menu "Offboard Peripheral Drivers" - - endmenu - -endmenu diff --git a/bsp/essemi/es32f0271/drivers/SConscript b/bsp/essemi/es32f0271/drivers/SConscript deleted file mode 100644 index 3be3df80c5..0000000000 --- a/bsp/essemi/es32f0271/drivers/SConscript +++ /dev/null @@ -1,45 +0,0 @@ -from building import * - -cwd = GetCurrentDir() - -# add the general drivers. -src = Split(''' -board.c -''') - -# add gpio code -if GetDepend('RT_USING_PIN'): - src += ['drv_gpio.c'] - -# add serial driver code -if GetDepend('BSP_USING_UART1') or GetDepend('BSP_USING_UART2') or GetDepend('BSP_USING_UART3'): - src += ['drv_uart.c'] - -# add spi driver code -if GetDepend('BSP_USING_SPI1') or GetDepend('BSP_USING_SPI2'): - src += ['drv_spi.c'] - -# add i2c driver code -if GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2'): - src += ['drv_i2c.c'] - -# add pwm driver code -if GetDepend('BSP_USING_PWM1') or GetDepend('BSP_USING_PWM2') or GetDepend('BSP_USING_PWM3') or GetDepend('BSP_USING_PWM4') or GetDepend('BSP_USING_PWM_GP16C2T1') or GetDepend('BSP_USING_PWM_GP16C2T4'): - src += ['drv_pwm.c'] - -# add hwtimer driver code -if GetDepend('BSP_USING_HWTIMER1'): - src += ['drv_hwtimer.c'] - -# add rtc driver code -if GetDepend(['BSP_USING_RTC']): - src += ['drv_rtc.c'] - -# add adc driver code -if GetDepend(['BSP_USING_ADC']): - src += ['drv_adc.c'] - -CPPPATH = [cwd] -group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') diff --git a/bsp/essemi/es32f0271/drivers/board.c b/bsp/essemi/es32f0271/drivers/board.c deleted file mode 100644 index 8ebc351ff1..0000000000 --- a/bsp/essemi/es32f0271/drivers/board.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include -#include "board.h" -#include "drv_uart.h" -#include "drv_gpio.h" -#include "md_gpio.h" - -/** - * @addtogroup es32f0 - */ - -/*@{*/ - -/******************************************************************************* -* Function Name : NVIC_Configuration -* Description : Configures Vector Table base location. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void NVIC_Configuration(void) -{ -} - -/******************************************************************************* - * Function Name : SystemClock_Configuration - * Description : Configures the System Clock. - * Input : None - * Output : None - * Return : None - *******************************************************************************/ -void SystemClock_Config(void) -{ - /*-------------------------Clock Config-------------------------/ - * Config system clock to 48MHz of which the clock source - * is PLL0. - */ - - // - // Open PLL0/HRC then wait it ready. - // - SET_BIT(RCU->CON, RCU_CON_PLL0ON_MSK); - SET_BIT(RCU->CON, RCU_CON_HRCON_MSK); - - /* Wait HRC clock steady. */ - while (!READ_BIT(RCU->CON, RCU_CON_HRCRDY_MSK)); - - // - // Change system clock source,PLL0,48MHz. - // - /* Chose PLL0 as system clock. */ - MODIFY_REG(RCU->CFG, RCU_CFG_SW_MSK, (0x4 << RCU_CFG_SW_POSS)); - /* Config mul of PLL0. */ - MODIFY_REG(RCU->CFG, RCU_CFG_PLLMUL_MSK, (11 << RCU_CFG_PLLMUL_POSS)); - - // - // Start to change system clock and wait it ready. - // - /* Config flash read wait time. */ - MODIFY_REG(FC->CON, FC_CON_WAIT_MSK, (0X2 << FC_CON_WAIT_POSS)); - /* Start to change. */ - SET_BIT(RCU->CFG, RCU_CFG_CKCFG_MSK); - - /* Wait system clock ready. */ - while (!READ_BIT(RCU->CON, RCU_CON_SWRDY_MSK)); - - // - // Remember the system clock. - // - SystemCoreClock = 48000000; -} - -/******************************************************************************* - * Function Name : SysTick_Configuration - * Description : Configures the SysTick for OS tick. - * Input : None - * Output : None - * Return : None - *******************************************************************************/ -void SysTick_Configuration(void) -{ - /* ticks = sysclk / RT_TICK_PER_SECOND */ - 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 initial ES32F0 board. - */ -void rt_hw_board_init(void) -{ - /* NVIC Configuration */ - NVIC_Configuration(); - - /*System Clock Configuration */ - SystemClock_Config(); - - /* 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 -} - diff --git a/bsp/essemi/es32f0271/drivers/board.h b/bsp/essemi/es32f0271/drivers/board.h deleted file mode 100644 index b1cb44890d..0000000000 --- a/bsp/essemi/es32f0271/drivers/board.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -// <<< Use Configuration Wizard in Context Menu >>> -#ifndef __BOARD_H__ -#define __BOARD_H__ - -#include "es32f0271.h" - -#define ES32F0_SRAM_SIZE 0x2000 -#define ES32F0_SRAM_END (0x20000000 + ES32F0_SRAM_SIZE) - -#if defined(__CC_ARM) || defined(__CLANG_ARM) - extern int Image$$RW_IRAM1$$ZI$$Limit; - #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) -#elif __ICCARM__ - #pragma section="HEAP" - #define HEAP_BEGIN (__segment_end("HEAP")) -#else - extern int __bss_end; - #define HEAP_BEGIN ((void *)&__bss_end) -#endif - -#define HEAP_END ES32F0_SRAM_END - -void rt_hw_board_init(void); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_adc.c b/bsp/essemi/es32f0271/drivers/drv_adc.c deleted file mode 100644 index d111b54f22..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_adc.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include -#include -#include "board.h" -#include "drv_adc.h" -#include "md_gpio.h" -#include "md_adc.h" -#include "md_rcu.h" -#include "md_syscfg.h" - -#ifdef RT_USING_ADC - -#define BSP_ADC_CHANNEL_NUM 8 - -/* define adc instance */ -static struct rt_adc_device _device_adc0; - -/* enable or disable adc */ -static rt_err_t es32f0_adc_enabled(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled) -{ - RT_ASSERT(device != RT_NULL); - - if (enabled) - { - md_adc_enable_ssen_ss0en(ADC); - } - else - { - md_adc_disable_ssen_ss0en(ADC); - } - - return RT_EOK; -} - -static void _adc_channel_config(rt_uint32_t channel) -{ - /* select gpio pin as adc function */ - switch (channel) - { - case 0: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_0, MD_GPIO_MODE_ANALOG); - break; - case 1: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_1, MD_GPIO_MODE_ANALOG); - break; - case 2: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_2, MD_GPIO_MODE_ANALOG); - break; - case 3: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_3, MD_GPIO_MODE_ANALOG); - break; - case 4: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_4, MD_GPIO_MODE_ANALOG); - break; - case 5: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_5, MD_GPIO_MODE_ANALOG); - break; - case 6: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_6, MD_GPIO_MODE_ANALOG); - break; - case 7: - md_gpio_set_mode(GPIOA, MD_GPIO_PIN_7, MD_GPIO_MODE_ANALOG); - break; - default: - break; - } -} - -static rt_err_t es32f0_get_adc_value(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value) -{ - rt_uint32_t chn_data[BSP_ADC_CHANNEL_NUM]; - rt_uint32_t i; - - RT_ASSERT(device != RT_NULL); - RT_ASSERT(value != RT_NULL); - - /* config adc channel */ - _adc_channel_config(channel); - - md_adc_set_swtri_ss0(ADC); - - while ((ADC->RIF & ADC_RIF_SS0RIF_MSK) == 0); - - for (i=0; i -#include -#include "board.h" -#include "drv_gpio.h" - -#ifdef RT_USING_PIN - -#define __ES32F0_PIN(index, gpio, gpio_index) {index, GPIO##gpio, gpio_index} -#define __ES32F0_PIN_DEFAULT {-1, 0, 0} - -/* ES32F0 GPIO driver */ -struct pin_index -{ - int index; - GPIO_TypeDef *gpio; - uint32_t pin; -}; - -static const struct pin_index pins[] = -{ - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(2, C, 13), - __ES32F0_PIN(3, C, 14), - __ES32F0_PIN(4, C, 15), - __ES32F0_PIN(5, D, 14), - __ES32F0_PIN(6, D, 15), - __ES32F0_PIN(7, D, 13), - __ES32F0_PIN(8, C, 0), - __ES32F0_PIN(9, C, 1), - __ES32F0_PIN(10, C, 2), - __ES32F0_PIN(11, C, 3), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(14, A, 0), - __ES32F0_PIN(15, A, 1), - __ES32F0_PIN(16, A, 2), - __ES32F0_PIN(17, A, 3), - __ES32F0_PIN(18, D, 0), - __ES32F0_PIN(19, D, 1), - __ES32F0_PIN(20, A, 4), - __ES32F0_PIN(21, A, 5), - __ES32F0_PIN(22, A, 6), - __ES32F0_PIN(23, A, 7), - __ES32F0_PIN(24, C, 4), - __ES32F0_PIN(25, C, 5), - __ES32F0_PIN(26, B, 0), - __ES32F0_PIN(27, B, 1), - __ES32F0_PIN(28, B, 2), - __ES32F0_PIN(29, B, 10), - __ES32F0_PIN(30, B, 11), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(33, B, 12), - __ES32F0_PIN(34, B, 13), - __ES32F0_PIN(35, B, 14), - __ES32F0_PIN(36, B, 15), - __ES32F0_PIN(37, C, 6), - __ES32F0_PIN(38, C, 7), - __ES32F0_PIN(39, C, 8), - __ES32F0_PIN(40, C, 9), - __ES32F0_PIN(41, A, 8), - __ES32F0_PIN(42, A, 9), - __ES32F0_PIN(43, A, 10), - __ES32F0_PIN(44, A, 11), - __ES32F0_PIN(45, A, 12), - __ES32F0_PIN(46, A, 13), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(49, A, 14), - __ES32F0_PIN(50, A, 15), - __ES32F0_PIN(51, C, 10), - __ES32F0_PIN(52, C, 11), - __ES32F0_PIN(53, C, 12), - __ES32F0_PIN(54, D, 2), - __ES32F0_PIN(55, B, 3), - __ES32F0_PIN(56, B, 4), - __ES32F0_PIN(57, B, 5), - __ES32F0_PIN(58, B, 6), - __ES32F0_PIN(59, B, 7), - __ES32F0_PIN(60, D, 3), - __ES32F0_PIN(61, B, 8), - __ES32F0_PIN(62, B, 9), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, -}; - -struct pin_irq_map -{ - rt_uint16_t pinbit; - IRQn_Type irqno; -}; -static const struct pin_irq_map pin_irq_map[] = -{ - {0, EXTI_0to1_IRQn}, - {1, EXTI_0to1_IRQn}, - {2, EXTI_2to3_IRQn}, - {3, EXTI_2to3_IRQn}, - {4, EXTI_4to15_IRQn}, - {5, EXTI_4to15_IRQn}, - {6, EXTI_4to15_IRQn}, - {7, EXTI_4to15_IRQn}, - {8, EXTI_4to15_IRQn}, - {9, EXTI_4to15_IRQn}, - {10, EXTI_4to15_IRQn}, - {11, EXTI_4to15_IRQn}, - {12, EXTI_4to15_IRQn}, - {13, EXTI_4to15_IRQn}, - {14, EXTI_4to15_IRQn}, - {15, EXTI_4to15_IRQn}, -}; - -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}, -}; - -#define ITEM_NUM(items) sizeof(items) / sizeof(items[0]) -const struct pin_index *get_pin(uint8_t pin) -{ - const struct pin_index *index; - if (pin < ITEM_NUM(pins)) - { - index = &pins[pin]; - if (index->index == -1) - index = RT_NULL; - } - else - { - index = RT_NULL; - } - return index; -}; - -void es32f0_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value) -{ - const struct pin_index *index; - index = get_pin(pin); - if (index == RT_NULL) - { - return; - } - - /* Write GPIO */ - if (value == 0) - SET_BIT(index->gpio->BSBR, 0x1<<(index->pin+16)); - else - SET_BIT(index->gpio->BSBR, 0x1<pin); -} - -int es32f0_pin_read(rt_device_t dev, rt_base_t pin) -{ - int value; - const struct pin_index *index; - value = PIN_LOW; - index = get_pin(pin); - if (index == RT_NULL) - { - return value; - } - - /* Read the GPIO value with the spcified index */ - value = (index->gpio->IDATA & (0x1<pin)) != 0; - - return value; -} - -void es32f0_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) -{ - const struct pin_index *index; - GPIO_TypeDef *gpiox; - index = get_pin(pin); - if (index == RT_NULL) - { - return; - } - - /* Get the IO port */ - gpiox = index->gpio; - - /* Config GPIO */ - switch(mode) - { - case PIN_MODE_OUTPUT: - { - /* pushpull & output & 16mA */ - MODIFY_REG(gpiox->MOD, (0x3<<(index->pin*2)), (0x1<<(index->pin*2))); - CLEAR_BIT(gpiox->OT, (0x1<pin)); - CLEAR_BIT(gpiox->DS, (0x1<pin)); - break; - } - case PIN_MODE_OUTPUT_OD: - { - /* opendrain & output & 16mA */ - MODIFY_REG(gpiox->MOD, (0x3<pin), (0x1<pin)); - SET_BIT(gpiox->OT, (0x1<pin)); - CLEAR_BIT(gpiox->DS, (0x1<pin)); - break; - } - case PIN_MODE_INPUT: - { - /* input & no pull & CMOS & filter */ - MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin)); - MODIFY_REG(gpiox->PUD, (0x3<pin), (0x0<pin)); - SET_BIT(gpiox->IST, (0x1<pin)); - SET_BIT(gpiox->FIR, (0x1<pin)); - break; - } - case PIN_MODE_INPUT_PULLUP: - { - /* input & pull up & CMOS & filter */ - MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin)); - MODIFY_REG(gpiox->PUD, (0x3<pin), (0x1<pin)); - SET_BIT(gpiox->IST, (0x1<pin)); - SET_BIT(gpiox->FIR, (0x1<pin)); - break; - } - case PIN_MODE_INPUT_PULLDOWN: - { - /* input & pull down & CMOS & filter */ - MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin)); - MODIFY_REG(gpiox->PUD, (0x3<pin), (0x2<pin)); - SET_BIT(gpiox->IST, (0x1<pin)); - SET_BIT(gpiox->FIR, (0x1<pin)); - break; - } - default: - { - /* output */ - MODIFY_REG(gpiox->MOD, (0x3<pin), (0x1<pin)); - } - } -} - -rt_inline const struct pin_irq_map *get_pin_irq_map(rt_uint16_t gpio_pin) -{ - rt_int32_t mapindex = gpio_pin & 0x00FF; - if (mapindex < 0 || mapindex >= ITEM_NUM(pin_irq_map)) - { - return RT_NULL; - } - return &pin_irq_map[mapindex]; -}; - -rt_err_t es32f0_pin_attach_irq(struct rt_device *device, rt_int32_t pin, - rt_uint32_t mode, void (*hdr)(void *args), void *args) -{ - const struct pin_index *index; - rt_base_t level; - rt_int32_t irqindex; - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - /* pin no. convert to dec no. */ - for (irqindex = 0; irqindex < 16; irqindex++) - { - if ((0x01 << irqindex) == index->pin) - { - break; - } - } - if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) - { - return RT_ENOSYS; - } - 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; -} - -rt_err_t es32f0_pin_detach_irq(struct rt_device *device, rt_int32_t pin) -{ - const struct pin_index *index; - rt_base_t level; - rt_int32_t irqindex = -1; - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - irqindex = index->pin & 0x00FF; - if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) - { - return RT_ENOSYS; - } - 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; -} - -rt_err_t es32f0_pin_irq_enable(struct rt_device *device, rt_base_t pin, - rt_uint32_t enabled) -{ - const struct pin_index *index; - const struct pin_irq_map *irqmap; - GPIO_TypeDef *gpiox; - rt_base_t level; - rt_int32_t irqindex = -1; - - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - - /* Get the IO port */ - gpiox = index->gpio; - - if (enabled == PIN_IRQ_ENABLE) - { - /* pin no. convert to dec no. */ - for (irqindex = 0; irqindex < 16; irqindex++) - { - if ((0x01 << irqindex) == index->pin) - { - break; - } - } - if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) - { - return RT_ENOSYS; - } - level = rt_hw_interrupt_disable(); - if (pin_irq_hdr_tab[irqindex].pin == -1) - { - rt_hw_interrupt_enable(level); - return RT_ENOSYS; - } - irqmap = &pin_irq_map[irqindex]; - - /* Config EXTI */ - MODIFY_REG(gpiox->MOD, (0x3<pin), (0x0<pin)); - SET_BIT(gpiox->FIR, index->pin); - SET_BIT(gpiox->IST, index->pin); - MODIFY_REG(((uint32_t *)(&EXTI->ICFG1))[index->pin/8], - 0xF<<(index->pin%8), - (((uint32_t)(index->gpio) - AHB2_BASE)/0x400)<<(index->pin%8)); - SET_BIT(EXTI->DB, 0x1<pin); - - switch (pin_irq_hdr_tab[irqindex].mode) - { - case PIN_IRQ_MODE_RISING: - { - /* pull down the pin */ - MODIFY_REG(gpiox->PUD, (0x3<pin), (0x2<pin)); - /* Enable EXTI rising interrupt and disable falling interrupt */ - SET_BIT(EXTI->RTS, (0x1<pin)); - CLEAR_BIT(EXTI->FTS, (0x1<pin)); - break; - } - case PIN_IRQ_MODE_FALLING: - { - /* pull up the pin */ - MODIFY_REG(gpiox->PUD, (0x3<pin), (0x1<pin)); - /* Enable EXTI falling interrupt and disable rising interrupt */ - CLEAR_BIT(EXTI->RTS, (0x1<pin)); - SET_BIT(EXTI->FTS, (0x1<pin)); - break; - } - case PIN_IRQ_MODE_RISING_FALLING: - { - /* pull up the pin */ - MODIFY_REG(gpiox->PUD, (0x3<pin), (0x1<pin)); - /* Enable EXTI falling interrupt and enable rising interrupt */ - SET_BIT(EXTI->RTS, (0x1<pin)); - SET_BIT(EXTI->FTS, (0x1<pin)); - break; - } - } - - /* Enable EXTI interrupt */ - SET_BIT(EXTI->IER, (0x1<pin)); - NVIC_EnableIRQ(irqmap->irqno); - rt_hw_interrupt_enable(level); - } - else if (enabled == PIN_IRQ_DISABLE) - { - irqmap = get_pin_irq_map(index->pin); - if (irqmap == RT_NULL) - { - return RT_ENOSYS; - } - NVIC_DisableIRQ(irqmap->irqno); - } - else - { - return RT_ENOSYS; - } - return RT_EOK; -} - -const static struct rt_pin_ops _es32f0_pin_ops = -{ - es32f0_pin_mode, - es32f0_pin_write, - es32f0_pin_read, - es32f0_pin_attach_irq, - es32f0_pin_detach_irq, - es32f0_pin_irq_enable, - RT_NULL, -}; - -int rt_hw_pin_init(void) -{ - int result; - - /* Open IO clock */ - SET_BIT(RCU->AHBEN, RCU_AHBEN_GPDEN_MSK|RCU_AHBEN_GPCEN_MSK \ - |RCU_AHBEN_GPBEN_MSK|RCU_AHBEN_GPAEN_MSK); - - /* register IO device */ - result = rt_device_pin_register("pin", &_es32f0_pin_ops, RT_NULL); - return result; -} -INIT_BOARD_EXPORT(rt_hw_pin_init); - -rt_inline void pin_irq_hdr(uint16_t GPIO_Pin) -{ - uint16_t irqno; - /* pin no. convert to dec no. */ - for (irqno = 0; irqno < 16; irqno++) - { - if ((0x01 << irqno) == GPIO_Pin) - { - break; - } - } - if (irqno == 16) - return; - if (pin_irq_hdr_tab[irqno].hdr) - { - pin_irq_hdr_tab[irqno].hdr(pin_irq_hdr_tab[irqno].args); - } -} - -void GPIO_EXTI_Callback(uint16_t GPIO_Pin) -{ - /* Read the exti interrupt then clear the flag */ - if ((EXTI->RIF & (0x1<ICR, 0x1< -#include -#include -#include -#include -#include "md_ad16c4t.h" -#include "md_rcu.h" - -#ifdef RT_USING_HWTIMER - -/* Defien the hardware timer control struct */ -struct es32f0_hwtimer_dev -{ - rt_hwtimer_t parent; - AD16C4T_TypeDef *hwtimer_periph; - IRQn_Type IRQn; -}; - -#ifdef BSP_USING_HWTIMER1 -static struct es32f0_hwtimer_dev hwtimer1; - -void BS16T1_IRQHandler(void) -{ - /* if BS16T1 IT */ - if (BS16T1->IFM & AD16C4T_RIF_UI_MSK) - { - SET_BIT(BS16T1->ICR, AD16C4T_ICR_UI_MSK); - rt_device_hwtimer_isr(&hwtimer1.parent); - - if (HWTIMER_MODE_ONESHOT == hwtimer1.parent.mode) - { - CLEAR_BIT(BS16T1->CON1, AD16C4T_CON1_CNTEN_MSK); - } - } -} -#endif - -static struct rt_hwtimer_info es32f0_hwtimer_info = -{ - 48000000, /* maximum count frequency */ - 1, /* minimum count frequency */ - 65535, /* counter maximum value */ - HWTIMER_CNTMODE_UP -}; - -static void es32f0_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - if (1 == state) - { - /* Set frequency */ - WRITE_REG(hwtimer->hwtimer_periph->PRES, (SystemCoreClock/hwtimer->parent.freq - 1)); - /* Enable timer IT */ - SET_BIT(hwtimer->hwtimer_periph->IER, AD16C4T_IER_UI_MSK); - NVIC_EnableIRQ(hwtimer->IRQn); - } - else - { - /* Dsiable timer IT */ - SET_BIT(hwtimer->hwtimer_periph->IDR, AD16C4T_IER_UI_MSK); - } -} - -static rt_err_t es32f0_hwtimer_start(rt_hwtimer_t *timer, - rt_uint32_t cnt, - rt_hwtimer_mode_t mode) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - WRITE_REG(hwtimer->hwtimer_periph->AR, cnt); - SET_BIT(hwtimer->hwtimer_periph->CON1, AD16C4T_CON1_CNTEN_MSK); - - return RT_EOK; -} - -static void es32f0_hwtimer_stop(rt_hwtimer_t *timer) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - CLEAR_BIT(hwtimer->hwtimer_periph->CON1, AD16C4T_CON1_CNTEN_MSK); -} - -static rt_uint32_t es32f0_hwtimer_count_get(rt_hwtimer_t *timer) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - uint32_t hwtimer_count = 0; - - RT_ASSERT(hwtimer != RT_NULL); - - hwtimer_count = READ_REG(hwtimer->hwtimer_periph->COUNT); - - return hwtimer_count; -} - -static rt_err_t es32f0_hwtimer_control(rt_hwtimer_t *timer, - rt_uint32_t cmd, - void *args) -{ - rt_err_t ret = RT_EOK; - rt_uint32_t freq = 0; - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - switch (cmd) - { - case HWTIMER_CTRL_FREQ_SET: - freq = *(rt_uint32_t *)args; - if ((freq < hwtimer->parent.info->minfreq) || (freq > hwtimer->parent.info->maxfreq)) - { - ret = RT_EINVAL; - } - /* Set frequency */ - WRITE_REG(hwtimer->hwtimer_periph->PRES, (SystemCoreClock/freq - 1)); - break; - - case HWTIMER_CTRL_STOP: - CLEAR_BIT(hwtimer->hwtimer_periph->CON1, AD16C4T_CON1_CNTEN_MSK); - break; - - default: - ret = RT_EINVAL; - break; - } - - return ret; -} - -static struct rt_hwtimer_ops es32f0_hwtimer_ops = -{ - es32f0_hwtimer_init, - es32f0_hwtimer_start, - es32f0_hwtimer_stop, - es32f0_hwtimer_count_get, - es32f0_hwtimer_control -}; - -int rt_hw_hwtimer_init(void) -{ - rt_err_t ret = RT_EOK; - -#ifdef BSP_USING_HWTIMER1 - /*Open clock*/ - SET_BIT(RCU->APB1EN, RCU_APB1EN_BS16T1EN_MSK); - - hwtimer1.hwtimer_periph = BS16T1; - hwtimer1.IRQn = BS16T1_IRQn; - hwtimer1.parent.info = &es32f0_hwtimer_info; - hwtimer1.parent.ops = &es32f0_hwtimer_ops; - ret = rt_device_hwtimer_register(&hwtimer1.parent, "timer1", &hwtimer1); -#endif - - return ret; -} -INIT_BOARD_EXPORT(rt_hw_hwtimer_init); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_hwtimer.h b/bsp/essemi/es32f0271/drivers/drv_hwtimer.h deleted file mode 100644 index 576671e735..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_hwtimer.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#ifndef DRV_HWTIMER_H__ -#define DRV_HWTIMER_H__ - -int rt_hw_hwtimer_init(void); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_i2c.c b/bsp/essemi/es32f0271/drivers/drv_i2c.c deleted file mode 100644 index fb4f79de09..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_i2c.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include -#include -#include "board.h" -#include "drv_i2c.h" -#include "md_i2c.h" -#include "md_gpio.h" - -#ifdef RT_USING_I2C - -#define TIMEOUT 0xF -/* Define I2C hardware SCL timeout */ -#define I2C_TIMING_48MHZ_CLK100KHZ ((0xBU<<28)|(4<<20)|(2<<16)|(0xF<<8)|(0x13)) - -/** - * @brief: I2C receive. - * @param: i2cx, pointer to the I2Cx - * @param: addr, address - * @param: buf, send data buffer - * @param: len, the length of buf - * @param: timout, timeout - * @retval: rt_err_t - */ -static rt_err_t __i2c_master_recv(I2C_TypeDef *i2cx, rt_uint16_t addr, - rt_uint8_t *buf, rt_uint16_t len, rt_uint32_t timout) -{ - rt_uint32_t rt_timout; - - // - // Config I2C transfer mode - // - md_i2c_set_con2_add10(i2cx, MD_I2C_ADDRESSINGMODE_7BIT); - /* Config slaver address */ - md_i2c_set_con2_sadd(i2cx, addr); - /* Config data size */ - md_i2c_set_con2_nbytes(i2cx, len); - /* Reset TX FIFO */ - md_i2c_set_fcon_txfrst(i2cx, MD_I2C_TXFIFO_RESET); - /* Config mode */ - md_i2c_set_con2_rd_wrn(i2cx, MD_I2C_MASTER_READ); - /* Config auto-reload */ - md_i2c_set_con2_reload(i2cx, MD_I2C_NORELOAD_MODE); - /* When NBYTES is matched, the communication will be automatically stop */ - md_i2c_set_con2_autoend(i2cx, MD_I2C_AUTOEND_MODE); - /* Start the I2C communication */ - md_i2c_set_con2_start(i2cx, MD_I2C_START_GENERATION); - - while (len > 0) - { - /* Wait Rx FIFO non-empty */ - rt_timout = timout; - while (md_i2c_is_active_stat_rxe(i2cx) && (--rt_timout)); - if (rt_timout == 0) - return RT_ETIMEOUT; - - *buf++ = md_i2c_recv(i2cx); - len--; - } - - return RT_EOK; -} - -/** - * @brief: I2C send. - * @param: i2cx, pointer to the I2Cx - * @param: addr, address - * @param: buf, send data buffer - * @param: len, the length of buf - * @param: timout, timeout - * @retval: rt_err_t - */ -static rt_err_t __i2c_master_send(I2C_TypeDef *i2cx, rt_uint16_t addr, - rt_uint8_t *buf, rt_uint16_t len, rt_uint32_t timout) -{ - rt_uint32_t rt_timout; - rt_uint8_t index; - - // - // Config I2C transfer mode - // - md_i2c_set_con2_add10(i2cx, MD_I2C_ADDRESSINGMODE_7BIT); - /* Config slaver address */ - md_i2c_set_con2_sadd(i2cx, addr); - /* Config data size */ - md_i2c_set_con2_nbytes(i2cx, len); - /* Reset TX FIFO */ - md_i2c_set_fcon_txfrst(i2cx, MD_I2C_TXFIFO_RESET); - /* Config mode */ - md_i2c_set_con2_rd_wrn(i2cx, MD_I2C_MASTER_WRITE); - /* Enable auto-end */ - md_i2c_set_con2_autoend(i2cx, MD_I2C_AUTOEND_MODE); - - // - // Check if the bus is busy - // - /* Wait bus to be ready */ - rt_timout = timout; - while ((READ_BIT(i2cx->STAT, I2C_STAT_BUSY_MSK) == I2C_STAT_BUSY_MSK) && (--rt_timout)); - if (rt_timout == 0) - return RT_EBUSY; - - // - // Start to send - // - if (len <= 8) - { - for (index = 0; index < len; index++) - md_i2c_send(i2cx, *buf++); - - len = 0; - } - else - { - for (index = 0; index < 8; index++) - md_i2c_send(i2cx, *buf++); - - len -= 8; - } - - /* Start the I2C communication */ - md_i2c_set_con2_start(i2cx, MD_I2C_START_GENERATION); - - while (len > 0) - { - rt_timout = timout; - while (md_i2c_is_active_stat_txf(i2cx) && (--rt_timout)); - if (rt_timout == 0) - return RT_ETIMEOUT; - - md_i2c_send(i2cx, *buf++); - len--; - } - - return RT_EOK; -} - -static rt_size_t es32f0_master_xfer(struct rt_i2c_bus_device *bus, - struct rt_i2c_msg msgs[], - rt_uint32_t num) -{ - struct rt_i2c_msg *msg; - rt_uint32_t i; - rt_err_t ret = RT_ERROR; - - for (i = 0; i < num; i++) - { - msg = &msgs[i]; - if (msg->flags & RT_I2C_RD) - { - if (__i2c_master_recv(bus->priv, msg->addr << 1, msg->buf, msg->len, TIMEOUT) != 0) - { - LOG_E("i2c bus write failed,i2c bus stop!\n"); - goto out; - } - } - else - { - if (__i2c_master_send(bus->priv, msg->addr << 1, msg->buf, msg->len, TIMEOUT) != 0) - { - LOG_E("i2c bus write failed,i2c bus stop!\n"); - goto out; - } - } - } - - ret = i; - -out: - LOG_E("send stop condition\n"); - - return ret; -} - -const struct rt_i2c_bus_device_ops es32f0_i2c_ops = -{ - es32f0_master_xfer, - RT_NULL, - RT_NULL, -}; - -static void _i2c_init(void) -{ - md_i2c_inittypedef I2C_Init = - { - .Timing = CLK100kHz48M, - .Address1 = 0x55 << 1, - .AddrSize = MD_I2C_ADDRESSINGMODE_7BIT, - .DualAddressMode = MD_I2C_DUALADDRESS_DISABLE, - .Address2 = 0xAA, - .Address2Masks = MD_I2C_ADDR2_NOMASK - }; - -#ifdef BSP_USING_I2C1 - /* Open I2C clock */ - SET_BIT(RCU->APB1EN, RCU_APB1EN_I2C1EN_MSK); - - /* GPIO configuration */ - md_gpio_set_pull (GPIOC, MD_GPIO_PIN_12, MD_GPIO_PULL_UP); - md_gpio_set_pull (GPIOD, MD_GPIO_PIN_2, MD_GPIO_PULL_UP); - md_gpio_set_output_type (GPIOC, MD_GPIO_PIN_12, MD_GPIO_OUTPUT_OPENDRAIN); - md_gpio_set_output_type (GPIOD, MD_GPIO_PIN_2, MD_GPIO_OUTPUT_OPENDRAIN); - md_gpio_set_mode (GPIOC, MD_GPIO_PIN_12, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOD, MD_GPIO_PIN_2, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function8_15(GPIOC, MD_GPIO_PIN_12, MD_GPIO_AF1); - md_gpio_set_function0_7 (GPIOD, MD_GPIO_PIN_2, MD_GPIO_AF1); - - // - // Config I2C - // - md_i2c_init(I2C1, &I2C_Init); -#endif - -#ifdef BSP_USING_I2C2 - /* Open I2C clock */ - SET_BIT(RCU->APB1EN, RCU_APB1EN_I2C2EN_MSK); - - /* GPIO configuration */ - md_gpio_set_pull (GPIOB, MD_GPIO_PIN_10, MD_GPIO_PULL_UP); - md_gpio_set_pull (GPIOB, MD_GPIO_PIN_11, MD_GPIO_PULL_UP); - md_gpio_set_output_type (GPIOB, MD_GPIO_PIN_10, MD_GPIO_OUTPUT_OPENDRAIN); - md_gpio_set_output_type (GPIOB, MD_GPIO_PIN_11, MD_GPIO_OUTPUT_OPENDRAIN); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_10, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_11, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_10, MD_GPIO_AF1); - md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_11, MD_GPIO_AF1); - - // - // Config I2C - // - md_i2c_init(I2C2, &I2C_Init); -#endif -} - -#ifdef BSP_USING_I2C2 -static struct rt_i2c_bus_device i2c_device2; -#endif - -#ifdef BSP_USING_I2C1 -static struct rt_i2c_bus_device i2c_device1; -#endif -int rt_hw_i2c_init(void) -{ - _i2c_init(); - -#ifdef BSP_USING_I2C2 - /* define i2c Instance */ - rt_memset((void *)&i2c_device2, 0, sizeof(struct rt_i2c_bus_device)); - i2c_device2.ops = &es32f0_i2c_ops; - i2c_device2.priv = I2C2; - rt_i2c_bus_device_register(&i2c_device2, "i2c2"); -#endif - -#ifdef BSP_USING_I2C1 - /* define i2c Instance */ - rt_memset((void *)&i2c_device1, 0, sizeof(struct rt_i2c_bus_device)); - i2c_device1.ops = &es32f0_i2c_ops; - i2c_device1.priv = I2C1; - rt_i2c_bus_device_register(&i2c_device1, "i2c1"); -#endif - - return RT_EOK; -} -INIT_DEVICE_EXPORT(rt_hw_i2c_init); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_i2c.h b/bsp/essemi/es32f0271/drivers/drv_i2c.h deleted file mode 100644 index 7af06805f7..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_i2c.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#ifndef DRV_I2C_H__ -#define DRV_I2C_H__ - -int rt_hw_i2c_init(void); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_pwm.c b/bsp/essemi/es32f0271/drivers/drv_pwm.c deleted file mode 100644 index 768fcd04cd..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_pwm.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include -#include -#include -#include "md_gpio.h" - -/* PWM device control struct */ -struct pwm_dev_ctrl { - AD16C4T_TypeDef *timx; - rt_uint8_t chnm; /* Cannel number */ - struct rt_pwm_configuration *cfg; -}; - -#ifdef BSP_USING_PWM_GP16C2T1 - -/* Remember channel configuration */ -static struct rt_pwm_configuration pwm_ch_cfg_gp16c2t1[2] = { - [0] = { - .channel = 1, - .period = 0, - .pulse = 0 - }, - [1] = { - .channel = 2, - .period = 0, - .pulse = 0 - } -}; - -/* Define static device */ -static struct rt_device_pwm pwm_dev_gp16c2t1; -static struct pwm_dev_ctrl pwm_dev_gp16c2t1_ctrl; -#endif -#ifdef BSP_USING_PWM_GP16C2T4 - -/* Remember channel configuration */ -static struct rt_pwm_configuration pwm_ch_cfg_gp16c2t4[2] = { - [0] = { - .channel = 1, - .period = 0, - .pulse = 0 - }, - [1] = { - .channel = 2, - .period = 0, - .pulse = 0 - } -}; - -/* Define static device */ -static struct rt_device_pwm pwm_dev_gp16c2t4; -static struct pwm_dev_ctrl pwm_dev_gp16c2t4_ctrl; -#endif - -static void pwm_auto_config_freq(AD16C4T_TypeDef *timerx, uint32_t ns) -{ - uint32_t temp_ar; - uint32_t temp_pres = timerx->PRES & 0xFFFF; - uint32_t err_cnt = 0; - - /* Automatic setting frequency division ratio */ - while (err_cnt++ < 65536) - { - temp_ar = (uint64_t)SystemCoreClock * ns / 1000000000 / (temp_pres + 1); - if (temp_ar <= 0xFFFF) - break; - temp_pres++; - } - - /* Write back to PRES */ - timerx->PRES = (uint16_t)(temp_pres & 0xFFFF); - timerx->AR = temp_ar; -} - -static void pwm_set_duty(AD16C4T_TypeDef *timerx, uint8_t ch, uint32_t ns) -{ - uint32_t temp_pres = timerx->PRES & 0xFFFF; - uint64_t tmp = (uint64_t)SystemCoreClock * ns / 1000000000 / (temp_pres + 1); - - if (ch == 1) - WRITE_REG(timerx->CCVAL1, (uint32_t)tmp); - else if (ch == 2) - WRITE_REG(timerx->CCVAL2, (uint32_t)tmp); -} - -static rt_err_t es32f0_pwm_control(struct rt_device_pwm *device, int cmd, void *arg) -{ - rt_err_t ret = RT_EOK; - struct pwm_dev_ctrl *dev_ctrl - = (struct pwm_dev_ctrl *)device->parent.user_data; - struct rt_pwm_configuration *cfg = (struct rt_pwm_configuration *)arg; - AD16C4T_TypeDef *timerx = (AD16C4T_TypeDef *)dev_ctrl->timx; - - switch (cmd) - { - case PWM_CMD_ENABLE: - { - if (cfg->channel == 1) - SET_BIT(timerx->CCEP, AD16C4T_CCEP_CC1EN_MSK); - else if (cfg->channel == 2) - SET_BIT(timerx->CCEP, AD16C4T_CCEP_CC2EN_MSK); - break; - } - case PWM_CMD_DISABLE: - { - if (cfg->channel == 1) - CLEAR_BIT(timerx->CCEP, AD16C4T_CCEP_CC1EN_MSK); - else if (cfg->channel == 2) - CLEAR_BIT(timerx->CCEP, AD16C4T_CCEP_CC2EN_MSK); - break; - } - case PWM_CMD_SET: - { - /* count registers max 0xFFFF, auto adjust prescaler */ - pwm_auto_config_freq(timerx, cfg->period); - pwm_set_duty(timerx, cfg->channel, cfg->pulse); - /* Remember configuration */ - dev_ctrl->cfg[cfg->channel-1].period = cfg->period; - dev_ctrl->cfg[cfg->channel-1].pulse = cfg->pulse; - break; - } - case PWM_CMD_GET: - { - cfg->period = dev_ctrl->cfg[cfg->channel-1].period; - cfg->pulse = dev_ctrl->cfg[cfg->channel-1].pulse; - break; - } - - default: - break; - } - return ret; -} - -const static struct rt_pwm_ops es32f0_pwm_ops = -{ - es32f0_pwm_control -}; - -int rt_hw_pwm_init(void) -{ - rt_err_t ret = RT_EOK; - -#ifdef BSP_USING_PWM_GP16C2T1 /* 2 channels */ - /* Open clock */ - SET_BIT(RCU->APB2EN, RCU_APB2EN_GP16C2T1EN_MSK); - - /* GPIO configuration */ - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_1, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_2, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_1, MD_GPIO_AF5); - md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_2, MD_GPIO_AF5); - - /* Timer configuration */ - MODIFY_REG(GP16C2T1->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK, - (6 << AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS)); - MODIFY_REG(GP16C2T1->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK, - (6 << AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS)); - SET_BIT(GP16C2T1->BDCFG, AD16C4T_BDCFG_GOEN_MSK); - SET_BIT(GP16C2T1->CON1, AD16C4T_CON1_CNTEN_MSK); - - pwm_dev_gp16c2t1_ctrl.chnm = 2; - pwm_dev_gp16c2t1_ctrl.timx = GP16C2T1; - pwm_dev_gp16c2t1_ctrl.cfg = pwm_ch_cfg_gp16c2t1; - /* Register PWM device */ - ret = rt_device_pwm_register(&pwm_dev_gp16c2t1, - "pwm1", &es32f0_pwm_ops, &pwm_dev_gp16c2t1_ctrl); -#endif - -#ifdef BSP_USING_PWM_GP16C2T4 /* 2 channels */ - /* Open clock */ - SET_BIT(RCU->APB2EN, RCU_APB2EN_GP16C2T4EN_MSK); - - /* GPIO configuration */ - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_12, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_14, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_12, MD_GPIO_AF5); - md_gpio_set_function8_15(GPIOB, MD_GPIO_PIN_14, MD_GPIO_AF5); - - /* Timer configuration */ - MODIFY_REG(GP16C2T4->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK, - (6 << AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS)); - MODIFY_REG(GP16C2T4->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK, - (6 << AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS)); - SET_BIT(GP16C2T4->BDCFG, AD16C4T_BDCFG_GOEN_MSK); - SET_BIT(GP16C2T4->CON1, AD16C4T_CON1_CNTEN_MSK); - - pwm_dev_gp16c2t4_ctrl.chnm = 2; - pwm_dev_gp16c2t4_ctrl.timx = GP16C2T4; - pwm_dev_gp16c2t4_ctrl.cfg = pwm_ch_cfg_gp16c2t4; - /* Register PWM device */ - ret = rt_device_pwm_register(&pwm_dev_gp16c2t4, - "pwm2", &es32f0_pwm_ops, &pwm_dev_gp16c2t4_ctrl); -#endif - - return ret; -} -INIT_DEVICE_EXPORT(rt_hw_pwm_init); diff --git a/bsp/essemi/es32f0271/drivers/drv_pwm.h b/bsp/essemi/es32f0271/drivers/drv_pwm.h deleted file mode 100644 index 12c0364563..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_pwm.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#ifndef DRV_PWM_H__ -#define DRV_PWM_H__ - -int rt_hw_pwm_init(void); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_rtc.c b/bsp/essemi/es32f0271/drivers/drv_rtc.c deleted file mode 100644 index 3e2cdd17a3..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_rtc.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include -#include -#include -#include -#include "board.h" -#include "drv_rtc.h" - -#ifdef RT_USING_RTC - -/** - * @brief Time structure - */ -typedef struct -{ - uint8_t hour; /**< Hours */ - uint8_t minute; /**< Minutes */ - uint8_t second; /**< Seconds */ - uint16_t sub_sec; /**< Sub-seconds */ -} rtc_time_t; - -/** - * @brief Date structure - */ -typedef struct -{ - uint8_t week; /**< Weeks */ - uint8_t day; /**< days */ - uint8_t month; /**< months */ - uint8_t year; /**< years */ -} rtc_date_t; - -static rt_uint32_t bcd_to_dec(rt_uint32_t bcd) -{ - return ((bcd & 0xF) + ((bcd >> 4) & 0xF) * 10); -} - -static void rtc_get_time(rtc_time_t *time) -{ - rt_uint32_t tmp = RTC->TIME; - - time->second = bcd_to_dec(tmp & 0x7F); - time->minute = bcd_to_dec((tmp >> 8) & 0x7F); - time->hour = bcd_to_dec((tmp >> 16) & 0x7F); - - return; -} - -static void rtc_get_date(rtc_date_t *date) -{ - uint32_t tmp = RTC->CAL; - - date->day = bcd_to_dec(tmp & 0x3F); - date->month = bcd_to_dec((tmp >> 8) & 0x1F); - date->year = bcd_to_dec((tmp >> 16) & 0xFF); - date->week = bcd_to_dec((RTC->TIME >> 24) & 0x7); - - return; -} - -static rt_err_t es32f0_rtc_control(rt_device_t dev, int cmd, void *args) -{ - rt_err_t result = RT_EOK; - - struct tm time_temp; - struct tm *pNow; - rt_uint16_t timout = 0xFFF; - rtc_time_t *time = rt_malloc(sizeof(rtc_time_t)); - rtc_date_t *date = rt_malloc(sizeof(rtc_date_t)); - - switch (cmd) - { - case RT_DEVICE_CTRL_RTC_GET_TIME: - { - /* Wait RTC data ready then read */ - while ((--timout)&&((RTC->STAT & RTC_STAT_SYNDONE_MSK) != RTC_STAT_SYNDONE_MSK)); - if (timout == 0) - result = RT_ERROR; - /* Read */ - rtc_get_time(time); - rtc_get_date(date); - - time_temp.tm_sec = time->second; - time_temp.tm_min = time->minute; - time_temp.tm_hour = time->hour; - time_temp.tm_wday = date->week - 1; - time_temp.tm_mday = date->day; - time_temp.tm_mon = date->month - 1; - time_temp.tm_year = date->year - 1900 + 2000; - *((time_t *)args) = timegm(&time_temp); - break; - } - case RT_DEVICE_CTRL_RTC_SET_TIME: - { - rt_enter_critical(); - /* converts calendar time time into local time. */ - pNow = gmtime((const time_t *)args); - /* copy the statically located variable */ - memcpy(&time_temp, pNow, sizeof(struct tm)); - /* unlock scheduler. */ - rt_exit_critical(); - - time->hour = time_temp.tm_hour; - time->minute = time_temp.tm_min; - time->second = time_temp.tm_sec; - date->year = time_temp.tm_year + 1900 - 2000; - date->month = time_temp.tm_mon + 1; - date->day = time_temp.tm_mday; - /* Stop RTC */ - CLEAR_BIT(RTC->CON, RTC_CON_RTCEN_MSK); - WRITE_REG(RTC->TIME, ((time->hour/10)<hour%10)<minute/10)<minute%10)<second/10)<second%10)<CAL, ((date->year/10)<year%10)<month/10)<month%10)<day/10)<day%10)<CON, RTC_CON_RTCEN_MSK); - break; - } - case RT_DEVICE_CTRL_RTC_GET_ALARM: - break; - - case RT_DEVICE_CTRL_RTC_SET_ALARM: - break; - - default: - break; - } - - rt_free(time); - rt_free(date); - - return result; -} - -#ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops es32f0_rtc_ops = -{ - RT_NULL, - RT_NULL, - RT_NULL, - RT_NULL, - RT_NULL, - es32f0_rtc_control -}; -#endif - -static struct rt_device rtc_dev; -#define RTC_SOURCE_LOSC 0x1 -#define RTC_SOURCE_LRC 0x2 -int rt_hw_rtc_init(void) -{ - rt_err_t ret = RT_EOK; - rt_uint16_t timout = 0xFFFF; - rt_uint32_t rtc_clk = 32768-1; - rt_uint8_t rtc_src = RTC_SOURCE_LOSC; - - /* - * Config RTC clock - * We config the external 32.768K crystal as RTC clock source for the first - * choice. If external 32.768K crystal is not ready, we will choose LRC. - */ - /* Enable LOSC then wait it ready */ - if ((RCU->CON & RCU_CON_LOSCON_MSK) != RCU_CON_LOSCON_MSK) - SET_BIT(RCU->CON, RCU_CON_LOSCON_MSK); - - /* Wait external 32.768K crystal ready */ - while (((RCU->CON & RCU_CON_LOSCRDY_MSK) != RCU_CON_LOSCRDY_MSK)&&(--timout)); - if (timout == 0) - { - /* We use LRC if external 32.768K crystal is not ready */ - if ((RCU->CON & RCU_CON_LRCON_MSK) != RCU_CON_LRCON_MSK) - SET_BIT(RCU->CON, RCU_CON_LRCON_MSK); - /* Wait LRC ready */ - timout = 0xFF; - while (((RCU->CON & RCU_CON_LRCRDY_MSK) != RCU_CON_LRCRDY_MSK)&&(--timout)); - rtc_clk = 32000-1; - rtc_src = RTC_SOURCE_LRC; - } - - /* Open RTC clock */ - SET_BIT(RCU->AHBEN, RCU_AHBEN_RTCEN_MSK); - - /* Reset RTC */ - SET_BIT(RCU->AHBRST, RCU_AHBRST_RTCEN_MSK); - CLEAR_BIT(RCU->AHBRST, RCU_AHBRST_RTCEN_MSK); - CLEAR_BIT(RTC->CON, RTC_CON_RTCEN_MSK); - - /* Config RTC clock source */ - MODIFY_REG(RTC->CON, RTC_CON_CKSEL_MSK, rtc_src<CON, RTC_CON_PSCALE_MSK|RTC_CON_SCALE_MSK, - ((rtc_clk&0x7F)<>7)&0xFF)<TIME, (0x3<CAL, (0x1<CON, RTC_CON_RTCEN_MSK); - - rtc_dev.type = RT_Device_Class_RTC; - rtc_dev.rx_indicate = RT_NULL; - rtc_dev.tx_complete = RT_NULL; - -#ifdef RT_USING_DEVICE_OPS - rtc_dev.ops = &es32f0_rtc_ops; -#else - rtc_dev.init = RT_NULL; - rtc_dev.open = RT_NULL; - rtc_dev.close = RT_NULL; - rtc_dev.read = RT_NULL; - rtc_dev.write = RT_NULL; - rtc_dev.control = es32f0_rtc_control; -#endif - - rtc_dev.user_data = RTC; - - ret = rt_device_register(&rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR); - - return ret; -} -INIT_DEVICE_EXPORT(rt_hw_rtc_init); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_rtc.h b/bsp/essemi/es32f0271/drivers/drv_rtc.h deleted file mode 100644 index 0fd0661026..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_rtc.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#ifndef DRV_RTC_H__ -#define DRV_RTC_H__ - -int rt_hw_rtc_init(void); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_spi.c b/bsp/essemi/es32f0271/drivers/drv_spi.c deleted file mode 100644 index 9a7fc3ab70..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_spi.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include -#include -#include -#include "board.h" -#include "drv_spi.h" -#include "md_spi.h" -#include "md_gpio.h" - -#ifdef RT_USING_SPI - -#define SPITIMEOUT 0x0FFF - -static rt_err_t __spi_send(struct rt_spi_device *device, rt_uint8_t *buf, - rt_int32_t len, rt_uint32_t tmout); -static rt_err_t __spi_recv(struct rt_spi_device *device, rt_uint8_t *buf, - rt_int32_t len, rt_uint32_t tmout); -static rt_err_t __spi_send_recv(struct rt_spi_device *device, rt_uint8_t *tbuf, - rt_uint8_t *rbuf, rt_int32_t len, rt_uint32_t tmout); - -/** - * @brief: SPI single line send. - * @param: device, pointer to the SPI device - * @param: buf, send data buffer - * @param: len, the length of buf - * @param: tmout, timeout - * @retval: rt_err_t - */ -static rt_err_t __spi_send(struct rt_spi_device *device, rt_uint8_t *buf, - rt_int32_t len, rt_uint32_t tmout) -{ - SPI_TypeDef *hspi; - rt_uint32_t rt_timout; - rt_uint8_t temp_data; - - /* Get the SPI port */ - hspi = (SPI_TypeDef *)device->bus->parent.user_data; - - /* Open SPI if it is disabled */ - if (READ_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK) != SPI_CON1_SPIEN_MSK) - SET_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK); - - while (len > 0) - { - /* Confirm that no data is being transmitted */ - rt_timout = tmout; - while (((hspi->STAT & SPI_STAT_TXE_MSK) == 0) && (--rt_timout)); - if (rt_timout == 0) - return RT_ETIMEOUT; - - /* Send data */ - if (device->config.data_width == 8) - { - hspi->DATA = *(rt_uint8_t *)buf; - buf++; - len--; - } - else if (device->config.data_width == 16) - { - hspi->DATA = *(rt_uint16_t *)buf; - buf += 2; - len -= 2; - } - else - return RT_EINVAL; - } - - /* At here, we have transmitted all the data. - * The next step is to clear the IT flag. - */ - for (rt_uint8_t i = 0; i < md_spi_get_stat_rxflv(hspi); i++) - temp_data = hspi->DATA; - UNUSED(temp_data); - hspi->ICR = hspi->RIF; - - return RT_EOK; -} - -/** - * @brief: SPI single line receive. - * @param: device, pointer to the SPI device - * @param: buf, receive data buffer - * @param: len, the length of buf - * @param: tmout, timeout - * @retval: rt_err_t - */ -static rt_err_t __spi_recv(struct rt_spi_device *device, rt_uint8_t *buf, - rt_int32_t len, rt_uint32_t tmout) -{ - SPI_TypeDef *hspi; - rt_uint32_t rt_timout; - - /* Get the SPI port */ - hspi = (SPI_TypeDef *)device->bus->parent.user_data; - - /* Open SPI if it is disabled */ - if (READ_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK) != SPI_CON1_SPIEN_MSK) - SET_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK); - - /* Handle data in __spi_send_recv() function */ - if (((device->config.mode & RT_SPI_SLAVE) == 0) - && ((device->config.mode & RT_SPI_3WIRE) == 0)) - __spi_send_recv(device, buf, buf, len, tmout); - - while (len > 0) - { - /* Waiting for data */ - rt_timout = tmout; - while (((hspi->STAT & SPI_STAT_RXTH_MSK) == 0) && (--rt_timout)); - if (rt_timout == 0) - return RT_ETIMEOUT; - - /* Send data */ - if (device->config.data_width == 8) - { - *(rt_uint8_t *)buf = hspi->DATA; - buf++; - len--; - } - else if (device->config.data_width == 16) - { - *(rt_uint16_t *)buf = hspi->DATA; - buf += 2; - len -= 2; - } - else - return RT_EINVAL; - } - - /* At here, we have transmitted all the data. - * The next step is to clear the IT flag. - */ - hspi->ICR = hspi->RIF; - - return RT_EOK; -} - -/** - * @brief: SPI two line transmission. - * @param: device, pointer to the SPI device - * @param: tbuf, send data buffer - * @param: rbuf, receive data buffer - * @param: len, the length of buf - * @param: tmout, timeout - * @retval: rt_err_t - */ -static rt_err_t __spi_send_recv(struct rt_spi_device *device, rt_uint8_t *tbuf, - rt_uint8_t *rbuf, rt_int32_t len, rt_uint32_t tmout) -{ - SPI_TypeDef *hspi; - rt_uint32_t rt_timout; - - /* Get the SPI port */ - hspi = (SPI_TypeDef *)device->bus->parent.user_data; - - /* Open SPI if it is disabled */ - if (READ_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK) != SPI_CON1_SPIEN_MSK) - SET_BIT(hspi->CON1, SPI_CON1_SPIEN_MSK); - - /* return error if SPI is in 1-line mode */ - if ((device->config.mode & RT_SPI_3WIRE) == RT_SPI_3WIRE) - return RT_ERROR; - - while (len > 0) - { - /* Confirm that no data is being transmitted */ - rt_timout = tmout; - while (((hspi->STAT & SPI_STAT_TXE_MSK) == 0) && (--rt_timout)); - if (rt_timout == 0) - return RT_ETIMEOUT; - - /* Send data */ - if (device->config.data_width == 8) - { - hspi->DATA = *(rt_uint8_t *)tbuf; - tbuf++; - len--; - } - else if (device->config.data_width == 16) - { - hspi->DATA = *(rt_uint16_t *)tbuf; - tbuf += 2; - len -= 2; - } - else - return RT_EINVAL; - - /* Waiting for data */ - rt_timout = tmout; - while (((hspi->STAT & SPI_STAT_RXTH_MSK) == 0) && (--rt_timout)); - if (rt_timout == 0) - return RT_ETIMEOUT; - - /* Send data */ - if (device->config.data_width == 8) - { - *(rt_uint8_t *)rbuf = hspi->DATA; - rbuf++; - } - else if (device->config.data_width == 16) - { - *(rt_uint16_t *)rbuf = hspi->DATA; - rbuf += 2; - } - } - - /* At here, we have transmitted all the data. - * The next step is to clear the IT flag. - */ - hspi->ICR = hspi->RIF; - - return RT_EOK; -} - -rt_err_t spi_configure(struct rt_spi_device *device, - struct rt_spi_configuration *cfg) -{ - SPI_TypeDef *hspi; - hspi = (SPI_TypeDef *)device->bus->parent.user_data; - - /* Close SPI temporarily */ - md_spi_disable_con1_spien(hspi); - - /* config spi mode */ - if (cfg->mode & RT_SPI_SLAVE) - md_spi_set_con1_mstren(hspi, MD_SPI_MODE_SLAVE); - else - md_spi_set_con1_mstren(hspi, MD_SPI_MODE_MASTER); - - /* Config data mode */ - if (cfg->mode & RT_SPI_3WIRE) - md_spi_set_con1_bidimode(hspi, MD_SPI_HALF_DUPLEX); - else - md_spi_set_con1_bidimode(hspi, MD_SPI_FULL_DUPLEX); - - /* Config data width */ - if (cfg->data_width == 8) - md_spi_set_con1_flen(hspi, MD_SPI_FRAME_FORMAT_8BIT); - else if (cfg->data_width == 16) - md_spi_set_con1_flen(hspi, SPI_CON1_FLEN_MSK); - - /* Config phase */ - if (cfg->mode & RT_SPI_CPHA) - md_spi_set_con1_cpha(hspi, MD_SPI_PHASE_2EDGE); - else - md_spi_set_con1_cpha(hspi, MD_SPI_PHASE_1EDGE); - - /* Config polarity */ - if (cfg->mode & RT_SPI_CPOL) - md_spi_set_con1_cpol(hspi, MD_SPI_POLARITY_HIGH); - else - md_spi_set_con1_cpol(hspi, MD_SPI_POLARITY_LOW); - - /* Config if NSS pin is managed by software */ - md_spi_disable_con1_ssen(hspi); - - /* config spi clock */ - if (cfg->max_hz >= SystemCoreClock / 2) - { - /* pclk1 max speed 48MHz, spi master max speed 10MHz */ - if (SystemCoreClock / 2 <= 10000000) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV2); - else if (SystemCoreClock / 4 <= 10000000) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV4); - else - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV8); - } - else if (cfg->max_hz >= SystemCoreClock / 4) - { - /* pclk1 max speed 48MHz, spi master max speed 10MHz */ - if (SystemCoreClock / 4 <= 10000000) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV4); - else - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV8); - } - else if (cfg->max_hz >= SystemCoreClock / 8) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV8); - else if (cfg->max_hz >= SystemCoreClock / 16) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV16); - else if (cfg->max_hz >= SystemCoreClock / 32) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV32); - else if (cfg->max_hz >= SystemCoreClock / 64) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV64); - else if (cfg->max_hz >= SystemCoreClock / 128) - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV128); - else - md_spi_set_con1_baud(hspi, MD_SPI_BAUDRATEPRESCALER_DIV256); - - /* Enable SPI */ - md_spi_enable_con1_spien(hspi); - - return RT_EOK; -} - -static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message) -{ - rt_err_t res; - rt_uint32_t *cs; - - RT_ASSERT(device != RT_NULL); - RT_ASSERT(device->bus != RT_NULL); - RT_ASSERT(device->bus->parent.user_data != RT_NULL); - RT_ASSERT(message->send_buf != RT_NULL || message->recv_buf != RT_NULL); - - cs = (rt_uint32_t *)device->parent.user_data; - - /* only send data */ - if (message->recv_buf == RT_NULL) - { - if (message->cs_take) - { - rt_pin_write(*cs, 0); - } - res = __spi_send(device, (rt_uint8_t *)message->send_buf, (rt_int32_t)message->length, SPITIMEOUT); - if (message->cs_release) - { - rt_pin_write(*cs, 1); - } - if (res != RT_EOK) - return RT_ERROR; - } - - /* only receive data */ - if (message->send_buf == RT_NULL) - { - if (message->cs_take) - { - rt_pin_write(*cs, 0); - } - res = __spi_recv(device, (rt_uint8_t *)message->recv_buf, (rt_int32_t)message->length, SPITIMEOUT); - if (message->cs_release) - { - rt_pin_write(*cs, 1); - } - if (res != RT_EOK) - return RT_ERROR; - } - - /* send & receive */ - else - { - if (message->cs_take) - { - rt_pin_write(*cs, 0); - } - res = __spi_send_recv(device, (rt_uint8_t *)message->send_buf, (rt_uint8_t *)message->recv_buf, - (rt_int32_t)message->length, SPITIMEOUT); - if (message->cs_release) - { - rt_pin_write(*cs, 1); - } - if (res != RT_EOK) - return RT_ERROR; - } - - return message->length; -} - -const struct rt_spi_ops es32f0_spi_ops = -{ - spi_configure, - spixfer, -}; - -static struct rt_spi_bus _spi_bus1, _spi_bus2; -int es32f0_spi_register_bus(SPI_TypeDef *SPIx, const char *name) -{ - struct rt_spi_bus *spi_bus; - - if (SPIx == SPI2) - { - /* Open GPIO and SPI clock */ - SET_BIT(RCU->APB1EN, RCU_APB1EN_SPI2EN_MSK); - SET_BIT(RCU->AHBEN, RCU_AHBEN_GPBEN_MSK); - - /* Config SPI2 GPIO */ - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_13, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_14, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_15, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function8_15 (GPIOB, MD_GPIO_PIN_13, MD_GPIO_AF0); - md_gpio_set_function8_15 (GPIOB, MD_GPIO_PIN_14, MD_GPIO_AF0); - md_gpio_set_function8_15 (GPIOB, MD_GPIO_PIN_15, MD_GPIO_AF0); - - /* Remember SPI bus2 */ - spi_bus = &_spi_bus2; - } - else if (SPIx == SPI1) - { - /* Open GPIO and SPI clock */ - SET_BIT(RCU->APB2EN, RCU_APB2EN_SPI1EN_MSK); - SET_BIT(RCU->AHBEN, RCU_AHBEN_GPBEN_MSK); - - /* Config SPI1 GPIO */ - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_3, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_4, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_5, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_3, MD_GPIO_AF0); - md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_4, MD_GPIO_AF0); - md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_5, MD_GPIO_AF0); - - /* Remember SPI bus1 */ - spi_bus = &_spi_bus1; - } - else - { - return -1; - } - spi_bus->parent.user_data = SPIx; - - return rt_spi_bus_register(spi_bus, name, &es32f0_spi_ops); -} - -int rt_hw_spi_init(void) -{ - int result = 0; - -#ifdef BSP_USING_SPI2 - result = es32f0_spi_register_bus(SPI2, "spi2"); -#endif - -#ifdef BSP_USING_SPI1 - result = es32f0_spi_register_bus(SPI1, "spi1"); -#endif - - return result; -} -INIT_BOARD_EXPORT(rt_hw_spi_init); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_spi.h b/bsp/essemi/es32f0271/drivers/drv_spi.h deleted file mode 100644 index c7c8a13b4a..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_spi.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#ifndef DRV_SPI_H__ -#define DRV_SPI_H__ - -#include -#include -#include - -///* cannot be used before completion init */ -//rt_err_t es32f0_spi_device_attach(rt_uint32_t pin, const char *bus_name, const char *device_name); -int rt_hw_spi_init(void); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_uart.c b/bsp/essemi/es32f0271/drivers/drv_uart.c deleted file mode 100644 index f860c2df91..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_uart.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#include -#include -#include -#include "board.h" -#include "drv_uart.h" -#include "md_gpio.h" -#include "md_uart.h" - -#ifdef RT_USING_SERIAL - -/* es32 uart driver */ -struct es32_uart -{ - UART_TypeDef *huart; - IRQn_Type irq; -}; - -static rt_err_t es32f0x_configure(struct rt_serial_device *serial, struct serial_configure *cfg) -{ - struct es32_uart *uart; - RT_ASSERT(serial != RT_NULL); - RT_ASSERT(cfg != RT_NULL); - uart = (struct es32_uart *)serial->parent.user_data; - - /* Close TX/RX temporarily */ - md_uart_disable_lcon_txen(uart->huart); - md_uart_disable_lcon_rxen(uart->huart); - -#ifdef BSP_USING_UART1 - /* Open UART1 clock */ - SET_BIT(RCU->APB2EN, RCU_APB2EN_UART1EN_MSK); - - /* Config UART1 GPIO pin */ - md_gpio_set_pull (GPIOB, MD_GPIO_PIN_7, MD_GPIO_PULL_UP); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_6, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOB, MD_GPIO_PIN_7, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_6, MD_GPIO_AF2); - md_gpio_set_function0_7 (GPIOB, MD_GPIO_PIN_7, MD_GPIO_AF2); -#endif /* uart2 gpio init */ - -#ifdef BSP_USING_UART2 - /* Open UART2 clock */ - SET_BIT(RCU->APB1EN, RCU_APB1EN_UART2EN_MSK); - - /* Config UART2 GPIO pin */ - md_gpio_set_pull (GPIOA, MD_GPIO_PIN_3, MD_GPIO_PULL_UP); - md_gpio_set_mode (GPIOA, MD_GPIO_PIN_2, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOA, MD_GPIO_PIN_3, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function0_7 (GPIOA, MD_GPIO_PIN_2, MD_GPIO_AF2); - md_gpio_set_function0_7 (GPIOA, MD_GPIO_PIN_3, MD_GPIO_AF2); -#endif /* uart1 gpio init */ - -#ifdef BSP_USING_UART3 - /* Open UART3 clock */ - SET_BIT(RCU->APB1EN, RCU_APB1EN_UART3EN_MSK); - - /* Config UART3 GPIO pin */ - md_gpio_set_pull (GPIOC, MD_GPIO_PIN_7, MD_GPIO_PULL_UP); - md_gpio_set_mode (GPIOC, MD_GPIO_PIN_6, MD_GPIO_MODE_FUNCTION); - md_gpio_set_mode (GPIOC, MD_GPIO_PIN_7, MD_GPIO_MODE_FUNCTION); - md_gpio_set_function0_7 (GPIOC, MD_GPIO_PIN_6, MD_GPIO_AF2); - md_gpio_set_function0_7 (GPIOC, MD_GPIO_PIN_7, MD_GPIO_AF2); -#endif /* uart3 gpio init */ - - if (cfg->bit_order == BIT_ORDER_MSB) - { - md_uart_set_lcon_msb(uart->huart, MD_UART_LCON_MSB_FIRST); - } - else - { - md_uart_set_lcon_msb(uart->huart, MD_UART_LCON_LSB_FIRST); - } - - if (cfg->invert == NRZ_INVERTED) - { - md_uart_enable_lcon_datainv(uart->huart); - } - else - { - md_uart_disable_lcon_datainv(uart->huart); - } - - /* Config buadrate */ - md_uart_set_brr(uart->huart, SystemCoreClock/cfg->baud_rate); - /* Config data width */ - md_uart_set_lcon_dls(uart->huart, 8-cfg->data_bits); - /* Config stop bits */ - md_uart_set_lcon_stop(uart->huart, cfg->stop_bits); - /* Config parity */ - if (cfg->parity > PARITY_NONE) - { - md_uart_set_lcon_ps(uart->huart, cfg->parity-1); - md_uart_enable_lcon_pe(uart->huart); - } - else - md_uart_disable_lcon_pe(uart->huart); - - /* enable rx int */ - md_uart_set_fcon_rxth(uart->huart, MD_UART_FCON_RXTH_1); - md_uart_enable_ier_rfth(uart->huart); - md_uart_enable_lcon_txen(uart->huart); - md_uart_enable_lcon_rxen(uart->huart); - - return RT_EOK; -} - -static rt_err_t es32f0x_control(struct rt_serial_device *serial, int cmd, void *arg) -{ - struct es32_uart *uart; - RT_ASSERT(serial != RT_NULL); - - uart = (struct es32_uart *)serial->parent.user_data; - switch (cmd) - { - case RT_DEVICE_CTRL_CLR_INT: - /* disable rx irq */ - NVIC_DisableIRQ(uart->irq); - /* disable interrupt */ - md_uart_disable_idr_rfth(uart->huart); - break; - - case RT_DEVICE_CTRL_SET_INT: - /* enable rx irq */ - NVIC_EnableIRQ(uart->irq); - /* enable interrupt */ - md_uart_enable_ier_rfth(uart->huart); - break; - } - - return RT_EOK; -} - -static int es32f0x_putc(struct rt_serial_device *serial, char c) -{ - struct es32_uart *uart; - RT_ASSERT(serial != RT_NULL); - uart = (struct es32_uart *)serial->parent.user_data; - - while (uart->huart->STAT & UART_STAT_TSBUSY_MSK); - WRITE_REG(uart->huart->TXBUF, c); - - return 1; -} - -static int es32f0x_getc(struct rt_serial_device *serial) -{ - int ch = -1; - struct es32_uart *uart; - - RT_ASSERT(serial != RT_NULL); - uart = (struct es32_uart *)serial->parent.user_data; - - if (uart->huart->STAT & UART_STAT_RFTH_MSK) - { - ch = (uint8_t)(uart->huart->RXBUF & 0xFF); - } - - return ch; -} - -static const struct rt_uart_ops es32f0x_uart_ops = -{ - es32f0x_configure, - es32f0x_control, - es32f0x_putc, - es32f0x_getc, -}; - -#ifdef BSP_USING_UART1 -/* UART1 device driver structure */ -struct es32_uart uart1 = -{ - UART1, - UART1_IRQn -}; - -struct rt_serial_device serial1; - -void UART1_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (md_uart_is_active_flag_rif_rfth(UART1) == 1) - { - rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND); - md_uart_clear_flag_rfth(UART1); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART1 */ - -#ifdef BSP_USING_UART2 -/* UART2 device driver structure */ -struct es32_uart uart2 = -{ - UART2, - UART2_IRQn -}; - -struct rt_serial_device serial2; - -void UART2_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (md_uart_is_active_flag_rif_rfth(UART2) == 1) - { - rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND); - md_uart_clear_flag_rfth(UART2); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART2 */ - -#ifdef BSP_USING_UART3 -/* UART3 device driver structure */ -struct es32_uart uart3 = -{ - UART3, - UART3_IRQn -}; - -struct rt_serial_device serial3; - -void UART3_AES_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (md_uart_is_active_flag_rif_rfth(UART3) == 1) - { - rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND); - md_uart_clear_flag_rfth(UART3); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART3 */ - -int rt_hw_uart_init(void) -{ - struct es32_uart *uart; - struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; - -#ifdef BSP_USING_UART1 - uart = &uart1; - serial1.ops = &es32f0x_uart_ops; - serial1.config = config; - - /* register UART1 device */ - rt_hw_serial_register(&serial1, "uart1", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, - uart); -#endif /* BSP_USING_UART1 */ - -#ifdef BSP_USING_UART2 - uart = &uart2; - serial2.ops = &es32f0x_uart_ops; - serial2.config = config; - - /* register UART2 device */ - rt_hw_serial_register(&serial2, "uart2", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, - uart); -#endif /* BSP_USING_UART2 */ - -#ifdef BSP_USING_UART3 - uart = &uart3; - serial3.ops = &es32f0x_uart_ops; - serial3.config = config; - - /* register UART3 device */ - rt_hw_serial_register(&serial3, "uart3", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, - uart); -#endif /* BSP_USING_UART3 */ - - return 0; -} -INIT_BOARD_EXPORT(rt_hw_uart_init); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/drv_uart.h b/bsp/essemi/es32f0271/drivers/drv_uart.h deleted file mode 100644 index 7d3755d0a6..0000000000 --- a/bsp/essemi/es32f0271/drivers/drv_uart.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-10-23 yuzrain the first version - */ - -#ifndef DRV_UART_H__ -#define DRV_UART_H__ - -int rt_hw_uart_init(void); - -#endif diff --git a/bsp/essemi/es32f0271/drivers/linker_scripts/link.sct b/bsp/essemi/es32f0271/drivers/linker_scripts/link.sct deleted file mode 100644 index 4ee8d1e3fc..0000000000 --- a/bsp/essemi/es32f0271/drivers/linker_scripts/link.sct +++ /dev/null @@ -1,14 +0,0 @@ -; ************************************************************* -; *** 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/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf b/bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf deleted file mode 100644 index b374366930..0000000000 Binary files a/bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf and /dev/null differ diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.rtf b/bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.rtf deleted file mode 100644 index fb44cda0ca..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.rtf +++ /dev/null @@ -1,793 +0,0 @@ -{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch37\stshfloch37\stshfhich37\stshfbi0\deflang2057\deflangfe2057\themelang2057\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} -{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fbidi \fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;} -{\f14\fbidi \froman\fcharset136\fprq2{\*\panose 02020500000000000000}PMingLiU{\*\falt \'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;} -{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f39\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;} -{\f40\fbidi \froman\fcharset136\fprq2{\*\panose 02020500000000000000}@PMingLiU;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} -{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} -{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} -{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} -{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f41\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f42\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\f44\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f45\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f46\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f47\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\f48\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f49\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f51\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f52\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;} -{\f54\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}{\f55\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f56\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f57\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);} -{\f58\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}{\f59\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f61\fbidi \fmodern\fcharset238\fprq1 Courier New CE;}{\f62\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr;} -{\f64\fbidi \fmodern\fcharset161\fprq1 Courier New Greek;}{\f65\fbidi \fmodern\fcharset162\fprq1 Courier New Tur;}{\f66\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f67\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic);} -{\f68\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic;}{\f69\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f183\fbidi \froman\fcharset0\fprq2 PMingLiU Western{\*\falt \'b7\'73\'b2\'d3\'a9\'fa\'c5\'e9};} -{\f381\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f382\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f384\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f385\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;} -{\f388\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f389\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f411\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f412\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} -{\f414\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f415\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f418\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f419\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);} -{\f421\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f422\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f424\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}{\f425\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;} -{\f426\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f427\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f428\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f429\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);} -{\f430\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f431\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f432\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f434\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;} -{\f435\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}{\f438\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f439\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\f443\fbidi \froman\fcharset0\fprq2 @PMingLiU Western;} -{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} -{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;} -{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;} -{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} -{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} -{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} -{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;} -{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;} -{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} -{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} -{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; -\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red34\green34\blue34;}{\*\defchp \loch\af37\hich\af37\dbch\af37 }{\*\defpap -\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 -\ltrch\fcs0 \fs22\lang2057\langfe1033\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\* -\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv -\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang2057\langfe2057\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp2057 -\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\s15\ql \li0\ri0\widctlpar -\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af2\afs20\alang1025 \ltrch\fcs0 -\f2\fs20\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \sbasedon0 \snext15 \slink16 \ssemihidden \sunhideused HTML Preformatted;}{\*\cs16 \additive \f2\fs20\lang0\langfe2057\langfenp2057 \slink15 \slocked \ssemihidden HTML Preformatted Char;}{\*\cs17 -\additive \ul\cf2 \sunhideused Hyperlink;}{\*\cs18 \additive \fs16 \ssemihidden \sunhideused annotation reference;}{\s19\ql \li0\ri0\sa200\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 -\ltrch\fcs0 \fs20\lang2057\langfe1033\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext19 \slink20 \ssemihidden \sunhideused annotation text;}{\*\cs20 \additive \fs20 \slink19 \slocked \ssemihidden Comment Text Char;}{ -\s21\ql \li0\ri0\sa200\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang2057\langfe1033\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 -\sbasedon19 \snext19 \slink22 \ssemihidden \sunhideused annotation subject;}{\*\cs22 \additive \b\fs20 \slink21 \slocked \ssemihidden Comment Subject Char;}{\s23\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 -\rtlch\fcs1 \af38\afs16\alang1025 \ltrch\fcs0 \fs16\lang2057\langfe1033\loch\f38\hich\af38\dbch\af37\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext23 \slink24 \ssemihidden \sunhideused Balloon Text;}{\*\cs24 \additive \f38\fs16 -\slink23 \slocked \ssemihidden Balloon Text Char;}{\s25\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\tqc\tx4680\tqr\tx9360\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext25 \slink26 \sunhideused header;}{\*\cs26 \additive \fs22\lang2057\langfe0\langnp2057 \slink25 \slocked Header Char;}{ -\s27\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\tqc\tx4680\tqr\tx9360\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext27 \slink28 \sunhideused \spriority0 footer;}{\*\cs28 \additive \fs22\lang2057\langfe0\langnp2057 \slink27 \slocked \ssemihidden Footer Char;}{\*\cs29 -\additive \rtlch\fcs1 \af0 \ltrch\fcs0 \sbasedon10 \spriority0 page number;}{\s30\ql \fi-425\li1134\ri0\sb120\sa120\widctlpar\tx1134\tqr\tx7920\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin1134\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 -\fs18\lang2057\langfe1033\loch\f1\hich\af1\dbch\af14\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext30 \spriority0 Indent;}{\s31\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 -\ltrch\fcs0 \fs22\lang2057\langfe1033\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 \snext31 \shidden \ssemihidden Revision;}{\s32\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 -\af0\afs21\alang1025 \ltrch\fcs0 \f39\fs21\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext32 \slink33 \sunhideused Plain Text;}{\*\cs33 \additive \f39\fs21\lang0\langfe1033\langfenp1033 \slink32 \slocked Plain Text Char;}{ -\s34\ql \li720\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin720\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang2057\langfe1033\loch\f37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 -\sbasedon0 \snext34 \sqformat \spriority34 List Paragraph;}}{\*\listtable{\*\listpicture{\pict{\*\picprop\shplid1027{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn borderTopColor}{\sv -16777216}} -{\sp{\sn borderLeftColor}{\sv -16777216}}{\sp{\sn borderBottomColor}{\sv -16777216}}{\sp{\sn borderRightColor}{\sv -16777216}}{\sp{\sn fIsBullet}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0 -\picw7620\pich7620\picwgoal4320\pichgoal4320\wmetafile8\bliptag769486312\blipupi-183{\*\blipuid 2ddd6de88f5353a50bdc5a988851b0ca} -0100090000038d00000002001c00000000000400000003010800050000000b0200000000050000000c0209070507040000002e0118001c000000fb0210000700 -00000000bc02000000000102022253797374656d0076a0823c0bcc8a330019e2957680019a767049340bd88a3300040000002d010000040000002d0100000400 -0000020101001c000000fb02a4ff0000000000009001000000000440002243616c69627269000000000000000000000000000000000000000000000000000400 -00002d010100040000002d010100040000002d010100050000000902000000020d000000320a570000000100040000000000080708072000360005000000090200000002040000002d010000040000002d010000030000000000}}{\list\listtemplateid-492936738\listhybrid{\listlevel\levelnfc0 -\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext -\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 -\ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2 -\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext -\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 -\ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid39328222}{\list\listtemplateid-917765150\listhybrid{\listlevel\levelnfc2\levelnfcn2\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li1080\lin1080 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 -\fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel -\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0 -\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 } -{\listname ;}\listid144588935}{\list\listtemplateid-1026387870{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\'00;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 -\fi-360\li360\lin360 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat2\levelspace0\levelindent0{\leveltext\'03\'00.\'01;}{\levelnumbers\'01\'03;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li360\lin360 }{\listlevel\levelnfc0 -\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'05\'00.\'01.\'02;}{\levelnumbers\'01\'03\'05;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li720\lin720 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0 -\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'07\'00.\'01.\'02.\'03;}{\levelnumbers\'01\'03\'05\'07;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li720\lin720 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\levelspace0\levelindent0{\leveltext\'09\'00.\'01.\'02.\'03.\'04;}{\levelnumbers\'01\'03\'05\'07\'09;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li720\lin720 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\levelspace0\levelindent0{\leveltext\'0b\'00.\'01.\'02.\'03.\'04.\'05;}{\levelnumbers\'01\'03\'05\'07\'09\'0b;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-1080\li1080\lin1080 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\levelspace0\levelindent0{\leveltext\'0d\'00.\'01.\'02.\'03.\'04.\'05.\'06;}{\levelnumbers\'01\'03\'05\'07\'09\'0b\'0d;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-1080\li1080\lin1080 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\levelspace0\levelindent0{\leveltext\'0f\'00.\'01.\'02.\'03.\'04.\'05.\'06.\'07;}{\levelnumbers\'01\'03\'05\'07\'09\'0b\'0d\'0f;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-1440\li1440\lin1440 }{\listlevel\levelnfc0\levelnfcn0\leveljc0 -\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'11\'00.\'01.\'02.\'03.\'04.\'05.\'06.\'07.\'08;}{\levelnumbers\'01\'03\'05\'07\'09\'0b\'0d\'0f\'11;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-1440\li1440\lin1440 }{\listname -;}\listid155655221}{\list\listtemplateid466939434\listhybrid{\listlevel\levelnfc3\levelnfcn3\leveljc0\leveljcn0\levelfollow0\levelstartat6\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 -\fi-360\li1080\lin1080 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1800\lin1800 }{\listlevel -\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2520\lin2520 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0 -\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3240\lin3240 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3960\lin3960 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4680\lin4680 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-360\li5400\lin5400 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li6120\lin6120 } -{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6840\lin6840 }{\listname ;}\listid207642902} -{\list\listtemplateid-868587660\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \cf1\dbch\af0\fbias0 -\fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2 -\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0 -\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 } -{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid244075828} -{\list\listtemplateid-301287646\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \cf1\dbch\af0\fbias0 -\fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2 -\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0 -\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 } -{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid358317280} -{\list\listtemplateid572415416\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \cf0\dbch\af37\fbias0 -\fi-360\li786\lin786 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1506\lin1506 }{\listlevel\levelnfc2 -\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2226\lin2226 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2946\lin2946 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0 -\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3666\lin3666 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4386\lin4386 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-360\li5106\lin5106 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5826\lin5826 } -{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6546\lin6546 }{\listname ;}\listid423112302} -{\list\listtemplateid-1459612926\listhybrid{\listlevel\levelnfc3\levelnfcn3\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li1275\lin1275 } -{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1995\lin1995 }{\listlevel\levelnfc2\levelnfcn2\leveljc2 -\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2715\lin2715 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3435\lin3435 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 -{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li4155\lin4155 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4875\lin4875 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 -\fi-360\li5595\lin5595 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li6315\lin6315 }{\listlevel -\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li7035\lin7035 }{\listname ;}\listid454718230} -{\list\listtemplateid-551514274\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat2\levelspace0\levelindent0{\leveltext\'01-;}{\levelnumbers;}\loch\af1\hich\af1\dbch\af0\fbias0 \fi-360\li1080\lin1080 }{\listlevel -\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li1800\lin1800 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li2520\lin2520 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 -{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li3240\lin3240 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 -\fi-360\li3960\lin3960 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li4680\lin4680 }{\listlevel\levelnfc23\levelnfcn23 -\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5400\lin5400 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li6120\lin6120 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;} -\f10\fbias0 \fi-360\li6840\lin6840 }{\listname ;}\listid474840100}{\list\listtemplateid-1601537400{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;} -\f3\fs20\fbias0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fs20\fbias0 \levelpicture0\fi-360\li1440 -\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fs20\fbias0 \fi-360\li2160\jclisttab\tx2160\lin2160 } -{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fs20\fbias0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23 -\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fs20\fbias0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fs20\fbias0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fs20\fbias0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'01\u-3929 ?;}{\levelnumbers;}\f10\fs20\fbias0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;} -\f10\fs20\fbias0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid891499942}{\list\listtemplateid-2106560774\listhybrid{\listlevel\levelnfc3\levelnfcn3\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext -\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 -\fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel -\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2 -\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid939029968}{\list\listtemplateid1475657882\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat2\levelspace0\levelindent0{\leveltext\'01-;}{\levelnumbers;} -\loch\af1\hich\af1\dbch\af0\fbias0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li2160\lin2160 }{\listlevel\levelnfc23 -\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li5040\lin5040 } -{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0 -\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'01o;}{\levelnumbers;}\f2\fbias0 \fi-360\li6480\lin6480 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 -{\leveltext\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0 \fi-360\li7200\lin7200 }{\listname ;}\listid1080055287}{\list\listtemplateid345380616\listhybrid{\listlevel\levelnfc2\levelnfcn2\leveljc0\leveljcn0\levelfollow0\levelstartat2\levelspace0\levelindent0 -{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li1864\lin1864 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2224\lin2224 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-180\li2944\lin2944 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3664\lin3664 } -{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li4384\lin4384 }{\listlevel\levelnfc2\levelnfcn2\leveljc2 -\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li5104\lin5104 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5824\lin5824 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 -{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li6544\lin6544 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li7264\lin7264 }{\listname ;}\listid1198470673}{\list\listtemplateid-1488150726\listhybrid{\listlevel\levelnfc2\levelnfcn2\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext -\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li1080\lin1080 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 -\fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel -\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2 -\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid1264800667}{\list\listtemplateid1709371634{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\'00;}{\levelnumbers\'01;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li360\lin360 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat2\levelspace0\levelindent0{\leveltext\'03\'00.\'01;}{\levelnumbers\'01\'03;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 -\fi-360\li360\lin360 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'05\'00.\'01.\'02;}{\levelnumbers\'01\'03\'05;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li720\lin720 }{\listlevel -\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'07\'00.\'01.\'02.\'03;}{\levelnumbers\'01\'03\'05\'07;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li720\lin720 }{\listlevel\levelnfc0\levelnfcn0 -\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'09\'00.\'01.\'02.\'03.\'04;}{\levelnumbers\'01\'03\'05\'07\'09;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li720\lin720 }{\listlevel\levelnfc0\levelnfcn0\leveljc0 -\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'0b\'00.\'01.\'02.\'03.\'04.\'05;}{\levelnumbers\'01\'03\'05\'07\'09\'0b;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-1080\li1080\lin1080 }{\listlevel\levelnfc0\levelnfcn0\leveljc0 -\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'0d\'00.\'01.\'02.\'03.\'04.\'05.\'06;}{\levelnumbers\'01\'03\'05\'07\'09\'0b\'0d;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-1080\li1080\lin1080 }{\listlevel\levelnfc0\levelnfcn0 -\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'0f\'00.\'01.\'02.\'03.\'04.\'05.\'06.\'07;}{\levelnumbers\'01\'03\'05\'07\'09\'0b\'0d\'0f;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-1440\li1440\lin1440 }{\listlevel -\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'11\'00.\'01.\'02.\'03.\'04.\'05.\'06.\'07.\'08;}{\levelnumbers\'01\'03\'05\'07\'09\'0b\'0d\'0f\'11;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 -\fi-1440\li1440\lin1440 }{\listname ;}\listid1335182434}{\list\listtemplateid-1861725538\listhybrid{\listlevel\levelnfc3\levelnfcn3\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 -\fi-360\li1440\lin1440 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel -\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0 -\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 } -{\listname ;}\listid1556695208}{\list\listtemplateid-301287646\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 -\cf1\dbch\af0\fbias0 \fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 } -{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0 -\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1 -\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 -{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;} -\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 -\fi-360\li5760\lin5760 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname -;}\listid1583906200}{\list\listtemplateid1806592008\listhybrid{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 -\fi-360\li720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\lin1440 }{\listlevel\levelnfc2 -\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0 -\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0 -\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600\lin3600 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4320\lin4320 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 -\af0 \ltrch\fcs0 \fi-360\li5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\lin5760 } -{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6480\lin6480 }{\listname ;}\listid1801338294} -{\list\listtemplateid-1056679890\listhybrid{\listlevel\levelnfc2\levelnfcn2\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-720\li1429 -\jclisttab\tx1429\lin1429 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1789\jclisttab\tx1789\lin1789 } -{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li2509\jclisttab\tx2509\lin2509 }{\listlevel\levelnfc0 -\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3229\jclisttab\tx3229\lin3229 }{\listlevel\levelnfc4\levelnfcn4\leveljc0 -\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3949\jclisttab\tx3949\lin3949 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0 -\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li4669\jclisttab\tx4669\lin4669 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative -\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5389\jclisttab\tx5389\lin5389 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0 -{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li6109\jclisttab\tx6109\lin6109 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext -\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-180\li6829\jclisttab\tx6829\lin6829 }{\listname ;}\listid1872956500}{\list\listtemplateid2052502928{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0 -\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc3\levelnfcn3\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext -\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers -\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li2160\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 -\ltrch\fcs0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li3600 -\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li4320\jclisttab\tx4320\lin4320 } -{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc0 -\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc0\levelnfcn0\leveljc0 -\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid1950702225}}{\*\listoverridetable -{\listoverride\listid474840100\listoverridecount0\ls1}{\listoverride\listid1080055287\listoverridecount0\ls2}{\listoverride\listid1872956500\listoverridecount0\ls3}{\listoverride\listid1198470673\listoverridecount0\ls4}{\listoverride\listid1950702225 -\listoverridecount0\ls5}{\listoverride\listid1556695208\listoverridecount0\ls6}{\listoverride\listid454718230\listoverridecount0\ls7}{\listoverride\listid939029968\listoverridecount0\ls8}{\listoverride\listid1264800667\listoverridecount0\ls9} -{\listoverride\listid244075828\listoverridecount0\ls10}{\listoverride\listid423112302\listoverridecount0\ls11}{\listoverride\listid1801338294\listoverridecount0\ls12}{\listoverride\listid155655221\listoverridecount0\ls13}{\listoverride\listid1335182434 -\listoverridecount0\ls14}{\listoverride\listid144588935\listoverridecount0\ls15}{\listoverride\listid1583906200\listoverridecount0\ls16}{\listoverride\listid891499942\listoverridecount0\ls17}{\listoverride\listid358317280\listoverridecount0\ls18} -{\listoverride\listid207642902\listoverridecount0\ls19}{\listoverride\listid39328222\listoverridecount9{\lfolevel\listoverridestartat\levelstartat1}{\lfolevel\listoverridestartat\levelstartat1}{\lfolevel\listoverridestartat\levelstartat1}{\lfolevel -\listoverridestartat\levelstartat1}{\lfolevel\listoverridestartat\levelstartat1}{\lfolevel\listoverridestartat\levelstartat1}{\lfolevel\listoverridestartat\levelstartat1}{\lfolevel\listoverridestartat\levelstartat1}{\lfolevel\listoverridestartat -\levelstartat1}\ls20}}{\*\rsidtbl \rsid1198806\rsid7222687\rsid9508363\rsid11754636\rsid13262587}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info -{\title LEC-PRE-00489 ~ EULA for CMSIS Deliverables}{\author emidre01}{\operator Joachim Krech}{\creatim\yr2014\mo6\dy2\hr8\min46}{\revtim\yr2014\mo6\dy2\hr8\min48}{\printim\yr2014\mo6\dy2\hr8\min46}{\version3}{\edmins4}{\nofpages4}{\nofwords1696} -{\nofchars9668}{\*\company ARM Ltd}{\nofcharsws11342}{\vern49167}{\*\saveprevpict}}{\*\userprops {\propname Check In Comment}\proptype30{\staticval Major Version Publish}{\propname ComputedCompany}\proptype30{\staticval ARM/}{\propname ComputedLR} -\proptype30{\staticval AP/}{\propname ComputedNumber}\proptype30{\staticval LEC-PRE-00489-V6.0}{\propname Created}\proptype30{\staticval 2014-02-19T13:26:48Z}{\propname Description}\proptype30{\staticval }{\propname display_urn:schemas-microsoft-com:offic -e:office#Author}\proptype30{\staticval Emily Drea}{\propname display_urn:schemas-microsoft-com:office:office#Editor}\proptype30{\staticval Emily Drea}{\propname EMAIL_OWNER_ADDRESS}\proptype30{\staticval sAAAUYtyAkeNWR4c/hyv83djDdgT//SlfRfj0yul0Nymu58=} -{\propname FileLeafRef}\proptype30{\staticval LEC-PRE-00489}{\propname HiddenDelete}\proptype30{\staticval }{\propname HiddenUpload}\proptype30{\staticval }{\propname MAIL_MSG_ID1}\proptype30{\staticval ABAAVOAfoSrQoywVz+n89RkH8vckJh2hX9X1LeIJRLXpkh+XCtJm -zNRfIdvcDdtCC+CW}{\propname MAIL_MSG_ID2}\proptype30{\staticval c5CxtGnFSJrNPiFAS7uBa/Md4M/GKbLGzLnuTUVlLUhYPGbMRhOa5RG4vn7\'0d\'0aRvdHkjT0j+KBwUyX0J0TijfAeRM/c9+3kWygmQ==}{\propname Modified}\proptype30{\staticval 2014-06-01T22:00:57Z}{\propname Modified - By}\proptype30{\staticval 62\'3b#Emily Drea,#EMEA\'5cemidre01,#Emily.Drea@arm.com,#,#Emily Drea}{\propname Name}\proptype30{\staticval LEC-PRE-00489.doc}{\propname Order}\proptype30{\staticval 672300}{\propname Property Bag}\proptype30{\staticval vti_con -tentversionisdirty:BW|false\'0d\'0avti_parserversion:SR|14.0.0.6029\'0d\'0aEXT:SW|doc\'0d\'0aOrder:IW|672300\'0d\'0avti_contenttag:SW|\'7bED0E0651-0814-4E38-B7AA-8478D3CBF58F\'7d,123,48\'0d\'0a_Category:SW|\'0d\'0aRESPONSE_SENDER_NAME:SW|gAAAdya76B99d4hLG -UR1rQ+8TxTv0GGEPdix\'0d\'0avti_author:SR|}{\propname RESPONSE_SENDER_NAME}\proptype30{\staticval gAAAdya76B99d4hLGUR1rQ+8TxTv0GGEPdix}{\propname Title}\proptype30{\staticval LEC-PRE-00489 ~ EULA for CMSIS Deliverables}}{\*\xmlnstbl {\xmlns1 http://schemas -.microsoft.com/office/word/2003/wordml}}\paperw11906\paperh16838\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect -\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1 -\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1 -\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct -\asianbrkrule\rsidroot2688764\newtblstyruls\nogrowautofit\utinl \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 -\rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1198806 \chftnsep -\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1198806 \chftnsepc -\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1198806 \chftnsep -\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1198806 \chftnsepc -\par }}\ltrpar \sectd \ltrsect\linex0\headery400\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sectrsid11754636\sftnbj {\headerr \ltrpar \ltrrow\trowd \irow0\irowband0\ltrrow -\ts11\trgaph108\trrh240\trleft-108\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth3009\clshdrawnil \cellx2901 -\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth3009\clshdrawnil \cellx5910\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl -\cltxlrtb\clftsWidth3\clwWidth3009\clshdrawnil \cellx8919\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \hich\af1\dbch\af1\loch\f1 1 June 2014\cell }\pard \ltrpar\qc \li0\ri0\sa200\sl276\slmult1 -\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \hich\af1\dbch\af1\loch\f1 CONFIDENTIAL\cell }\pard \ltrpar\qr \li0\ri0\sa200\sl276\slmult1 -\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \hich\af1\dbch\af1\loch\f1 LEC-PRE-00489\cell }\pard \ltrpar -\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \trowd \irow0\irowband0\ltrrow -\ts11\trgaph108\trrh240\trleft-108\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth3009\clshdrawnil \cellx2901 -\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth3009\clshdrawnil \cellx5910\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl -\cltxlrtb\clftsWidth3\clwWidth3009\clshdrawnil \cellx8919\row \ltrrow}\trowd \irow1\irowband1\lastrow \ltrrow\ts11\trgaph108\trrh240\trleft-108\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt -\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth9026\clshdrawnil \cellx8919\pard \ltrpar\qr \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af1 -\ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \hich\af1\dbch\af1\loch\f1 SP-Version: 3.0\cell }\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af1 \ltrch\fcs0 -\fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \trowd \irow1\irowband1\lastrow \ltrrow\ts11\trgaph108\trrh240\trleft-108\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl -\clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth9026\clshdrawnil \cellx8919\row }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\rtlch\fcs1 \af0 \ltrch\fcs0 -\insrsid11754636 -\par }}{\footerr \ltrpar \ltrrow\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trgaph108\trrh240\trleft-108\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr -\brdrtbl \cltxlrtb\clftsWidth3\clwWidth4513\clshdrawnil \cellx4405\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth4513\clshdrawnil \cellx8918\pard\plain \ltrpar\qr \li0\ri0\sa200\sl276\slmult1 -\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\field{\*\fldinst {\rtlch\fcs1 \af1 \ltrch\fcs0 -\fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \hich\af1\dbch\af1\loch\f1 PAGE}}{\fldrslt {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\lang1024\langfe1024\loch\af1\hich\af1\dbch\af1\noproof\insrsid9508363 \hich\af1\dbch\af1\loch\f1 4}}}\sectd \ltrsect -\linex0\endnhere\sectdefaultcl\sftnbj {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \hich\af1\dbch\af1\loch\f1 of }{\field{\*\fldinst {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 -\hich\af1\dbch\af1\loch\f1 NUMPAGES}}{\fldrslt {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\lang1024\langfe1024\loch\af1\hich\af1\dbch\af1\noproof\insrsid9508363 \hich\af1\dbch\af1\loch\f1 4}}}\sectd \ltrsect\linex0\endnhere\sectdefaultcl\sftnbj {\rtlch\fcs1 \af1 -\ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 \cell \cell }\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\rtlch\fcs1 \af1 \ltrch\fcs0 \fs18\loch\af1\hich\af1\dbch\af1\insrsid11754636 -\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trgaph108\trrh240\trleft-108\trftsWidth1\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl -\cltxlrtb\clftsWidth3\clwWidth4513\clshdrawnil \cellx4405\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth4513\clshdrawnil \cellx8918\row }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1 -\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11754636 -\par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}} -{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8 -\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\qj \li0\ri0\sa240\widctlpar -\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 END USER LICENCE AGREEMENT FOR THE }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CORTEX MICROCONTROLLER SOFTWARE INTERFACE STANDARD (CMSIS) DELIVERABLES }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -\par THIS END USER LICENCE AGREEMENT ("LICENCE") IS A LEGAL AGREEMENT BETWEEN YOU (EITHER A }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid5861575 -SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND ARM LIMITED ("ARM") FOR THE USE OF THE CMSIS }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 DELIVERABLES}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid5861575 . ARM IS ONLY WILLING TO LICENSE THE }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS DELIVERABLES }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid5861575 TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 TERMS IN THIS LICENCE. BY CLICKING "I AGREE", OR BY INSTALLING OR OTHERWISE USING OR COPYING THE }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS DELIVERABLES }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL THE TERMS OF THIS LICENCE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENCE, ARM IS UNWILLING TO LICENSE YOU TO USE }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 OF }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 THE }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS DELIVERABLES}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 AND YOU MAY NOT INSTALL, USE OR COPY THE }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS DELIVERABLES}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'93 -CMSIS Deliverables\'94 means the following components: (i) CMSIS-CORE; (ii) CMSIS-DRIVER; (iii) CMSIS-DSP; (iv) CMSIS-PACK; (v) CMSIS-RTOS API; and (vi) CMSIS-SVD . -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\tx0\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'93CMSIS-CORE -\'94 means the specification defining the application programming interface, naming and coding conventions for the Cortex-M processor cores. -\par \'94}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid488451 \hich\af1\dbch\af37\loch\f1 CMSIS-DRIVER}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'94}{\rtlch\fcs1 \af0 \ltrch\fcs0 -\insrsid11754636 \hich\af37\dbch\af37\loch\f37 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid488451 \hich\af1\dbch\af37\loch\f1 means the specification defining }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\hich\af1\dbch\af37\loch\f1 a generic}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid488451 \hich\af1\dbch\af37\loch\f1 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 p}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid488451 \hich\af1\dbch\af37\loch\f1 eripheral }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 d}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\insrsid11754636\charrsid488451 \hich\af1\dbch\af37\loch\f1 river application programming interface, naming and coding conventions}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11754636 . -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'93CMSIS-DSP\'94 - means the digital signal process (DSP) library specification defining the application programming interface of a DSP library implementation}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15023647 .}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\tx0\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'93}{ -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid13240697 \hich\af1\dbch\af37\loch\f1 CMSIS-PACK}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'94}{\rtlch\fcs1 \af0 \ltrch\fcs0 -\insrsid11754636\charrsid13240697 \hich\af37\dbch\af37\loch\f37 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid13240697 \hich\af1\dbch\af37\loch\f1 means the specification defining a software pack file format}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 , verification utility, }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid13240697 \hich\af1\dbch\af37\loch\f1 and the associated XML schema file}{\rtlch\fcs1 -\af0 \ltrch\fcs0 \insrsid11754636\charrsid13240697 .}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11754636 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'93CMSIS-RTOS API\'94 means the - real-time operating system (RTOS) specification defining a generic application programming interface layer for a RTOS system}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15023647 .}{ -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4029239 \hich\af1\dbch\af37\loch\f1 -Notwithstanding the foregoing, }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4730869 \hich\af1\dbch\af37\loch\f1 the CMSIS D}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 eliverables}{ -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4730869 \hich\af1\dbch\af37\loch\f1 shall not}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4029239 \hich\af1\dbch\af37\loch\f1 include}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 :}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4029239 \hich\af1\dbch\af37\loch\f1 (i) the implementation of other published specification -\hich\af1\dbch\af37\loch\f1 s }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 referenced }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4029239 \hich\af1\dbch\af37\loch\f1 in th}{ -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 e}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4029239 \hich\af1\dbch\af37\loch\f1 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 CMSIS Deliverables }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4029239 \hich\af1\dbch\af37\loch\f1 -; (ii) any enabling technologies that may be necessary to make or use any product or portion thereof that }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4283548 \hich\af1\dbch\af37\loch\f1 complies with the }{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4283548 \hich\af1\dbch\af37\loch\f1 , but are not themselves expressly set forth in the }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 CMSIS Deliverables }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4283548 \hich\af1\dbch\af37\loch\f1 (e.\hich\af1\dbch\af37\loch\f1 -g. compiler front ends, code generators, back ends, libraries or other compiler, assembler or linker technologies; validation or debug software or hardware; applications, operating system or driver software; RISC architecture; processor microarchitecture) -\hich\af1\dbch\af37\loch\f1 ;\hich\af1\dbch\af37\loch\f1 (iii) maskworks and physical layouts of integrated circuit designs; or (iv) RTL or other high}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid4029239 -\hich\af1\dbch\af37\loch\f1 level representations of integrated circuit designs.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'93CMSIS-SVD\'94 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid9306407 means }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 the specification defining the System View Description (SVD), verification utility, }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf17\lang1033\langfe2057\langnp1033\langfenp2057\insrsid11754636\charrsid9306407 and associated XML}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf17\lang1033\langfe2057\langnp1033\langfenp2057\insrsid11754636 schema}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\cf17\lang1033\langfe2057\langnp1033\langfenp2057\insrsid11754636\charrsid9306407 files. }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid9306407 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \'93Separate Files\'94 means the components in }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid10227990 the CMSIS reference implementation identified}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 - in the Schedule that demonstrate the usage of the CMSIS-CORE, CMSIS-DRIVER, CMSIS-DSP, CMSIS-PACK and CMSIS-RTOS API, }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid3618484 for microprocessors -or device specific software applications that are for use with microprocessors.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par }\pard \ltrpar\qj \li0\ri0\sa240\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 { -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 1. LICENCE GRANTS. -\par }\pard \ltrpar\qj \li0\ri0\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 {\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 1.1}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS DELIVERABLES -\par -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 ARM hereby grants to you, subject to the terms and conditions of this Licence, a non-exclusive, non-transferable }{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid1317547 licence, to use and copy the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS D}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 eliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 for the purpose of: }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar -\tx426\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 (i) subject to clause 1.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 2}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 , developing, having developed, manufacturing, having manufactured, offering to sell, selling, supplying or otherwise distributing products that comply with the }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS D}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 eliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 ; and -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid1317547 (ii) distributing and having distributed (directly or through your customers and authorised distributors) the CMSIS-D}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 eliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid1317547 unmodified, with the products}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 you have developed under }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 Clause 1.1 (i) }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 provided you preserve any copyright notices which are included with the CMSIS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 D}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 eliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid6756135 . -\par }\pard \ltrpar\qj \li0\ri0\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 {\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 1.2}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 CONDITIONS ON REDISTRIBUTION}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 .}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 -\cbpat8 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid1928237 \hich\af1\dbch\af37\loch\f1 -If you distribute (directly or through your customers and authorised distributors) the products you have created pursuant to Clauses 1.1}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 \hich\af1\dbch\af37\loch\f1 -}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid1928237 \hich\af1\dbch\af37\loch\f1 (i) you agree: (a) not to use ARM\hich\f1 \rquote \loch\f1 s name\hich\af1\dbch\af37\loch\f1 -, logo or trademarks to market any or all of the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid1928237 products created under Clause 1.1 (i); }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid1928237 \hich\af1\dbch\af37\loch\f1 (b) }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 \hich\af1\dbch\af37\loch\f1 to }{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid1928237 \hich\af1\dbch\af37\loch\f1 pr}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 \hich\af1\dbch\af37\loch\f1 e}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid1928237 \hich\af1\dbch\af37\loch\f1 serve any copyright notices included in the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 -\hich\af1\dbch\af37\loch\f1 CMSIS D}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 eliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid1928237 -\hich\af1\dbch\af37\loch\f1 ; and (c) to ensure your customers and authorised distributors comply with this Clause 1.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 \hich\af1\dbch\af37\loch\f1 2}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid1928237 .}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 \hich\af1\dbch\af37\loch\f1 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par }\pard \ltrpar\qj \li0\ri0\sa240\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 { -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 2. RESTRICTIONS ON USE OF THE}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 - CMSIS DELIVERABLES}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 -\cbpat8 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 PERMITTED USERS: The }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -CMSIS Deliverables }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 shall be used only by you (either a single individual, or single legal entity) your employees, or by your }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 on-site }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -bona fide sub-contractors for whose acts and omissions you hereby agree to be responsible to ARM}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 for}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 to the same extent as }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 you are for }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 your employees, and provided always that such sub-contractors}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 :}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 (i) are contractually obligated to use the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -CMSIS Deliverables }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 only for your benefit}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -;}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 and (i}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 i}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 ) agree to assign all their work product and any rights they create therein in the supply of such work to you. -\par COPYRIGHT AND RESERVATION OF RIGHTS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid14488502 : The }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid14488502 - are owned by ARM or its licensors and are protected by copyright and other intellectual property laws and international treaties. The }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables}{ -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid14488502 are licensed not sold. Except as expressly licensed herein, you acquire no right, title or interest in the }{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid14488502 - or any intellectual property therein. In no event shall the licences granted herein be construed as granting you, expressly or by implication, estoppels or otherwise, a licence to use any ARM technology except the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid14488502 .}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -\par }\pard \ltrpar\qj \li0\ri0\sa240\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 { -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 3}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . SUPPORT. -\par ARM is not obligated to support the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables but}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 may do so entirely at ARM's discretion. -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 4}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 NO }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 WARRANT}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 Y.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -\par YOU AGREE THAT THE }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS DELIVERABLES ARE}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 - LICENSED "AS IS", AND THAT ARM EXPRESSLY DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS OR OTHER TERMS, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION THE IMPLIED WARR -ANTIES OF NON-INFRINGEMENT, SATISFACTORY QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 THE CMSIS DELIVERABLES MAY CONTAIN ERRORS. }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 5}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . LIMITATION OF LIABILITY. -\par THE MAXIMUM LIABILITY OF ARM TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST ARM IN CONTRACT}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 ,}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER OF THIS LICENCE SHALL NOT EXCEED }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 THE GREATER OF (I) }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -THE TOTAL OF SUMS PAID BY YOU TO ARM (IF ANY) FOR THIS LICENCE}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 AND (II) US$10.00}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 .}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 THE LIMITATIONS, EXCLUSIONS AND DISCLAIMERS IN THIS LICEN -CE SHALL APPLY TO THE MAXIMUM EXTENT ALLOWED BY APPLICABLE LAW. -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 \hich\af1\dbch\af37\loch\f1 6 -}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid13830602 \hich\af1\dbch\af37\loch\f1 . THIRD PARTY RIGHTS.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid13830602 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid13830602 \hich\af1\dbch\af37\loch\f1 -The Separate Files are delivered subject to and your use is governed by their own separate licence agreements. This Licence does not apply to such Separate Files and the\hich\af1\dbch\af37\loch\f1 \hich\f1 y are not included in the term \'93}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636 \hich\af1\dbch\af37\loch\f1 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\lang1024\langfe1024\noproof\insrsid11754636\charrsid13830602 -\loch\af1\dbch\af37\hich\f1 \'94\loch\f1 \hich\f1 under this Licence. You agree to comply with all terms and conditions imposed on you in respect of such Separate Files including those identified in the Schedule (\'93\loch\f1 \hich\f1 Third Party Terms -\'94\loch\f1 ). -\par \hich\af1\dbch\af37\loch\f1 ARM HEREBY DISCLA\hich\af1\dbch\af37\loch\f1 \hich\f1 -IMS ANY AND ALL WARRANTIES EXPRESS OR IMPLIED FROM ANY THIRD PARTIES REGARDING ANY SEPARATE FILES, ANY THIRD PARTY MATERIALS INCLUDED IN THE SOFTWARE, ANY THIRD PARTY MATERIALS FROM WHICH THE SOFTWARE IS DERIVED (COLLECTIVELY \'93\loch\f1 \hich\f1 -OTHER CODE\'94\loch\f1 ), AND THE USE OF\hich\af1\dbch\af37\loch\f1 \hich\af1\dbch\af37\loch\f1 -ANY OR ALL THE OTHER CODE IN CONNECTION WITH THE SOFTWARE, INCLUDING (WITHOUT LIMITATION) ANY WARRANTIES OF SATISFACTORY QUALITY OR FITNESS FOR A PARTICULAR PURPOSE. -\par \hich\af1\dbch\af37\loch\f1 NO THIRD PARTY LICENSORS OF OTHER CODE SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, \hich\af1\dbch\af37\loch\f1 -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND WHETHER MADE UNDER CONTRACT, TORT OR OTHER LEGAL THEORY, ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE OTHER CODE OR THE EX -\hich\af1\dbch\af37\loch\f1 E\hich\af1\dbch\af37\loch\f1 RCISE OF ANY RIGHTS GRANTED UNDER EITHER OR BOTH THIS LICENCE AND THE LEGAL TERMS APPLICABLE TO ANY SEPARATE FILES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -\par }\pard \ltrpar\qj \li0\ri0\sa240\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 { -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 7}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . U.S. GOVERNMENT END USERS. -\par US Government Restrictions: Use, duplication, reproduction, release, modification, disclosure or transfer of this commercial product and accompanying documentation is restricted in accordance with the terms of this Licence. -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 8}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . TERM AND TERMINATION. -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 8.1 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -This Licence shall remain in force until terminated }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 in accordance with the terms of Clause 8.2 or Clause 8.3 below}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par 8.2 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -Without prejudice to any of its other rights if you are in breach of any of the terms and conditions of this Licence then ARM may terminate this Licence immediately upon giving written notice to you}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid7630822 . You may terminate this Licence at any time. }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7106724 \hich\af1\dbch\af37\loch\f1 -8.3 This Licence shall immediately terminate and shall be unavailable to you if you or any party affiliated to you asserts any patents against ARM, ARM affiliates, third parties who have a valid licence fro\hich\af1\dbch\af37\loch\f1 -m ARM for the CMSIS Deliverables, or any customers or distributors of any of them based upon a claim that your (or your affiliate) patent is Necessary to implement the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\hich\af1\dbch\af37\loch\f1 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7106724 \hich\af1\dbch\af37\loch\f1 . In this Licence}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\hich\af1\dbch\af37\loch\f1 :}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7106724 \hich\af1\dbch\af37\loch\f1 (i) "affiliate" means any entity controlling, contr\hich\af1\dbch\af37\loch\f1 -olled by or under common control with a party (in fact or in law, via voting securities, management control or otherwise) and "affiliated" shall be construed accordingly; (ii) "assert" means to allege infringement in legal or administrative proceedings, o -\hich\af1\dbch\af37\loch\f1 r\hich\af1\dbch\af37\loch\f1 proceedings before any other competent trade, arbitral or international authority; }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 and }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7106724 \hich\af1\dbch\af37\loch\f1 \hich\f1 (iii) \'93\loch\f1 \hich\f1 Necessary\'94\loch\f1 - means with respect to any claims of any patent, those claims which, without the appropriate permission of the patent owner, will be infringed when imp\hich\af1\dbch\af37\loch\f1 lementing the CMSIS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 Deliverables }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7106724 \hich\af1\dbch\af37\loch\f1 -because no alternative, commercially reasonable, non-infringing way of implementing the CMSIS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 Deliverables }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\insrsid11754636\charrsid7106724 \hich\af1\dbch\af37\loch\f1 is known.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid5900444 \hich\af1\dbch\af37\loch\f1 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\par }\pard \ltrpar\qj \li0\ri0\sa240\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 { -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 8.4 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid7630822 Upon termination of this Licence,}{ -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 you shall stop }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15098396 -using the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15098396 - and destroy all copies of the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15098396 in your possession. The provisions of clauses 5, 6, 7, 8 and 9 shall survive termination of this Licence.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 9}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 . GENERAL. -\par This Licence is governed by English Law. Except where ARM agrees otherwise in a written contract signed by you and ARM, this is the only agreement between you and ARM relating to the }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 CMSIS Deliverables}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15280636 - and it may only be modified by written agreement between you and ARM. Except as expressly agreed in writing, this Licence may not be modified by purchase orders, ad -vertising or other representation by any person. If any clause or sentence in this Licence is held by a court of law to be illegal or unenforceable the remaining provisions of this Licence shall not be affected thereby. The failure by ARM to enforce any o -f the provisions of this Licence, unless waived in writing, shall not constitute a waiver of ARM's rights to enforce such provision or any other provision of this Licence in the future.}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 This Licence may not be assigned without the prior written consent of ARM. -\par }\pard \ltrpar\qc \li0\ri0\sa240\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 { -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 \page SCHEDULE -\par }\pard \ltrpar\qj \li0\ri0\sa240\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \cbpat8 { -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 Separate Files -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 The }{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15098396 package }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 also }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15098396 includes the components}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 contained in the following directories}{\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15098396 :}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\insrsid11754636 \hich\af1\dbch\af0\loch\f1 (a)\tab}}\pard \ltrpar -\qj \fi-360\li720\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls16\adjustright\rin0\lin720\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 ./}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 \hich\af1\dbch\af37\loch\f1 CMSIS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 /}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 -\hich\af1\dbch\af37\loch\f1 DSP_Lib}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 - }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636\charrsid15098396 -DSP Library sources and examples}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 ; -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\insrsid11754636 \hich\af1\dbch\af0\loch\f1 (b)\tab}}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 ./}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 \hich\af1\dbch\af37\loch\f1 CMSIS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 /}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 -\hich\af1\dbch\af37\loch\f1 Include}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 - Header files; -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\insrsid11754636 \hich\af1\dbch\af0\loch\f1 (c)\tab}}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 ./}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 \hich\af1\dbch\af37\loch\f1 CMSIS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 /}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 -\hich\af1\dbch\af37\loch\f1 Lib}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 - }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 \hich\af1\dbch\af37\loch\f1 -DSP Library build for various toolchains}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 ; -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\insrsid11754636 \hich\af1\dbch\af0\loch\f1 (d)\tab}}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 ./}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 \hich\af1\dbch\af37\loch\f1 CMSIS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 /}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 -\hich\af1\dbch\af37\loch\f1 RTOS}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 - }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid7090778 \hich\af1\dbch\af37\loch\f1 -Header file template for CMSIS-RTOS implementation}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 ; and -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\insrsid11754636 \hich\af1\dbch\af0\loch\f1 (e)\tab}}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\cf1\lang2057\langfe2057\langfenp2057\insrsid11754636 .}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 /Device - T}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid14488502 \hich\af1\dbch\af37\loch\f1 emplate files and implementations for Cortex-M class processors}{ -\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 . -\par }\pard \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\par \hich\af1\dbch\af37\loch\f1 All of the above components (a\hich\f1 \endash \loch\f1 e) are licensed to you under the terms of the BSD licence, which is incorp\hich\af1\dbch\af37\loch\f1 orated within or alongside the above components. -\par }\pard \ltrpar\qj \li284\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin284\itap0\pararsid11754636 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 -\f1\fs18\insrsid11754636\charrsid13975144 \hich\af1\dbch\af37\loch\f1 (f)}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid13975144 -\hich\af1\dbch\af37\loch\f1 ./CMSIS/Driver \hich\f1 \endash \loch\f1 CMSIS-Driver header files}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid13975144 \hich\af1\dbch\af37\loch\f1 (g)}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11754636 -\hich\af37\dbch\af37\loch\f37 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 ./CMSIS/Pack \hich\f1 \endash \loch\f1 Example Device Family Pack}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11754636\charrsid13975144 - -\par }\pard\plain \ltrpar\s32\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \f39\fs21\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 -\af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\par The above components (f \endash g) are licensed to you under the terms of the zlib licence, which is incorporated within or alongside the above components. -\par -\par }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid14488502 }{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636 -\par -\par -\par }\pard\plain \ltrpar\qj \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11754636 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 -\fs22\lang2057\langfe1033\loch\af37\hich\af37\dbch\af37\cgrid\langnp2057\langfenp1033 {\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid2958685 \hich\af1\dbch\af37\loch\f1 ARM contract reference LEC-PRE-00489}{\rtlch\fcs1 \af1\afs18 -\ltrch\fcs0 \f1\fs18\insrsid11754636 \hich\af1\dbch\af37\loch\f1 - v3.0}{\rtlch\fcs1 \af1\afs18 \ltrch\fcs0 \f1\fs18\insrsid11754636\charrsid2958685 -\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a -9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad -5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6 -b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0 -0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6 -a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f -c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512 -0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462 -a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865 -6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b -4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b -4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f -7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87 -615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad -79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b -5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab -999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9 -699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586 -8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6 -0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f -9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be -15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979 -3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d -32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a -f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86 -e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90 -fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2 -ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae -a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1 -399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5 -4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84 -0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b -c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7 -689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20 -5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0 -aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d -316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840 -545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a -c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100 -0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7 -8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89 -d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500 -1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f -bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6 -a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a -0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021 -0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008 -00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000} -{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d -617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 -6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 -656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} -{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; -\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; -\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; -\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdpriority0 \lsdlocked0 footer;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdpriority0 \lsdlocked0 page number; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid; -\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography; -\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 0105000002000000180000004d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000560000 -d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff0900060000000000000000000000010000000100000000000000001000000200000001000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -fffffffffffffffffdffffff09000000feffffff04000000050000000600000007000000080000000a0000000c0000000b0000000d0000000f0000000e00000028000000feffffff1100000012000000130000001400000015000000160000001700000018000000190000001a0000001b0000001c0000001d0000001e00 -00001f0000002000000021000000220000002300000024000000250000002600000027000000feffffff29000000feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffff010000000c6ad98892f1d411a65f0040963251e500000000000000000000000010aa -35ab2e7ecf0103000000c0160000000000004d0073006f004400610074006100530074006f0072006500000000000000000000000000000000000000000000000000000000000000000000000000000000001a000101ffffffffffffffff05000000000000000000000000000000000000000000000010aa35ab2e7ecf01 -10aa35ab2e7ecf0100000000000000000000000033005800c800dd00d0004e00c500d300540055003400df00c9005500df00db00cb0045004200d200df00d0003d003d000000000000000000000000000000000032000101ffffffffffffffff03000000000000000000000000000000000000000000000010aa35ab2e7e -cf0110aa35ab2e7ecf010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff04000000ffffffff000000000000000000000000000000000000000000000000 -00000000000000000000000000000000f40b0000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f000000100000001100000012000000130000001400000015000000160000001700000018000000190000001a00 -00001b0000001c0000001d0000001e0000001f000000200000002100000022000000230000002400000025000000260000002700000028000000290000002a0000002b0000002c0000002d0000002e0000002f000000feffffff3100000032000000330000003400000035000000feffffff370000003800000039000000 -feffffff3b0000003c0000003d0000003e0000003f000000feffffff410000004200000043000000feffffff4500000046000000470000004800000049000000feffffff4b0000004c0000004d0000004e0000004f0000005000000051000000520000005300000054000000550000005600000057000000580000005900 -00005a000000feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d227574662d38223f3e3c4c6f6e6750726f7065727469657320786d6c6e733d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f666669 -63652f323030362f6d657461646174612f6c6f6e6750726f70657274696573223e3c4c6f6e6750726f7020786d6c6e733d2222206e616d653d2250726f70657274795f78303032305f426167223e3c215b43444154415b7674695f636f6e74656e7476657273696f6e697364697274793a42577c66616c73650d0a767469 -5f70617273657276657273696f6e3a53527c31342e302e302e363032390d0a4558543a53577c646f630d0a4f726465723a49577c3637323330300d0a7674695f636f6e74656e747461673a53577c7b45443045303635312d303831342d344533382d423741412d3834373844334342463538467d2c3132332c34380d0a5f -43617465676f72793a53577c0d0a524553504f4e53455f53454e4445525f4e414d453a53577c6741414164796137364239396434684c4755523172512b385478547630474745506469780d0a7674695f617574686f723a53527c454d45415c5c656d6964726530310d0a4e6f746573506172743a53577c4c45432d505245 -2d30303438392e646f630d0a53696465204c6574746572733a49577c300d0a7674695f63617465676f726965733a56577c0d0a48696464656e55706c6f61643a53577c0d0a50726f7065727479204261673a53577c7674695f636f6e74656e7476657273696f6e697364697274793a42577c66616c73655c725c6e767469 -5f70617273657276657273696f6e3a53527c31342e302e302e363032395c725c6e4558543a53577c646f635c725c6e4f726465723a49577c3637323330305c725c6e7674695f636f6e74656e747461673a53577c7b33384143303341362d393444362d344142302d394543322d4445424631343146333837437d2c313131 -2c37335c725c6e5f43617465676f72793a53577c5c725c6e524553504f4e53455f53454e4445525f4e414d453a53577c6741414164796137364239396434684c4755523172512b385478547630474745506469785c725c6e7674695f617574686f723a53527c0d0a5469746c653a53577c4c45432d5052452d3030343839 -207e2045554c4120666f7220434d5349532044656c6976657261626c65730d0a7674695f61737369676e6564746f3a53577c0d0a4b6579776f7264733a53577c0d0a436f6d7075746564436f6d70616e793a53577c41524d2f0d0a436f6d70757465644c523a53577c41502f0d0a437265617465643a53577c323031342d -30322d31385431343a32393a31315a0d0a7674695f6d6f64696669656462793a53527c454d45415c5c656d6964726530310d0a436f6e74656e745479706549643a53577c307830313031303030394135453436413142414235363438423443423131314343384143453237440d0a5f417574686f723a53577c0d0a436865 -636b20496e20436f6d6d656e743a53577c4d616a6f722056657273696f6e205075626c6973680d0a4e616d653a53577c4c45432d5052452d30303438392e646f630d0a5f436f6d6d656e74733a53577c0d0a436f6d6d656e74733a53577c0d0a446f634e756d6265723a53577c4c45432d5052452d30303438390d0a446f -6d696e6f20417574686f723a53577c0d0a4d41494c5f4d53475f4944323a53577c6335437874476e46534a724e5069464153377542612f4d64344d2f474b624c477a4c6e755455566c4c5568595047624d52684f6135524734766e375c725c6e527664486b6a54306a2b4b4277557958304a3054696a664165524d2f6339 -2b336b5779676d513d3d0d0a7674695f73796e6375706461746568696464656e76657273696f6e3a49577c3131390d0a5375626a6563743a53577c0d0a646973706c61795f75726e5c3a736368656d61732d6d6963726f736f66742d636f6d5c3a6f66666963655c3a6f666669636523456469746f723a53577c456d696c -7920447265610d0a437265617465642042793a53577c36323b23456d696c7920447265612c23454d45415c5c656d6964726530312c23456d696c792e447265614061726d2e636f6d2c232c23456d696c7920447265610d0a7674695f666f6c6465726974656d636f756e743a49527c300d0a4d41494c5f4d53475f494431 -3a53577c41424141564f41666f5372516f7977567a2b6e3839526b483876636b4a683268583958314c65494a524c58706b682b5843744a6d7a4e52664964766344647443432b43570d0a4d6f6469666965643a53577c323031342d30322d31395431333a32363a34355a0d0a436f6d70757465644e756d6265723a53577c -4c45432d5052452d30303438392d56362e300d0a4d6f6469666965642042793a53577c36323b23456d696c7920447265612c23454d45415c5c656d6964726530312c23456d696c792e447265614061726d2e636f6d2c232c23456d696c7920447265610d0a7674695f617070726f76616c6c6576656c3a53577c0d0a4469 -766973696f6e3a53577c5344440d0a48696464656e44656c6574653a53577c0d0a4e6f746573554e49443a53577c32383939374630443531443738304644383032353736433630303736363041310d0a7674695f666f6c646572737562666f6c6465726974656d636f756e743a49527c300d0a5f5374617475733a53577c -0d0a646973706c61795f75726e5c3a736368656d61732d6d6963726f736f66742d636f6d5c3a6f66666963655c3a6f666669636523417574686f723a53577c456d696c7920447265610d0a446f63547970653a53577c507265636564656e740d0a446f6d696e6f2056657273696f6e3a53577c0d0a454d41494c5f4f574e -45525f414444524553533a53577c7341414155597479416b654e575234632f6879763833646a446467542f2f536c6652666a3079756c304e796d7535383d0d0a7674695f636163686564637573746f6d70726f70733a56587c5375626a65637420646973706c61795f75726e3a736368656d61732d6d6963726f736f6674 -2d636f6d3a6f66666963653a6f666669636523456469746f7220455854204d41494c5f4d53475f494431204f72646572205f43617465676f727920524553504f4e53455f53454e4445525f4e414d45204d6f64696669656420436f6d70757465644e756d626572204e6f7465735061727420536964655c5c204c65747465 -7273207674695f617070726f76616c6c6576656c207674695f63617465676f72696573204469766973696f6e2048696464656e44656c6574652048696464656e55706c6f6164204e6f746573554e49442050726f70657274795c5c20426167207674695f61737369676e6564746f204b6579776f726473205f5374617475 -7320436f6d7075746564436f6d70616e7920436f6d70757465644c52204372656174656420646973706c61795f75726e3a736368656d61732d6d6963726f736f66742d636f6d3a6f66666963653a6f666669636523417574686f7220446f635479706520446f6d696e6f5c5c2056657273696f6e20454d41494c5f4f574e -45525f41444452455353207674695f7469746c65205f417574686f7220436865636b5c5c20496e5c5c20436f6d6d656e742046696c654c656166526566204e6f74657354696d655374616d70205f436f6d6d656e7473204e616d6520436f6d6d656e747320446f634e756d62657220446f6d696e6f5c5c20417574686f72 -204d41494c5f4d53475f4944320d0a7674695f646f6373746f726576657273696f6e3a49527c3132330d0a7674695f6d657461696e666f76657273696f6e3a49577c3136390d0a7674695f636f6e74656e746368616e6765756e69743a53577c0d0a7674695f6361636865647469746c653a53527c4c45432d5052452d30 -30343839207e2045554c4120666f7220434d5349532044656c6976657261626c65730d0a7674695f7469746c653a53577c4c45432d5052452d3030343839207e2045554c4120666f7220434d5349532044656c6976657261626c65730d0a46696c654c6561665265663a53577c4c45432d5052452d30303438390d0a4e6f -74657354696d655374616d703a53577c30332f31322f323031302032323a34303a33360d0a5d5d3e3c2f4c6f6e6750726f703e3c2f4c6f6e6750726f706572746965733e000000000000000000000000500072006f0070006500720074006900650073000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000016000200ffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000300000006c010000000000003500de005900ca00c700ce003400dd00d600c400ce0042005500d1003200ce005300c700480030004f00c000 -3d003d000000000000000000000000000000000032000101020000000800000006000000000000000000000000000000000000000000000010aa35ab2e7ecf0110aa35ab2e7ecf010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000a000201ffffffff07000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000036000000d700000000000000500072006f0070006500720074006900650073000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000003a0000004e010000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38222073 -74616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b43303344374137352d373344392d343734442d424641352d3446464241433430373246467d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d617473 -2e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f6c6f6e -6750726f70657274696573222f3e3c64733a736368656d615265662064733a7572693d22222f3e3c2f64733a736368656d61526566733e3c2f64733a6461746173746f72654974656d3e00000000000000000000000000000000000000003c3f6d736f2d636f6e74656e74547970653f3e3c637573746f6d58736e20786d -6c6e733d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f637573746f6d58736e223e3c78736e4c6f636174696f6e3e3c2f78736e4c6f636174696f6e3e3c6361636865643e547275653c2f6361636865643e3c6f70656e42794465666175 -6c743e46616c73653c2f6f70656e427944656661756c743e3c78736e53636f70653e3c2f78736e53636f70653e3c2f637573746f6d58736e3e00000000000000000000000000000000000000000000000000000000000000000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e67 -3d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b39453241453637462d424445372d344244412d383135332d3137324534413731444133417d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e -786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d65 -7461646174612f637573746f6d58736e222f3e3c2f64733a736368656d61526566733e3c2f64733a6461746173746f72654974656d3e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004e0051003400c500d200da00dc005700c400d4003000 -cb00cd0043004600d700cd00d900da004a00c40041003d003d000000000000000000000000000000000032000101ffffffff0b00000009000000000000000000000000000000000000000000000010aa35ab2e7ecf0110aa35ab2e7ecf010000000000000000000000004900740065006d00000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff0a000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000040000000db00000000000000500072006f00700065007200740069006500 -7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000440000004f01000000000000c700d80030003300550054004a00d000 -34005500c600c0005500cc0057005900c60033004900c0004b0051003d003d000000000000000000000000000000000032000100ffffffffffffffff0c000000000000000000000000000000000000000000000010aa35ab2e7ecf0110aa35ab2e7ecf010000000000000000000000003c3f6d736f2d636f6e74656e7454 -7970653f3e3c466f726d54656d706c6174657320786d6c6e733d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f7368617265706f696e742f76332f636f6e74656e74747970652f666f726d73223e3c446973706c61793e446f63756d656e744c696272617279466f726d3c2f446973706c6179 -3e3c456469743e446f63756d656e744c696272617279466f726d3c2f456469743e3c4e65773e446f63756d656e744c696272617279466f726d3c2f4e65773e3c2f466f726d54656d706c617465733e000000000000000000000000000000000000000000000000000000000000000000000000003c3f786d6c2076657273 -696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b43424135303733352d313641462d343639332d414242342d3231373742373945383939307d2220786d6c6e733a64733d2268 -7474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e -636f6d2f7368617265706f696e742f76332f636f6e74656e74747970652f666f726d73222f3e3c2f64733a736368656d61526566733e3c2f64733a6461746173746f72654974656d3e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c3f786d -6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b35313944383639462d373033322d343937392d413035322d4335393839394432323032397d2220786d6c6e73 -3a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d696372 -6f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f636f6e74656e7454797065222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f70726f706572746965 -732f4900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff0d000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000010000000cc2f0000 -00000000500072006f007000650072007400690065007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000004a0000004004 -0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d227574662d38223f3e3c63743a636f6e74656e7454797065536368656d612063743a5f3d2222206d613a5f3d2222206d613a636f6e74656e74547970654e616d653d22446f63756d656e7422206d613a636f6e74656e74 -5479706549443d223078303130313030303941354534364131424142353634384234434231313143433841434532374422206d613a636f6e74656e745479706556657273696f6e3d22343122206d613a636f6e74656e74547970654465736372697074696f6e3d224372656174652061206e657720646f63756d656e742e -22206d613a636f6e74656e745479706553636f70653d2222206d613a76657273696f6e49443d2237663466393737643166663565326331623933313539653339336638616237612220786d6c6e733a63743d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d65 -7461646174612f636f6e74656e74547970652220786d6c6e733a6d613d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f70726f706572746965732f6d65746141747472696275746573223e0d0a3c7873643a736368656d61207461726765 -744e616d6573706163653d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f70726f7065727469657322206d613a726f6f743d227472756522206d613a6669656c647349443d22353938653565303963363230653761646330626239323935 -306563333638303522206e73323a5f3d222220786d6c6e733a7873643d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612220786d6c6e733a78733d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612220786d6c6e733a703d22687474703a2f2f7363 -68656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f70726f706572746965732220786d6c6e733a6e73323d2232656334313736362d353237652d346338342d623438342d646633663235393966643061223e0d0a3c7873643a696d706f7274206e616d6573706163653d -2232656334313736362d353237652d346338342d623438342d646633663235393966643061222f3e0d0a3c7873643a656c656d656e74206e616d653d2270726f70657274696573223e0d0a3c7873643a636f6d706c6578547970653e0d0a3c7873643a73657175656e63653e0d0a3c7873643a656c656d656e74206e616d -653d22646f63756d656e744d616e6167656d656e74223e0d0a3c7873643a636f6d706c6578547970653e0d0a3c7873643a616c6c3e0d0a3c7873643a656c656d656e74207265663d226e73323a45585422206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a446f635479 -706522206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a4469766973696f6e22206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a436f6d6d656e747322206d696e4f63637572733d2230222f3e0d0a3c7873643a656c -656d656e74207265663d226e73323a446f6d696e6f5f78303032305f56657273696f6e22206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a446f6d696e6f5f78303032305f417574686f7222206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74 -207265663d226e73323a446f634e756d62657222206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a4e6f746573554e494422206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a4e6f74657354696d655374616d702220 -6d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a4e6f7465735061727422206d696e4f63637572733d2230222f3e0d0a3c7873643a656c656d656e74207265663d226e73323a536964655f78303032305f4c65747465727322206d696e4f63637572733d2230222f3e0d0a -3c2f7873643a616c6c3e0d0a3c2f7873643a636f6d706c6578547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c2f7873643a73657175656e63653e0d0a3c2f7873643a636f6d706c6578547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c2f7873643a736368656d613e0d0a3c7873643a736368656d -61207461726765744e616d6573706163653d2232656334313736362d353237652d346338342d623438342d6466336632353939666430612220656c656d656e74466f726d44656661756c743d227175616c69666965642220786d6c6e733a7873643d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c53 -6368656d612220786d6c6e733a78733d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612220786d6c6e733a646d733d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f646f63756d656e744d616e6167656d656e742f74797065 -732220786d6c6e733a70633d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f696e666f706174682f323030372f506172746e6572436f6e74726f6c73223e0d0a3c7873643a696d706f7274206e616d6573706163653d22687474703a2f2f736368656d61732e6d6963726f73 -6f66742e636f6d2f6f66666963652f323030362f646f63756d656e744d616e6167656d656e742f7479706573222f3e0d0a3c7873643a696d706f7274206e616d6573706163653d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f696e666f706174682f323030372f50617274 -6e6572436f6e74726f6c73222f3e0d0a3c7873643a656c656d656e74206e616d653d2245585422206d613a696e6465783d223122206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d2245585422206d613a6465736372697074696f6e3d2246696c6520457874656e73696f6e22206d613a68 -696464656e3d227472756522206d613a696e7465726e616c4e616d653d2245585422206d613a726561644f6e6c793d2266616c7365223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a54657874223e0d0a3c7873643a6d61784c656e6774682076 -616c75653d223130222f3e0d0a3c2f7873643a7265737472696374696f6e3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d22446f635479706522206d613a696e6465783d223222206e696c6c61626c653d227472756522206d -613a646973706c61794e616d653d22446f635479706522206d613a64656661756c743d22507265636564656e7422206d613a666f726d61743d2244726f70646f776e22206d613a68696464656e3d227472756522206d613a696e7465726e616c4e616d653d22446f635479706522206d613a726561644f6e6c793d226661 -6c7365223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a43686f696365223e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22507265636564656e74222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d225369 -6465204c6574746572202d20537562222f3e0d0a3c2f7873643a7265737472696374696f6e3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d224469766973696f6e22206d613a696e6465783d223422206e696c6c61626c653d -227472756522206d613a646973706c61794e616d653d224469766973696f6e22206d613a666f726d61743d2244726f70646f776e22206d613a696e7465726e616c4e616d653d224469766973696f6e223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d -733a43686f696365223e0d0a3c7873643a656e756d65726174696f6e2076616c75653d2241726368697665222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22415344222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22436f72706f72617465222f3e0d0a3c7873643a656e75 -6d65726174696f6e2076616c75653d22446174612050726f74656374696f6e222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22446576656c6f706d656e742053797374656d73222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22454441222f3e0d0a3c7873643a656e756d65 -726174696f6e2076616c75653d224852222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d224c6567616c204f7065726174696f6e73222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22506174656e7473222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22 -5044202d20417263686974656374757265222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d225044202d20436f726573222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22504420e2809320435353222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d225044 -202d204d5044222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d2250444547222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22504445472046726565204c69627261727920416e6e65786573222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d2250444547 -2046726565204c69627261727920436f6e747261637473222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d2250495044222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22504950442046726565204c69627261727920416e6e65786573222f3e0d0a3c7873643a656e756d6572 -6174696f6e2076616c75653d22504950442046726565204c69627261727920436f6e747261637473222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22534444222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22535344222f3e0d0a3c7873643a656e756d65726174696f6e20 -76616c75653d224d61726b6574696e67222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d225044202d204661627269632028617070726f76616c20726571756972656420627920436f6e74726163742d617070726f76616c2d504429222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75 -653d225374616e6461726473222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d225275737369616e207472616e73616374696f6e73222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d225765627369746520506f6c6963696573222f3e0d0a3c7873643a656e756d65726174696f -6e2076616c75653d225472616465204d61726b73222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22496f54204255222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22504547202870726576696f75736c792041534429222f3e0d0a3c7873643a656e756d65726174696f6e20 -76616c75653d224d5047202870726576696f75736c79206b6e6f776e206173205044202d204d504429222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22435047202870726576696f75736c79206b6e6f776e20617320e2809c5044202d20436f72657329222f3e0d0a3c7873643a656e756d657261 -74696f6e2076616c75653d22445347202870726576696f75736c79206b6e6f776e2061732053444429222f3e0d0a3c7873643a656e756d65726174696f6e2076616c75653d22415447202870726576696f75736c79206b6e6f776e206173205044202d2041726368697465637475726529222f3e0d0a3c7873643a656e75 -6d65726174696f6e2076616c75653d22535347202d2053797374656d20495020616e6420436f72655369676874202870726576696f75736c79206b6e6f776e206173205044202d2046616272696329222f3e0d0a3c2f7873643a7265737472696374696f6e3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f78 -73643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d22436f6d6d656e747322206d613a696e6465783d223522206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d22436f6d6d656e747322206d613a696e7465726e616c4e616d653d22436f6d6d656e7473223e0d0a -3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a4e6f7465223e0d0a3c7873643a6d61784c656e6774682076616c75653d22323535222f3e0d0a3c2f7873643a7265737472696374696f6e3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f7873 -643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d22446f6d696e6f5f78303032305f56657273696f6e22206d613a696e6465783d223622206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d22446f6d696e6f2056657273696f6e22206d613a68696464656e3d2274 -72756522206d613a696e7465726e616c4e616d653d22446f6d696e6f5f78303032305f56657273696f6e22206d613a726561644f6e6c793d2266616c7365223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a54657874222f3e0d0a3c2f7873643a -73696d706c65547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d22446f6d696e6f5f78303032305f417574686f7222206d613a696e6465783d223722206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d22446f6d696e6f20417574686f -7222206d613a68696464656e3d227472756522206d613a696e7465726e616c4e616d653d22446f6d696e6f5f78303032305f417574686f7222206d613a726561644f6e6c793d2266616c7365223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a54 -657874222f3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d22446f634e756d62657222206d613a696e6465783d223822206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d22446f634e756d6265 -7222206d613a68696464656e3d227472756522206d613a696e7465726e616c4e616d653d22446f634e756d62657222206d613a726561644f6e6c793d2266616c7365223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a54657874222f3e0d0a3c2f -7873643a73696d706c65547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d224e6f746573554e494422206d613a696e6465783d22313422206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d224e6f746573554e494422206d613a686964 -64656e3d227472756522206d613a696e7465726e616c4e616d653d224e6f746573554e4944223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a54657874222f3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f7873643a656c656d656e -743e0d0a3c7873643a656c656d656e74206e616d653d224e6f74657354696d655374616d7022206d613a696e6465783d22313522206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d224e6f74657354696d655374616d7022206d613a68696464656e3d227472756522206d613a696e746572 -6e616c4e616d653d224e6f74657354696d655374616d70223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a4461746554696d65222f3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a65 -6c656d656e74206e616d653d224e6f7465735061727422206d613a696e6465783d22313622206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d224e6f7465735061727422206d613a68696464656e3d227472756522206d613a696e7465726e616c4e616d653d224e6f74657350617274223e -0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a54657874222f3e0d0a3c2f7873643a73696d706c65547970653e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d22536964655f78303032305f4c65747465 -727322206d613a696e6465783d22313822206e696c6c61626c653d227472756522206d613a646973706c61794e616d653d2253696465204c65747465727322206d613a64656661756c743d223022206d613a68696464656e3d227472756522206d613a696e7465726e616c4e616d653d22536964655f78303032305f4c65 -747465727322206d613a726561644f6e6c793d2266616c736522206d613a70657263656e746167653d2246414c5345223e0d0a3c7873643a73696d706c65547970653e0d0a3c7873643a7265737472696374696f6e20626173653d22646d733a4e756d626572222f3e0d0a3c2f7873643a73696d706c65547970653e0d0a -3c2f7873643a656c656d656e743e0d0a3c2f7873643a736368656d613e0d0a3c7873643a736368656d61207461726765744e616d6573706163653d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f7061636b6167652f323030362f6d657461646174612f636f72652d70726f7065 -72746965732220656c656d656e74466f726d44656661756c743d227175616c69666965642220617474726962757465466f726d44656661756c743d22756e7175616c69666965642220626c6f636b44656661756c743d2223616c6c2220786d6c6e733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d -6174732e6f72672f7061636b6167652f323030362f6d657461646174612f636f72652d70726f706572746965732220786d6c6e733a7873643d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f -584d4c536368656d612d696e7374616e63652220786d6c6e733a64633d22687474703a2f2f7075726c2e6f72672f64632f656c656d656e74732f312e312f2220786d6c6e733a64637465726d733d22687474703a2f2f7075726c2e6f72672f64632f7465726d732f2220786d6c6e733a6f646f633d22687474703a2f2f73 -6368656d61732e6d6963726f736f66742e636f6d2f696e7465726e616c2f6f6264223e0d0a3c7873643a696d706f7274206e616d6573706163653d22687474703a2f2f7075726c2e6f72672f64632f656c656d656e74732f312e312f2220736368656d614c6f636174696f6e3d22687474703a2f2f6475626c696e636f72 -652e6f72672f736368656d61732f786d6c732f7164632f323030332f30342f30322f64632e787364222f3e0d0a3c7873643a696d706f7274206e616d6573706163653d22687474703a2f2f7075726c2e6f72672f64632f7465726d732f2220736368656d614c6f636174696f6e3d22687474703a2f2f6475626c696e636f -72652e6f72672f736368656d61732f786d6c732f7164632f323030332f30342f30322f64637465726d732e787364222f3e0d0a3c7873643a656c656d656e74206e616d653d22636f726550726f706572746965732220747970653d2243545f636f726550726f70657274696573222f3e0d0a3c7873643a636f6d706c6578 -54797065206e616d653d2243545f636f726550726f70657274696573223e0d0a3c7873643a616c6c3e0d0a3c7873643a656c656d656e74207265663d2264633a63726561746f7222206d696e4f63637572733d223022206d61784f63637572733d2231222f3e0d0a3c7873643a656c656d656e74207265663d2264637465 -726d733a6372656174656422206d696e4f63637572733d223022206d61784f63637572733d2231222f3e0d0a3c7873643a656c656d656e74207265663d2264633a6964656e74696669657222206d696e4f63637572733d223022206d61784f63637572733d2231222f3e0d0a3c7873643a656c656d656e74206e616d653d -22636f6e74656e745479706522206d696e4f63637572733d223022206d61784f63637572733d22312220747970653d227873643a737472696e6722206d613a696e6465783d223922206d613a646973706c61794e616d653d22436f6e74656e742054797065222f3e0d0a3c7873643a656c656d656e74207265663d226463 -3a7469746c6522206d696e4f63637572733d223022206d61784f63637572733d223122206d613a696e6465783d223322206d613a646973706c61794e616d653d225469746c65222f3e0d0a3c7873643a656c656d656e74207265663d2264633a7375626a65637422206d696e4f63637572733d223022206d61784f636375 -72733d2231222f3e0d0a3c7873643a656c656d656e74207265663d2264633a6465736372697074696f6e22206d696e4f63637572733d223022206d61784f63637572733d2231222f3e0d0a3c7873643a656c656d656e74206e616d653d226b6579776f72647322206d696e4f63637572733d223022206d61784f63637572 -733d22312220747970653d227873643a737472696e67222f3e0d0a3c7873643a656c656d656e74207265663d2264633a6c616e677561676522206d696e4f63637572733d223022206d61784f63637572733d2231222f3e0d0a3c7873643a656c656d656e74206e616d653d2263617465676f727922206d696e4f63637572 -733d223022206d61784f63637572733d22312220747970653d227873643a737472696e67222f3e0d0a3c7873643a656c656d656e74206e616d653d2276657273696f6e22206d696e4f63637572733d223022206d61784f63637572733d22312220747970653d227873643a737472696e67222f3e0d0a3c7873643a656c65 -6d656e74206e616d653d227265766973696f6e22206d696e4f63637572733d223022206d61784f63637572733d22312220747970653d227873643a737472696e67223e0d0a3c7873643a616e6e6f746174696f6e3e0d0a3c7873643a646f63756d656e746174696f6e3e0d0a202020202020202020202020202020202020 -202020202020546869732076616c756520696e6469636174657320746865206e756d626572206f66207361766573206f72207265766973696f6e732e20546865206170706c69636174696f6e20697320726573706f6e7369626c6520666f72207570646174696e6720746869732076616c75652061667465722065616368 -207265766973696f6e2e0d0a20202020202020202020202020202020202020203c2f7873643a646f63756d656e746174696f6e3e0d0a3c2f7873643a616e6e6f746174696f6e3e0d0a3c2f7873643a656c656d656e743e0d0a3c7873643a656c656d656e74206e616d653d226c6173744d6f646966696564427922206d69 -6e4f63637572733d223022206d61784f63637572733d22312220747970653d227873643a737472696e67222f3e0d0a3c7873643a656c656d656e74207265663d2264637465726d733a6d6f64696669656422206d696e4f63637572733d223022206d61784f63637572733d2231222f3e0d0a3c7873643a656c656d656e74 -206e616d653d22636f6e74656e7453746174757322206d696e4f63637572733d223022206d61784f63637572733d22312220747970653d227873643a737472696e67222f3e0d0a3c2f7873643a616c6c3e0d0a3c2f7873643a636f6d706c6578547970653e0d0a3c2f7873643a736368656d613e0d0a3c78733a73636865 -6d61207461726765744e616d6573706163653d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f696e666f706174682f323030372f506172746e6572436f6e74726f6c732220656c656d656e74466f726d44656661756c743d227175616c696669656422206174747269627574 -65466f726d44656661756c743d22756e7175616c69666965642220786d6c6e733a70633d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f696e666f706174682f323030372f506172746e6572436f6e74726f6c732220786d6c6e733a78733d22687474703a2f2f7777772e77 -332e6f72672f323030312f584d4c536368656d61223e0d0a3c78733a656c656d656e74206e616d653d22506572736f6e223e0d0a3c78733a636f6d706c6578547970653e0d0a3c78733a73657175656e63653e0d0a3c78733a656c656d656e74207265663d2270633a446973706c61794e616d6522206d696e4f63637572 -733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a4163636f756e74496422206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a4163636f756e745479706522206d696e4f63637572733d2230 -223e3c2f78733a656c656d656e743e0d0a3c2f78733a73657175656e63653e0d0a3c2f78733a636f6d706c6578547970653e0d0a3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d22446973706c61794e616d652220747970653d2278733a737472696e67223e3c2f78733a656c656d656e -743e0d0a3c78733a656c656d656e74206e616d653d224163636f756e7449642220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d224163636f756e74547970652220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e -0d0a3c78733a656c656d656e74206e616d653d224244434173736f636961746564456e74697479223e0d0a3c78733a636f6d706c6578547970653e0d0a3c78733a73657175656e63653e0d0a3c78733a656c656d656e74207265663d2270633a424443456e7469747922206d696e4f63637572733d223022206d61784f63 -637572733d22756e626f756e646564223e3c2f78733a656c656d656e743e0d0a3c2f78733a73657175656e63653e0d0a3c78733a617474726962757465207265663d2270633a456e746974794e616d657370616365223e3c2f78733a6174747269627574653e0d0a3c78733a617474726962757465207265663d2270633a -456e746974794e616d65223e3c2f78733a6174747269627574653e0d0a3c78733a617474726962757465207265663d2270633a53797374656d496e7374616e63654e616d65223e3c2f78733a6174747269627574653e0d0a3c78733a617474726962757465207265663d2270633a4173736f63696174696f6e4e616d6522 -3e3c2f78733a6174747269627574653e0d0a3c2f78733a636f6d706c6578547970653e0d0a3c2f78733a656c656d656e743e0d0a3c78733a617474726962757465206e616d653d22456e746974794e616d6573706163652220747970653d2278733a737472696e67223e3c2f78733a6174747269627574653e0d0a3c7873 -3a617474726962757465206e616d653d22456e746974794e616d652220747970653d2278733a737472696e67223e3c2f78733a6174747269627574653e0d0a3c78733a617474726962757465206e616d653d2253797374656d496e7374616e63654e616d652220747970653d2278733a737472696e67223e3c2f78733a61 -74747269627574653e0d0a3c78733a617474726962757465206e616d653d224173736f63696174696f6e4e616d652220747970653d2278733a737472696e67223e3c2f78733a6174747269627574653e0d0a3c78733a656c656d656e74206e616d653d22424443456e74697479223e0d0a3c78733a636f6d706c65785479 -70653e0d0a3c78733a73657175656e63653e0d0a3c78733a656c656d656e74207265663d2270633a456e74697479446973706c61794e616d6522206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a456e74697479496e7374616e636552656665 -72656e636522206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a456e7469747949643122206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a456e7469747949643222 -206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a456e7469747949643322206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a456e7469747949643422206d696e4f63 -637572733d2230223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a456e7469747949643522206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c2f78733a73657175656e63653e0d0a3c2f78733a636f6d706c6578547970653e0d0a3c2f78733a656c -656d656e743e0d0a3c78733a656c656d656e74206e616d653d22456e74697479446973706c61794e616d652220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d22456e74697479496e7374616e63655265666572656e63652220747970653d22 -78733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d22456e746974794964312220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d22456e746974794964322220747970653d2278733a73 -7472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d22456e746974794964332220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d22456e746974794964342220747970653d2278733a737472696e -67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d22456e746974794964352220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d225465726d73223e0d0a3c78733a636f6d706c6578547970653e0d0a3c78 -733a73657175656e63653e0d0a3c78733a656c656d656e74207265663d2270633a5465726d496e666f22206d696e4f63637572733d223022206d61784f63637572733d22756e626f756e646564223e3c2f78733a656c656d656e743e0d0a3c2f78733a73657175656e63653e0d0a3c2f78733a636f6d706c657854797065 -3e0d0a3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d225465726d496e666f223e0d0a3c78733a636f6d706c6578547970653e0d0a3c78733a73657175656e63653e0d0a3c78733a656c656d656e74207265663d2270633a5465726d4e616d6522206d696e4f63637572733d2230223e3c -2f78733a656c656d656e743e0d0a3c78733a656c656d656e74207265663d2270633a5465726d496422206d696e4f63637572733d2230223e3c2f78733a656c656d656e743e0d0a3c2f78733a73657175656e63653e0d0a3c2f78733a636f6d706c6578547970653e0d0a3c2f78733a656c656d656e743e0d0a3c78733a65 -6c656d656e74206e616d653d225465726d4e616d652220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c78733a656c656d656e74206e616d653d225465726d49642220747970653d2278733a737472696e67223e3c2f78733a656c656d656e743e0d0a3c2f78733a736368656d613e0d -0a3c2f63743a636f6e74656e7454797065536368656d613e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006d65746141747472696275746573222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f2f7777772e -77332e6f72672f323030312f584d4c536368656d61222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f6d657461646174612f70726f70657274696573222f3e3c64733a736368656d615265662064733a -7572693d2232656334313736362d353237652d346338342d623438342d646633663235393966643061222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f323030362f646f63756d656e744d616e6167656d656e742f -7479706573222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f6f66666963652f696e666f706174682f323030372f506172746e6572436f6e74726f6c73222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f -2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f7061636b6167652f323030362f6d657461646174612f636f72652d70726f70657274696573222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f2f7075726c2e6f72672f64632f656c656d656e74732f312e312f222f3e3c -64733a736368656d615265662064733a7572693d22687474703a2f2f7075726c2e6f72672f64632f7465726d732f222f3e3c64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6d6963726f736f66742e636f6d2f696e7465726e616c2f6f6264222f3e3c2f64733a736368656d61 -526566733e3c2f64733a6461746173746f72654974656d3e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_ad16c4t.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_ad16c4t.h deleted file mode 100644 index f70a10e35c..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_ad16c4t.h +++ /dev/null @@ -1,683 +0,0 @@ -/** - ************************************************************************************** - * @file reg_AD16C4T.h - * @brief AD16C4T Head File - * - * @version V0.01 - * @date 3/12/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __REG_AD16C4T_H__ -#define __REG_AD16C4T_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for AD16C4T_CON1 register ************************/ - -#define AD16C4T_CON1_DBGSEL_POS 15U -#define AD16C4T_CON1_DBGSEL_MSK BIT(AD16C4T_CON1_DBGSEL_POS) - -#define AD16C4T_CON1_CMPSEL_POSS 11U -#define AD16C4T_CON1_CMPSEL_POSE 13U -#define AD16C4T_CON1_CMPSEL_MSK BITS(AD16C4T_CON1_CMPSEL_POSS,AD16C4T_CON1_CMPSEL_POSE) - -#define AD16C4T_CON1_CMPSELP_POS 10U -#define AD16C4T_CON1_CMPSELP_MSK BIT(AD16C4T_CON1_CMPSELP_POS) - -#define AD16C4T_CON1_DFCKSEL_POSS 8U -#define AD16C4T_CON1_DFCKSEL_POSE 9U -#define AD16C4T_CON1_DFCKSEL_MSK BITS(AD16C4T_CON1_DFCKSEL_POSS,AD16C4T_CON1_DFCKSEL_POSE) - -#define AD16C4T_CON1_ARPEN_POS 7U -#define AD16C4T_CON1_ARPEN_MSK BIT(AD16C4T_CON1_ARPEN_POS) - -#define AD16C4T_CON1_CMSEL_POSS 5U -#define AD16C4T_CON1_CMSEL_POSE 6U -#define AD16C4T_CON1_CMSEL_MSK BITS(AD16C4T_CON1_CMSEL_POSS,AD16C4T_CON1_CMSEL_POSE) - -#define AD16C4T_CON1_DIRSEL_POS 4U -#define AD16C4T_CON1_DIRSEL_MSK BIT(AD16C4T_CON1_DIRSEL_POS) - -#define AD16C4T_CON1_SPMEN_POS 3U -#define AD16C4T_CON1_SPMEN_MSK BIT(AD16C4T_CON1_SPMEN_POS) - -#define AD16C4T_CON1_UERSEL_POS 2U -#define AD16C4T_CON1_UERSEL_MSK BIT(AD16C4T_CON1_UERSEL_POS) - -#define AD16C4T_CON1_DISUE_POS 1U -#define AD16C4T_CON1_DISUE_MSK BIT(AD16C4T_CON1_DISUE_POS) - -#define AD16C4T_CON1_CNTEN_POS 0U -#define AD16C4T_CON1_CNTEN_MSK BIT(AD16C4T_CON1_CNTEN_POS) - -/****************** Bit definition for AD16C4T_CON2 register ************************/ - -#define AD16C4T_CON2_OISS4_POS 14U -#define AD16C4T_CON2_OISS4_MSK BIT(AD16C4T_CON2_OISS4_POS) - -#define AD16C4T_CON2_OISS3N_POS 13U -#define AD16C4T_CON2_OISS3N_MSK BIT(AD16C4T_CON2_OISS3N_POS) - -#define AD16C4T_CON2_OISS3_POS 12U -#define AD16C4T_CON2_OISS3_MSK BIT(AD16C4T_CON2_OISS3_POS) - -#define AD16C4T_CON2_OISS2N_POS 11U -#define AD16C4T_CON2_OISS2N_MSK BIT(AD16C4T_CON2_OISS2N_POS) - -#define AD16C4T_CON2_OISS2_POS 10U -#define AD16C4T_CON2_OISS2_MSK BIT(AD16C4T_CON2_OISS2_POS) - -#define AD16C4T_CON2_OISS1N_POS 9U -#define AD16C4T_CON2_OISS1N_MSK BIT(AD16C4T_CON2_OISS1N_POS) - -#define AD16C4T_CON2_OISS1_POS 8U -#define AD16C4T_CON2_OISS1_MSK BIT(AD16C4T_CON2_OISS1_POS) - -#define AD16C4T_CON2_I1SEL_POS 7U -#define AD16C4T_CON2_I1SEL_MSK BIT(AD16C4T_CON2_I1SEL_POS) - -#define AD16C4T_CON2_MMSEL_POSS 4U -#define AD16C4T_CON2_MMSEL_POSE 6U -#define AD16C4T_CON2_MMSEL_MSK BITS(AD16C4T_CON2_MMSEL_POSS,AD16C4T_CON2_MMSEL_POSE) - -#define AD16C4T_CON2_CCDMASEL_POS 3U -#define AD16C4T_CON2_CCDMASEL_MSK BIT(AD16C4T_CON2_CCDMASEL_POS) - -#define AD16C4T_CON2_CCUSEL_POS 2U -#define AD16C4T_CON2_CCUSEL_MSK BIT(AD16C4T_CON2_CCUSEL_POS) - -#define AD16C4T_CON2_CCPCEN_POS 0U -#define AD16C4T_CON2_CCPCEN_MSK BIT(AD16C4T_CON2_CCPCEN_POS) - -/****************** Bit definition for AD16C4T_SMCON register ************************/ - -#define AD16C4T_SMCON_ETPOL_POS 15U -#define AD16C4T_SMCON_ETPOL_MSK BIT(AD16C4T_SMCON_ETPOL_POS) - -#define AD16C4T_SMCON_ECM2EN_POS 14U -#define AD16C4T_SMCON_ECM2EN_MSK BIT(AD16C4T_SMCON_ECM2EN_POS) - -#define AD16C4T_SMCON_ETFLT_POSS 8U -#define AD16C4T_SMCON_ETFLT_POSE 11U -#define AD16C4T_SMCON_ETFLT_MSK BITS(AD16C4T_SMCON_ETFLT_POSS,AD16C4T_SMCON_ETFLT_POSE) - -#define AD16C4T_SMCON_MSCFG_POS 7U -#define AD16C4T_SMCON_MSCFG_MSK BIT(AD16C4T_SMCON_MSCFG_POS) - -#define AD16C4T_SMCON_TSSEL_POSS 4U -#define AD16C4T_SMCON_TSSEL_POSE 6U -#define AD16C4T_SMCON_TSSEL_MSK BITS(AD16C4T_SMCON_TSSEL_POSS,AD16C4T_SMCON_TSSEL_POSE) - -#define AD16C4T_SMCON_CHCSEL_POS 3U -#define AD16C4T_SMCON_CHCSEL_MSK BIT(AD16C4T_SMCON_CHCSEL_POS) - -#define AD16C4T_SMCON_SMODS_POSS 0U -#define AD16C4T_SMCON_SMODS_POSE 2U -#define AD16C4T_SMCON_SMODS_MSK BITS(AD16C4T_SMCON_SMODS_POSS,AD16C4T_SMCON_SMODS_POSE) - -/****************** Bit definition for AD16C4T_IER register ************************/ - -#define AD16C4T_IER_CH4OVI_POS 12U -#define AD16C4T_IER_CH4OVI_MSK BIT(AD16C4T_IER_CH4OVI_POS) - -#define AD16C4T_IER_CH3OVI_POS 11U -#define AD16C4T_IER_CH3OVI_MSK BIT(AD16C4T_IER_CH3OVI_POS) - -#define AD16C4T_IER_CH2OVI_POS 10U -#define AD16C4T_IER_CH2OVI_MSK BIT(AD16C4T_IER_CH2OVI_POS) - -#define AD16C4T_IER_CH1OVI_POS 9U -#define AD16C4T_IER_CH1OVI_MSK BIT(AD16C4T_IER_CH1OVI_POS) - -#define AD16C4T_IER_BRKI_POS 7U -#define AD16C4T_IER_BRKI_MSK BIT(AD16C4T_IER_BRKI_POS) - -#define AD16C4T_IER_TRGI_POS 6U -#define AD16C4T_IER_TRGI_MSK BIT(AD16C4T_IER_TRGI_POS) - -#define AD16C4T_IER_COMI_POS 5U -#define AD16C4T_IER_COMI_MSK BIT(AD16C4T_IER_COMI_POS) - -#define AD16C4T_IER_CH4I_POS 4U -#define AD16C4T_IER_CH4I_MSK BIT(AD16C4T_IER_CH4I_POS) - -#define AD16C4T_IER_CH3I_POS 3U -#define AD16C4T_IER_CH3I_MSK BIT(AD16C4T_IER_CH3I_POS) - -#define AD16C4T_IER_CH2I_POS 2U -#define AD16C4T_IER_CH2I_MSK BIT(AD16C4T_IER_CH2I_POS) - -#define AD16C4T_IER_CH1I_POS 1U -#define AD16C4T_IER_CH1I_MSK BIT(AD16C4T_IER_CH1I_POS) - -#define AD16C4T_IER_UI_POS 0U -#define AD16C4T_IER_UI_MSK BIT(AD16C4T_IER_UI_POS) - -/****************** Bit definition for AD16C4T_IDR register ************************/ - -#define AD16C4T_IDR_CH4OVI_POS 12U -#define AD16C4T_IDR_CH4OVI_MSK BIT(AD16C4T_IDR_CH4OVI_POS) - -#define AD16C4T_IDR_CH3OVI_POS 11U -#define AD16C4T_IDR_CH3OVI_MSK BIT(AD16C4T_IDR_CH3OVI_POS) - -#define AD16C4T_IDR_CH2OVI_POS 10U -#define AD16C4T_IDR_CH2OVI_MSK BIT(AD16C4T_IDR_CH2OVI_POS) - -#define AD16C4T_IDR_CH1OVI_POS 9U -#define AD16C4T_IDR_CH1OVI_MSK BIT(AD16C4T_IDR_CH1OVI_POS) - -#define AD16C4T_IDR_BRKI_POS 7U -#define AD16C4T_IDR_BRKI_MSK BIT(AD16C4T_IDR_BRKI_POS) - -#define AD16C4T_IDR_TRGI_POS 6U -#define AD16C4T_IDR_TRGI_MSK BIT(AD16C4T_IDR_TRGI_POS) - -#define AD16C4T_IDR_COMI_POS 5U -#define AD16C4T_IDR_COMI_MSK BIT(AD16C4T_IDR_COMI_POS) - -#define AD16C4T_IDR_CH4I_POS 4U -#define AD16C4T_IDR_CH4I_MSK BIT(AD16C4T_IDR_CH4I_POS) - -#define AD16C4T_IDR_CH3I_POS 3U -#define AD16C4T_IDR_CH3I_MSK BIT(AD16C4T_IDR_CH3I_POS) - -#define AD16C4T_IDR_CH2I_POS 2U -#define AD16C4T_IDR_CH2I_MSK BIT(AD16C4T_IDR_CH2I_POS) - -#define AD16C4T_IDR_CH1I_POS 1U -#define AD16C4T_IDR_CH1I_MSK BIT(AD16C4T_IDR_CH1I_POS) - -#define AD16C4T_IDR_UI_POS 0U -#define AD16C4T_IDR_UI_MSK BIT(AD16C4T_IDR_UI_POS) - -/****************** Bit definition for AD16C4T_IVS register ************************/ - -#define AD16C4T_IVS_CH4OVI_POS 12U -#define AD16C4T_IVS_CH4OVI_MSK BIT(AD16C4T_IVS_CH4OVI_POS) - -#define AD16C4T_IVS_CH3OVI_POS 11U -#define AD16C4T_IVS_CH3OVI_MSK BIT(AD16C4T_IVS_CH3OVI_POS) - -#define AD16C4T_IVS_CH2OVI_POS 10U -#define AD16C4T_IVS_CH2OVI_MSK BIT(AD16C4T_IVS_CH2OVI_POS) - -#define AD16C4T_IVS_CH1OVI_POS 9U -#define AD16C4T_IVS_CH1OVI_MSK BIT(AD16C4T_IVS_CH1OVI_POS) - -#define AD16C4T_IVS_BRKI_POS 7U -#define AD16C4T_IVS_BRKI_MSK BIT(AD16C4T_IVS_BRKI_POS) - -#define AD16C4T_IVS_TRGI_POS 6U -#define AD16C4T_IVS_TRGI_MSK BIT(AD16C4T_IVS_TRGI_POS) - -#define AD16C4T_IVS_COMI_POS 5U -#define AD16C4T_IVS_COMI_MSK BIT(AD16C4T_IVS_COMI_POS) - -#define AD16C4T_IVS_CH4I_POS 4U -#define AD16C4T_IVS_CH4I_MSK BIT(AD16C4T_IVS_CH4I_POS) - -#define AD16C4T_IVS_CH3I_POS 3U -#define AD16C4T_IVS_CH3I_MSK BIT(AD16C4T_IVS_CH3I_POS) - -#define AD16C4T_IVS_CH2I_POS 2U -#define AD16C4T_IVS_CH2I_MSK BIT(AD16C4T_IVS_CH2I_POS) - -#define AD16C4T_IVS_CH1I_POS 1U -#define AD16C4T_IVS_CH1I_MSK BIT(AD16C4T_IVS_CH1I_POS) - -#define AD16C4T_IVS_UI_POS 0U -#define AD16C4T_IVS_UI_MSK BIT(AD16C4T_IVS_UI_POS) - -/****************** Bit definition for AD16C4T_RIF register ************************/ - -#define AD16C4T_RIF_CH4OVI_POS 12U -#define AD16C4T_RIF_CH4OVI_MSK BIT(AD16C4T_RIF_CH4OVI_POS) - -#define AD16C4T_RIF_CH3OVI_POS 11U -#define AD16C4T_RIF_CH3OVI_MSK BIT(AD16C4T_RIF_CH3OVI_POS) - -#define AD16C4T_RIF_CH2OVI_POS 10U -#define AD16C4T_RIF_CH2OVI_MSK BIT(AD16C4T_RIF_CH2OVI_POS) - -#define AD16C4T_RIF_CH1OVI_POS 9U -#define AD16C4T_RIF_CH1OVI_MSK BIT(AD16C4T_RIF_CH1OVI_POS) - -#define AD16C4T_RIF_BRKI_POS 7U -#define AD16C4T_RIF_BRKI_MSK BIT(AD16C4T_RIF_BRKI_POS) - -#define AD16C4T_RIF_TRGI_POS 6U -#define AD16C4T_RIF_TRGI_MSK BIT(AD16C4T_RIF_TRGI_POS) - -#define AD16C4T_RIF_COMI_POS 5U -#define AD16C4T_RIF_COMI_MSK BIT(AD16C4T_RIF_COMI_POS) - -#define AD16C4T_RIF_CH4I_POS 4U -#define AD16C4T_RIF_CH4I_MSK BIT(AD16C4T_RIF_CH4I_POS) - -#define AD16C4T_RIF_CH3I_POS 3U -#define AD16C4T_RIF_CH3I_MSK BIT(AD16C4T_RIF_CH3I_POS) - -#define AD16C4T_RIF_CH2I_POS 2U -#define AD16C4T_RIF_CH2I_MSK BIT(AD16C4T_RIF_CH2I_POS) - -#define AD16C4T_RIF_CH1I_POS 1U -#define AD16C4T_RIF_CH1I_MSK BIT(AD16C4T_RIF_CH1I_POS) - -#define AD16C4T_RIF_UI_POS 0U -#define AD16C4T_RIF_UI_MSK BIT(AD16C4T_RIF_UI_POS) - -/****************** Bit definition for AD16C4T_IFM register ************************/ - -#define AD16C4T_IFM_CH4OVI_POS 12U -#define AD16C4T_IFM_CH4OVI_MSK BIT(AD16C4T_IFM_CH4OVI_POS) - -#define AD16C4T_IFM_CH3OVI_POS 11U -#define AD16C4T_IFM_CH3OVI_MSK BIT(AD16C4T_IFM_CH3OVI_POS) - -#define AD16C4T_IFM_CH2OVI_POS 10U -#define AD16C4T_IFM_CH2OVI_MSK BIT(AD16C4T_IFM_CH2OVI_POS) - -#define AD16C4T_IFM_CH1OVI_POS 9U -#define AD16C4T_IFM_CH1OVI_MSK BIT(AD16C4T_IFM_CH1OVI_POS) - -#define AD16C4T_IFM_BRKI_POS 7U -#define AD16C4T_IFM_BRKI_MSK BIT(AD16C4T_IFM_BRKI_POS) - -#define AD16C4T_IFM_TRGI_POS 6U -#define AD16C4T_IFM_TRGI_MSK BIT(AD16C4T_IFM_TRGI_POS) - -#define AD16C4T_IFM_COMI_POS 5U -#define AD16C4T_IFM_COMI_MSK BIT(AD16C4T_IFM_COMI_POS) - -#define AD16C4T_IFM_CH4I_POS 4U -#define AD16C4T_IFM_CH4I_MSK BIT(AD16C4T_IFM_CH4I_POS) - -#define AD16C4T_IFM_CH3I_POS 3U -#define AD16C4T_IFM_CH3I_MSK BIT(AD16C4T_IFM_CH3I_POS) - -#define AD16C4T_IFM_CH2I_POS 2U -#define AD16C4T_IFM_CH2I_MSK BIT(AD16C4T_IFM_CH2I_POS) - -#define AD16C4T_IFM_CH1I_POS 1U -#define AD16C4T_IFM_CH1I_MSK BIT(AD16C4T_IFM_CH1I_POS) - -#define AD16C4T_IFM_UI_POS 0U -#define AD16C4T_IFM_UI_MSK BIT(AD16C4T_IFM_UI_POS) - -/****************** Bit definition for AD16C4T_ICR register ************************/ - -#define AD16C4T_ICR_CH4OVI_POS 12U -#define AD16C4T_ICR_CH4OVI_MSK BIT(AD16C4T_ICR_CH4OVI_POS) - -#define AD16C4T_ICR_CH3OVI_POS 11U -#define AD16C4T_ICR_CH3OVI_MSK BIT(AD16C4T_ICR_CH3OVI_POS) - -#define AD16C4T_ICR_CH2OVI_POS 10U -#define AD16C4T_ICR_CH2OVI_MSK BIT(AD16C4T_ICR_CH2OVI_POS) - -#define AD16C4T_ICR_CH1OVI_POS 9U -#define AD16C4T_ICR_CH1OVI_MSK BIT(AD16C4T_ICR_CH1OVI_POS) - -#define AD16C4T_ICR_BRKI_POS 7U -#define AD16C4T_ICR_BRKI_MSK BIT(AD16C4T_ICR_BRKI_POS) - -#define AD16C4T_ICR_TRGI_POS 6U -#define AD16C4T_ICR_TRGI_MSK BIT(AD16C4T_ICR_TRGI_POS) - -#define AD16C4T_ICR_COMI_POS 5U -#define AD16C4T_ICR_COMI_MSK BIT(AD16C4T_ICR_COMI_POS) - -#define AD16C4T_ICR_CH4I_POS 4U -#define AD16C4T_ICR_CH4I_MSK BIT(AD16C4T_ICR_CH4I_POS) - -#define AD16C4T_ICR_CH3I_POS 3U -#define AD16C4T_ICR_CH3I_MSK BIT(AD16C4T_ICR_CH3I_POS) - -#define AD16C4T_ICR_CH2I_POS 2U -#define AD16C4T_ICR_CH2I_MSK BIT(AD16C4T_ICR_CH2I_POS) - -#define AD16C4T_ICR_CH1I_POS 1U -#define AD16C4T_ICR_CH1I_MSK BIT(AD16C4T_ICR_CH1I_POS) - -#define AD16C4T_ICR_UI_POS 0U -#define AD16C4T_ICR_UI_MSK BIT(AD16C4T_ICR_UI_POS) - -/****************** Bit definition for AD16C4T_SGE register ************************/ - -#define AD16C4T_SGE_SGBRK_POS 7U -#define AD16C4T_SGE_SGBRK_MSK BIT(AD16C4T_SGE_SGBRK_POS) - -#define AD16C4T_SGE_SGTRG_POS 6U -#define AD16C4T_SGE_SGTRG_MSK BIT(AD16C4T_SGE_SGTRG_POS) - -#define AD16C4T_SGE_SGCOM_POS 5U -#define AD16C4T_SGE_SGCOM_MSK BIT(AD16C4T_SGE_SGCOM_POS) - -#define AD16C4T_SGE_SGCH4_POS 4U -#define AD16C4T_SGE_SGCH4_MSK BIT(AD16C4T_SGE_SGCH4_POS) - -#define AD16C4T_SGE_SGCH3_POS 3U -#define AD16C4T_SGE_SGCH3_MSK BIT(AD16C4T_SGE_SGCH3_POS) - -#define AD16C4T_SGE_SGCH2_POS 2U -#define AD16C4T_SGE_SGCH2_MSK BIT(AD16C4T_SGE_SGCH2_POS) - -#define AD16C4T_SGE_SGCH1_POS 1U -#define AD16C4T_SGE_SGCH1_MSK BIT(AD16C4T_SGE_SGCH1_POS) - -#define AD16C4T_SGE_SGU_POS 0U -#define AD16C4T_SGE_SGU_MSK BIT(AD16C4T_SGE_SGU_POS) - -/****************** Bit definition for AD16C4T_CHMR1_OUTPUT register ************************/ - -#define AD16C4T_CHMR1_OUTPUT_CH2OCLREN_POS 15U -#define AD16C4T_CHMR1_OUTPUT_CH2OCLREN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH2OCLREN_POS) - -#define AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS 12U -#define AD16C4T_CHMR1_OUTPUT_CH2MOD_POSE 14U -#define AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK BITS(AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS,AD16C4T_CHMR1_OUTPUT_CH2MOD_POSE) - -#define AD16C4T_CHMR1_OUTPUT_CH2PEN_POS 11U -#define AD16C4T_CHMR1_OUTPUT_CH2PEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH2PEN_POS) - -#define AD16C4T_CHMR1_OUTPUT_CH2FEN_POS 10U -#define AD16C4T_CHMR1_OUTPUT_CH2FEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH2FEN_POS) - -#define AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSS 8U -#define AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSE 9U -#define AD16C4T_CHMR1_OUTPUT_CC2SSEL_MSK BITS(AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSS,AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSE) - -#define AD16C4T_CHMR1_OUTPUT_CH1OCLREN_POS 7U -#define AD16C4T_CHMR1_OUTPUT_CH1OCLREN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH1OCLREN_POS) - -#define AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS 4U -#define AD16C4T_CHMR1_OUTPUT_CH1MOD_POSE 6U -#define AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK BITS(AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS,AD16C4T_CHMR1_OUTPUT_CH1MOD_POSE) - -#define AD16C4T_CHMR1_OUTPUT_CH1PEN_POS 3U -#define AD16C4T_CHMR1_OUTPUT_CH1PEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH1PEN_POS) - -#define AD16C4T_CHMR1_OUTPUT_CH1FEN_POS 2U -#define AD16C4T_CHMR1_OUTPUT_CH1FEN_MSK BIT(AD16C4T_CHMR1_OUTPUT_CH1FEN_POS) - -#define AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSS 0U -#define AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSE 1U -#define AD16C4T_CHMR1_OUTPUT_CC1SSEL_MSK BITS(AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSS,AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSE) - -/****************** Bit definition for AD16C4T_CHMR1_INPUT register ************************/ - -#define AD16C4T_CHMR1_INPUT_I2FLT_POSS 12U -#define AD16C4T_CHMR1_INPUT_I2FLT_POSE 15U -#define AD16C4T_CHMR1_INPUT_I2FLT_MSK BITS(AD16C4T_CHMR1_INPUT_I2FLT_POSS,AD16C4T_CHMR1_INPUT_I2FLT_POSE) - -#define AD16C4T_CHMR1_INPUT_I2PRES_POSS 10U -#define AD16C4T_CHMR1_INPUT_I2PRES_POSE 11U -#define AD16C4T_CHMR1_INPUT_I2PRES_MSK BITS(AD16C4T_CHMR1_INPUT_I2PRES_POSS,AD16C4T_CHMR1_INPUT_I2PRES_POSE) - -#define AD16C4T_CHMR1_INPUT_CC2SSEL_POSS 8U -#define AD16C4T_CHMR1_INPUT_CC2SSEL_POSE 9U -#define AD16C4T_CHMR1_INPUT_CC2SSEL_MSK BITS(AD16C4T_CHMR1_INPUT_CC2SSEL_POSS,AD16C4T_CHMR1_INPUT_CC2SSEL_POSE) - -#define AD16C4T_CHMR1_INPUT_I1FLT_POSS 4U -#define AD16C4T_CHMR1_INPUT_I1FLT_POSE 7U -#define AD16C4T_CHMR1_INPUT_I1FLT_MSK BITS(AD16C4T_CHMR1_INPUT_I1FLT_POSS,AD16C4T_CHMR1_INPUT_I1FLT_POSE) - -#define AD16C4T_CHMR1_INPUT_I1PRES_POSS 2U -#define AD16C4T_CHMR1_INPUT_I1PRES_POSE 3U -#define AD16C4T_CHMR1_INPUT_I1PRES_MSK BITS(AD16C4T_CHMR1_INPUT_I1PRES_POSS,AD16C4T_CHMR1_INPUT_I1PRES_POSE) - -#define AD16C4T_CHMR1_INPUT_CC1SSEL_POSS 0U -#define AD16C4T_CHMR1_INPUT_CC1SSEL_POSE 1U -#define AD16C4T_CHMR1_INPUT_CC1SSEL_MSK BITS(AD16C4T_CHMR1_INPUT_CC1SSEL_POSS,AD16C4T_CHMR1_INPUT_CC1SSEL_POSE) - -/****************** Bit definition for AD16C4T_CHMR2_OUTPUT register ************************/ - -#define AD16C4T_CHMR2_OUTPUT_CH4OCLREN_POS 15U -#define AD16C4T_CHMR2_OUTPUT_CH4OCLREN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH4OCLREN_POS) - -#define AD16C4T_CHMR2_OUTPUT_CH4MOD_POSS 12U -#define AD16C4T_CHMR2_OUTPUT_CH4MOD_POSE 14U -#define AD16C4T_CHMR2_OUTPUT_CH4MOD_MSK BITS(AD16C4T_CHMR2_OUTPUT_CH4MOD_POSS,AD16C4T_CHMR2_OUTPUT_CH4MOD_POSE) - -#define AD16C4T_CHMR2_OUTPUT_CH4PEN_POS 11U -#define AD16C4T_CHMR2_OUTPUT_CH4PEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH4PEN_POS) - -#define AD16C4T_CHMR2_OUTPUT_CH4FEN_POS 10U -#define AD16C4T_CHMR2_OUTPUT_CH4FEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH4FEN_POS) - -#define AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSS 8U -#define AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSE 9U -#define AD16C4T_CHMR2_OUTPUT_CC4SSEL_MSK BITS(AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSS,AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSE) - -#define AD16C4T_CHMR2_OUTPUT_CH3OCLREN_POS 7U -#define AD16C4T_CHMR2_OUTPUT_CH3OCLREN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH3OCLREN_POS) - -#define AD16C4T_CHMR2_OUTPUT_CH3MOD_POSS 4U -#define AD16C4T_CHMR2_OUTPUT_CH3MOD_POSE 6U -#define AD16C4T_CHMR2_OUTPUT_CH3MOD_MSK BITS(AD16C4T_CHMR2_OUTPUT_CH3MOD_POSS,AD16C4T_CHMR2_OUTPUT_CH3MOD_POSE) - -#define AD16C4T_CHMR2_OUTPUT_CH3PEN_POS 3U -#define AD16C4T_CHMR2_OUTPUT_CH3PEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH3PEN_POS) - -#define AD16C4T_CHMR2_OUTPUT_CH3FEN_POS 2U -#define AD16C4T_CHMR2_OUTPUT_CH3FEN_MSK BIT(AD16C4T_CHMR2_OUTPUT_CH3FEN_POS) - -#define AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSS 0U -#define AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSE 1U -#define AD16C4T_CHMR2_OUTPUT_CC3SSEL_MSK BITS(AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSS,AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSE) - -/****************** Bit definition for AD16C4T_CHMR2_INPUT register ************************/ - -#define AD16C4T_CHMR2_INPUT_I4FLT_POSS 12U -#define AD16C4T_CHMR2_INPUT_I4FLT_POSE 15U -#define AD16C4T_CHMR2_INPUT_I4FLT_MSK BITS(AD16C4T_CHMR2_INPUT_I4FLT_POSS,AD16C4T_CHMR2_INPUT_I4FLT_POSE) - -#define AD16C4T_CHMR2_INPUT_I4PRES_POSS 10U -#define AD16C4T_CHMR2_INPUT_I4PRES_POSE 11U -#define AD16C4T_CHMR2_INPUT_I4PRES_MSK BITS(AD16C4T_CHMR2_INPUT_I4PRES_POSS,AD16C4T_CHMR2_INPUT_I4PRES_POSE) - -#define AD16C4T_CHMR2_INPUT_CC4SSEL_POSS 8U -#define AD16C4T_CHMR2_INPUT_CC4SSEL_POSE 9U -#define AD16C4T_CHMR2_INPUT_CC4SSEL_MSK BITS(AD16C4T_CHMR2_INPUT_CC4SSEL_POSS,AD16C4T_CHMR2_INPUT_CC4SSEL_POSE) - -#define AD16C4T_CHMR2_INPUT_I3FLT_POSS 4U -#define AD16C4T_CHMR2_INPUT_I3FLT_POSE 7U -#define AD16C4T_CHMR2_INPUT_I3FLT_MSK BITS(AD16C4T_CHMR2_INPUT_I3FLT_POSS,AD16C4T_CHMR2_INPUT_I3FLT_POSE) - -#define AD16C4T_CHMR2_INPUT_I3PRES_POSS 2U -#define AD16C4T_CHMR2_INPUT_I3PRES_POSE 3U -#define AD16C4T_CHMR2_INPUT_I3PRES_MSK BITS(AD16C4T_CHMR2_INPUT_I3PRES_POSS,AD16C4T_CHMR2_INPUT_I3PRES_POSE) - -#define AD16C4T_CHMR2_INPUT_CC3SSEL_POSS 0U -#define AD16C4T_CHMR2_INPUT_CC3SSEL_POSE 1U -#define AD16C4T_CHMR2_INPUT_CC3SSEL_MSK BITS(AD16C4T_CHMR2_INPUT_CC3SSEL_POSS,AD16C4T_CHMR2_INPUT_CC3SSEL_POSE) - -/****************** Bit definition for AD16C4T_CCEP register ************************/ - -#define AD16C4T_CCEP_CC4NPOL_POS 15U -#define AD16C4T_CCEP_CC4NPOL_MSK BIT(AD16C4T_CCEP_CC4NPOL_POS) - -#define AD16C4T_CCEP_CC4POL_POS 13U -#define AD16C4T_CCEP_CC4POL_MSK BIT(AD16C4T_CCEP_CC4POL_POS) - -#define AD16C4T_CCEP_CC4EN_POS 12U -#define AD16C4T_CCEP_CC4EN_MSK BIT(AD16C4T_CCEP_CC4EN_POS) - -#define AD16C4T_CCEP_CC3NPOL_POS 11U -#define AD16C4T_CCEP_CC3NPOL_MSK BIT(AD16C4T_CCEP_CC3NPOL_POS) - -#define AD16C4T_CCEP_CC3NEN_POS 10U -#define AD16C4T_CCEP_CC3NEN_MSK BIT(AD16C4T_CCEP_CC3NEN_POS) - -#define AD16C4T_CCEP_CC3POL_POS 9U -#define AD16C4T_CCEP_CC3POL_MSK BIT(AD16C4T_CCEP_CC3POL_POS) - -#define AD16C4T_CCEP_CC3EN_POS 8U -#define AD16C4T_CCEP_CC3EN_MSK BIT(AD16C4T_CCEP_CC3EN_POS) - -#define AD16C4T_CCEP_CC2NPOL_POS 7U -#define AD16C4T_CCEP_CC2NPOL_MSK BIT(AD16C4T_CCEP_CC2NPOL_POS) - -#define AD16C4T_CCEP_CC2NEN_POS 6U -#define AD16C4T_CCEP_CC2NEN_MSK BIT(AD16C4T_CCEP_CC2NEN_POS) - -#define AD16C4T_CCEP_CC2POL_POS 5U -#define AD16C4T_CCEP_CC2POL_MSK BIT(AD16C4T_CCEP_CC2POL_POS) - -#define AD16C4T_CCEP_CC2EN_POS 4U -#define AD16C4T_CCEP_CC2EN_MSK BIT(AD16C4T_CCEP_CC2EN_POS) - -#define AD16C4T_CCEP_CC1NPOL_POS 3U -#define AD16C4T_CCEP_CC1NPOL_MSK BIT(AD16C4T_CCEP_CC1NPOL_POS) - -#define AD16C4T_CCEP_CC1NEN_POS 2U -#define AD16C4T_CCEP_CC1NEN_MSK BIT(AD16C4T_CCEP_CC1NEN_POS) - -#define AD16C4T_CCEP_CC1POL_POS 1U -#define AD16C4T_CCEP_CC1POL_MSK BIT(AD16C4T_CCEP_CC1POL_POS) - -#define AD16C4T_CCEP_CC1EN_POS 0U -#define AD16C4T_CCEP_CC1EN_MSK BIT(AD16C4T_CCEP_CC1EN_POS) - -/****************** Bit definition for AD16C4T_COUNT register ************************/ - -#define AD16C4T_COUNT_CNTV_POSS 0U -#define AD16C4T_COUNT_CNTV_POSE 15U -#define AD16C4T_COUNT_CNTV_MSK BITS(AD16C4T_COUNT_CNTV_POSS,AD16C4T_COUNT_CNTV_POSE) - -/****************** Bit definition for AD16C4T_PRES register ************************/ - -#define AD16C4T_PRES_PSCV_POSS 0U -#define AD16C4T_PRES_PSCV_POSE 15U -#define AD16C4T_PRES_PSCV_MSK BITS(AD16C4T_PRES_PSCV_POSS,AD16C4T_PRES_PSCV_POSE) - -/****************** Bit definition for AD16C4T_AR register ************************/ - -#define AD16C4T_AR_ARV_POSS 0U -#define AD16C4T_AR_ARV_POSE 15U -#define AD16C4T_AR_ARV_MSK BITS(AD16C4T_AR_ARV_POSS,AD16C4T_AR_ARV_POSE) - -/****************** Bit definition for AD16C4T_REPAR register ************************/ - -#define AD16C4T_REPAR_REPV_POSS 0U -#define AD16C4T_REPAR_REPV_POSE 7U -#define AD16C4T_REPAR_REPV_MSK BITS(AD16C4T_REPAR_REPV_POSS,AD16C4T_REPAR_REPV_POSE) - -/****************** Bit definition for AD16C4T_CCVAL1 register ************************/ - -#define AD16C4T_CCVAL1_CCRV1_POSS 0U -#define AD16C4T_CCVAL1_CCRV1_POSE 15U -#define AD16C4T_CCVAL1_CCRV1_MSK BITS(AD16C4T_CCVAL1_CCRV1_POSS,AD16C4T_CCVAL1_CCRV1_POSE) - -/****************** Bit definition for AD16C4T_CCVAL2 register ************************/ - -#define AD16C4T_CCVAL2_CCRV2_POSS 0U -#define AD16C4T_CCVAL2_CCRV2_POSE 15U -#define AD16C4T_CCVAL2_CCRV2_MSK BITS(AD16C4T_CCVAL2_CCRV2_POSS,AD16C4T_CCVAL2_CCRV2_POSE) - -/****************** Bit definition for AD16C4T_CCVAL3 register ************************/ - -#define AD16C4T_CCVAL3_CCRV3_POSS 0U -#define AD16C4T_CCVAL3_CCRV3_POSE 15U -#define AD16C4T_CCVAL3_CCRV3_MSK BITS(AD16C4T_CCVAL3_CCRV3_POSS,AD16C4T_CCVAL3_CCRV3_POSE) - -/****************** Bit definition for AD16C4T_CCVAL4 register ************************/ - -#define AD16C4T_CCVAL4_CCRV4_POSS 0U -#define AD16C4T_CCVAL4_CCRV4_POSE 15U -#define AD16C4T_CCVAL4_CCRV4_MSK BITS(AD16C4T_CCVAL4_CCRV4_POSS,AD16C4T_CCVAL4_CCRV4_POSE) - -/****************** Bit definition for AD16C4T_BDCFG register ************************/ - -#define AD16C4T_BDCFG_GOEN_POS 15U -#define AD16C4T_BDCFG_GOEN_MSK BIT(AD16C4T_BDCFG_GOEN_POS) - -#define AD16C4T_BDCFG_AOEN_POS 14U -#define AD16C4T_BDCFG_AOEN_MSK BIT(AD16C4T_BDCFG_AOEN_POS) - -#define AD16C4T_BDCFG_BRKP_POS 13U -#define AD16C4T_BDCFG_BRKP_MSK BIT(AD16C4T_BDCFG_BRKP_POS) - -#define AD16C4T_BDCFG_BRKEN_POS 12U -#define AD16C4T_BDCFG_BRKEN_MSK BIT(AD16C4T_BDCFG_BRKEN_POS) - -#define AD16C4T_BDCFG_OFFSSR_POS 11U -#define AD16C4T_BDCFG_OFFSSR_MSK BIT(AD16C4T_BDCFG_OFFSSR_POS) - -#define AD16C4T_BDCFG_OFFSSI_POS 10U -#define AD16C4T_BDCFG_OFFSSI_MSK BIT(AD16C4T_BDCFG_OFFSSI_POS) - -#define AD16C4T_BDCFG_LOCKLVL_POSS 8U -#define AD16C4T_BDCFG_LOCKLVL_POSE 9U -#define AD16C4T_BDCFG_LOCKLVL_MSK BITS(AD16C4T_BDCFG_LOCKLVL_POSS,AD16C4T_BDCFG_LOCKLVL_POSE) - -#define AD16C4T_BDCFG_DT_POSS 0U -#define AD16C4T_BDCFG_DT_POSE 7U -#define AD16C4T_BDCFG_DT_MSK BITS(AD16C4T_BDCFG_DT_POSS,AD16C4T_BDCFG_DT_POSE) - -/****************** Bit definition for AD16C4T_DMAEN register ************************/ - -#define AD16C4T_DMAEN_TRGIDE_POS 6U -#define AD16C4T_DMAEN_TRGIDE_MSK BIT(AD16C4T_DMAEN_TRGIDE_POS) - -#define AD16C4T_DMAEN_COMDE_POS 5U -#define AD16C4T_DMAEN_COMDE_MSK BIT(AD16C4T_DMAEN_COMDE_POS) - -#define AD16C4T_DMAEN_CH4DE_POS 4U -#define AD16C4T_DMAEN_CH4DE_MSK BIT(AD16C4T_DMAEN_CH4DE_POS) - -#define AD16C4T_DMAEN_CH3DE_POS 3U -#define AD16C4T_DMAEN_CH3DE_MSK BIT(AD16C4T_DMAEN_CH3DE_POS) - -#define AD16C4T_DMAEN_CH2DE_POS 2U -#define AD16C4T_DMAEN_CH2DE_MSK BIT(AD16C4T_DMAEN_CH2DE_POS) - -#define AD16C4T_DMAEN_CH1DE_POS 1U -#define AD16C4T_DMAEN_CH1DE_MSK BIT(AD16C4T_DMAEN_CH1DE_POS) - -#define AD16C4T_DMAEN_UDE_POS 0U -#define AD16C4T_DMAEN_UDE_MSK BIT(AD16C4T_DMAEN_UDE_POS) - -typedef struct -{ - __IO uint32_t CON1; /* 0x000 AD16C4T_CON1 Control register 1 */ - __IO uint32_t CON2; /* 0x004 AD16C4T_CON2 Control register 2 */ - __IO uint32_t SMCON; /* 0x008 AD16C4T_SMCON Slave mode control register */ - __O uint32_t IER; /* 0x00C AD16C4T_IER Interrupt Enable register */ - __O uint32_t IDR; /* 0x010 AD16C4T_IDR Interrupt Disable register */ - __I uint32_t IVS; /* 0x014 AD16C4T_IVS Interrupt Valid status register */ - __I uint32_t RIF; /* 0x018 AD16C4T_RIF Interrupt Raw interrupt Flag */ - __I uint32_t IFM; /* 0x01C AD16C4T_IFM Interrupt Masked interrupt Flag */ - __O uint32_t ICR; /* 0x020 AD16C4T_ICR Interrupt Clear status register */ - __O uint32_t SGE; /* 0x024 AD16C4T_SGE Event generation register */ - __IO uint32_t CHMR1; /* 0x028 AD16C4T_CHMR1 Capture/compare mode register 1 */ - __IO uint32_t CHMR2; /* 0x02C AD16C4T_CHMR2 Capture/compare mode register 2 */ - __IO uint32_t CCEP; /* 0x030 AD16C4T_CCEP Capture/compare enable register */ - __IO uint32_t COUNT; /* 0x034 AD16C4T_COUNT Timer Counter */ - __IO uint32_t PRES; /* 0x038 AD16C4T_PRES Prescaler */ - __IO uint32_t AR; /* 0x03C AD16C4T_AR Auto-reload register */ - __IO uint32_t REPAR; /* 0x040 AD16C4T_REPAR Repetition counter register */ - __IO uint32_t CCVAL1; /* 0x044 AD16C4T_CCVAL1 Capture/compare register 1 */ - __IO uint32_t CCVAL2; /* 0x048 AD16C4T_CCVAL2 Capture/compare register 2 */ - __IO uint32_t CCVAL3; /* 0x04C AD16C4T_CCVAL3 Capture/compare register 3 */ - __IO uint32_t CCVAL4; /* 0x050 AD16C4T_CCVAL4 Capture/compare register 4 */ - __IO uint32_t BDCFG; /* 0x054 AD16C4T_BDCFG Break and dead-time register */ - __IO uint32_t DMAEN; /* 0x058 AD16C4T_DMAEN DMA trigger event enable */ -} AD16C4T_TypeDef; - -#endif -/******************* (C) COPYRIGHT Eastsoft Microelectronics END OF REG_AD16C4T.H****/ - diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_adc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_adc.h deleted file mode 100644 index e1b57e2773..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_adc.h +++ /dev/null @@ -1,795 +0,0 @@ -/** - ************************************************************************************** - * @file REG_ADC.h - * @brief ADC Header File - * - * @version V1.00.01 - * @date 04/12/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __ADC_H__ -#define __ADC_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for ADC_CFG register ************************/ - -#define ADC_CFG_TESTEN_POSS 8U -#define ADC_CFG_TESTEN_POSE 15U -#define ADC_CFG_TESTEN_MSK BITS(ADC_CFG_TESTEN_POSS,ADC_CFG_TESTEN_POSE) - -#define ADC_CFG_MODE_POS 0U -#define ADC_CFG_MODE_MSK BIT(ADC_CFG_MODE_POS) - -/****************** Bit definition for ADC_SRATE register ************************/ - -#define ADC_SRATE_CNT_POSS 16U -#define ADC_SRATE_CNT_POSE 23U -#define ADC_SRATE_CNT_MSK BITS(ADC_SRATE_CNT_POSS,ADC_SRATE_CNT_POSE) - -#define ADC_SRATE_CNTINI_POSS 8U -#define ADC_SRATE_CNTINI_POSE 15U -#define ADC_SRATE_CNTINI_MSK BITS(ADC_SRATE_CNTINI_POSS,ADC_SRATE_CNTINI_POSE) - -#define ADC_SRATE_CKDIV_POSS 1U -#define ADC_SRATE_CKDIV_POSE 4U -#define ADC_SRATE_CKDIV_MSK BITS(ADC_SRATE_CKDIV_POSS,ADC_SRATE_CKDIV_POSE) - -#define ADC_SRATE_CKEN_POS 0U -#define ADC_SRATE_CKEN_MSK BIT(ADC_SRATE_CKEN_POS) - -/****************** Bit definition for ADC_CHINV register ************************/ - -#define ADC_CHINV_CH15INV_POS 15U -#define ADC_CHINV_CH15INV_MSK BIT(ADC_CHINV_CH15INV_POS) - -#define ADC_CHINV_CH14INV_POS 14U -#define ADC_CHINV_CH14INV_MSK BIT(ADC_CHINV_CH14INV_POS) - -#define ADC_CHINV_CH13INV_POS 13U -#define ADC_CHINV_CH13INV_MSK BIT(ADC_CHINV_CH13INV_POS) - -#define ADC_CHINV_CH12INV_POS 12U -#define ADC_CHINV_CH12INV_MSK BIT(ADC_CHINV_CH12INV_POS) - -#define ADC_CHINV_CH11INV_POS 11U -#define ADC_CHINV_CH11INV_MSK BIT(ADC_CHINV_CH11INV_POS) - -#define ADC_CHINV_CH10INV_POS 10U -#define ADC_CHINV_CH10INV_MSK BIT(ADC_CHINV_CH10INV_POS) - -#define ADC_CHINV_CH9INV_POS 9U -#define ADC_CHINV_CH9INV_MSK BIT(ADC_CHINV_CH9INV_POS) - -#define ADC_CHINV_CH8INV_POS 8U -#define ADC_CHINV_CH8INV_MSK BIT(ADC_CHINV_CH8INV_POS) - -#define ADC_CHINV_CH7INV_POS 7U -#define ADC_CHINV_CH7INV_MSK BIT(ADC_CHINV_CH7INV_POS) - -#define ADC_CHINV_CH6INV_POS 6U -#define ADC_CHINV_CH6INV_MSK BIT(ADC_CHINV_CH6INV_POS) - -#define ADC_CHINV_CH5INV_POS 5U -#define ADC_CHINV_CH5INV_MSK BIT(ADC_CHINV_CH5INV_POS) - -#define ADC_CHINV_CH4INV_POS 4U -#define ADC_CHINV_CH4INV_MSK BIT(ADC_CHINV_CH4INV_POS) - -#define ADC_CHINV_CH3INV_POS 3U -#define ADC_CHINV_CH3INV_MSK BIT(ADC_CHINV_CH3INV_POS) - -#define ADC_CHINV_CH2INV_POS 2U -#define ADC_CHINV_CH2INV_MSK BIT(ADC_CHINV_CH2INV_POS) - -#define ADC_CHINV_CH1INV_POS 1U -#define ADC_CHINV_CH1INV_MSK BIT(ADC_CHINV_CH1INV_POS) - -#define ADC_CHINV_CH0INV_POS 0U -#define ADC_CHINV_CH0INV_MSK BIT(ADC_CHINV_CH0INV_POS) - -/****************** Bit definition for ADC_GAINL register ************************/ - -#define ADC_GAINL_CH7PGA_POSS 21U -#define ADC_GAINL_CH7PGA_POSE 23U -#define ADC_GAINL_CH7PGA_MSK BITS(ADC_GAINL_CH7PGA_POSS,ADC_GAINL_CH7PGA_POSE) - -#define ADC_GAINL_CH6PGA_POSS 18U -#define ADC_GAINL_CH6PGA_POSE 20U -#define ADC_GAINL_CH6PGA_MSK BITS(ADC_GAINL_CH6PGA_POSS,ADC_GAINL_CH6PGA_POSE) - -#define ADC_GAINL_CH5PGA_POSS 15U -#define ADC_GAINL_CH5PGA_POSE 17U -#define ADC_GAINL_CH5PGA_MSK BITS(ADC_GAINL_CH5PGA_POSS,ADC_GAINL_CH5PGA_POSE) - -#define ADC_GAINL_CH4PGA_POSS 12U -#define ADC_GAINL_CH4PGA_POSE 14U -#define ADC_GAINL_CH4PGA_MSK BITS(ADC_GAINL_CH4PGA_POSS,ADC_GAINL_CH4PGA_POSE) - -#define ADC_GAINL_CH3PGA_POSS 9U -#define ADC_GAINL_CH3PGA_POSE 11U -#define ADC_GAINL_CH3PGA_MSK BITS(ADC_GAINL_CH3PGA_POSS,ADC_GAINL_CH3PGA_POSE) - -#define ADC_GAINL_CH2PGA_POSS 6U -#define ADC_GAINL_CH2PGA_POSE 8U -#define ADC_GAINL_CH2PGA_MSK BITS(ADC_GAINL_CH2PGA_POSS,ADC_GAINL_CH2PGA_POSE) - -#define ADC_GAINL_CH1PGA_POSS 3U -#define ADC_GAINL_CH1PGA_POSE 5U -#define ADC_GAINL_CH1PGA_MSK BITS(ADC_GAINL_CH1PGA_POSS,ADC_GAINL_CH1PGA_POSE) - -#define ADC_GAINL_CH0PGA_POSS 0U -#define ADC_GAINL_CH0PGA_POSE 2U -#define ADC_GAINL_CH0PGA_MSK BITS(ADC_GAINL_CH0PGA_POSS,ADC_GAINL_CH0PGA_POSE) - -/****************** Bit definition for ADC_GAINH register ************************/ - -#define ADC_GAINH_CH15PGA_POSS 21U -#define ADC_GAINH_CH15PGA_POSE 23U -#define ADC_GAINH_CH15PGA_MSK BITS(ADC_GAINH_CH15PGA_POSS,ADC_GAINH_CH15PGA_POSE) - -#define ADC_GAINH_CH14PGA_POSS 18U -#define ADC_GAINH_CH14PGA_POSE 20U -#define ADC_GAINH_CH14PGA_MSK BITS(ADC_GAINH_CH14PGA_POSS,ADC_GAINH_CH14PGA_POSE) - -#define ADC_GAINH_CH13PGA_POSS 15U -#define ADC_GAINH_CH13PGA_POSE 17U -#define ADC_GAINH_CH13PGA_MSK BITS(ADC_GAINH_CH13PGA_POSS,ADC_GAINH_CH13PGA_POSE) - -#define ADC_GAINH_CH12PGA_POSS 12U -#define ADC_GAINH_CH12PGA_POSE 14U -#define ADC_GAINH_CH12PGA_MSK BITS(ADC_GAINH_CH12PGA_POSS,ADC_GAINH_CH12PGA_POSE) - -#define ADC_GAINH_CH11PGA_POSS 9U -#define ADC_GAINH_CH11PGA_POSE 11U -#define ADC_GAINH_CH11PGA_MSK BITS(ADC_GAINH_CH11PGA_POSS,ADC_GAINH_CH11PGA_POSE) - -#define ADC_GAINH_CH10PGA_POSS 6U -#define ADC_GAINH_CH10PGA_POSE 8U -#define ADC_GAINH_CH10PGA_MSK BITS(ADC_GAINH_CH10PGA_POSS,ADC_GAINH_CH10PGA_POSE) - -#define ADC_GAINH_CH9PGA_POSS 3U -#define ADC_GAINH_CH9PGA_POSE 5U -#define ADC_GAINH_CH9PGA_MSK BITS(ADC_GAINH_CH9PGA_POSS,ADC_GAINH_CH9PGA_POSE) - -#define ADC_GAINH_CH8PGA_POSS 0U -#define ADC_GAINH_CH8PGA_POSE 2U -#define ADC_GAINH_CH8PGA_MSK BITS(ADC_GAINH_CH8PGA_POSS,ADC_GAINH_CH8PGA_POSE) - -/****************** Bit definition for ADC_FRF register ************************/ - -#define ADC_FRF_FFRST_POS 4U -#define ADC_FRF_FFRST_MSK BIT(ADC_FRF_FFRST_POS) - -#define ADC_FRF_SS3RF_POS 3U -#define ADC_FRF_SS3RF_MSK BIT(ADC_FRF_SS3RF_POS) - -#define ADC_FRF_SS2RF_POS 2U -#define ADC_FRF_SS2RF_MSK BIT(ADC_FRF_SS2RF_POS) - -#define ADC_FRF_SS1RF_POS 1U -#define ADC_FRF_SS1RF_MSK BIT(ADC_FRF_SS1RF_POS) - -#define ADC_FRF_SS0RF_POS 0U -#define ADC_FRF_SS0RF_MSK BIT(ADC_FRF_SS0RF_POS) - -/****************** Bit definition for ADC_SSEN register ************************/ - -#define ADC_SSEN_IDLE_POS 4U -#define ADC_SSEN_IDLE_MSK BIT(ADC_SSEN_IDLE_POS) - -#define ADC_SSEN_SS3EN_POS 3U -#define ADC_SSEN_SS3EN_MSK BIT(ADC_SSEN_SS3EN_POS) - -#define ADC_SSEN_SS2EN_POS 2U -#define ADC_SSEN_SS2EN_MSK BIT(ADC_SSEN_SS2EN_POS) - -#define ADC_SSEN_SS1EN_POS 1U -#define ADC_SSEN_SS1EN_MSK BIT(ADC_SSEN_SS1EN_POS) - -#define ADC_SSEN_SS0EN_POS 0U -#define ADC_SSEN_SS0EN_MSK BIT(ADC_SSEN_SS0EN_POS) - -/****************** Bit definition for ADC_SWTRI register ************************/ - -#define ADC_SWTRI_SS3_POS 3U -#define ADC_SWTRI_SS3_MSK BIT(ADC_SWTRI_SS3_POS) - -#define ADC_SWTRI_SS2_POS 2U -#define ADC_SWTRI_SS2_MSK BIT(ADC_SWTRI_SS2_POS) - -#define ADC_SWTRI_SS1_POS 1U -#define ADC_SWTRI_SS1_MSK BIT(ADC_SWTRI_SS1_POS) - -#define ADC_SWTRI_SS0_POS 0U -#define ADC_SWTRI_SS0_MSK BIT(ADC_SWTRI_SS0_POS) - -/****************** Bit definition for ADC_IER register ************************/ - -#define ADC_IER_TOIE_POS 4U -#define ADC_IER_TOIE_MSK BIT(ADC_IER_TOIE_POS) - -#define ADC_IER_SS3IE_POS 3U -#define ADC_IER_SS3IE_MSK BIT(ADC_IER_SS3IE_POS) - -#define ADC_IER_SS2IE_POS 2U -#define ADC_IER_SS2IE_MSK BIT(ADC_IER_SS2IE_POS) - -#define ADC_IER_SS1IE_POS 1U -#define ADC_IER_SS1IE_MSK BIT(ADC_IER_SS1IE_POS) - -#define ADC_IER_SS0IE_POS 0U -#define ADC_IER_SS0IE_MSK BIT(ADC_IER_SS0IE_POS) - -/****************** Bit definition for ADC_IDR register ************************/ - -#define ADC_IDR_TOID_POS 4U -#define ADC_IDR_TOID_MSK BIT(ADC_IDR_TOID_POS) - -#define ADC_IDR_SS3ID_POS 3U -#define ADC_IDR_SS3ID_MSK BIT(ADC_IDR_SS3ID_POS) - -#define ADC_IDR_SS2ID_POS 2U -#define ADC_IDR_SS2ID_MSK BIT(ADC_IDR_SS2ID_POS) - -#define ADC_IDR_SS1ID_POS 1U -#define ADC_IDR_SS1ID_MSK BIT(ADC_IDR_SS1ID_POS) - -#define ADC_IDR_SS0ID_POS 0U -#define ADC_IDR_SS0ID_MSK BIT(ADC_IDR_SS0ID_POS) - -/****************** Bit definition for ADC_IVS register ************************/ - -#define ADC_IVS_TOIVS_POS 4U -#define ADC_IVS_TOIVS_MSK BIT(ADC_IVS_TOIVS_POS) - -#define ADC_IVS_SS3IVS_POS 3U -#define ADC_IVS_SS3IVS_MSK BIT(ADC_IVS_SS3IVS_POS) - -#define ADC_IVS_SS2IVS_POS 2U -#define ADC_IVS_SS2IVS_MSK BIT(ADC_IVS_SS2IVS_POS) - -#define ADC_IVS_SS1IVS_POS 1U -#define ADC_IVS_SS1IVS_MSK BIT(ADC_IVS_SS1IVS_POS) - -#define ADC_IVS_SS0IVS_POS 0U -#define ADC_IVS_SS0IVS_MSK BIT(ADC_IVS_SS0IVS_POS) - -/****************** Bit definition for ADC_RIF register ************************/ - -#define ADC_RIF_TORIF_POS 4U -#define ADC_RIF_TORIF_MSK BIT(ADC_RIF_TORIF_POS) - -#define ADC_RIF_SS3RIF_POS 3U -#define ADC_RIF_SS3RIF_MSK BIT(ADC_RIF_SS3RIF_POS) - -#define ADC_RIF_SS2RIF_POS 2U -#define ADC_RIF_SS2RIF_MSK BIT(ADC_RIF_SS2RIF_POS) - -#define ADC_RIF_SS1RIF_POS 1U -#define ADC_RIF_SS1RIF_MSK BIT(ADC_RIF_SS1RIF_POS) - -#define ADC_RIF_SS0RIF_POS 0U -#define ADC_RIF_SS0RIF_MSK BIT(ADC_RIF_SS0RIF_POS) - -/****************** Bit definition for ADC_IFM register ************************/ - -#define ADC_IFM_TOIFM_POS 4U -#define ADC_IFM_TOIFM_MSK BIT(ADC_IFM_TOIFM_POS) - -#define ADC_IFM_SS3IFM_POS 3U -#define ADC_IFM_SS3IFM_MSK BIT(ADC_IFM_SS3IFM_POS) - -#define ADC_IFM_SS2IFM_POS 2U -#define ADC_IFM_SS2IFM_MSK BIT(ADC_IFM_SS2IFM_POS) - -#define ADC_IFM_SS1IFM_POS 1U -#define ADC_IFM_SS1IFM_MSK BIT(ADC_IFM_SS1IFM_POS) - -#define ADC_IFM_SS0IFM_POS 0U -#define ADC_IFM_SS0IFM_MSK BIT(ADC_IFM_SS0IFM_POS) - -/****************** Bit definition for ADC_ICR register ************************/ - -#define ADC_ICR_TOICR_POS 4U -#define ADC_ICR_TOICR_MSK BIT(ADC_ICR_TOICR_POS) - -#define ADC_ICR_SS3ICR_POS 3U -#define ADC_ICR_SS3ICR_MSK BIT(ADC_ICR_SS3ICR_POS) - -#define ADC_ICR_SS2ICR_POS 2U -#define ADC_ICR_SS2ICR_MSK BIT(ADC_ICR_SS2ICR_POS) - -#define ADC_ICR_SS1ICR_POS 1U -#define ADC_ICR_SS1ICR_MSK BIT(ADC_ICR_SS1ICR_POS) - -#define ADC_ICR_SS0ICR_POS 0U -#define ADC_ICR_SS0ICR_MSK BIT(ADC_ICR_SS0ICR_POS) - -/****************** Bit definition for ADC_DMA register ************************/ - -#define ADC_DMA_SS3_DMAEN_POS 3U -#define ADC_DMA_SS3_DMAEN_MSK BIT(ADC_DMA_SS3_DMAEN_POS) - -#define ADC_DMA_SS2_DMAEN_POS 2U -#define ADC_DMA_SS2_DMAEN_MSK BIT(ADC_DMA_SS2_DMAEN_POS) - -#define ADC_DMA_SS1_DMAEN_POS 1U -#define ADC_DMA_SS1_DMAEN_MSK BIT(ADC_DMA_SS1_DMAEN_POS) - -#define ADC_DMA_SS0_DMAEN_POS 0U -#define ADC_DMA_SS0_DMAEN_MSK BIT(ADC_DMA_SS0_DMAEN_POS) - -/****************** Bit definition for ADC_SS0_CON register ************************/ - -#define ADC_SS0_CON_SEL_POSS 11U -#define ADC_SS0_CON_SEL_POSE 15U -#define ADC_SS0_CON_SEL_MSK BITS(ADC_SS0_CON_SEL_POSS,ADC_SS0_CON_SEL_POSE) - -#define ADC_SS0_CON_TYP_POS 8U -#define ADC_SS0_CON_TYP_MSK BIT(ADC_SS0_CON_TYP_POS) - -#define ADC_SS0_CON_PRI_POSS 4U -#define ADC_SS0_CON_PRI_POSE 5U -#define ADC_SS0_CON_PRI_MSK BITS(ADC_SS0_CON_PRI_POSS,ADC_SS0_CON_PRI_POSE) - -#define ADC_SS0_CON_ONE_POS 0U -#define ADC_SS0_CON_ONE_MSK BIT(ADC_SS0_CON_ONE_POS) - -/****************** Bit definition for ADC_SS0_MUX0 register ************************/ - -#define ADC_SS0_MUX0_MUX7_POSS 28U -#define ADC_SS0_MUX0_MUX7_POSE 31U -#define ADC_SS0_MUX0_MUX7_MSK BITS(ADC_SS0_MUX0_MUX7_POSS,ADC_SS0_MUX0_MUX7_POSE) - -#define ADC_SS0_MUX0_MUX6_POSS 24U -#define ADC_SS0_MUX0_MUX6_POSE 27U -#define ADC_SS0_MUX0_MUX6_MSK BITS(ADC_SS0_MUX0_MUX6_POSS,ADC_SS0_MUX0_MUX6_POSE) - -#define ADC_SS0_MUX0_MUX5_POSS 20U -#define ADC_SS0_MUX0_MUX5_POSE 23U -#define ADC_SS0_MUX0_MUX5_MSK BITS(ADC_SS0_MUX0_MUX5_POSS,ADC_SS0_MUX0_MUX5_POSE) - -#define ADC_SS0_MUX0_MUX4_POSS 16U -#define ADC_SS0_MUX0_MUX4_POSE 19U -#define ADC_SS0_MUX0_MUX4_MSK BITS(ADC_SS0_MUX0_MUX4_POSS,ADC_SS0_MUX0_MUX4_POSE) - -#define ADC_SS0_MUX0_MUX3_POSS 12U -#define ADC_SS0_MUX0_MUX3_POSE 15U -#define ADC_SS0_MUX0_MUX3_MSK BITS(ADC_SS0_MUX0_MUX3_POSS,ADC_SS0_MUX0_MUX3_POSE) - -#define ADC_SS0_MUX0_MUX2_POSS 8U -#define ADC_SS0_MUX0_MUX2_POSE 11U -#define ADC_SS0_MUX0_MUX2_MSK BITS(ADC_SS0_MUX0_MUX2_POSS,ADC_SS0_MUX0_MUX2_POSE) - -#define ADC_SS0_MUX0_MUX1_POSS 4U -#define ADC_SS0_MUX0_MUX1_POSE 7U -#define ADC_SS0_MUX0_MUX1_MSK BITS(ADC_SS0_MUX0_MUX1_POSS,ADC_SS0_MUX0_MUX1_POSE) - -#define ADC_SS0_MUX0_MUX0_POSS 0U -#define ADC_SS0_MUX0_MUX0_POSE 3U -#define ADC_SS0_MUX0_MUX0_MSK BITS(ADC_SS0_MUX0_MUX0_POSS,ADC_SS0_MUX0_MUX0_POSE) - -/****************** Bit definition for ADC_SS0_MUX1 register ************************/ - -#define ADC_SS0_MUX1_MUX15_POSS 28U -#define ADC_SS0_MUX1_MUX15_POSE 31U -#define ADC_SS0_MUX1_MUX15_MSK BITS(ADC_SS0_MUX1_MUX15_POSS,ADC_SS0_MUX1_MUX15_POSE) - -#define ADC_SS0_MUX1_MUX14_POSS 24U -#define ADC_SS0_MUX1_MUX14_POSE 27U -#define ADC_SS0_MUX1_MUX14_MSK BITS(ADC_SS0_MUX1_MUX14_POSS,ADC_SS0_MUX1_MUX14_POSE) - -#define ADC_SS0_MUX1_MUX13_POSS 20U -#define ADC_SS0_MUX1_MUX13_POSE 23U -#define ADC_SS0_MUX1_MUX13_MSK BITS(ADC_SS0_MUX1_MUX13_POSS,ADC_SS0_MUX1_MUX13_POSE) - -#define ADC_SS0_MUX1_MUX12_POSS 16U -#define ADC_SS0_MUX1_MUX12_POSE 19U -#define ADC_SS0_MUX1_MUX12_MSK BITS(ADC_SS0_MUX1_MUX12_POSS,ADC_SS0_MUX1_MUX12_POSE) - -#define ADC_SS0_MUX1_MUX11_POSS 12U -#define ADC_SS0_MUX1_MUX11_POSE 15U -#define ADC_SS0_MUX1_MUX11_MSK BITS(ADC_SS0_MUX1_MUX11_POSS,ADC_SS0_MUX1_MUX11_POSE) - -#define ADC_SS0_MUX1_MUX10_POSS 8U -#define ADC_SS0_MUX1_MUX10_POSE 11U -#define ADC_SS0_MUX1_MUX10_MSK BITS(ADC_SS0_MUX1_MUX10_POSS,ADC_SS0_MUX1_MUX10_POSE) - -#define ADC_SS0_MUX1_MUX9_POSS 4U -#define ADC_SS0_MUX1_MUX9_POSE 7U -#define ADC_SS0_MUX1_MUX9_MSK BITS(ADC_SS0_MUX1_MUX9_POSS,ADC_SS0_MUX1_MUX9_POSE) - -#define ADC_SS0_MUX1_MUX8_POSS 0U -#define ADC_SS0_MUX1_MUX8_POSE 3U -#define ADC_SS0_MUX1_MUX8_MSK BITS(ADC_SS0_MUX1_MUX8_POSS,ADC_SS0_MUX1_MUX8_POSE) - -/****************** Bit definition for ADC_SS0_END register ************************/ - -#define ADC_SS0_END_IE15_POS 23U -#define ADC_SS0_END_IE15_MSK BIT(ADC_SS0_END_IE15_POS) - -#define ADC_SS0_END_IE14_POS 22U -#define ADC_SS0_END_IE14_MSK BIT(ADC_SS0_END_IE14_POS) - -#define ADC_SS0_END_IE13_POS 21U -#define ADC_SS0_END_IE13_MSK BIT(ADC_SS0_END_IE13_POS) - -#define ADC_SS0_END_IE12_POS 20U -#define ADC_SS0_END_IE12_MSK BIT(ADC_SS0_END_IE12_POS) - -#define ADC_SS0_END_IE11_POS 19U -#define ADC_SS0_END_IE11_MSK BIT(ADC_SS0_END_IE11_POS) - -#define ADC_SS0_END_IE10_POS 18U -#define ADC_SS0_END_IE10_MSK BIT(ADC_SS0_END_IE10_POS) - -#define ADC_SS0_END_IE9_POS 17U -#define ADC_SS0_END_IE9_MSK BIT(ADC_SS0_END_IE9_POS) - -#define ADC_SS0_END_IE8_POS 16U -#define ADC_SS0_END_IE8_MSK BIT(ADC_SS0_END_IE8_POS) - -#define ADC_SS0_END_IE7_POS 15U -#define ADC_SS0_END_IE7_MSK BIT(ADC_SS0_END_IE7_POS) - -#define ADC_SS0_END_IE6_POS 14U -#define ADC_SS0_END_IE6_MSK BIT(ADC_SS0_END_IE6_POS) - -#define ADC_SS0_END_IE5_POS 13U -#define ADC_SS0_END_IE5_MSK BIT(ADC_SS0_END_IE5_POS) - -#define ADC_SS0_END_IE4_POS 12U -#define ADC_SS0_END_IE4_MSK BIT(ADC_SS0_END_IE4_POS) - -#define ADC_SS0_END_IE3_POS 11U -#define ADC_SS0_END_IE3_MSK BIT(ADC_SS0_END_IE3_POS) - -#define ADC_SS0_END_IE2_POS 10U -#define ADC_SS0_END_IE2_MSK BIT(ADC_SS0_END_IE2_POS) - -#define ADC_SS0_END_IE1_POS 9U -#define ADC_SS0_END_IE1_MSK BIT(ADC_SS0_END_IE1_POS) - -#define ADC_SS0_END_IE0_POS 8U -#define ADC_SS0_END_IE0_MSK BIT(ADC_SS0_END_IE0_POS) - -#define ADC_SS0_END_END_POSS 0U -#define ADC_SS0_END_END_POSE 3U -#define ADC_SS0_END_END_MSK BITS(ADC_SS0_END_END_POSS,ADC_SS0_END_END_POSE) - -/****************** Bit definition for ADC_SS0_FSTAT register ************************/ - -#define ADC_SS0_FSTAT_OV_POS 11U -#define ADC_SS0_FSTAT_OV_MSK BIT(ADC_SS0_FSTAT_OV_POS) - -#define ADC_SS0_FSTAT_FULL_POS 10U -#define ADC_SS0_FSTAT_FULL_MSK BIT(ADC_SS0_FSTAT_FULL_POS) - -#define ADC_SS0_FSTAT_UV_POS 9U -#define ADC_SS0_FSTAT_UV_MSK BIT(ADC_SS0_FSTAT_UV_POS) - -#define ADC_SS0_FSTAT_EMPTY_POS 8U -#define ADC_SS0_FSTAT_EMPTY_MSK BIT(ADC_SS0_FSTAT_EMPTY_POS) - -#define ADC_SS0_FSTAT_HPTR_POSS 4U -#define ADC_SS0_FSTAT_HPTR_POSE 7U -#define ADC_SS0_FSTAT_HPTR_MSK BITS(ADC_SS0_FSTAT_HPTR_POSS,ADC_SS0_FSTAT_HPTR_POSE) - -#define ADC_SS0_FSTAT_TPTR_POSS 0U -#define ADC_SS0_FSTAT_TPTR_POSE 3U -#define ADC_SS0_FSTAT_TPTR_MSK BITS(ADC_SS0_FSTAT_TPTR_POSS,ADC_SS0_FSTAT_TPTR_POSE) - -/****************** Bit definition for ADC_SS0_DATA register ************************/ - -#define ADC_SS0_DATA_DATA_POSS 0U -#define ADC_SS0_DATA_DATA_POSE 11U -#define ADC_SS0_DATA_DATA_MSK BITS(ADC_SS0_DATA_DATA_POSS,ADC_SS0_DATA_DATA_POSE) - -/****************** Bit definition for ADC_SS1_CON register ************************/ - -#define ADC_SS1_CON_SEL_POSS 11U -#define ADC_SS1_CON_SEL_POSE 15U -#define ADC_SS1_CON_SEL_MSK BITS(ADC_SS1_CON_SEL_POSS,ADC_SS1_CON_SEL_POSE) - -#define ADC_SS1_CON_TYP_POS 8U -#define ADC_SS1_CON_TYP_MSK BIT(ADC_SS1_CON_TYP_POS) - -#define ADC_SS1_CON_PRI_POSS 4U -#define ADC_SS1_CON_PRI_POSE 5U -#define ADC_SS1_CON_PRI_MSK BITS(ADC_SS1_CON_PRI_POSS,ADC_SS1_CON_PRI_POSE) - -#define ADC_SS1_CON_ONE_POS 0U -#define ADC_SS1_CON_ONE_MSK BIT(ADC_SS1_CON_ONE_POS) - -/****************** Bit definition for ADC_SS1_MUX0 register ************************/ - -#define ADC_SS1_MUX0_MUX7_POSS 28U -#define ADC_SS1_MUX0_MUX7_POSE 31U -#define ADC_SS1_MUX0_MUX7_MSK BITS(ADC_SS1_MUX0_MUX7_POSS,ADC_SS1_MUX0_MUX7_POSE) - -#define ADC_SS1_MUX0_MUX6_POSS 24U -#define ADC_SS1_MUX0_MUX6_POSE 27U -#define ADC_SS1_MUX0_MUX6_MSK BITS(ADC_SS1_MUX0_MUX6_POSS,ADC_SS1_MUX0_MUX6_POSE) - -#define ADC_SS1_MUX0_MUX5_POSS 20U -#define ADC_SS1_MUX0_MUX5_POSE 23U -#define ADC_SS1_MUX0_MUX5_MSK BITS(ADC_SS1_MUX0_MUX5_POSS,ADC_SS1_MUX0_MUX5_POSE) - -#define ADC_SS1_MUX0_MUX4_POSS 16U -#define ADC_SS1_MUX0_MUX4_POSE 19U -#define ADC_SS1_MUX0_MUX4_MSK BITS(ADC_SS1_MUX0_MUX4_POSS,ADC_SS1_MUX0_MUX4_POSE) - -#define ADC_SS1_MUX0_MUX3_POSS 12U -#define ADC_SS1_MUX0_MUX3_POSE 15U -#define ADC_SS1_MUX0_MUX3_MSK BITS(ADC_SS1_MUX0_MUX3_POSS,ADC_SS1_MUX0_MUX3_POSE) - -#define ADC_SS1_MUX0_MUX2_POSS 8U -#define ADC_SS1_MUX0_MUX2_POSE 11U -#define ADC_SS1_MUX0_MUX2_MSK BITS(ADC_SS1_MUX0_MUX2_POSS,ADC_SS1_MUX0_MUX2_POSE) - -#define ADC_SS1_MUX0_MUX1_POSS 4U -#define ADC_SS1_MUX0_MUX1_POSE 7U -#define ADC_SS1_MUX0_MUX1_MSK BITS(ADC_SS1_MUX0_MUX1_POSS,ADC_SS1_MUX0_MUX1_POSE) - -#define ADC_SS1_MUX0_MUX0_POSS 0U -#define ADC_SS1_MUX0_MUX0_POSE 3U -#define ADC_SS1_MUX0_MUX0_MSK BITS(ADC_SS1_MUX0_MUX0_POSS,ADC_SS1_MUX0_MUX0_POSE) - -/****************** Bit definition for ADC_SS1_END register ************************/ - -#define ADC_SS1_END_IE7_POS 15U -#define ADC_SS1_END_IE7_MSK BIT(ADC_SS1_END_IE7_POS) - -#define ADC_SS1_END_IE6_POS 14U -#define ADC_SS1_END_IE6_MSK BIT(ADC_SS1_END_IE6_POS) - -#define ADC_SS1_END_IE5_POS 13U -#define ADC_SS1_END_IE5_MSK BIT(ADC_SS1_END_IE5_POS) - -#define ADC_SS1_END_IE4_POS 12U -#define ADC_SS1_END_IE4_MSK BIT(ADC_SS1_END_IE4_POS) - -#define ADC_SS1_END_IE3_POS 11U -#define ADC_SS1_END_IE3_MSK BIT(ADC_SS1_END_IE3_POS) - -#define ADC_SS1_END_IE2_POS 10U -#define ADC_SS1_END_IE2_MSK BIT(ADC_SS1_END_IE2_POS) - -#define ADC_SS1_END_IE1_POS 9U -#define ADC_SS1_END_IE1_MSK BIT(ADC_SS1_END_IE1_POS) - -#define ADC_SS1_END_IE0_POS 8U -#define ADC_SS1_END_IE0_MSK BIT(ADC_SS1_END_IE0_POS) - -#define ADC_SS1_END_END_POSS 0U -#define ADC_SS1_END_END_POSE 2U -#define ADC_SS1_END_END_MSK BITS(ADC_SS1_END_END_POSS,ADC_SS1_END_END_POSE) - -/****************** Bit definition for ADC_SS1_FSTAT register ************************/ - -#define ADC_SS1_FSTAT_OV_POS 11U -#define ADC_SS1_FSTAT_OV_MSK BIT(ADC_SS1_FSTAT_OV_POS) - -#define ADC_SS1_FSTAT_FULL_POS 10U -#define ADC_SS1_FSTAT_FULL_MSK BIT(ADC_SS1_FSTAT_FULL_POS) - -#define ADC_SS1_FSTAT_UV_POS 9U -#define ADC_SS1_FSTAT_UV_MSK BIT(ADC_SS1_FSTAT_UV_POS) - -#define ADC_SS1_FSTAT_EMPTY_POS 8U -#define ADC_SS1_FSTAT_EMPTY_MSK BIT(ADC_SS1_FSTAT_EMPTY_POS) - -#define ADC_SS1_FSTAT_HPTR_POSS 4U -#define ADC_SS1_FSTAT_HPTR_POSE 7U -#define ADC_SS1_FSTAT_HPTR_MSK BITS(ADC_SS1_FSTAT_HPTR_POSS,ADC_SS1_FSTAT_HPTR_POSE) - -#define ADC_SS1_FSTAT_TPTR_POSS 0U -#define ADC_SS1_FSTAT_TPTR_POSE 3U -#define ADC_SS1_FSTAT_TPTR_MSK BITS(ADC_SS1_FSTAT_TPTR_POSS,ADC_SS1_FSTAT_TPTR_POSE) - -/****************** Bit definition for ADC_SS1_DATA register ************************/ - -#define ADC_SS1_DATA_DATA_POSS 0U -#define ADC_SS1_DATA_DATA_POSE 11U -#define ADC_SS1_DATA_DATA_MSK BITS(ADC_SS1_DATA_DATA_POSS,ADC_SS1_DATA_DATA_POSE) - -/****************** Bit definition for ADC_SS2_CON register ************************/ - -#define ADC_SS2_CON_SEL_POSS 11U -#define ADC_SS2_CON_SEL_POSE 15U -#define ADC_SS2_CON_SEL_MSK BITS(ADC_SS2_CON_SEL_POSS,ADC_SS2_CON_SEL_POSE) - -#define ADC_SS2_CON_TYP_POS 8U -#define ADC_SS2_CON_TYP_MSK BIT(ADC_SS2_CON_TYP_POS) - -#define ADC_SS2_CON_PRI_POSS 4U -#define ADC_SS2_CON_PRI_POSE 5U -#define ADC_SS2_CON_PRI_MSK BITS(ADC_SS2_CON_PRI_POSS,ADC_SS2_CON_PRI_POSE) - -#define ADC_SS2_CON_ONE_POS 0U -#define ADC_SS2_CON_ONE_MSK BIT(ADC_SS2_CON_ONE_POS) - -/****************** Bit definition for ADC_SS2_MUX0 register ************************/ - -#define ADC_SS2_MUX0_MUX3_POSS 12U -#define ADC_SS2_MUX0_MUX3_POSE 15U -#define ADC_SS2_MUX0_MUX3_MSK BITS(ADC_SS2_MUX0_MUX3_POSS,ADC_SS2_MUX0_MUX3_POSE) - -#define ADC_SS2_MUX0_MUX2_POSS 8U -#define ADC_SS2_MUX0_MUX2_POSE 11U -#define ADC_SS2_MUX0_MUX2_MSK BITS(ADC_SS2_MUX0_MUX2_POSS,ADC_SS2_MUX0_MUX2_POSE) - -#define ADC_SS2_MUX0_MUX1_POSS 4U -#define ADC_SS2_MUX0_MUX1_POSE 7U -#define ADC_SS2_MUX0_MUX1_MSK BITS(ADC_SS2_MUX0_MUX1_POSS,ADC_SS2_MUX0_MUX1_POSE) - -#define ADC_SS2_MUX0_MUX0_POSS 0U -#define ADC_SS2_MUX0_MUX0_POSE 3U -#define ADC_SS2_MUX0_MUX0_MSK BITS(ADC_SS2_MUX0_MUX0_POSS,ADC_SS2_MUX0_MUX0_POSE) - -/****************** Bit definition for ADC_SS2_END register ************************/ - -#define ADC_SS2_END_IE3_POS 11U -#define ADC_SS2_END_IE3_MSK BIT(ADC_SS2_END_IE3_POS) - -#define ADC_SS2_END_IE2_POS 10U -#define ADC_SS2_END_IE2_MSK BIT(ADC_SS2_END_IE2_POS) - -#define ADC_SS2_END_IE1_POS 9U -#define ADC_SS2_END_IE1_MSK BIT(ADC_SS2_END_IE1_POS) - -#define ADC_SS2_END_IE0_POS 8U -#define ADC_SS2_END_IE0_MSK BIT(ADC_SS2_END_IE0_POS) - -#define ADC_SS2_END_END_POSS 0U -#define ADC_SS2_END_END_POSE 1U -#define ADC_SS2_END_END_MSK BITS(ADC_SS2_END_END_POSS,ADC_SS2_END_END_POSE) - -/****************** Bit definition for ADC_SS2_FSTAT register ************************/ - -#define ADC_SS2_FSTAT_OV_POS 11U -#define ADC_SS2_FSTAT_OV_MSK BIT(ADC_SS2_FSTAT_OV_POS) - -#define ADC_SS2_FSTAT_FULL_POS 10U -#define ADC_SS2_FSTAT_FULL_MSK BIT(ADC_SS2_FSTAT_FULL_POS) - -#define ADC_SS2_FSTAT_UV_POS 9U -#define ADC_SS2_FSTAT_UV_MSK BIT(ADC_SS2_FSTAT_UV_POS) - -#define ADC_SS2_FSTAT_EMPTY_POS 8U -#define ADC_SS2_FSTAT_EMPTY_MSK BIT(ADC_SS2_FSTAT_EMPTY_POS) - -#define ADC_SS2_FSTAT_HPTR_POSS 4U -#define ADC_SS2_FSTAT_HPTR_POSE 7U -#define ADC_SS2_FSTAT_HPTR_MSK BITS(ADC_SS2_FSTAT_HPTR_POSS,ADC_SS2_FSTAT_HPTR_POSE) - -#define ADC_SS2_FSTAT_TPTR_POSS 0U -#define ADC_SS2_FSTAT_TPTR_POSE 3U -#define ADC_SS2_FSTAT_TPTR_MSK BITS(ADC_SS2_FSTAT_TPTR_POSS,ADC_SS2_FSTAT_TPTR_POSE) - -/****************** Bit definition for ADC_SS2_DATA register ************************/ - -#define ADC_SS2_DATA_DATA_POSS 0U -#define ADC_SS2_DATA_DATA_POSE 11U -#define ADC_SS2_DATA_DATA_MSK BITS(ADC_SS2_DATA_DATA_POSS,ADC_SS2_DATA_DATA_POSE) - -/****************** Bit definition for ADC_SS3_CON register ************************/ - -#define ADC_SS3_CON_SEL_POSS 11U -#define ADC_SS3_CON_SEL_POSE 15U -#define ADC_SS3_CON_SEL_MSK BITS(ADC_SS3_CON_SEL_POSS,ADC_SS3_CON_SEL_POSE) - -#define ADC_SS3_CON_TYP_POS 8U -#define ADC_SS3_CON_TYP_MSK BIT(ADC_SS3_CON_TYP_POS) - -#define ADC_SS3_CON_PRI_POSS 4U -#define ADC_SS3_CON_PRI_POSE 5U -#define ADC_SS3_CON_PRI_MSK BITS(ADC_SS3_CON_PRI_POSS,ADC_SS3_CON_PRI_POSE) - -#define ADC_SS3_CON_ONE_POS 0U -#define ADC_SS3_CON_ONE_MSK BIT(ADC_SS3_CON_ONE_POS) - -/****************** Bit definition for ADC_SS3_MUX0 register ************************/ - -#define ADC_SS3_MUX0_MUX0_POSS 0U -#define ADC_SS3_MUX0_MUX0_POSE 3U -#define ADC_SS3_MUX0_MUX0_MSK BITS(ADC_SS3_MUX0_MUX0_POSS,ADC_SS3_MUX0_MUX0_POSE) - -/****************** Bit definition for ADC_SS3_END register ************************/ - -#define ADC_SS3_END_IE0_POS 8U -#define ADC_SS3_END_IE0_MSK BIT(ADC_SS3_END_IE0_POS) - -#define ADC_SS3_END_END_POS 0U -#define ADC_SS3_END_END_MSK BIT(ADC_SS3_END_END_POS) - -/****************** Bit definition for ADC_SS3_FSTAT register ************************/ - -#define ADC_SS3_FSTAT_OV_POS 11U -#define ADC_SS3_FSTAT_OV_MSK BIT(ADC_SS3_FSTAT_OV_POS) - -#define ADC_SS3_FSTAT_FULL_POS 10U -#define ADC_SS3_FSTAT_FULL_MSK BIT(ADC_SS3_FSTAT_FULL_POS) - -#define ADC_SS3_FSTAT_UV_POS 9U -#define ADC_SS3_FSTAT_UV_MSK BIT(ADC_SS3_FSTAT_UV_POS) - -#define ADC_SS3_FSTAT_EMPTY_POS 8U -#define ADC_SS3_FSTAT_EMPTY_MSK BIT(ADC_SS3_FSTAT_EMPTY_POS) - -#define ADC_SS3_FSTAT_HPTR_POSS 4U -#define ADC_SS3_FSTAT_HPTR_POSE 7U -#define ADC_SS3_FSTAT_HPTR_MSK BITS(ADC_SS3_FSTAT_HPTR_POSS,ADC_SS3_FSTAT_HPTR_POSE) - -#define ADC_SS3_FSTAT_TPTR_POSS 0U -#define ADC_SS3_FSTAT_TPTR_POSE 3U -#define ADC_SS3_FSTAT_TPTR_MSK BITS(ADC_SS3_FSTAT_TPTR_POSS,ADC_SS3_FSTAT_TPTR_POSE) - -/****************** Bit definition for ADC_SS3_DATA register ************************/ - -#define ADC_SS3_DATA_DATA_POSS 0U -#define ADC_SS3_DATA_DATA_POSE 11U -#define ADC_SS3_DATA_DATA_MSK BITS(ADC_SS3_DATA_DATA_POSS,ADC_SS3_DATA_DATA_POSE) - -typedef struct -{ - __IO uint32_t CFG; - __IO uint32_t SRATE; - __IO uint32_t CHINV; - __IO uint32_t GAINL; - __IO uint32_t GAINH; - __O uint32_t FRF; - __IO uint32_t SSEN; - __IO uint32_t SWTRI; - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; - __IO uint32_t DMA; - uint32_t RESERVED0 ; - __IO uint32_t SS0_CON; - __IO uint32_t SS0_MUX0; - __IO uint32_t SS0_MUX1; - __IO uint32_t SS0_END; - __I uint32_t SS0_FSTAT; - __IO uint32_t SS0_DATA; - uint32_t RESERVED1[2] ; - __IO uint32_t SS1_CON; - __IO uint32_t SS1_MUX0; - __IO uint32_t SS1_END; - __I uint32_t SS1_FSTAT; - __IO uint32_t SS1_DATA; - uint32_t RESERVED2 ; - __IO uint32_t SS2_CON; - __IO uint32_t SS2_MUX0; - __IO uint32_t SS2_END; - __I uint32_t SS2_FSTAT; - __IO uint32_t SS2_DATA; - uint32_t RESERVED3 ; - __IO uint32_t SS3_CON; - __IO uint32_t SS3_MUX0; - __IO uint32_t SS3_END; - __I uint32_t SS3_FSTAT; - __IO uint32_t SS3_DATA; -} ADC_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_aes.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_aes.h deleted file mode 100644 index dd47cdea10..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_aes.h +++ /dev/null @@ -1,193 +0,0 @@ -/** - ************************************************************************************** - * @file REG_AES.h - * @brief AES Head File - * - * @version V0.01 - * @data 11/16/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __AES_H__ -#define __AES_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for AES_CON register ************************/ - -#define AES_CON_READY_POS 22U -#define AES_CON_READY_MSK BIT(AES_CON_READY_POS) - -#define AES_CON_OT_DMA_ST_POS 21U -#define AES_CON_OT_DMA_ST_MSK BIT(AES_CON_OT_DMA_ST_POS) - -#define AES_CON_IT_DMA_ST_POS 20U -#define AES_CON_IT_DMA_ST_MSK BIT(AES_CON_IT_DMA_ST_POS) - -#define AES_CON_OT_DEPTH_POSS 18U -#define AES_CON_OT_DEPTH_POSE 19U -#define AES_CON_OT_DEPTH_MSK BITS(AES_CON_OT_DEPTH_POSS,AES_CON_OT_DEPTH_POSE) - -#define AES_CON_IT_DEPTH_POSS 16U -#define AES_CON_IT_DEPTH_POSE 17U -#define AES_CON_IT_DEPTH_MSK BITS(AES_CON_IT_DEPTH_POSS,AES_CON_IT_DEPTH_POSE) - -#define AES_CON_RE_INIT_POS 8U -#define AES_CON_RE_INIT_MSK BIT(AES_CON_RE_INIT_POS) - -#define AES_CON_DMA_EN_POSS 6U -#define AES_CON_DMA_EN_POSE 7U -#define AES_CON_DMA_EN_MSK BITS(AES_CON_DMA_EN_POSS,AES_CON_DMA_EN_POSE) - -#define AES_CON_BL_POSS 3U -#define AES_CON_BL_POSE 5U -#define AES_CON_BL_MSK BITS(AES_CON_BL_POSS,AES_CON_BL_POSE) - -#define AES_CON_REV_POS 2U -#define AES_CON_REV_MSK BIT(AES_CON_REV_POS) - -#define AES_CON_MODE_POS 1U -#define AES_CON_MODE_MSK BIT(AES_CON_MODE_POS) - -#define AES_CON_START_POS 0U -#define AES_CON_START_MSK BIT(AES_CON_START_POS) - -/****************** Bit definition for AES_IER register ************************/ - -#define AES_IER_DECIE_POS 1U -#define AES_IER_DECIE_MSK BIT(AES_IER_DECIE_POS) - -#define AES_IER_ENCIE_POS 0U -#define AES_IER_ENCIE_MSK BIT(AES_IER_ENCIE_POS) - -/****************** Bit definition for AES_IDR register ************************/ - -#define AES_IDR_DECID_POS 1U -#define AES_IDR_DECID_MSK BIT(AES_IDR_DECID_POS) - -#define AES_IDR_ENCID_POS 0U -#define AES_IDR_ENCID_MSK BIT(AES_IDR_ENCID_POS) - -/****************** Bit definition for AES_IVS register ************************/ - -#define AES_IVS_DECIVS_POS 1U -#define AES_IVS_DECIVS_MSK BIT(AES_IVS_DECIVS_POS) - -#define AES_IVS_ENCIVS_POS 0U -#define AES_IVS_ENCIVS_MSK BIT(AES_IVS_ENCIVS_POS) - -/****************** Bit definition for AES_RIF register ************************/ - -#define AES_RIF_DECRIF_POS 1U -#define AES_RIF_DECRIF_MSK BIT(AES_RIF_DECRIF_POS) - -#define AES_RIF_ENCRIF_POS 0U -#define AES_RIF_ENCRIF_MSK BIT(AES_RIF_ENCRIF_POS) - -/****************** Bit definition for AES_IFM register ************************/ - -#define AES_IFM_DECIFM_POS 1U -#define AES_IFM_DECIFM_MSK BIT(AES_IFM_DECIFM_POS) - -#define AES_IFM_ENCIFM_POS 0U -#define AES_IFM_ENCIFM_MSK BIT(AES_IFM_ENCIFM_POS) - -/****************** Bit definition for AES_ICR register ************************/ - -#define AES_ICR_DECICR_POS 1U -#define AES_ICR_DECICR_MSK BIT(AES_ICR_DECICR_POS) - -#define AES_ICR_ENCICR_POS 0U -#define AES_ICR_ENCICR_MSK BIT(AES_ICR_ENCICR_POS) - -/****************** Bit definition for AES_DIO register ************************/ - -#define AES_DIO_DIO_POSS 0U -#define AES_DIO_DIO_POSE 31U -#define AES_DIO_DIO_MSK BITS(AES_DIO_DIO_POSS,AES_DIO_DIO_POSE) - -/****************** Bit definition for AES_KEY0 register ************************/ - -#define AES_KEY0_KEY0_POSS 0U -#define AES_KEY0_KEY0_POSE 31U -#define AES_KEY0_KEY0_MSK BITS(AES_KEY0_KEY0_POSS,AES_KEY0_KEY0_POSE) - -/****************** Bit definition for AES_KEY1 register ************************/ - -#define AES_KEY1_KEY1_POSS 0U -#define AES_KEY1_KEY1_POSE 31U -#define AES_KEY1_KEY1_MSK BITS(AES_KEY1_KEY1_POSS,AES_KEY1_KEY1_POSE) - -/****************** Bit definition for AES_KEY2 register ************************/ - -#define AES_KEY2_KEY2_POSS 0U -#define AES_KEY2_KEY2_POSE 31U -#define AES_KEY2_KEY2_MSK BITS(AES_KEY2_KEY2_POSS,AES_KEY2_KEY2_POSE) - -/****************** Bit definition for AES_KEY3 register ************************/ - -#define AES_KEY3_KEY3_POSS 0U -#define AES_KEY3_KEY3_POSE 31U -#define AES_KEY3_KEY3_MSK BITS(AES_KEY3_KEY3_POSS,AES_KEY3_KEY3_POSE) - -/****************** Bit definition for AES_IV0 register ************************/ - -#define AES_IV0_IV0_POSS 0U -#define AES_IV0_IV0_POSE 31U -#define AES_IV0_IV0_MSK BITS(AES_IV0_IV0_POSS,AES_IV0_IV0_POSE) - -/****************** Bit definition for AES_IV1 register ************************/ - -#define AES_IV1_IV1_POSS 0U -#define AES_IV1_IV1_POSE 31U -#define AES_IV1_IV1_MSK BITS(AES_IV1_IV1_POSS,AES_IV1_IV1_POSE) - -/****************** Bit definition for AES_IV2 register ************************/ - -#define AES_IV2_IV2_POSS 0U -#define AES_IV2_IV2_POSE 31U -#define AES_IV2_IV2_MSK BITS(AES_IV2_IV2_POSS,AES_IV2_IV2_POSE) - -/****************** Bit definition for AES_IV3 register ************************/ - -#define AES_IV3_IV3_POSS 0U -#define AES_IV3_IV3_POSE 31U -#define AES_IV3_IV3_MSK BITS(AES_IV3_IV3_POSS,AES_IV3_IV3_POSE) - -typedef struct -{ - __IO uint32_t CON; /* 0x000 AES_CON AES Control Register */ - __O uint32_t IER; /* 0x004 AES_IER AES Interrupt Enable Register */ - __O uint32_t IDR; /* 0x008 AES_IDR AES Interrupt Disable Register */ - __I uint32_t IVS; /* 0x00C AES_IVS AES Interrupt Valid Status Register */ - __I uint32_t RIF; /* 0x010 AES_RIF AES Raw Interrupt Flag Status Register */ - __I uint32_t IFM; /* 0x014 AES_IFM AES Interrupt Flag Masked Register */ - __O uint32_t ICR; /* 0x018 AES_ICR AES Interrupt Clear Register */ - __IO uint32_t DIO; /* 0x01C AES_DIO AES 128-bit Input/Output Data Register */ - __IO uint32_t KEY0; /* 0x020 AES_KEY0 AES 256-bit Keyword Register 0 */ - __IO uint32_t KEY1; /* 0x024 AES_KEY1 AES 256-bit Keyword Register 1 */ - __IO uint32_t KEY2; /* 0x028 AES_KEY2 AES 256-bit Keyword Register 2 */ - __IO uint32_t KEY3; /* 0x02C AES_KEY3 AES 256-bit Keyword Register 3 */ - uint32_t RESERVED0[4] ; - __IO uint32_t IV0; /* 0x040 AES_IV0 AES 128-bit Initial Vector Register 0 */ - __IO uint32_t IV1; /* 0x044 AES_IV1 AES 128-bit Initial Vector Register 1 */ - __IO uint32_t IV2; /* 0x048 AES_IV2 AES 128-bit Initial Vector Register 2 */ - __IO uint32_t IV3; /* 0x04C AES_IV3 AES 128-bit Initial Vector Register 3 */ -} AES_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_cmp.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_cmp.h deleted file mode 100644 index 8b1f4e5de6..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_cmp.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - ************************************************************************************** - * @file REG_CMP.h - * @brief CMP Head File - * - * @version V0.01 - * @data 12/3/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __CMP_H__ -#define __CMP_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for CMP_CON register ************************/ - -#define CMP_CON_REFON_POS 4U -#define CMP_CON_REFON_MSK BIT(CMP_CON_REFON_POS) - -#define CMP_CON_CMPON2_POS 1U -#define CMP_CON_CMPON2_MSK BIT(CMP_CON_CMPON2_POS) - -#define CMP_CON_CMPON1_POS 0U -#define CMP_CON_CMPON1_MSK BIT(CMP_CON_CMPON1_POS) - -/****************** Bit definition for CMP_CFG1 register ************************/ - -#define CMP_CFG1_RS_POSS 4U -#define CMP_CFG1_RS_POSE 5U -#define CMP_CFG1_RS_MSK BITS(CMP_CFG1_RS_POSS,CMP_CFG1_RS_POSE) - -#define CMP_CFG1_FEN_POS 3U -#define CMP_CFG1_FEN_MSK BIT(CMP_CFG1_FEN_POS) - -#define CMP_CFG1_PSEN_POS 2U -#define CMP_CFG1_PSEN_MSK BIT(CMP_CFG1_PSEN_POS) - -#define CMP_CFG1_INSEL_POS 1U -#define CMP_CFG1_INSEL_MSK BIT(CMP_CFG1_INSEL_POS) - -#define CMP_CFG1_IPSEL_POS 0U -#define CMP_CFG1_IPSEL_MSK BIT(CMP_CFG1_IPSEL_POS) - -/****************** Bit definition for CMP_CFG2 register ************************/ - -#define CMP_CFG2_RS_POSS 4U -#define CMP_CFG2_RS_POSE 5U -#define CMP_CFG2_RS_MSK BITS(CMP_CFG2_RS_POSS,CMP_CFG2_RS_POSE) - -#define CMP_CFG2_FEN_POS 3U -#define CMP_CFG2_FEN_MSK BIT(CMP_CFG1_FEN_POS) - -#define CMP_CFG2_PSEN_POS 2U -#define CMP_CFG2_PSEN_MSK BIT(CMP_CFG1_PSEN_POS) - -#define CMP_CFG2_INSEL_POS 1U -#define CMP_CFG2_INSEL_MSK BIT(CMP_CFG1_INSEL_POS) - -#define CMP_CFG2_IPSEL_POS 0U -#define CMP_CFG2_IPSEL_MSK BIT(CMP_CFG1_IPSEL_POS) - -/****************** Bit definition for CMP_RULT register ************************/ - -#define CMP_RULT_CMPO2_POS 1U -#define CMP_RULT_CMPO2_MSK BIT(CMP_RULT_CMPO2_POS) - -#define CMP_RULT_CMPO1_POS 0U -#define CMP_RULT_CMPO1_MSK BIT(CMP_RULT_CMPO1_POS) - -typedef struct -{ - __IO uint32_t CON; - __IO uint32_t CFG1; - __IO uint32_t CFG2; - uint32_t RESERVED0[2] ; - __I uint32_t RULT; -} CMP_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_crc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_crc.h deleted file mode 100644 index cdbb00b45c..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_crc.h +++ /dev/null @@ -1,125 +0,0 @@ -/** - ************************************************************************************** - * @file REG_CRC.h - * @brief CRC Head File - * - * @version V0.01 - * @data 11/16/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __CRC_H__ -#define __CRC_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for CRC_INIT register ************************/ - -#define CRC_INIT_INIT_POSS 0U -#define CRC_INIT_INIT_POSE 31U -#define CRC_INIT_INIT_MSK BITS(CRC_INIT_INIT_POSS,CRC_INIT_INIT_POSE) - -/****************** Bit definition for CRC_POLY register ************************/ - -#define CRC_POLY_POLY_POSS 0U -#define CRC_POLY_POLY_POSE 31U -#define CRC_POLY_POLY_MSK BITS(CRC_POLY_POLY_POSS,CRC_POLY_POLY_POSE) - -/****************** Bit definition for CRC_DATA register ************************/ - -#define CRC_DATA_DATA_POSS 0U -#define CRC_DATA_DATA_POSE 31U -#define CRC_DATA_DATA_MSK BITS(CRC_DATA_DATA_POSS,CRC_DATA_DATA_POSE) - -/****************** Bit definition for CRC_COMP register ************************/ - -#define CRC_COMP_COMP_POSS 0U -#define CRC_COMP_COMP_POSE 31U -#define CRC_COMP_COMP_MSK BITS(CRC_COMP_COMP_POSS,CRC_COMP_COMP_POSE) - -/****************** Bit definition for CRC_REMA register ************************/ - -#define CRC_REMA_REMA_POSS 0U -#define CRC_REMA_REMA_POSE 31U -#define CRC_REMA_REMA_MSK BITS(CRC_REMA_REMA_POSS,CRC_REMA_REMA_POSE) - -/****************** Bit definition for CRC_CON register ************************/ - -#define CRC_CON_DMA_POS 16U -#define CRC_CON_DMA_MSK BIT(CRC_CON_DMA_POS) - -#define CRC_CON_MSB_POS 12U -#define CRC_CON_MSB_MSK BIT(CRC_CON_MSB_POS) - -#define CRC_CON_REOUT_POS 10U -#define CRC_CON_REOUT_MSK BIT(CRC_CON_REOUT_POS) - -#define CRC_CON_REIN_POS 8U -#define CRC_CON_REIN_MSK BIT(CRC_CON_REIN_POS) - -#define CRC_CON_SIZE_POSS 4U -#define CRC_CON_SIZE_POSE 5U -#define CRC_CON_SIZE_MSK BITS(CRC_CON_SIZE_POSS,CRC_CON_SIZE_POSE) - -#define CRC_CON_MODE_POSS 2U -#define CRC_CON_MODE_POSE 3U -#define CRC_CON_MODE_MSK BITS(CRC_CON_MODE_POSS,CRC_CON_MODE_POSE) - -#define CRC_CON_RESET_POS 0U -#define CRC_CON_RESET_MSK BIT(CRC_CON_RESET_POS) - -/****************** Bit definition for CRC_DOUT register ************************/ - -#define CRC_DOUT_DOUT_POSS 0U -#define CRC_DOUT_DOUT_POSE 31U -#define CRC_DOUT_DOUT_MSK BITS(CRC_DOUT_DOUT_POSS,CRC_DOUT_DOUT_POSE) - -/****************** Bit definition for CRC_DOUT_XOR register ************************/ - -#define CRC_DOUT_XOR_DOUT_XOR_POSS 0U -#define CRC_DOUT_XOR_DOUT_XOR_POSE 31U -#define CRC_DOUT_XOR_DOUT_XOR_MSK BITS(CRC_DOUT_XOR_DOUT_XOR_POSS,CRC_DOUT_XOR_DOUT_XOR_POSE) - -/****************** Bit definition for CRC_STAT register ************************/ - -#define CRC_STAT_FAIL_POS 8U -#define CRC_STAT_FAIL_MSK BIT(CRC_STAT_FAIL_POS) - -#define CRC_STAT_EMPTY_POS 2U -#define CRC_STAT_EMPTY_MSK BIT(CRC_STAT_EMPTY_POS) - -#define CRC_STAT_BUSY_POS 1U -#define CRC_STAT_BUSY_MSK BIT(CRC_STAT_BUSY_POS) - -#define CRC_STAT_DONE_POS 0U -#define CRC_STAT_DONE_MSK BIT(CRC_STAT_DONE_POS) - -typedef struct -{ - __IO uint32_t INIT; /* 0x000 CRC_INIT CRC Iintial Value Register */ - __IO uint32_t POLY; /* 0x004 CRC_POLY CRC Polynomial Register */ - __IO uint32_t DATA; /* 0x008 CRC_DATA CRC Input Data Register */ - __IO uint32_t COMP; /* 0x00C CRC_COMP CRC Compare Data Register */ - __IO uint32_t REMA; /* 0x010 CRC_REMA CRC Remainder Register */ - __IO uint32_t CON; /* 0x014 CRC_CTRL CRC Control Register */ - __I uint32_t DOUT; /* 0x018 CRC_DOUT CRC Output Data Register */ - __I uint32_t DOUT_XOR; /* 0x01C CRC_DOUT_XOR CRC Output Data Register */ - __I uint32_t STAT; /* 0x020 CRC_STA CRC Status Register */ -} CRC_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dac.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dac.h deleted file mode 100644 index 73a409e5eb..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dac.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - ************************************************************************************** - * @file REG_DAC.h - * @brief DAC Head File - * - * @version V0.01 - * @data 1/14/2019 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __DAC_H__ -#define __DAC_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for DAC_CON register ************************/ - -#define DAC_CON_T_SEL_POSS 9U -#define DAC_CON_T_SEL_POSE 13U -#define DAC_CON_T_SEL_MSK BITS(DAC_CON_T_SEL_POSS,DAC_CON_T_SEL_POSE) - -#define DAC_CON_TRIEN_POS 8U -#define DAC_CON_TRIEN_MSK BIT(DAC_CON_TRIEN_POS) - -#define DAC_CON_MAMP_POSS 3U -#define DAC_CON_MAMP_POSE 6U -#define DAC_CON_MAMP_MSK BITS(DAC_CON_MAMP_POSS,DAC_CON_MAMP_POSE) - -#define DAC_CON_WAVE_POSS 1U -#define DAC_CON_WAVE_POSE 2U -#define DAC_CON_WAVE_MSK BITS(DAC_CON_WAVE_POSS,DAC_CON_WAVE_POSE) - -#define DAC_CON_INVREN_POS 0U -#define DAC_CON_INVREN_MSK BIT(DAC_CON_INVREN_POS) - -/****************** Bit definition for DAC_DIV register ************************/ - -#define DAC_DIV_DIV_VALUE_POSS 0U -#define DAC_DIV_DIV_VALUE_POSE 15U -#define DAC_DIV_DIV_VALUE_MSK BITS(DAC_DIV_DIV_VALUE_POSS,DAC_DIV_DIV_VALUE_POSE) - -/****************** Bit definition for DAC_STAT register ************************/ - -#define DAC_STAT_TX_FULL_POS 1U -#define DAC_STAT_TX_FULL_MSK BIT(DAC_STAT_TX_FULL_POS) - -#define DAC_STAT_BUSY_POS 0U -#define DAC_STAT_BUSY_MSK BIT(DAC_STAT_BUSY_POS) - -/****************** Bit definition for DAC_EN register ************************/ - -#define DAC_EN_DAC_EN_POS 0U -#define DAC_EN_DAC_EN_MSK BIT(DAC_EN_DAC_EN_POS) - -/****************** Bit definition for DAC_DMAC register ************************/ - -#define DAC_DMAC_TXDMAEN_POS 0U -#define DAC_DMAC_TXDMAEN_MSK BIT(DAC_DMAC_TXDMAEN_POS) - -/****************** Bit definition for DAC_TRIG register ************************/ - -#define DAC_TRIG_S_TRIG_POS 0U -#define DAC_TRIG_S_TRIG_MSK BIT(DAC_TRIG_S_TRIG_POS) - -/****************** Bit definition for DAC_DATA register ************************/ - -#define DAC_DATA_TXDATA_POSS 0U -#define DAC_DATA_TXDATA_POSE 11U -#define DAC_DATA_TXDATA_MSK BITS(DAC_DATA_TXDATA_POSS,DAC_DATA_TXDATA_POSE) - -typedef struct -{ - __IO uint32_t CON; - __IO uint32_t DIV; - __I uint32_t STAT; - __IO uint32_t EN; - __IO uint32_t DMAC; - __O uint32_t TRIG; - __IO uint32_t DATA; -} DAC_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dma.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dma.h deleted file mode 100644 index bead8afcdb..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_dma.h +++ /dev/null @@ -1,825 +0,0 @@ -/** - ************************************************************************************** - * @file REG_DMA.h - * @brief DMA Head File - * - * @version V0.01 - * @date 12/5/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __DMA_H__ -#define __DMA_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for DMA_IER register ************************/ - -#define DMA_IER_CH5TABIE_POS 11U -#define DMA_IER_CH5TABIE_MSK BIT(DMA_IER_CH5TABIE_POS) - -#define DMA_IER_CH5BTDIE_POS 10U -#define DMA_IER_CH5BTDIE_MSK BIT(DMA_IER_CH5BTDIE_POS) - -#define DMA_IER_CH4TABIE_POS 9U -#define DMA_IER_CH4TABIE_MSK BIT(DMA_IER_CH4TABIE_POS) - -#define DMA_IER_CH4BTDIE_POS 8U -#define DMA_IER_CH4BTDIE_MSK BIT(DMA_IER_CH4BTDIE_POS) - -#define DMA_IER_CH3TABIE_POS 7U -#define DMA_IER_CH3TABIE_MSK BIT(DMA_IER_CH3TABIE_POS) - -#define DMA_IER_CH3BTDIE_POS 6U -#define DMA_IER_CH3BTDIE_MSK BIT(DMA_IER_CH3BTDIE_POS) - -#define DMA_IER_CH2TABIE_POS 5U -#define DMA_IER_CH2TABIE_MSK BIT(DMA_IER_CH2TABIE_POS) - -#define DMA_IER_CH2BTDIE_POS 4U -#define DMA_IER_CH2BTDIE_MSK BIT(DMA_IER_CH2BTDIE_POS) - -#define DMA_IER_CH1TABIE_POS 3U -#define DMA_IER_CH1TABIE_MSK BIT(DMA_IER_CH1TABIE_POS) - -#define DMA_IER_CH1BTDIE_POS 2U -#define DMA_IER_CH1BTDIE_MSK BIT(DMA_IER_CH1BTDIE_POS) - -#define DMA_IER_CH0TABIE_POS 1U -#define DMA_IER_CH0TABIE_MSK BIT(DMA_IER_CH0TABIE_POS) - -#define DMA_IER_CH0BTDIE_POS 0U -#define DMA_IER_CH0BTDIE_MSK BIT(DMA_IER_CH0BTDIE_POS) - -/****************** Bit definition for DMA_IDR register ************************/ - -#define DMA_IDR_CH5TABID_POS 11U -#define DMA_IDR_CH5TABID_MSK BIT(DMA_IDR_CH5TABID_POS) - -#define DMA_IDR_CH5BTDID_POS 10U -#define DMA_IDR_CH5BTDID_MSK BIT(DMA_IDR_CH5BTDID_POS) - -#define DMA_IDR_CH4TABID_POS 9U -#define DMA_IDR_CH4TABID_MSK BIT(DMA_IDR_CH4TABID_POS) - -#define DMA_IDR_CH4BTDID_POS 8U -#define DMA_IDR_CH4BTDID_MSK BIT(DMA_IDR_CH4BTDID_POS) - -#define DMA_IDR_CH3TABID_POS 7U -#define DMA_IDR_CH3TABID_MSK BIT(DMA_IDR_CH3TABID_POS) - -#define DMA_IDR_CH3BTDID_POS 6U -#define DMA_IDR_CH3BTDID_MSK BIT(DMA_IDR_CH3BTDID_POS) - -#define DMA_IDR_CH2TABID_POS 5U -#define DMA_IDR_CH2TABID_MSK BIT(DMA_IDR_CH2TABID_POS) - -#define DMA_IDR_CH2BTDID_POS 4U -#define DMA_IDR_CH2BTDID_MSK BIT(DMA_IDR_CH2BTDID_POS) - -#define DMA_IDR_CH1TABID_POS 3U -#define DMA_IDR_CH1TABID_MSK BIT(DMA_IDR_CH1TABID_POS) - -#define DMA_IDR_CH1BTDID_POS 2U -#define DMA_IDR_CH1BTDID_MSK BIT(DMA_IDR_CH1BTDID_POS) - -#define DMA_IDR_CH0TABID_POS 1U -#define DMA_IDR_CH0TABID_MSK BIT(DMA_IDR_CH0TABID_POS) - -#define DMA_IDR_CH0BTDID_POS 0U -#define DMA_IDR_CH0BTDID_MSK BIT(DMA_IDR_CH0BTDID_POS) - -/****************** Bit definition for DMA_IVS register ************************/ - -#define DMA_IVS_CH5TABIVS_POS 11U -#define DMA_IVS_CH5TABIVS_MSK BIT(DMA_IVS_CH5TABIVS_POS) - -#define DMA_IVS_CH5BTDIVS_POS 10U -#define DMA_IVS_CH5BTDIVS_MSK BIT(DMA_IVS_CH5BTDIVS_POS) - -#define DMA_IVS_CH4TABIVS_POS 9U -#define DMA_IVS_CH4TABIVS_MSK BIT(DMA_IVS_CH4TABIVS_POS) - -#define DMA_IVS_CH4BTDIVS_POS 8U -#define DMA_IVS_CH4BTDIVS_MSK BIT(DMA_IVS_CH4BTDIVS_POS) - -#define DMA_IVS_CH3TABIVS_POS 7U -#define DMA_IVS_CH3TABIVS_MSK BIT(DMA_IVS_CH3TABIVS_POS) - -#define DMA_IVS_CH3BTDIVS_POS 6U -#define DMA_IVS_CH3BTDIVS_MSK BIT(DMA_IVS_CH3BTDIVS_POS) - -#define DMA_IVS_CH2TABIVS_POS 5U -#define DMA_IVS_CH2TABIVS_MSK BIT(DMA_IVS_CH2TABIVS_POS) - -#define DMA_IVS_CH2BTDIVS_POS 4U -#define DMA_IVS_CH2BTDIVS_MSK BIT(DMA_IVS_CH2BTDIVS_POS) - -#define DMA_IVS_CH1TABIVS_POS 3U -#define DMA_IVS_CH1TABIVS_MSK BIT(DMA_IVS_CH1TABIVS_POS) - -#define DMA_IVS_CH1BTDIVS_POS 2U -#define DMA_IVS_CH1BTDIVS_MSK BIT(DMA_IVS_CH1BTDIVS_POS) - -#define DMA_IVS_CH0TABIVS_POS 1U -#define DMA_IVS_CH0TABIVS_MSK BIT(DMA_IVS_CH0TABIVS_POS) - -#define DMA_IVS_CH0BTDIVS_POS 0U -#define DMA_IVS_CH0BTDIVS_MSK BIT(DMA_IVS_CH0BTDIVS_POS) - -/****************** Bit definition for DMA_RIF register ************************/ - -#define DMA_RIF_CH5TABRIF_POS 11U -#define DMA_RIF_CH5TABRIF_MSK BIT(DMA_RIF_CH5TABRIF_POS) - -#define DMA_RIF_CH5BTDRIF_POS 10U -#define DMA_RIF_CH5BTDRIF_MSK BIT(DMA_RIF_CH5BTDRIF_POS) - -#define DMA_RIF_CH4TABRIF_POS 9U -#define DMA_RIF_CH4TABRIF_MSK BIT(DMA_RIF_CH4TABRIF_POS) - -#define DMA_RIF_CH4BTDRIF_POS 8U -#define DMA_RIF_CH4BTDRIF_MSK BIT(DMA_RIF_CH4BTDRIF_POS) - -#define DMA_RIF_CH3TABRIF_POS 7U -#define DMA_RIF_CH3TABRIF_MSK BIT(DMA_RIF_CH3TABRIF_POS) - -#define DMA_RIF_CH3BTDRIF_POS 6U -#define DMA_RIF_CH3BTDRIF_MSK BIT(DMA_RIF_CH3BTDRIF_POS) - -#define DMA_RIF_CH2TABRIF_POS 5U -#define DMA_RIF_CH2TABRIF_MSK BIT(DMA_RIF_CH2TABRIF_POS) - -#define DMA_RIF_CH2BTDRIF_POS 4U -#define DMA_RIF_CH2BTDRIF_MSK BIT(DMA_RIF_CH2BTDRIF_POS) - -#define DMA_RIF_CH1TABRIF_POS 3U -#define DMA_RIF_CH1TABRIF_MSK BIT(DMA_RIF_CH1TABRIF_POS) - -#define DMA_RIF_CH1BTDRIF_POS 2U -#define DMA_RIF_CH1BTDRIF_MSK BIT(DMA_RIF_CH1BTDRIF_POS) - -#define DMA_RIF_CH0TABRIF_POS 1U -#define DMA_RIF_CH0TABRIF_MSK BIT(DMA_RIF_CH0TABRIF_POS) - -#define DMA_RIF_CH0BTDRIF_POS 0U -#define DMA_RIF_CH0BTDRIF_MSK BIT(DMA_RIF_CH0BTDRIF_POS) - -/****************** Bit definition for DMA_IFM register ************************/ - -#define DMA_IFM_CH5TABIFM_POS 11U -#define DMA_IFM_CH5TABIFM_MSK BIT(DMA_IFM_CH5TABIFM_POS) - -#define DMA_IFM_CH5BTDIFM_POS 10U -#define DMA_IFM_CH5BTDIFM_MSK BIT(DMA_IFM_CH5BTDIFM_POS) - -#define DMA_IFM_CH4TABIFM_POS 9U -#define DMA_IFM_CH4TABIFM_MSK BIT(DMA_IFM_CH4TABIFM_POS) - -#define DMA_IFM_CH4BTDIFM_POS 8U -#define DMA_IFM_CH4BTDIFM_MSK BIT(DMA_IFM_CH4BTDIFM_POS) - -#define DMA_IFM_CH3TABIFM_POS 7U -#define DMA_IFM_CH3TABIFM_MSK BIT(DMA_IFM_CH3TABIFM_POS) - -#define DMA_IFM_CH3BTDIFM_POS 6U -#define DMA_IFM_CH3BTDIFM_MSK BIT(DMA_IFM_CH3BTDIFM_POS) - -#define DMA_IFM_CH2TABIFM_POS 5U -#define DMA_IFM_CH2TABIFM_MSK BIT(DMA_IFM_CH2TABIFM_POS) - -#define DMA_IFM_CH2BTDIFM_POS 4U -#define DMA_IFM_CH2BTDIFM_MSK BIT(DMA_IFM_CH2BTDIFM_POS) - -#define DMA_IFM_CH1TABIFM_POS 3U -#define DMA_IFM_CH1TABIFM_MSK BIT(DMA_IFM_CH1TABIFM_POS) - -#define DMA_IFM_CH1BTDIFM_POS 2U -#define DMA_IFM_CH1BTDIFM_MSK BIT(DMA_IFM_CH1BTDIFM_POS) - -#define DMA_IFM_CH0TABIFM_POS 1U -#define DMA_IFM_CH0TABIFM_MSK BIT(DMA_IFM_CH0TABIFM_POS) - -#define DMA_IFM_CH0BTDIFM_POS 0U -#define DMA_IFM_CH0BTDIFM_MSK BIT(DMA_IFM_CH0BTDIFM_POS) - -/****************** Bit definition for DMA_ICR register ************************/ - -#define DMA_ICR_CH5TABICR_POS 11U -#define DMA_ICR_CH5TABICR_MSK BIT(DMA_ICR_CH5TABICR_POS) - -#define DMA_ICR_CH5BTDICR_POS 10U -#define DMA_ICR_CH5BTDICR_MSK BIT(DMA_ICR_CH5BTDICR_POS) - -#define DMA_ICR_CH4TABICR_POS 9U -#define DMA_ICR_CH4TABICR_MSK BIT(DMA_ICR_CH4TABICR_POS) - -#define DMA_ICR_CH4BTDICR_POS 8U -#define DMA_ICR_CH4BTDICR_MSK BIT(DMA_ICR_CH4BTDICR_POS) - -#define DMA_ICR_CH3TABICR_POS 7U -#define DMA_ICR_CH3TABICR_MSK BIT(DMA_ICR_CH3TABICR_POS) - -#define DMA_ICR_CH3BTDICR_POS 6U -#define DMA_ICR_CH3BTDICR_MSK BIT(DMA_ICR_CH3BTDICR_POS) - -#define DMA_ICR_CH2TABICR_POS 5U -#define DMA_ICR_CH2TABICR_MSK BIT(DMA_ICR_CH2TABICR_POS) - -#define DMA_ICR_CH2BTDICR_POS 4U -#define DMA_ICR_CH2BTDICR_MSK BIT(DMA_ICR_CH2BTDICR_POS) - -#define DMA_ICR_CH1TABICR_POS 3U -#define DMA_ICR_CH1TABICR_MSK BIT(DMA_ICR_CH1TABICR_POS) - -#define DMA_ICR_CH1BTDICR_POS 2U -#define DMA_ICR_CH1BTDICR_MSK BIT(DMA_ICR_CH1BTDICR_POS) - -#define DMA_ICR_CH0TABICR_POS 1U -#define DMA_ICR_CH0TABICR_MSK BIT(DMA_ICR_CH0TABICR_POS) - -#define DMA_ICR_CH0BTDICR_POS 0U -#define DMA_ICR_CH0BTDICR_MSK BIT(DMA_ICR_CH0BTDICR_POS) - -/****************** Bit definition for DMA_EMSG register ************************/ - -#define DMA_EMSG_CH5PFSER_POS 23U -#define DMA_EMSG_CH5PFSER_MSK BIT(DMA_EMSG_CH5PFSER_POS) - -#define DMA_EMSG_CH5PFOV_POS 22U -#define DMA_EMSG_CH5PFOV_MSK BIT(DMA_EMSG_CH5PFOV_POS) - -#define DMA_EMSG_CH5SETBUER_POS 21U -#define DMA_EMSG_CH5SETBUER_MSK BIT(DMA_EMSG_CH5SETBUER_POS) - -#define DMA_EMSG_CH5SETBCER_POS 20U -#define DMA_EMSG_CH5SETBCER_MSK BIT(DMA_EMSG_CH5SETBCER_POS) - -#define DMA_EMSG_CH4PFSER_POS 19U -#define DMA_EMSG_CH4PFSER_MSK BIT(DMA_EMSG_CH4PFSER_POS) - -#define DMA_EMSG_CH4PFOV_POS 18U -#define DMA_EMSG_CH4PFOV_MSK BIT(DMA_EMSG_CH4PFOV_POS) - -#define DMA_EMSG_CH4SETBUER_POS 17U -#define DMA_EMSG_CH4SETBUER_MSK BIT(DMA_EMSG_CH4SETBUER_POS) - -#define DMA_EMSG_CH4SETBCER_POS 16U -#define DMA_EMSG_CH4SETBCER_MSK BIT(DMA_EMSG_CH4SETBCER_POS) - -#define DMA_EMSG_CH3PFSER_POS 15U -#define DMA_EMSG_CH3PFSER_MSK BIT(DMA_EMSG_CH3PFSER_POS) - -#define DMA_EMSG_CH3PFOV_POS 14U -#define DMA_EMSG_CH3PFOV_MSK BIT(DMA_EMSG_CH3PFOV_POS) - -#define DMA_EMSG_CH3SETBUER_POS 13U -#define DMA_EMSG_CH3SETBUER_MSK BIT(DMA_EMSG_CH3SETBUER_POS) - -#define DMA_EMSG_CH3SETBCER_POS 12U -#define DMA_EMSG_CH3SETBCER_MSK BIT(DMA_EMSG_CH3SETBCER_POS) - -#define DMA_EMSG_CH2PFSER_POS 11U -#define DMA_EMSG_CH2PFSER_MSK BIT(DMA_EMSG_CH2PFSER_POS) - -#define DMA_EMSG_CH2PFOV_POS 10U -#define DMA_EMSG_CH2PFOV_MSK BIT(DMA_EMSG_CH2PFOV_POS) - -#define DMA_EMSG_CH2SETBUER_POS 9U -#define DMA_EMSG_CH2SETBUER_MSK BIT(DMA_EMSG_CH2SETBUER_POS) - -#define DMA_EMSG_CH2SETBCER_POS 8U -#define DMA_EMSG_CH2SETBCER_MSK BIT(DMA_EMSG_CH2SETBCER_POS) - -#define DMA_EMSG_CH1PFSER_POS 7U -#define DMA_EMSG_CH1PFSER_MSK BIT(DMA_EMSG_CH1PFSER_POS) - -#define DMA_EMSG_CH1PFOV_POS 6U -#define DMA_EMSG_CH1PFOV_MSK BIT(DMA_EMSG_CH1PFOV_POS) - -#define DMA_EMSG_CH1SETBUER_POS 5U -#define DMA_EMSG_CH1SETBUER_MSK BIT(DMA_EMSG_CH1SETBUER_POS) - -#define DMA_EMSG_CH1SETBCER_POS 4U -#define DMA_EMSG_CH1SETBCER_MSK BIT(DMA_EMSG_CH1SETBCER_POS) - -#define DMA_EMSG_CH0PFSER_POS 3U -#define DMA_EMSG_CH0PFSER_MSK BIT(DMA_EMSG_CH0PFSER_POS) - -#define DMA_EMSG_CH0PFOV_POS 2U -#define DMA_EMSG_CH0PFOV_MSK BIT(DMA_EMSG_CH0PFOV_POS) - -#define DMA_EMSG_CH0SETBUER_POS 1U -#define DMA_EMSG_CH0SETBUER_MSK BIT(DMA_EMSG_CH0SETBUER_POS) - -#define DMA_EMSG_CH0SETBCER_POS 0U -#define DMA_EMSG_CH0SETBCER_MSK BIT(DMA_EMSG_CH0SETBCER_POS) - -/****************** Bit definition for DMA_CSR0 register ************************/ - -#define DMA_CSR0_DINCOS_POS 30U -#define DMA_CSR0_DINCOS_MSK BIT(DMA_CSR0_DINCOS_POS) - -#define DMA_CSR0_DBUSEL_POSS 27U -#define DMA_CSR0_DBUSEL_POSE 29U -#define DMA_CSR0_DBUSEL_MSK BITS(DMA_CSR0_DBUSEL_POSS,DMA_CSR0_DBUSEL_POSE) - -#define DMA_CSR0_DDWSEL_POSS 25U -#define DMA_CSR0_DDWSEL_POSE 26U -#define DMA_CSR0_DDWSEL_MSK BITS(DMA_CSR0_DDWSEL_POSS,DMA_CSR0_DDWSEL_POSE) - -#define DMA_CSR0_DINC_POS 24U -#define DMA_CSR0_DINC_MSK BIT(DMA_CSR0_DINC_POS) - -#define DMA_CSR0_SINCOS_POS 22U -#define DMA_CSR0_SINCOS_MSK BIT(DMA_CSR0_SINCOS_POS) - -#define DMA_CSR0_SBUSEL_POSS 19U -#define DMA_CSR0_SBUSEL_POSE 21U -#define DMA_CSR0_SBUSEL_MSK BITS(DMA_CSR0_SBUSEL_POSS,DMA_CSR0_SBUSEL_POSE) - -#define DMA_CSR0_SDWSEL_POSS 17U -#define DMA_CSR0_SDWSEL_POSE 18U -#define DMA_CSR0_SDWSEL_MSK BITS(DMA_CSR0_SDWSEL_POSS,DMA_CSR0_SDWSEL_POSE) - -#define DMA_CSR0_SINC_POS 16U -#define DMA_CSR0_SINC_MSK BIT(DMA_CSR0_SINC_POS) - -#define DMA_CSR0_PHSS_POSS 9U -#define DMA_CSR0_PHSS_POSE 15U -#define DMA_CSR0_PHSS_MSK BITS(DMA_CSR0_PHSS_POSS,DMA_CSR0_PHSS_POSE) - -#define DMA_CSR0_CHPRI_POSS 6U -#define DMA_CSR0_CHPRI_POSE 8U -#define DMA_CSR0_CHPRI_MSK BITS(DMA_CSR0_CHPRI_POSS,DMA_CSR0_CHPRI_POSE) - -#define DMA_CSR0_MODESEL_POSS 4U -#define DMA_CSR0_MODESEL_POSE 5U -#define DMA_CSR0_MODESEL_MSK BITS(DMA_CSR0_MODESEL_POSS,DMA_CSR0_MODESEL_POSE) - -#define DMA_CSR0_DIRMDEN_POS 3U -#define DMA_CSR0_DIRMDEN_MSK BIT(DMA_CSR0_DIRMDEN_POS) - -#define DMA_CSR0_PFCTRL_POS 2U -#define DMA_CSR0_PFCTRL_MSK BIT(DMA_CSR0_PFCTRL_POS) - -#define DMA_CSR0_CIRC_POS 1U -#define DMA_CSR0_CIRC_MSK BIT(DMA_CSR0_CIRC_POS) - -#define DMA_CSR0_CHEN_POS 0U -#define DMA_CSR0_CHEN_MSK BIT(DMA_CSR0_CHEN_POS) - -/****************** Bit definition for DMA_SAR0 register ************************/ - -#define DMA_SAR0_SAR_POSS 0U -#define DMA_SAR0_SAR_POSE 31U -#define DMA_SAR0_SAR_MSK BITS(DMA_SAR0_SAR_POSS,DMA_SAR0_SAR_POSE) - -/****************** Bit definition for DMA_DAR0 register ************************/ - -#define DMA_DAR0_DAR_POSS 0U -#define DMA_DAR0_DAR_POSE 31U -#define DMA_DAR0_DAR_MSK BITS(DMA_DAR0_DAR_POSS,DMA_DAR0_DAR_POSE) - -/****************** Bit definition for DMA_BCR0 register ************************/ - -#define DMA_BCR0_CBCR_POSS 16U -#define DMA_BCR0_CBCR_POSE 31U -#define DMA_BCR0_CBCR_MSK BITS(DMA_BCR0_CBCR_POSS,DMA_BCR0_CBCR_POSE) - -#define DMA_BCR0_BCR_POSS 0U -#define DMA_BCR0_BCR_POSE 15U -#define DMA_BCR0_BCR_MSK BITS(DMA_BCR0_BCR_POSS,DMA_BCR0_BCR_POSE) - -/****************** Bit definition for DMA_CSR1 register ************************/ - -#define DMA_CSR1_DINCOS_POS 30U -#define DMA_CSR1_DINCOS_MSK BIT(DMA_CSR1_DINCOS_POS) - -#define DMA_CSR1_DBUSEL_POSS 27U -#define DMA_CSR1_DBUSEL_POSE 29U -#define DMA_CSR1_DBUSEL_MSK BITS(DMA_CSR1_DBUSEL_POSS,DMA_CSR1_DBUSEL_POSE) - -#define DMA_CSR1_DDWSEL_POSS 25U -#define DMA_CSR1_DDWSEL_POSE 26U -#define DMA_CSR1_DDWSEL_MSK BITS(DMA_CSR1_DDWSEL_POSS,DMA_CSR1_DDWSEL_POSE) - -#define DMA_CSR1_DINC_POS 24U -#define DMA_CSR1_DINC_MSK BIT(DMA_CSR1_DINC_POS) - -#define DMA_CSR1_SINCOS_POS 22U -#define DMA_CSR1_SINCOS_MSK BIT(DMA_CSR1_SINCOS_POS) - -#define DMA_CSR1_SBUSEL_POSS 19U -#define DMA_CSR1_SBUSEL_POSE 21U -#define DMA_CSR1_SBUSEL_MSK BITS(DMA_CSR1_SBUSEL_POSS,DMA_CSR1_SBUSEL_POSE) - -#define DMA_CSR1_SDWSEL_POSS 17U -#define DMA_CSR1_SDWSEL_POSE 18U -#define DMA_CSR1_SDWSEL_MSK BITS(DMA_CSR1_SDWSEL_POSS,DMA_CSR1_SDWSEL_POSE) - -#define DMA_CSR1_SINC_POS 16U -#define DMA_CSR1_SINC_MSK BIT(DMA_CSR1_SINC_POS) - -#define DMA_CSR1_PHSS_POSS 9U -#define DMA_CSR1_PHSS_POSE 15U -#define DMA_CSR1_PHSS_MSK BITS(DMA_CSR1_PHSS_POSS,DMA_CSR1_PHSS_POSE) - -#define DMA_CSR1_CHPRI_POSS 6U -#define DMA_CSR1_CHPRI_POSE 8U -#define DMA_CSR1_CHPRI_MSK BITS(DMA_CSR1_CHPRI_POSS,DMA_CSR1_CHPRI_POSE) - -#define DMA_CSR1_MODESEL_POSS 4U -#define DMA_CSR1_MODESEL_POSE 5U -#define DMA_CSR1_MODESEL_MSK BITS(DMA_CSR1_MODESEL_POSS,DMA_CSR1_MODESEL_POSE) - -#define DMA_CSR1_DIRMDEN_POS 3U -#define DMA_CSR1_DIRMDEN_MSK BIT(DMA_CSR1_DIRMDEN_POS) - -#define DMA_CSR1_PFCTRL_POS 2U -#define DMA_CSR1_PFCTRL_MSK BIT(DMA_CSR1_PFCTRL_POS) - -#define DMA_CSR1_CIRC_POS 1U -#define DMA_CSR1_CIRC_MSK BIT(DMA_CSR1_CIRC_POS) - -#define DMA_CSR1_CHEN_POS 0U -#define DMA_CSR1_CHEN_MSK BIT(DMA_CSR1_CHEN_POS) - -/****************** Bit definition for DMA_SAR1 register ************************/ - -#define DMA_SAR1_SAR_POSS 0U -#define DMA_SAR1_SAR_POSE 31U -#define DMA_SAR1_SAR_MSK BITS(DMA_SAR1_SAR_POSS,DMA_SAR1_SAR_POSE) - -/****************** Bit definition for DMA_DAR1 register ************************/ - -#define DMA_DAR1_DAR_POSS 0U -#define DMA_DAR1_DAR_POSE 31U -#define DMA_DAR1_DAR_MSK BITS(DMA_DAR1_DAR_POSS,DMA_DAR1_DAR_POSE) - -/****************** Bit definition for DMA_BCR1 register ************************/ - -#define DMA_BCR1_CBCR_POSS 16U -#define DMA_BCR1_CBCR_POSE 31U -#define DMA_BCR1_CBCR_MSK BITS(DMA_BCR1_CBCR_POSS,DMA_BCR1_CBCR_POSE) - -#define DMA_BCR1_BCR_POSS 0U -#define DMA_BCR1_BCR_POSE 15U -#define DMA_BCR1_BCR_MSK BITS(DMA_BCR1_BCR_POSS,DMA_BCR1_BCR_POSE) - -/****************** Bit definition for DMA_CSR2 register ************************/ - -#define DMA_CSR2_DINCOS_POS 30U -#define DMA_CSR2_DINCOS_MSK BIT(DMA_CSR2_DINCOS_POS) - -#define DMA_CSR2_DBUSEL_POSS 27U -#define DMA_CSR2_DBUSEL_POSE 29U -#define DMA_CSR2_DBUSEL_MSK BITS(DMA_CSR2_DBUSEL_POSS,DMA_CSR2_DBUSEL_POSE) - -#define DMA_CSR2_DDWSEL_POSS 25U -#define DMA_CSR2_DDWSEL_POSE 26U -#define DMA_CSR2_DDWSEL_MSK BITS(DMA_CSR2_DDWSEL_POSS,DMA_CSR2_DDWSEL_POSE) - -#define DMA_CSR2_DINC_POS 24U -#define DMA_CSR2_DINC_MSK BIT(DMA_CSR2_DINC_POS) - -#define DMA_CSR2_SINCOS_POS 22U -#define DMA_CSR2_SINCOS_MSK BIT(DMA_CSR2_SINCOS_POS) - -#define DMA_CSR2_SBUSEL_POSS 19U -#define DMA_CSR2_SBUSEL_POSE 21U -#define DMA_CSR2_SBUSEL_MSK BITS(DMA_CSR2_SBUSEL_POSS,DMA_CSR2_SBUSEL_POSE) - -#define DMA_CSR2_SDWSEL_POSS 17U -#define DMA_CSR2_SDWSEL_POSE 18U -#define DMA_CSR2_SDWSEL_MSK BITS(DMA_CSR2_SDWSEL_POSS,DMA_CSR2_SDWSEL_POSE) - -#define DMA_CSR2_SINC_POS 16U -#define DMA_CSR2_SINC_MSK BIT(DMA_CSR2_SINC_POS) - -#define DMA_CSR2_PHSS_POSS 9U -#define DMA_CSR2_PHSS_POSE 15U -#define DMA_CSR2_PHSS_MSK BITS(DMA_CSR2_PHSS_POSS,DMA_CSR2_PHSS_POSE) - -#define DMA_CSR2_CHPRI_POSS 6U -#define DMA_CSR2_CHPRI_POSE 8U -#define DMA_CSR2_CHPRI_MSK BITS(DMA_CSR2_CHPRI_POSS,DMA_CSR2_CHPRI_POSE) - -#define DMA_CSR2_MODESEL_POSS 4U -#define DMA_CSR2_MODESEL_POSE 5U -#define DMA_CSR2_MODESEL_MSK BITS(DMA_CSR2_MODESEL_POSS,DMA_CSR2_MODESEL_POSE) - -#define DMA_CSR2_DIRMDEN_POS 3U -#define DMA_CSR2_DIRMDEN_MSK BIT(DMA_CSR2_DIRMDEN_POS) - -#define DMA_CSR2_PFCTRL_POS 2U -#define DMA_CSR2_PFCTRL_MSK BIT(DMA_CSR2_PFCTRL_POS) - -#define DMA_CSR2_CIRC_POS 1U -#define DMA_CSR2_CIRC_MSK BIT(DMA_CSR2_CIRC_POS) - -#define DMA_CSR2_CHEN_POS 0U -#define DMA_CSR2_CHEN_MSK BIT(DMA_CSR2_CHEN_POS) - -/****************** Bit definition for DMA_SAR2 register ************************/ - -#define DMA_SAR2_SAR_POSS 0U -#define DMA_SAR2_SAR_POSE 31U -#define DMA_SAR2_SAR_MSK BITS(DMA_SAR2_SAR_POSS,DMA_SAR2_SAR_POSE) - -/****************** Bit definition for DMA_DAR2 register ************************/ - -#define DMA_DAR2_DAR_POSS 0U -#define DMA_DAR2_DAR_POSE 31U -#define DMA_DAR2_DAR_MSK BITS(DMA_DAR2_DAR_POSS,DMA_DAR2_DAR_POSE) - -/****************** Bit definition for DMA_BCR2 register ************************/ - -#define DMA_BCR2_CBCR_POSS 16U -#define DMA_BCR2_CBCR_POSE 31U -#define DMA_BCR2_CBCR_MSK BITS(DMA_BCR2_CBCR_POSS,DMA_BCR2_CBCR_POSE) - -#define DMA_BCR2_BCR_POSS 0U -#define DMA_BCR2_BCR_POSE 15U -#define DMA_BCR2_BCR_MSK BITS(DMA_BCR2_BCR_POSS,DMA_BCR2_BCR_POSE) - -/****************** Bit definition for DMA_CSR3 register ************************/ - -#define DMA_CSR3_DINCOS_POS 30U -#define DMA_CSR3_DINCOS_MSK BIT(DMA_CSR3_DINCOS_POS) - -#define DMA_CSR3_DBUSEL_POSS 27U -#define DMA_CSR3_DBUSEL_POSE 29U -#define DMA_CSR3_DBUSEL_MSK BITS(DMA_CSR3_DBUSEL_POSS,DMA_CSR3_DBUSEL_POSE) - -#define DMA_CSR3_DDWSEL_POSS 25U -#define DMA_CSR3_DDWSEL_POSE 26U -#define DMA_CSR3_DDWSEL_MSK BITS(DMA_CSR3_DDWSEL_POSS,DMA_CSR3_DDWSEL_POSE) - -#define DMA_CSR3_DINC_POS 24U -#define DMA_CSR3_DINC_MSK BIT(DMA_CSR3_DINC_POS) - -#define DMA_CSR3_SINCOS_POS 22U -#define DMA_CSR3_SINCOS_MSK BIT(DMA_CSR3_SINCOS_POS) - -#define DMA_CSR3_SBUSEL_POSS 19U -#define DMA_CSR3_SBUSEL_POSE 21U -#define DMA_CSR3_SBUSEL_MSK BITS(DMA_CSR3_SBUSEL_POSS,DMA_CSR3_SBUSEL_POSE) - -#define DMA_CSR3_SDWSEL_POSS 17U -#define DMA_CSR3_SDWSEL_POSE 18U -#define DMA_CSR3_SDWSEL_MSK BITS(DMA_CSR3_SDWSEL_POSS,DMA_CSR3_SDWSEL_POSE) - -#define DMA_CSR3_SINC_POS 16U -#define DMA_CSR3_SINC_MSK BIT(DMA_CSR3_SINC_POS) - -#define DMA_CSR3_PHSS_POSS 9U -#define DMA_CSR3_PHSS_POSE 15U -#define DMA_CSR3_PHSS_MSK BITS(DMA_CSR3_PHSS_POSS,DMA_CSR3_PHSS_POSE) - -#define DMA_CSR3_CHPRI_POSS 6U -#define DMA_CSR3_CHPRI_POSE 8U -#define DMA_CSR3_CHPRI_MSK BITS(DMA_CSR3_CHPRI_POSS,DMA_CSR3_CHPRI_POSE) - -#define DMA_CSR3_MODESEL_POSS 4U -#define DMA_CSR3_MODESEL_POSE 5U -#define DMA_CSR3_MODESEL_MSK BITS(DMA_CSR3_MODESEL_POSS,DMA_CSR3_MODESEL_POSE) - -#define DMA_CSR3_DIRMDEN_POS 3U -#define DMA_CSR3_DIRMDEN_MSK BIT(DMA_CSR3_DIRMDEN_POS) - -#define DMA_CSR3_PFCTRL_POS 2U -#define DMA_CSR3_PFCTRL_MSK BIT(DMA_CSR3_PFCTRL_POS) - -#define DMA_CSR3_CIRC_POS 1U -#define DMA_CSR3_CIRC_MSK BIT(DMA_CSR3_CIRC_POS) - -#define DMA_CSR3_CHEN_POS 0U -#define DMA_CSR3_CHEN_MSK BIT(DMA_CSR3_CHEN_POS) - -/****************** Bit definition for DMA_SAR3 register ************************/ - -#define DMA_SAR3_SAR_POSS 0U -#define DMA_SAR3_SAR_POSE 31U -#define DMA_SAR3_SAR_MSK BITS(DMA_SAR3_SAR_POSS,DMA_SAR3_SAR_POSE) - -/****************** Bit definition for DMA_DAR3 register ************************/ - -#define DMA_DAR3_DAR_POSS 0U -#define DMA_DAR3_DAR_POSE 31U -#define DMA_DAR3_DAR_MSK BITS(DMA_DAR3_DAR_POSS,DMA_DAR3_DAR_POSE) - -/****************** Bit definition for DMA_BCR3 register ************************/ - -#define DMA_BCR3_CBCR_POSS 16U -#define DMA_BCR3_CBCR_POSE 31U -#define DMA_BCR3_CBCR_MSK BITS(DMA_BCR3_CBCR_POSS,DMA_BCR3_CBCR_POSE) - -#define DMA_BCR3_BCR_POSS 0U -#define DMA_BCR3_BCR_POSE 15U -#define DMA_BCR3_BCR_MSK BITS(DMA_BCR3_BCR_POSS,DMA_BCR3_BCR_POSE) - -/****************** Bit definition for DMA_CSR4 register ************************/ - -#define DMA_CSR4_DINCOS_POS 30U -#define DMA_CSR4_DINCOS_MSK BIT(DMA_CSR4_DINCOS_POS) - -#define DMA_CSR4_DBUSEL_POSS 27U -#define DMA_CSR4_DBUSEL_POSE 29U -#define DMA_CSR4_DBUSEL_MSK BITS(DMA_CSR4_DBUSEL_POSS,DMA_CSR4_DBUSEL_POSE) - -#define DMA_CSR4_DDWSEL_POSS 25U -#define DMA_CSR4_DDWSEL_POSE 26U -#define DMA_CSR4_DDWSEL_MSK BITS(DMA_CSR4_DDWSEL_POSS,DMA_CSR4_DDWSEL_POSE) - -#define DMA_CSR4_DINC_POS 24U -#define DMA_CSR4_DINC_MSK BIT(DMA_CSR4_DINC_POS) - -#define DMA_CSR4_SINCOS_POS 22U -#define DMA_CSR4_SINCOS_MSK BIT(DMA_CSR4_SINCOS_POS) - -#define DMA_CSR4_SBUSEL_POSS 19U -#define DMA_CSR4_SBUSEL_POSE 21U -#define DMA_CSR4_SBUSEL_MSK BITS(DMA_CSR4_SBUSEL_POSS,DMA_CSR4_SBUSEL_POSE) - -#define DMA_CSR4_SDWSEL_POSS 17U -#define DMA_CSR4_SDWSEL_POSE 18U -#define DMA_CSR4_SDWSEL_MSK BITS(DMA_CSR4_SDWSEL_POSS,DMA_CSR4_SDWSEL_POSE) - -#define DMA_CSR4_SINC_POS 16U -#define DMA_CSR4_SINC_MSK BIT(DMA_CSR4_SINC_POS) - -#define DMA_CSR4_PHSS_POSS 9U -#define DMA_CSR4_PHSS_POSE 15U -#define DMA_CSR4_PHSS_MSK BITS(DMA_CSR4_PHSS_POSS,DMA_CSR4_PHSS_POSE) - -#define DMA_CSR4_CHPRI_POSS 6U -#define DMA_CSR4_CHPRI_POSE 8U -#define DMA_CSR4_CHPRI_MSK BITS(DMA_CSR4_CHPRI_POSS,DMA_CSR4_CHPRI_POSE) - -#define DMA_CSR4_MODESEL_POSS 4U -#define DMA_CSR4_MODESEL_POSE 5U -#define DMA_CSR4_MODESEL_MSK BITS(DMA_CSR4_MODESEL_POSS,DMA_CSR4_MODESEL_POSE) - -#define DMA_CSR4_DIRMDEN_POS 3U -#define DMA_CSR4_DIRMDEN_MSK BIT(DMA_CSR4_DIRMDEN_POS) - -#define DMA_CSR4_PFCTRL_POS 2U -#define DMA_CSR4_PFCTRL_MSK BIT(DMA_CSR4_PFCTRL_POS) - -#define DMA_CSR4_CIRC_POS 1U -#define DMA_CSR4_CIRC_MSK BIT(DMA_CSR4_CIRC_POS) - -#define DMA_CSR4_CHEN_POS 0U -#define DMA_CSR4_CHEN_MSK BIT(DMA_CSR4_CHEN_POS) - -/****************** Bit definition for DMA_SAR4 register ************************/ - -#define DMA_SAR4_SAR_POSS 0U -#define DMA_SAR4_SAR_POSE 31U -#define DMA_SAR4_SAR_MSK BITS(DMA_SAR4_SAR_POSS,DMA_SAR4_SAR_POSE) - -/****************** Bit definition for DMA_DAR4 register ************************/ - -#define DMA_DAR4_DAR_POSS 0U -#define DMA_DAR4_DAR_POSE 31U -#define DMA_DAR4_DAR_MSK BITS(DMA_DAR4_DAR_POSS,DMA_DAR4_DAR_POSE) - -/****************** Bit definition for DMA_BCR4 register ************************/ - -#define DMA_BCR4_CBCR_POSS 16U -#define DMA_BCR4_CBCR_POSE 31U -#define DMA_BCR4_CBCR_MSK BITS(DMA_BCR4_CBCR_POSS,DMA_BCR4_CBCR_POSE) - -#define DMA_BCR4_BCR_POSS 0U -#define DMA_BCR4_BCR_POSE 15U -#define DMA_BCR4_BCR_MSK BITS(DMA_BCR4_BCR_POSS,DMA_BCR4_BCR_POSE) - -/****************** Bit definition for DMA_CSR5 register ************************/ - -#define DMA_CSR5_DINCOS_POS 30U -#define DMA_CSR5_DINCOS_MSK BIT(DMA_CSR5_DINCOS_POS) - -#define DMA_CSR5_DBUSEL_POSS 27U -#define DMA_CSR5_DBUSEL_POSE 29U -#define DMA_CSR5_DBUSEL_MSK BITS(DMA_CSR5_DBUSEL_POSS,DMA_CSR5_DBUSEL_POSE) - -#define DMA_CSR5_DDWSEL_POSS 25U -#define DMA_CSR5_DDWSEL_POSE 26U -#define DMA_CSR5_DDWSEL_MSK BITS(DMA_CSR5_DDWSEL_POSS,DMA_CSR5_DDWSEL_POSE) - -#define DMA_CSR5_DINC_POS 24U -#define DMA_CSR5_DINC_MSK BIT(DMA_CSR5_DINC_POS) - -#define DMA_CSR5_SINCOS_POS 22U -#define DMA_CSR5_SINCOS_MSK BIT(DMA_CSR5_SINCOS_POS) - -#define DMA_CSR5_SBUSEL_POSS 19U -#define DMA_CSR5_SBUSEL_POSE 21U -#define DMA_CSR5_SBUSEL_MSK BITS(DMA_CSR5_SBUSEL_POSS,DMA_CSR5_SBUSEL_POSE) - -#define DMA_CSR5_SDWSEL_POSS 17U -#define DMA_CSR5_SDWSEL_POSE 18U -#define DMA_CSR5_SDWSEL_MSK BITS(DMA_CSR5_SDWSEL_POSS,DMA_CSR5_SDWSEL_POSE) - -#define DMA_CSR5_SINC_POS 16U -#define DMA_CSR5_SINC_MSK BIT(DMA_CSR5_SINC_POS) - -#define DMA_CSR5_PHSS_POSS 9U -#define DMA_CSR5_PHSS_POSE 15U -#define DMA_CSR5_PHSS_MSK BITS(DMA_CSR5_PHSS_POSS,DMA_CSR5_PHSS_POSE) - -#define DMA_CSR5_CHPRI_POSS 6U -#define DMA_CSR5_CHPRI_POSE 8U -#define DMA_CSR5_CHPRI_MSK BITS(DMA_CSR5_CHPRI_POSS,DMA_CSR5_CHPRI_POSE) - -#define DMA_CSR5_MODESEL_POSS 4U -#define DMA_CSR5_MODESEL_POSE 5U -#define DMA_CSR5_MODESEL_MSK BITS(DMA_CSR5_MODESEL_POSS,DMA_CSR5_MODESEL_POSE) - -#define DMA_CSR5_DIRMDEN_POS 3U -#define DMA_CSR5_DIRMDEN_MSK BIT(DMA_CSR5_DIRMDEN_POS) - -#define DMA_CSR5_PFCTRL_POS 2U -#define DMA_CSR5_PFCTRL_MSK BIT(DMA_CSR5_PFCTRL_POS) - -#define DMA_CSR5_CIRC_POS 1U -#define DMA_CSR5_CIRC_MSK BIT(DMA_CSR5_CIRC_POS) - -#define DMA_CSR5_CHEN_POS 0U -#define DMA_CSR5_CHEN_MSK BIT(DMA_CSR5_CHEN_POS) - -/****************** Bit definition for DMA_SAR5 register ************************/ - -#define DMA_SAR5_SAR_POSS 0U -#define DMA_SAR5_SAR_POSE 31U -#define DMA_SAR5_SAR_MSK BITS(DMA_SAR5_SAR_POSS,DMA_SAR5_SAR_POSE) - -/****************** Bit definition for DMA_DAR5 register ************************/ - -#define DMA_DAR5_DAR_POSS 0U -#define DMA_DAR5_DAR_POSE 31U -#define DMA_DAR5_DAR_MSK BITS(DMA_DAR5_DAR_POSS,DMA_DAR5_DAR_POSE) - -/****************** Bit definition for DMA_BCR5 register ************************/ - -#define DMA_BCR5_CBCR_POSS 16U -#define DMA_BCR5_CBCR_POSE 31U -#define DMA_BCR5_CBCR_MSK BITS(DMA_BCR5_CBCR_POSS,DMA_BCR5_CBCR_POSE) - -#define DMA_BCR5_BCR_POSS 0U -#define DMA_BCR5_BCR_POSE 15U -#define DMA_BCR5_BCR_MSK BITS(DMA_BCR5_BCR_POSS,DMA_BCR5_BCR_POSE) - -typedef struct -{ - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; - __I uint32_t EMSG; - uint32_t RESERVED0 ; - __IO uint32_t CSR0; - __IO uint32_t SAR0; - __IO uint32_t DAR0; - __IO uint32_t BCR0; - __IO uint32_t CSR1; - __IO uint32_t SAR1; - __IO uint32_t DAR1; - __IO uint32_t BCR1; - __IO uint32_t CSR2; - __IO uint32_t SAR2; - __IO uint32_t DAR2; - __IO uint32_t BCR2; - __IO uint32_t CSR3; - __IO uint32_t SAR3; - __IO uint32_t DAR3; - __IO uint32_t BCR3; - __IO uint32_t CSR4; - __IO uint32_t SAR4; - __IO uint32_t DAR4; - __IO uint32_t BCR4; - __IO uint32_t CSR5; - __IO uint32_t SAR5; - __IO uint32_t DAR5; - __IO uint32_t BCR5; -} DMA_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_exti.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_exti.h deleted file mode 100644 index 92a8228889..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_exti.h +++ /dev/null @@ -1,809 +0,0 @@ -/** - ************************************************************************************** - * @file REG_EXTI.h - * @brief EXTI Head File - * - * @version V0.01 - * @data 12/3/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __EXTI_H__ -#define __EXTI_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for EXTI_IER register ************************/ - -#define EXTI_IER_WAKEUP_POS 21U -#define EXTI_IER_WAKEUP_MSK BIT(EXTI_IER_WAKEUP_POS) - -#define EXTI_IER_PVD0_POS 20U -#define EXTI_IER_PVD0_MSK BIT(EXTI_IER_PVD0_POS) - -#define EXTI_IER_CMP2_POS 17U -#define EXTI_IER_CMP2_MSK BIT(EXTI_IER_CMP2_POS) - -#define EXTI_IER_CMP1_POS 16U -#define EXTI_IER_CMP1_MSK BIT(EXTI_IER_CMP1_POS) - -#define EXTI_IER_GPIO15_POS 15U -#define EXTI_IER_GPIO15_MSK BIT(EXTI_IER_GPIO15_POS) - -#define EXTI_IER_GPIO14_POS 14U -#define EXTI_IER_GPIO14_MSK BIT(EXTI_IER_GPIO14_POS) - -#define EXTI_IER_GPIO13_POS 13U -#define EXTI_IER_GPIO13_MSK BIT(EXTI_IER_GPIO13_POS) - -#define EXTI_IER_GPIO12_POS 12U -#define EXTI_IER_GPIO12_MSK BIT(EXTI_IER_GPIO12_POS) - -#define EXTI_IER_GPIO11_POS 11U -#define EXTI_IER_GPIO11_MSK BIT(EXTI_IER_GPIO11_POS) - -#define EXTI_IER_GPIO10_POS 10U -#define EXTI_IER_GPIO10_MSK BIT(EXTI_IER_GPIO10_POS) - -#define EXTI_IER_GPIO9_POS 9U -#define EXTI_IER_GPIO9_MSK BIT(EXTI_IER_GPIO9_POS) - -#define EXTI_IER_GPIO8_POS 8U -#define EXTI_IER_GPIO8_MSK BIT(EXTI_IER_GPIO8_POS) - -#define EXTI_IER_GPIO7_POS 7U -#define EXTI_IER_GPIO7_MSK BIT(EXTI_IER_GPIO7_POS) - -#define EXTI_IER_GPIO6_POS 6U -#define EXTI_IER_GPIO6_MSK BIT(EXTI_IER_GPIO6_POS) - -#define EXTI_IER_GPIO5_POS 5U -#define EXTI_IER_GPIO5_MSK BIT(EXTI_IER_GPIO5_POS) - -#define EXTI_IER_GPIO4_POS 4U -#define EXTI_IER_GPIO4_MSK BIT(EXTI_IER_GPIO4_POS) - -#define EXTI_IER_GPIO3_POS 3U -#define EXTI_IER_GPIO3_MSK BIT(EXTI_IER_GPIO3_POS) - -#define EXTI_IER_GPIO2_POS 2U -#define EXTI_IER_GPIO2_MSK BIT(EXTI_IER_GPIO2_POS) - -#define EXTI_IER_GPIO1_POS 1U -#define EXTI_IER_GPIO1_MSK BIT(EXTI_IER_GPIO1_POS) - -#define EXTI_IER_GPIO0_POS 0U -#define EXTI_IER_GPIO0_MSK BIT(EXTI_IER_GPIO0_POS) - -/****************** Bit definition for EXTI_IDR register ************************/ - -#define EXTI_IDR_WAKEUP_POS 21U -#define EXTI_IDR_WAKEUP_MSK BIT(EXTI_IDR_WAKEUP_POS) - -#define EXTI_IDR_PVD0_POS 20U -#define EXTI_IDR_PVD0_MSK BIT(EXTI_IDR_PVD0_POS) - -#define EXTI_IDR_CMP2_POS 17U -#define EXTI_IDR_CMP2_MSK BIT(EXTI_IDR_CMP2_POS) - -#define EXTI_IDR_CMP1_POS 16U -#define EXTI_IDR_CMP1_MSK BIT(EXTI_IDR_CMP1_POS) - -#define EXTI_IDR_GPIO15_POS 15U -#define EXTI_IDR_GPIO15_MSK BIT(EXTI_IDR_GPIO15_POS) - -#define EXTI_IDR_GPIO14_POS 14U -#define EXTI_IDR_GPIO14_MSK BIT(EXTI_IDR_GPIO14_POS) - -#define EXTI_IDR_GPIO13_POS 13U -#define EXTI_IDR_GPIO13_MSK BIT(EXTI_IDR_GPIO13_POS) - -#define EXTI_IDR_GPIO12_POS 12U -#define EXTI_IDR_GPIO12_MSK BIT(EXTI_IDR_GPIO12_POS) - -#define EXTI_IDR_GPIO11_POS 11U -#define EXTI_IDR_GPIO11_MSK BIT(EXTI_IDR_GPIO11_POS) - -#define EXTI_IDR_GPIO10_POS 10U -#define EXTI_IDR_GPIO10_MSK BIT(EXTI_IDR_GPIO10_POS) - -#define EXTI_IDR_GPIO9_POS 9U -#define EXTI_IDR_GPIO9_MSK BIT(EXTI_IDR_GPIO9_POS) - -#define EXTI_IDR_GPIO8_POS 8U -#define EXTI_IDR_GPIO8_MSK BIT(EXTI_IDR_GPIO8_POS) - -#define EXTI_IDR_GPIO7_POS 7U -#define EXTI_IDR_GPIO7_MSK BIT(EXTI_IDR_GPIO7_POS) - -#define EXTI_IDR_GPIO6_POS 6U -#define EXTI_IDR_GPIO6_MSK BIT(EXTI_IDR_GPIO6_POS) - -#define EXTI_IDR_GPIO5_POS 5U -#define EXTI_IDR_GPIO5_MSK BIT(EXTI_IDR_GPIO5_POS) - -#define EXTI_IDR_GPIO4_POS 4U -#define EXTI_IDR_GPIO4_MSK BIT(EXTI_IDR_GPIO4_POS) - -#define EXTI_IDR_GPIO3_POS 3U -#define EXTI_IDR_GPIO3_MSK BIT(EXTI_IDR_GPIO3_POS) - -#define EXTI_IDR_GPIO2_POS 2U -#define EXTI_IDR_GPIO2_MSK BIT(EXTI_IDR_GPIO2_POS) - -#define EXTI_IDR_GPIO1_POS 1U -#define EXTI_IDR_GPIO1_MSK BIT(EXTI_IDR_GPIO1_POS) - -#define EXTI_IDR_GPIO0_POS 0U -#define EXTI_IDR_GPIO0_MSK BIT(EXTI_IDR_GPIO0_POS) - -/****************** Bit definition for EXTI_IVS register ************************/ - -#define EXTI_IVS_WAKEUP_POS 21U -#define EXTI_IVS_WAKEUP_MSK BIT(EXTI_IVS_WAKEUP_POS) - -#define EXTI_IVS_PVD0_POS 20U -#define EXTI_IVS_PVD0_MSK BIT(EXTI_IVS_PVD0_POS) - -#define EXTI_IVS_CMP2_POS 17U -#define EXTI_IVS_CMP2_MSK BIT(EXTI_IVS_CMP2_POS) - -#define EXTI_IVS_CMP1_POS 16U -#define EXTI_IVS_CMP1_MSK BIT(EXTI_IVS_CMP1_POS) - -#define EXTI_IVS_GPIO15_POS 15U -#define EXTI_IVS_GPIO15_MSK BIT(EXTI_IVS_GPIO15_POS) - -#define EXTI_IVS_GPIO14_POS 14U -#define EXTI_IVS_GPIO14_MSK BIT(EXTI_IVS_GPIO14_POS) - -#define EXTI_IVS_GPIO13_POS 13U -#define EXTI_IVS_GPIO13_MSK BIT(EXTI_IVS_GPIO13_POS) - -#define EXTI_IVS_GPIO12_POS 12U -#define EXTI_IVS_GPIO12_MSK BIT(EXTI_IVS_GPIO12_POS) - -#define EXTI_IVS_GPIO11_POS 11U -#define EXTI_IVS_GPIO11_MSK BIT(EXTI_IVS_GPIO11_POS) - -#define EXTI_IVS_GPIO10_POS 10U -#define EXTI_IVS_GPIO10_MSK BIT(EXTI_IVS_GPIO10_POS) - -#define EXTI_IVS_GPIO9_POS 9U -#define EXTI_IVS_GPIO9_MSK BIT(EXTI_IVS_GPIO9_POS) - -#define EXTI_IVS_GPIO8_POS 8U -#define EXTI_IVS_GPIO8_MSK BIT(EXTI_IVS_GPIO8_POS) - -#define EXTI_IVS_GPIO7_POS 7U -#define EXTI_IVS_GPIO7_MSK BIT(EXTI_IVS_GPIO7_POS) - -#define EXTI_IVS_GPIO6_POS 6U -#define EXTI_IVS_GPIO6_MSK BIT(EXTI_IVS_GPIO6_POS) - -#define EXTI_IVS_GPIO5_POS 5U -#define EXTI_IVS_GPIO5_MSK BIT(EXTI_IVS_GPIO5_POS) - -#define EXTI_IVS_GPIO4_POS 4U -#define EXTI_IVS_GPIO4_MSK BIT(EXTI_IVS_GPIO4_POS) - -#define EXTI_IVS_GPIO3_POS 3U -#define EXTI_IVS_GPIO3_MSK BIT(EXTI_IVS_GPIO3_POS) - -#define EXTI_IVS_GPIO2_POS 2U -#define EXTI_IVS_GPIO2_MSK BIT(EXTI_IVS_GPIO2_POS) - -#define EXTI_IVS_GPIO1_POS 1U -#define EXTI_IVS_GPIO1_MSK BIT(EXTI_IVS_GPIO1_POS) - -#define EXTI_IVS_GPIO0_POS 0U -#define EXTI_IVS_GPIO0_MSK BIT(EXTI_IVS_GPIO0_POS) - -/****************** Bit definition for EXTI_RIF register ************************/ - -#define EXTI_RIF_WAKEUP_POS 21U -#define EXTI_RIF_WAKEUP_MSK BIT(EXTI_RIF_WAKEUP_POS) - -#define EXTI_RIF_PVD0_POS 20U -#define EXTI_RIF_PVD0_MSK BIT(EXTI_RIF_PVD0_POS) - -#define EXTI_RIF_CMP2_POS 17U -#define EXTI_RIF_CMP2_MSK BIT(EXTI_RIF_CMP2_POS) - -#define EXTI_RIF_CMP1_POS 16U -#define EXTI_RIF_CMP1_MSK BIT(EXTI_RIF_CMP1_POS) - -#define EXTI_RIF_GPIO15_POS 15U -#define EXTI_RIF_GPIO15_MSK BIT(EXTI_RIF_GPIO15_POS) - -#define EXTI_RIF_GPIO14_POS 14U -#define EXTI_RIF_GPIO14_MSK BIT(EXTI_RIF_GPIO14_POS) - -#define EXTI_RIF_GPIO13_POS 13U -#define EXTI_RIF_GPIO13_MSK BIT(EXTI_RIF_GPIO13_POS) - -#define EXTI_RIF_GPIO12_POS 12U -#define EXTI_RIF_GPIO12_MSK BIT(EXTI_RIF_GPIO12_POS) - -#define EXTI_RIF_GPIO11_POS 11U -#define EXTI_RIF_GPIO11_MSK BIT(EXTI_RIF_GPIO11_POS) - -#define EXTI_RIF_GPIO10_POS 10U -#define EXTI_RIF_GPIO10_MSK BIT(EXTI_RIF_GPIO10_POS) - -#define EXTI_RIF_GPIO9_POS 9U -#define EXTI_RIF_GPIO9_MSK BIT(EXTI_RIF_GPIO9_POS) - -#define EXTI_RIF_GPIO8_POS 8U -#define EXTI_RIF_GPIO8_MSK BIT(EXTI_RIF_GPIO8_POS) - -#define EXTI_RIF_GPIO7_POS 7U -#define EXTI_RIF_GPIO7_MSK BIT(EXTI_RIF_GPIO7_POS) - -#define EXTI_RIF_GPIO6_POS 6U -#define EXTI_RIF_GPIO6_MSK BIT(EXTI_RIF_GPIO6_POS) - -#define EXTI_RIF_GPIO5_POS 5U -#define EXTI_RIF_GPIO5_MSK BIT(EXTI_RIF_GPIO5_POS) - -#define EXTI_RIF_GPIO4_POS 4U -#define EXTI_RIF_GPIO4_MSK BIT(EXTI_RIF_GPIO4_POS) - -#define EXTI_RIF_GPIO3_POS 3U -#define EXTI_RIF_GPIO3_MSK BIT(EXTI_RIF_GPIO3_POS) - -#define EXTI_RIF_GPIO2_POS 2U -#define EXTI_RIF_GPIO2_MSK BIT(EXTI_RIF_GPIO2_POS) - -#define EXTI_RIF_GPIO1_POS 1U -#define EXTI_RIF_GPIO1_MSK BIT(EXTI_RIF_GPIO1_POS) - -#define EXTI_RIF_GPIO0_POS 0U -#define EXTI_RIF_GPIO0_MSK BIT(EXTI_RIF_GPIO0_POS) - -/****************** Bit definition for EXTI_IFM register ************************/ - -#define EXTI_IFM_WAKEUP_POS 21U -#define EXTI_IFM_WAKEUP_MSK BIT(EXTI_IFM_WAKEUP_POS) - -#define EXTI_IFM_PVD0_POS 20U -#define EXTI_IFM_PVD0_MSK BIT(EXTI_IFM_PVD0_POS) - -#define EXTI_IFM_CMP2_POS 17U -#define EXTI_IFM_CMP2_MSK BIT(EXTI_IFM_CMP2_POS) - -#define EXTI_IFM_CMP1_POS 16U -#define EXTI_IFM_CMP1_MSK BIT(EXTI_IFM_CMP1_POS) - -#define EXTI_IFM_GPIO15_POS 15U -#define EXTI_IFM_GPIO15_MSK BIT(EXTI_IFM_GPIO15_POS) - -#define EXTI_IFM_GPIO14_POS 14U -#define EXTI_IFM_GPIO14_MSK BIT(EXTI_IFM_GPIO14_POS) - -#define EXTI_IFM_GPIO13_POS 13U -#define EXTI_IFM_GPIO13_MSK BIT(EXTI_IFM_GPIO13_POS) - -#define EXTI_IFM_GPIO12_POS 12U -#define EXTI_IFM_GPIO12_MSK BIT(EXTI_IFM_GPIO12_POS) - -#define EXTI_IFM_GPIO11_POS 11U -#define EXTI_IFM_GPIO11_MSK BIT(EXTI_IFM_GPIO11_POS) - -#define EXTI_IFM_GPIO10_POS 10U -#define EXTI_IFM_GPIO10_MSK BIT(EXTI_IFM_GPIO10_POS) - -#define EXTI_IFM_GPIO9_POS 9U -#define EXTI_IFM_GPIO9_MSK BIT(EXTI_IFM_GPIO9_POS) - -#define EXTI_IFM_GPIO8_POS 8U -#define EXTI_IFM_GPIO8_MSK BIT(EXTI_IFM_GPIO8_POS) - -#define EXTI_IFM_GPIO7_POS 7U -#define EXTI_IFM_GPIO7_MSK BIT(EXTI_IFM_GPIO7_POS) - -#define EXTI_IFM_GPIO6_POS 6U -#define EXTI_IFM_GPIO6_MSK BIT(EXTI_IFM_GPIO6_POS) - -#define EXTI_IFM_GPIO5_POS 5U -#define EXTI_IFM_GPIO5_MSK BIT(EXTI_IFM_GPIO5_POS) - -#define EXTI_IFM_GPIO4_POS 4U -#define EXTI_IFM_GPIO4_MSK BIT(EXTI_IFM_GPIO4_POS) - -#define EXTI_IFM_GPIO3_POS 3U -#define EXTI_IFM_GPIO3_MSK BIT(EXTI_IFM_GPIO3_POS) - -#define EXTI_IFM_GPIO2_POS 2U -#define EXTI_IFM_GPIO2_MSK BIT(EXTI_IFM_GPIO2_POS) - -#define EXTI_IFM_GPIO1_POS 1U -#define EXTI_IFM_GPIO1_MSK BIT(EXTI_IFM_GPIO1_POS) - -#define EXTI_IFM_GPIO0_POS 0U -#define EXTI_IFM_GPIO0_MSK BIT(EXTI_IFM_GPIO0_POS) - -/****************** Bit definition for EXTI_ICR register ************************/ - -#define EXTI_ICR_WAKEUP_POS 21U -#define EXTI_ICR_WAKEUP_MSK BIT(EXTI_ICR_WAKEUP_POS) - -#define EXTI_ICR_PVD0_POS 20U -#define EXTI_ICR_PVD0_MSK BIT(EXTI_ICR_PVD0_POS) - -#define EXTI_ICR_CMP2_POS 17U -#define EXTI_ICR_CMP2_MSK BIT(EXTI_ICR_CMP2_POS) - -#define EXTI_ICR_CMP1_POS 16U -#define EXTI_ICR_CMP1_MSK BIT(EXTI_ICR_CMP1_POS) - -#define EXTI_ICR_GPIO15_POS 15U -#define EXTI_ICR_GPIO15_MSK BIT(EXTI_ICR_GPIO15_POS) - -#define EXTI_ICR_GPIO14_POS 14U -#define EXTI_ICR_GPIO14_MSK BIT(EXTI_ICR_GPIO14_POS) - -#define EXTI_ICR_GPIO13_POS 13U -#define EXTI_ICR_GPIO13_MSK BIT(EXTI_ICR_GPIO13_POS) - -#define EXTI_ICR_GPIO12_POS 12U -#define EXTI_ICR_GPIO12_MSK BIT(EXTI_ICR_GPIO12_POS) - -#define EXTI_ICR_GPIO11_POS 11U -#define EXTI_ICR_GPIO11_MSK BIT(EXTI_ICR_GPIO11_POS) - -#define EXTI_ICR_GPIO10_POS 10U -#define EXTI_ICR_GPIO10_MSK BIT(EXTI_ICR_GPIO10_POS) - -#define EXTI_ICR_GPIO9_POS 9U -#define EXTI_ICR_GPIO9_MSK BIT(EXTI_ICR_GPIO9_POS) - -#define EXTI_ICR_GPIO8_POS 8U -#define EXTI_ICR_GPIO8_MSK BIT(EXTI_ICR_GPIO8_POS) - -#define EXTI_ICR_GPIO7_POS 7U -#define EXTI_ICR_GPIO7_MSK BIT(EXTI_ICR_GPIO7_POS) - -#define EXTI_ICR_GPIO6_POS 6U -#define EXTI_ICR_GPIO6_MSK BIT(EXTI_ICR_GPIO6_POS) - -#define EXTI_ICR_GPIO5_POS 5U -#define EXTI_ICR_GPIO5_MSK BIT(EXTI_ICR_GPIO5_POS) - -#define EXTI_ICR_GPIO4_POS 4U -#define EXTI_ICR_GPIO4_MSK BIT(EXTI_ICR_GPIO4_POS) - -#define EXTI_ICR_GPIO3_POS 3U -#define EXTI_ICR_GPIO3_MSK BIT(EXTI_ICR_GPIO3_POS) - -#define EXTI_ICR_GPIO2_POS 2U -#define EXTI_ICR_GPIO2_MSK BIT(EXTI_ICR_GPIO2_POS) - -#define EXTI_ICR_GPIO1_POS 1U -#define EXTI_ICR_GPIO1_MSK BIT(EXTI_ICR_GPIO1_POS) - -#define EXTI_ICR_GPIO0_POS 0U -#define EXTI_ICR_GPIO0_MSK BIT(EXTI_ICR_GPIO0_POS) - -/****************** Bit definition for EXTI_RTS register ************************/ - -#define EXTI_RTS_WAKEUP_POS 21U -#define EXTI_RTS_WAKEUP_MSK BIT(EXTI_RTS_WAKEUP_POS) - -#define EXTI_RTS_PVD0_POS 20U -#define EXTI_RTS_PVD0_MSK BIT(EXTI_RTS_PVD0_POS) - -#define EXTI_RTS_CMP2_POS 17U -#define EXTI_RTS_CMP2_MSK BIT(EXTI_RTS_CMP2_POS) - -#define EXTI_RTS_CMP1_POS 16U -#define EXTI_RTS_CMP1_MSK BIT(EXTI_RTS_CMP1_POS) - -#define EXTI_RTS_GPIO15_POS 15U -#define EXTI_RTS_GPIO15_MSK BIT(EXTI_RTS_GPIO15_POS) - -#define EXTI_RTS_GPIO14_POS 14U -#define EXTI_RTS_GPIO14_MSK BIT(EXTI_RTS_GPIO14_POS) - -#define EXTI_RTS_GPIO13_POS 13U -#define EXTI_RTS_GPIO13_MSK BIT(EXTI_RTS_GPIO13_POS) - -#define EXTI_RTS_GPIO12_POS 12U -#define EXTI_RTS_GPIO12_MSK BIT(EXTI_RTS_GPIO12_POS) - -#define EXTI_RTS_GPIO11_POS 11U -#define EXTI_RTS_GPIO11_MSK BIT(EXTI_RTS_GPIO11_POS) - -#define EXTI_RTS_GPIO10_POS 10U -#define EXTI_RTS_GPIO10_MSK BIT(EXTI_RTS_GPIO10_POS) - -#define EXTI_RTS_GPIO9_POS 9U -#define EXTI_RTS_GPIO9_MSK BIT(EXTI_RTS_GPIO9_POS) - -#define EXTI_RTS_GPIO8_POS 8U -#define EXTI_RTS_GPIO8_MSK BIT(EXTI_RTS_GPIO8_POS) - -#define EXTI_RTS_GPIO7_POS 7U -#define EXTI_RTS_GPIO7_MSK BIT(EXTI_RTS_GPIO7_POS) - -#define EXTI_RTS_GPIO6_POS 6U -#define EXTI_RTS_GPIO6_MSK BIT(EXTI_RTS_GPIO6_POS) - -#define EXTI_RTS_GPIO5_POS 5U -#define EXTI_RTS_GPIO5_MSK BIT(EXTI_RTS_GPIO5_POS) - -#define EXTI_RTS_GPIO4_POS 4U -#define EXTI_RTS_GPIO4_MSK BIT(EXTI_RTS_GPIO4_POS) - -#define EXTI_RTS_GPIO3_POS 3U -#define EXTI_RTS_GPIO3_MSK BIT(EXTI_RTS_GPIO3_POS) - -#define EXTI_RTS_GPIO2_POS 2U -#define EXTI_RTS_GPIO2_MSK BIT(EXTI_RTS_GPIO2_POS) - -#define EXTI_RTS_GPIO1_POS 1U -#define EXTI_RTS_GPIO1_MSK BIT(EXTI_RTS_GPIO1_POS) - -#define EXTI_RTS_GPIO0_POS 0U -#define EXTI_RTS_GPIO0_MSK BIT(EXTI_RTS_GPIO0_POS) - -/****************** Bit definition for EXTI_FTS register ************************/ - -#define EXTI_FTS_WAKEUP_POS 21U -#define EXTI_FTS_WAKEUP_MSK BIT(EXTI_FTS_WAKEUP_POS) - -#define EXTI_FTS_PVD0_POS 20U -#define EXTI_FTS_PVD0_MSK BIT(EXTI_FTS_PVD0_POS) - -#define EXTI_FTS_CMP2_POS 17U -#define EXTI_FTS_CMP2_MSK BIT(EXTI_FTS_CMP2_POS) - -#define EXTI_FTS_CMP1_POS 16U -#define EXTI_FTS_CMP1_MSK BIT(EXTI_FTS_CMP1_POS) - -#define EXTI_FTS_GPIO15_POS 15U -#define EXTI_FTS_GPIO15_MSK BIT(EXTI_FTS_GPIO15_POS) - -#define EXTI_FTS_GPIO14_POS 14U -#define EXTI_FTS_GPIO14_MSK BIT(EXTI_FTS_GPIO14_POS) - -#define EXTI_FTS_GPIO13_POS 13U -#define EXTI_FTS_GPIO13_MSK BIT(EXTI_FTS_GPIO13_POS) - -#define EXTI_FTS_GPIO12_POS 12U -#define EXTI_FTS_GPIO12_MSK BIT(EXTI_FTS_GPIO12_POS) - -#define EXTI_FTS_GPIO11_POS 11U -#define EXTI_FTS_GPIO11_MSK BIT(EXTI_FTS_GPIO11_POS) - -#define EXTI_FTS_GPIO10_POS 10U -#define EXTI_FTS_GPIO10_MSK BIT(EXTI_FTS_GPIO10_POS) - -#define EXTI_FTS_GPIO9_POS 9U -#define EXTI_FTS_GPIO9_MSK BIT(EXTI_FTS_GPIO9_POS) - -#define EXTI_FTS_GPIO8_POS 8U -#define EXTI_FTS_GPIO8_MSK BIT(EXTI_FTS_GPIO8_POS) - -#define EXTI_FTS_GPIO7_POS 7U -#define EXTI_FTS_GPIO7_MSK BIT(EXTI_FTS_GPIO7_POS) - -#define EXTI_FTS_GPIO6_POS 6U -#define EXTI_FTS_GPIO6_MSK BIT(EXTI_FTS_GPIO6_POS) - -#define EXTI_FTS_GPIO5_POS 5U -#define EXTI_FTS_GPIO5_MSK BIT(EXTI_FTS_GPIO5_POS) - -#define EXTI_FTS_GPIO4_POS 4U -#define EXTI_FTS_GPIO4_MSK BIT(EXTI_FTS_GPIO4_POS) - -#define EXTI_FTS_GPIO3_POS 3U -#define EXTI_FTS_GPIO3_MSK BIT(EXTI_FTS_GPIO3_POS) - -#define EXTI_FTS_GPIO2_POS 2U -#define EXTI_FTS_GPIO2_MSK BIT(EXTI_FTS_GPIO2_POS) - -#define EXTI_FTS_GPIO1_POS 1U -#define EXTI_FTS_GPIO1_MSK BIT(EXTI_FTS_GPIO1_POS) - -#define EXTI_FTS_GPIO0_POS 0U -#define EXTI_FTS_GPIO0_MSK BIT(EXTI_FTS_GPIO0_POS) - -/****************** Bit definition for EXTI_SWI register ************************/ - -#define EXTI_SWI_WAKEUP_POS 21U -#define EXTI_SWI_WAKEUP_MSK BIT(EXTI_SWI_WAKEUP_POS) - -#define EXTI_SWI_PVD0_POS 20U -#define EXTI_SWI_PVD0_MSK BIT(EXTI_SWI_PVD0_POS) - -#define EXTI_SWI_CMP2_POS 17U -#define EXTI_SWI_CMP2_MSK BIT(EXTI_SWI_CMP2_POS) - -#define EXTI_SWI_CMP1_POS 16U -#define EXTI_SWI_CMP1_MSK BIT(EXTI_SWI_CMP1_POS) - -#define EXTI_SWI_GPIO15_POS 15U -#define EXTI_SWI_GPIO15_MSK BIT(EXTI_SWI_GPIO15_POS) - -#define EXTI_SWI_GPIO14_POS 14U -#define EXTI_SWI_GPIO14_MSK BIT(EXTI_SWI_GPIO14_POS) - -#define EXTI_SWI_GPIO13_POS 13U -#define EXTI_SWI_GPIO13_MSK BIT(EXTI_SWI_GPIO13_POS) - -#define EXTI_SWI_GPIO12_POS 12U -#define EXTI_SWI_GPIO12_MSK BIT(EXTI_SWI_GPIO12_POS) - -#define EXTI_SWI_GPIO11_POS 11U -#define EXTI_SWI_GPIO11_MSK BIT(EXTI_SWI_GPIO11_POS) - -#define EXTI_SWI_GPIO10_POS 10U -#define EXTI_SWI_GPIO10_MSK BIT(EXTI_SWI_GPIO10_POS) - -#define EXTI_SWI_GPIO9_POS 9U -#define EXTI_SWI_GPIO9_MSK BIT(EXTI_SWI_GPIO9_POS) - -#define EXTI_SWI_GPIO8_POS 8U -#define EXTI_SWI_GPIO8_MSK BIT(EXTI_SWI_GPIO8_POS) - -#define EXTI_SWI_GPIO7_POS 7U -#define EXTI_SWI_GPIO7_MSK BIT(EXTI_SWI_GPIO7_POS) - -#define EXTI_SWI_GPIO6_POS 6U -#define EXTI_SWI_GPIO6_MSK BIT(EXTI_SWI_GPIO6_POS) - -#define EXTI_SWI_GPIO5_POS 5U -#define EXTI_SWI_GPIO5_MSK BIT(EXTI_SWI_GPIO5_POS) - -#define EXTI_SWI_GPIO4_POS 4U -#define EXTI_SWI_GPIO4_MSK BIT(EXTI_SWI_GPIO4_POS) - -#define EXTI_SWI_GPIO3_POS 3U -#define EXTI_SWI_GPIO3_MSK BIT(EXTI_SWI_GPIO3_POS) - -#define EXTI_SWI_GPIO2_POS 2U -#define EXTI_SWI_GPIO2_MSK BIT(EXTI_SWI_GPIO2_POS) - -#define EXTI_SWI_GPIO1_POS 1U -#define EXTI_SWI_GPIO1_MSK BIT(EXTI_SWI_GPIO1_POS) - -#define EXTI_SWI_GPIO0_POS 0U -#define EXTI_SWI_GPIO0_MSK BIT(EXTI_SWI_GPIO0_POS) - -/****************** Bit definition for EXTI_ADTE register ************************/ - -#define EXTI_ADTE_WAKEUP_POS 21U -#define EXTI_ADTE_WAKEUP_MSK BIT(EXTI_ADTE_WAKEUP_POS) - -#define EXTI_ADTE_PVD0_POS 20U -#define EXTI_ADTE_PVD0_MSK BIT(EXTI_ADTE_PVD0_POS) - -#define EXTI_ADTE_CMP2_POS 17U -#define EXTI_ADTE_CMP2_MSK BIT(EXTI_ADTE_CMP2_POS) - -#define EXTI_ADTE_CMP1_POS 16U -#define EXTI_ADTE_CMP1_MSK BIT(EXTI_ADTE_CMP1_POS) - -#define EXTI_ADTE_GPIO15_POS 15U -#define EXTI_ADTE_GPIO15_MSK BIT(EXTI_ADTE_GPIO15_POS) - -#define EXTI_ADTE_GPIO14_POS 14U -#define EXTI_ADTE_GPIO14_MSK BIT(EXTI_ADTE_GPIO14_POS) - -#define EXTI_ADTE_GPIO13_POS 13U -#define EXTI_ADTE_GPIO13_MSK BIT(EXTI_ADTE_GPIO13_POS) - -#define EXTI_ADTE_GPIO12_POS 12U -#define EXTI_ADTE_GPIO12_MSK BIT(EXTI_ADTE_GPIO12_POS) - -#define EXTI_ADTE_GPIO11_POS 11U -#define EXTI_ADTE_GPIO11_MSK BIT(EXTI_ADTE_GPIO11_POS) - -#define EXTI_ADTE_GPIO10_POS 10U -#define EXTI_ADTE_GPIO10_MSK BIT(EXTI_ADTE_GPIO10_POS) - -#define EXTI_ADTE_GPIO9_POS 9U -#define EXTI_ADTE_GPIO9_MSK BIT(EXTI_ADTE_GPIO9_POS) - -#define EXTI_ADTE_GPIO8_POS 8U -#define EXTI_ADTE_GPIO8_MSK BIT(EXTI_ADTE_GPIO8_POS) - -#define EXTI_ADTE_GPIO7_POS 7U -#define EXTI_ADTE_GPIO7_MSK BIT(EXTI_ADTE_GPIO7_POS) - -#define EXTI_ADTE_GPIO6_POS 6U -#define EXTI_ADTE_GPIO6_MSK BIT(EXTI_ADTE_GPIO6_POS) - -#define EXTI_ADTE_GPIO5_POS 5U -#define EXTI_ADTE_GPIO5_MSK BIT(EXTI_ADTE_GPIO5_POS) - -#define EXTI_ADTE_GPIO4_POS 4U -#define EXTI_ADTE_GPIO4_MSK BIT(EXTI_ADTE_GPIO4_POS) - -#define EXTI_ADTE_GPIO3_POS 3U -#define EXTI_ADTE_GPIO3_MSK BIT(EXTI_ADTE_GPIO3_POS) - -#define EXTI_ADTE_GPIO2_POS 2U -#define EXTI_ADTE_GPIO2_MSK BIT(EXTI_ADTE_GPIO2_POS) - -#define EXTI_ADTE_GPIO1_POS 1U -#define EXTI_ADTE_GPIO1_MSK BIT(EXTI_ADTE_GPIO1_POS) - -#define EXTI_ADTE_GPIO0_POS 0U -#define EXTI_ADTE_GPIO0_MSK BIT(EXTI_ADTE_GPIO0_POS) - -/****************** Bit definition for EXTI_DB register ************************/ - -#define EXTI_DB_WAKEUP_POS 21U -#define EXTI_DB_WAKEUP_MSK BIT(EXTI_DB_WAKEUP_POS) - -#define EXTI_DB_PVD0_POS 20U -#define EXTI_DB_PVD0_MSK BIT(EXTI_DB_PVD0_POS) - -#define EXTI_DB_CMP2_POS 17U -#define EXTI_DB_CMP2_MSK BIT(EXTI_DB_CMP2_POS) - -#define EXTI_DB_CMP1_POS 16U -#define EXTI_DB_CMP1_MSK BIT(EXTI_DB_CMP1_POS) - -#define EXTI_DB_GPIO15_POS 15U -#define EXTI_DB_GPIO15_MSK BIT(EXTI_DB_GPIO15_POS) - -#define EXTI_DB_GPIO14_POS 14U -#define EXTI_DB_GPIO14_MSK BIT(EXTI_DB_GPIO14_POS) - -#define EXTI_DB_GPIO13_POS 13U -#define EXTI_DB_GPIO13_MSK BIT(EXTI_DB_GPIO13_POS) - -#define EXTI_DB_GPIO12_POS 12U -#define EXTI_DB_GPIO12_MSK BIT(EXTI_DB_GPIO12_POS) - -#define EXTI_DB_GPIO11_POS 11U -#define EXTI_DB_GPIO11_MSK BIT(EXTI_DB_GPIO11_POS) - -#define EXTI_DB_GPIO10_POS 10U -#define EXTI_DB_GPIO10_MSK BIT(EXTI_DB_GPIO10_POS) - -#define EXTI_DB_GPIO9_POS 9U -#define EXTI_DB_GPIO9_MSK BIT(EXTI_DB_GPIO9_POS) - -#define EXTI_DB_GPIO8_POS 8U -#define EXTI_DB_GPIO8_MSK BIT(EXTI_DB_GPIO8_POS) - -#define EXTI_DB_GPIO7_POS 7U -#define EXTI_DB_GPIO7_MSK BIT(EXTI_DB_GPIO7_POS) - -#define EXTI_DB_GPIO6_POS 6U -#define EXTI_DB_GPIO6_MSK BIT(EXTI_DB_GPIO6_POS) - -#define EXTI_DB_GPIO5_POS 5U -#define EXTI_DB_GPIO5_MSK BIT(EXTI_DB_GPIO5_POS) - -#define EXTI_DB_GPIO4_POS 4U -#define EXTI_DB_GPIO4_MSK BIT(EXTI_DB_GPIO4_POS) - -#define EXTI_DB_GPIO3_POS 3U -#define EXTI_DB_GPIO3_MSK BIT(EXTI_DB_GPIO3_POS) - -#define EXTI_DB_GPIO2_POS 2U -#define EXTI_DB_GPIO2_MSK BIT(EXTI_DB_GPIO2_POS) - -#define EXTI_DB_GPIO1_POS 1U -#define EXTI_DB_GPIO1_MSK BIT(EXTI_DB_GPIO1_POS) - -#define EXTI_DB_GPIO0_POS 0U -#define EXTI_DB_GPIO0_MSK BIT(EXTI_DB_GPIO0_POS) - -/****************** Bit definition for EXTI_DBCON register ************************/ - -#define EXTI_DBCON_DBPRE_POSS 8U -#define EXTI_DBCON_DBPRE_POSE 15U -#define EXTI_DBCON_DBPRE_MSK BITS(EXTI_DBCON_DBPRE_POSS,EXTI_DBCON_DBPRE_POSE) - -#define EXTI_DBCON_DBCNT_POSS 0U -#define EXTI_DBCON_DBCNT_POSE 2U -#define EXTI_DBCON_DBCNT_MSK BITS(EXTI_DBCON_DBCNT_POSS,EXTI_DBCON_DBCNT_POSE) - -/****************** Bit definition for EXTI_ICFG1 register ************************/ - -#define EXTI_ICFG1_GPIO7_POSS 28U -#define EXTI_ICFG1_GPIO7_POSE 31U -#define EXTI_ICFG1_GPIO7_MSK BITS(EXTI_ICFG1_GPIO7_POSS,EXTI_ICFG1_GPIO7_POSE) - -#define EXTI_ICFG1_GPIO6_POSS 24U -#define EXTI_ICFG1_GPIO6_POSE 27U -#define EXTI_ICFG1_GPIO6_MSK BITS(EXTI_ICFG1_GPIO6_POSS,EXTI_ICFG1_GPIO6_POSE) - -#define EXTI_ICFG1_GPIO5_POSS 20U -#define EXTI_ICFG1_GPIO5_POSE 23U -#define EXTI_ICFG1_GPIO5_MSK BITS(EXTI_ICFG1_GPIO5_POSS,EXTI_ICFG1_GPIO5_POSE) - -#define EXTI_ICFG1_GPIO4_POSS 16U -#define EXTI_ICFG1_GPIO4_POSE 19U -#define EXTI_ICFG1_GPIO4_MSK BITS(EXTI_ICFG1_GPIO4_POSS,EXTI_ICFG1_GPIO4_POSE) - -#define EXTI_ICFG1_GPIO3_POSS 12U -#define EXTI_ICFG1_GPIO3_POSE 15U -#define EXTI_ICFG1_GPIO3_MSK BITS(EXTI_ICFG1_GPIO3_POSS,EXTI_ICFG1_GPIO3_POSE) - -#define EXTI_ICFG1_GPIO2_POSS 8U -#define EXTI_ICFG1_GPIO2_POSE 11U -#define EXTI_ICFG1_GPIO2_MSK BITS(EXTI_ICFG1_GPIO2_POSS,EXTI_ICFG1_GPIO2_POSE) - -#define EXTI_ICFG1_GPIO1_POSS 4U -#define EXTI_ICFG1_GPIO1_POSE 7U -#define EXTI_ICFG1_GPIO1_MSK BITS(EXTI_ICFG1_GPIO1_POSS,EXTI_ICFG1_GPIO1_POSE) - -#define EXTI_ICFG1_GPIO0_POSS 0U -#define EXTI_ICFG1_GPIO0_POSE 3U -#define EXTI_ICFG1_GPIO0_MSK BITS(EXTI_ICFG1_GPIO0_POSS,EXTI_ICFG1_GPIO0_POSE) - -/****************** Bit definition for EXTI_ICFG2 register ************************/ - -#define EXTI_ICFG2_GPIO15_POSS 28U -#define EXTI_ICFG2_GPIO15_POSE 31U -#define EXTI_ICFG2_GPIO15_MSK BITS(EXTI_ICFG2_GPIO15_POSS,EXTI_ICFG2_GPIO15_POSE) - -#define EXTI_ICFG2_GPIO14_POSS 24U -#define EXTI_ICFG2_GPIO14_POSE 27U -#define EXTI_ICFG2_GPIO14_MSK BITS(EXTI_ICFG2_GPIO14_POSS,EXTI_ICFG2_GPIO14_POSE) - -#define EXTI_ICFG2_GPIO13_POSS 20U -#define EXTI_ICFG2_GPIO13_POSE 23U -#define EXTI_ICFG2_GPIO13_MSK BITS(EXTI_ICFG2_GPIO13_POSS,EXTI_ICFG2_GPIO13_POSE) - -#define EXTI_ICFG2_GPIO12_POSS 16U -#define EXTI_ICFG2_GPIO12_POSE 19U -#define EXTI_ICFG2_GPIO12_MSK BITS(EXTI_ICFG2_GPIO12_POSS,EXTI_ICFG2_GPIO12_POSE) - -#define EXTI_ICFG2_GPIO11_POSS 12U -#define EXTI_ICFG2_GPIO11_POSE 15U -#define EXTI_ICFG2_GPIO11_MSK BITS(EXTI_ICFG2_GPIO11_POSS,EXTI_ICFG2_GPIO11_POSE) - -#define EXTI_ICFG2_GPIO10_POSS 8U -#define EXTI_ICFG2_GPIO10_POSE 11U -#define EXTI_ICFG2_GPIO10_MSK BITS(EXTI_ICFG2_GPIO10_POSS,EXTI_ICFG2_GPIO10_POSE) - -#define EXTI_ICFG2_GPIO9_POSS 4U -#define EXTI_ICFG2_GPIO9_POSE 7U -#define EXTI_ICFG2_GPIO9_MSK BITS(EXTI_ICFG2_GPIO9_POSS,EXTI_ICFG2_GPIO9_POSE) - -#define EXTI_ICFG2_GPIO8_POSS 0U -#define EXTI_ICFG2_GPIO8_POSE 3U -#define EXTI_ICFG2_GPIO8_MSK BITS(EXTI_ICFG2_GPIO8_POSS,EXTI_ICFG2_GPIO8_POSE) - -typedef struct -{ - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; - __IO uint32_t RTS; - __IO uint32_t FTS; - __O uint32_t SWI; - __IO uint32_t ADTE; - __IO uint32_t DB; - __IO uint32_t DBCON; - __IO uint32_t ICFG1; - __IO uint32_t ICFG2; -} EXTI_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_fc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_fc.h deleted file mode 100644 index 0b9850cb4e..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_fc.h +++ /dev/null @@ -1,181 +0,0 @@ -/** - ************************************************************************************** - * @file REG_FC.h - * @brief FC Head File - * - * @version V0.01 - * @data 12/3/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __fc_H__ -#define __fc_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for FC_CMD register ************************/ - -#define FC_CMD_FC_CMD_POSS 0U -#define FC_CMD_FC_CMD_POSE 7U -#define FC_CMD_FC_CMD_MSK BITS(FC_CMD_FC_CMD_POSS,FC_CMD_FC_CMD_POSE) - -/****************** Bit definition for FC_PA register ************************/ - -#define FC_PA_PCNT_POSS 25U -#define FC_PA_PCNT_POSE 31U -#define FC_PA_PCNT_MSK BITS(FC_PA_PCNT_POSS,FC_PA_PCNT_POSE) - -#define FC_PA_IFREN_POS 24U -#define FC_PA_IFREN_MSK BIT(FC_PA_IFREN_POS) - -#define FC_PA_PROG_ADDR_POSS 0U -#define FC_PA_PROG_ADDR_POSE 23U -#define FC_PA_PROG_ADDR_MSK BITS(FC_PA_PROG_ADDR_POSS,FC_PA_PROG_ADDR_POSE) - -/****************** Bit definition for FC_PLD register ************************/ - -#define FC_PLD_PROG_DATA_L_POSS 0U -#define FC_PLD_PROG_DATA_L_POSE 31U -#define FC_PLD_PROG_DATA_L_MSK BITS(FC_PLD_PROG_DATA_L_POSS,FC_PLD_PROG_DATA_L_POSE) - -/****************** Bit definition for FC_PHD register ************************/ - -#define FC_PHD_PROG_DATA_H_POSS 0U -#define FC_PHD_PROG_DATA_H_POSE 31U -#define FC_PHD_PROG_DATA_H_MSK BITS(FC_PHD_PROG_DATA_H_POSS,FC_PHD_PROG_DATA_H_POSE) - -/****************** Bit definition for FC_CON register ************************/ - -#define FC_CON_SLEEP_POS 9U -#define FC_CON_SLEEP_MSK BIT(FC_CON_SLEEP_POS) - -#define FC_CON_PFEN_POS 8U -#define FC_CON_PFEN_MSK BIT(FC_CON_PFEN_POS) - -#define FC_CON_WAIT_POSS 0U -#define FC_CON_WAIT_POSE 1U -#define FC_CON_WAIT_MSK BITS(FC_CON_WAIT_POSS,FC_CON_WAIT_POSE) - -/****************** Bit definition for FC_STAT register ************************/ - -#define FC_STAT_OPVD_POS 2U -#define FC_STAT_OPVD_MSK BIT(FC_STAT_OPVD_POS) - -#define FC_STAT_MUNP2_POS 1U -#define FC_STAT_MUNP2_MSK BIT(FC_STAT_MUNP2_POS) - -#define FC_STAT_MUNP1_POS 0U -#define FC_STAT_MUNP1_MSK BIT(FC_STAT_MUNP1_POS) - -/****************** Bit definition for FC_UPL register ************************/ - -#define FC_UPL_UPL_POSS 0U -#define FC_UPL_UPL_POSE 31U -#define FC_UPL_UPL_MSK BITS(FC_UPL_UPL_POSS,FC_UPL_UPL_POSE) - -/****************** Bit definition for FC_UPH register ************************/ - -#define FC_UPH_UPH_POSS 0U -#define FC_UPH_UPH_POSE 31U -#define FC_UPH_UPH_MSK BITS(FC_UPH_UPH_POSS,FC_UPH_UPH_POSE) - -/****************** Bit definition for FC_OP_TRIM register ************************/ - -#define FC_OP_TRIM_BGTRIMVD_POSS 24U -#define FC_OP_TRIM_BGTRIMVD_POSE 31U -#define FC_OP_TRIM_BGTRIMVD_MSK BITS(FC_OP_TRIM_BGTRIMVD_POSS,FC_OP_TRIM_BGTRIMVD_POSE) - -#define FC_OP_TRIM_BGTRIM_POSS 16U -#define FC_OP_TRIM_BGTRIM_POSE 23U -#define FC_OP_TRIM_BGTRIM_MSK BITS(FC_OP_TRIM_BGTRIM_POSS,FC_OP_TRIM_BGTRIM_POSE) - -#define FC_OP_TRIM_HRCTRIMVD_POSS 8U -#define FC_OP_TRIM_HRCTRIMVD_POSE 15U -#define FC_OP_TRIM_HRCTRIMVD_MSK BITS(FC_OP_TRIM_HRCTRIMVD_POSS,FC_OP_TRIM_HRCTRIMVD_POSE) - -#define FC_OP_TRIM_HRCTRIM_POSS 0U -#define FC_OP_TRIM_HRCTRIM_POSE 7U -#define FC_OP_TRIM_HRCTRIM_MSK BITS(FC_OP_TRIM_HRCTRIM_POSS,FC_OP_TRIM_HRCTRIM_POSE) - -/****************** Bit definition for FC_OP_PRT2L register ************************/ - -#define FC_OP_PRT2L_PRTLV2L_POSS 0U -#define FC_OP_PRT2L_PRTLV2L_POSE 31U -#define FC_OP_PRT2L_PRTLV2L_MSK BITS(FC_OP_PRT2L_PRTLV2L_POSS,FC_OP_PRT2L_PRTLV2L_POSE) - -/****************** Bit definition for FC_OP_PRT2H register ************************/ - -#define FC_OP_PRT2H_PRTLV2H_POSS 0U -#define FC_OP_PRT2H_PRTLV2H_POSE 31U -#define FC_OP_PRT2H_PRTLV2H_MSK BITS(FC_OP_PRT2H_PRTLV2H_POSS,FC_OP_PRT2H_PRTLV2H_POSE) - -/****************** Bit definition for FC_OP_PRT1L register ************************/ - -#define FC_OP_PRT1L_PRTLV1L_POSS 0U -#define FC_OP_PRT1L_PRTLV1L_POSE 31U -#define FC_OP_PRT1L_PRTLV1L_MSK BITS(FC_OP_PRT1L_PRTLV1L_POSS,FC_OP_PRT1L_PRTLV1L_POSE) - -/****************** Bit definition for FC_OP_PRT1H register ************************/ - -#define FC_OP_PRT1H_PRTLV1H_POSS 0U -#define FC_OP_PRT1H_PRTLV1H_POSE 31U -#define FC_OP_PRT1H_PRTLV1H_MSK BITS(FC_OP_PRT1H_PRTLV1H_POSS,FC_OP_PRT1H_PRTLV1H_POSE) - -/****************** Bit definition for FC_OP_REMAP register ************************/ - -#define FC_OP_REMAP_HREMAP_POSS 8U -#define FC_OP_REMAP_HREMAP_POSE 15U -#define FC_OP_REMAP_HREMAP_MSK BITS(FC_OP_REMAP_HREMAP_POSS,FC_OP_REMAP_HREMAP_POSE) - -#define FC_OP_REMAP_SREMAP_POSS 4U -#define FC_OP_REMAP_SREMAP_POSE 5U -#define FC_OP_REMAP_SREMAP_MSK BITS(FC_OP_REMAP_SREMAP_POSS,FC_OP_REMAP_SREMAP_POSE) - -#define FC_OP_REMAP_SEFBASE_POSS 0U -#define FC_OP_REMAP_SEFBASE_POSE 3U -#define FC_OP_REMAP_SEFBASE_MSK BITS(FC_OP_REMAP_SEFBASE_POSS,FC_OP_REMAP_SEFBASE_POSE) - -typedef struct -{ - __IO uint32_t CMD; - __IO uint32_t PA; - __IO uint32_t PLD; - __IO uint32_t PHD; - __IO uint32_t CON; - __I uint32_t STAT; - uint32_t RESERVED0[2] ; - __IO uint32_t UPL; - __IO uint32_t UPH; - uint32_t RESERVED1[2] ; - __I uint32_t OP_TRIM; - uint32_t RESERVED2[4] ; -// uint32_t ADCTRIM_1V; -// uint32_t ADCTRIM_2V; -// uint32_t RESERVED3; - - uint32_t ADCTRIM_VDD5V_VREF5V; - uint32_t ADCTRIM_VDD3V3_VREF3V3; - uint32_t ADCTRIM_VDD5V_VREF2V5; - __I uint32_t OP_PRT2L; - __I uint32_t OP_PRT2H; - __I uint32_t OP_PRT1L; - __I uint32_t OP_PRT1H; - __I uint32_t OP_REMAP; -} FC_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_gpio.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_gpio.h deleted file mode 100644 index d965ef3b94..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_gpio.h +++ /dev/null @@ -1,710 +0,0 @@ -/** - ************************************************************************************** - * @file REG_GPIO.h - * @brief GPIO Head File - * - * @version V0.01 - * @date 12/5/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __GPIO_H__ -#define __GPIO_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for GPIO_IDATA register ************************/ - -#define GPIO_IDATA_ID15_POS 15U -#define GPIO_IDATA_ID15_MSK BIT(GPIO_IDATA_ID15_POS) - -#define GPIO_IDATA_ID14_POS 14U -#define GPIO_IDATA_ID14_MSK BIT(GPIO_IDATA_ID14_POS) - -#define GPIO_IDATA_ID13_POS 13U -#define GPIO_IDATA_ID13_MSK BIT(GPIO_IDATA_ID13_POS) - -#define GPIO_IDATA_ID12_POS 12U -#define GPIO_IDATA_ID12_MSK BIT(GPIO_IDATA_ID12_POS) - -#define GPIO_IDATA_ID11_POS 11U -#define GPIO_IDATA_ID11_MSK BIT(GPIO_IDATA_ID11_POS) - -#define GPIO_IDATA_ID10_POS 10U -#define GPIO_IDATA_ID10_MSK BIT(GPIO_IDATA_ID10_POS) - -#define GPIO_IDATA_ID9_POS 9U -#define GPIO_IDATA_ID9_MSK BIT(GPIO_IDATA_ID9_POS) - -#define GPIO_IDATA_ID8_POS 8U -#define GPIO_IDATA_ID8_MSK BIT(GPIO_IDATA_ID8_POS) - -#define GPIO_IDATA_ID7_POS 7U -#define GPIO_IDATA_ID7_MSK BIT(GPIO_IDATA_ID7_POS) - -#define GPIO_IDATA_ID6_POS 6U -#define GPIO_IDATA_ID6_MSK BIT(GPIO_IDATA_ID6_POS) - -#define GPIO_IDATA_ID5_POS 5U -#define GPIO_IDATA_ID5_MSK BIT(GPIO_IDATA_ID5_POS) - -#define GPIO_IDATA_ID4_POS 4U -#define GPIO_IDATA_ID4_MSK BIT(GPIO_IDATA_ID4_POS) - -#define GPIO_IDATA_ID3_POS 3U -#define GPIO_IDATA_ID3_MSK BIT(GPIO_IDATA_ID3_POS) - -#define GPIO_IDATA_ID2_POS 2U -#define GPIO_IDATA_ID2_MSK BIT(GPIO_IDATA_ID2_POS) - -#define GPIO_IDATA_ID1_POS 1U -#define GPIO_IDATA_ID1_MSK BIT(GPIO_IDATA_ID1_POS) - -#define GPIO_IDATA_ID0_POS 0U -#define GPIO_IDATA_ID0_MSK BIT(GPIO_IDATA_ID0_POS) - -/****************** Bit definition for GPIO_ODATA register ************************/ - -#define GPIO_ODATA_OD15_POS 15U -#define GPIO_ODATA_OD15_MSK BIT(GPIO_ODATA_OD15_POS) - -#define GPIO_ODATA_OD14_POS 14U -#define GPIO_ODATA_OD14_MSK BIT(GPIO_ODATA_OD14_POS) - -#define GPIO_ODATA_OD13_POS 13U -#define GPIO_ODATA_OD13_MSK BIT(GPIO_ODATA_OD13_POS) - -#define GPIO_ODATA_OD12_POS 12U -#define GPIO_ODATA_OD12_MSK BIT(GPIO_ODATA_OD12_POS) - -#define GPIO_ODATA_OD11_POS 11U -#define GPIO_ODATA_OD11_MSK BIT(GPIO_ODATA_OD11_POS) - -#define GPIO_ODATA_OD10_POS 10U -#define GPIO_ODATA_OD10_MSK BIT(GPIO_ODATA_OD10_POS) - -#define GPIO_ODATA_OD9_POS 9U -#define GPIO_ODATA_OD9_MSK BIT(GPIO_ODATA_OD9_POS) - -#define GPIO_ODATA_OD8_POS 8U -#define GPIO_ODATA_OD8_MSK BIT(GPIO_ODATA_OD8_POS) - -#define GPIO_ODATA_OD7_POS 7U -#define GPIO_ODATA_OD7_MSK BIT(GPIO_ODATA_OD7_POS) - -#define GPIO_ODATA_OD6_POS 6U -#define GPIO_ODATA_OD6_MSK BIT(GPIO_ODATA_OD6_POS) - -#define GPIO_ODATA_OD5_POS 5U -#define GPIO_ODATA_OD5_MSK BIT(GPIO_ODATA_OD5_POS) - -#define GPIO_ODATA_OD4_POS 4U -#define GPIO_ODATA_OD4_MSK BIT(GPIO_ODATA_OD4_POS) - -#define GPIO_ODATA_OD3_POS 3U -#define GPIO_ODATA_OD3_MSK BIT(GPIO_ODATA_OD3_POS) - -#define GPIO_ODATA_OD2_POS 2U -#define GPIO_ODATA_OD2_MSK BIT(GPIO_ODATA_OD2_POS) - -#define GPIO_ODATA_OD1_POS 1U -#define GPIO_ODATA_OD1_MSK BIT(GPIO_ODATA_OD1_POS) - -#define GPIO_ODATA_OD0_POS 0U -#define GPIO_ODATA_OD0_MSK BIT(GPIO_ODATA_OD0_POS) - -/****************** Bit definition for GPIO_BSBR register ************************/ - -#define GPIO_BSBR_BR15_POS 31U -#define GPIO_BSBR_BR15_MSK BIT(GPIO_BSBR_BR15_POS) - -#define GPIO_BSBR_BR14_POS 30U -#define GPIO_BSBR_BR14_MSK BIT(GPIO_BSBR_BR14_POS) - -#define GPIO_BSBR_BR13_POS 29U -#define GPIO_BSBR_BR13_MSK BIT(GPIO_BSBR_BR13_POS) - -#define GPIO_BSBR_BR12_POS 28U -#define GPIO_BSBR_BR12_MSK BIT(GPIO_BSBR_BR12_POS) - -#define GPIO_BSBR_BR11_POS 27U -#define GPIO_BSBR_BR11_MSK BIT(GPIO_BSBR_BR11_POS) - -#define GPIO_BSBR_BR10_POS 26U -#define GPIO_BSBR_BR10_MSK BIT(GPIO_BSBR_BR10_POS) - -#define GPIO_BSBR_BR9_POS 25U -#define GPIO_BSBR_BR9_MSK BIT(GPIO_BSBR_BR9_POS) - -#define GPIO_BSBR_BR8_POS 24U -#define GPIO_BSBR_BR8_MSK BIT(GPIO_BSBR_BR8_POS) - -#define GPIO_BSBR_BR7_POS 23U -#define GPIO_BSBR_BR7_MSK BIT(GPIO_BSBR_BR7_POS) - -#define GPIO_BSBR_BR6_POS 22U -#define GPIO_BSBR_BR6_MSK BIT(GPIO_BSBR_BR6_POS) - -#define GPIO_BSBR_BR5_POS 21U -#define GPIO_BSBR_BR5_MSK BIT(GPIO_BSBR_BR5_POS) - -#define GPIO_BSBR_BR4_POS 20U -#define GPIO_BSBR_BR4_MSK BIT(GPIO_BSBR_BR4_POS) - -#define GPIO_BSBR_BR3_POS 19U -#define GPIO_BSBR_BR3_MSK BIT(GPIO_BSBR_BR3_POS) - -#define GPIO_BSBR_BR2_POS 18U -#define GPIO_BSBR_BR2_MSK BIT(GPIO_BSBR_BR2_POS) - -#define GPIO_BSBR_BR1_POS 17U -#define GPIO_BSBR_BR1_MSK BIT(GPIO_BSBR_BR1_POS) - -#define GPIO_BSBR_BR0_POS 16U -#define GPIO_BSBR_BR0_MSK BIT(GPIO_BSBR_BR0_POS) - -#define GPIO_BSBR_BS15_POS 15U -#define GPIO_BSBR_BS15_MSK BIT(GPIO_BSBR_BS15_POS) - -#define GPIO_BSBR_BS14_POS 14U -#define GPIO_BSBR_BS14_MSK BIT(GPIO_BSBR_BS14_POS) - -#define GPIO_BSBR_BS13_POS 13U -#define GPIO_BSBR_BS13_MSK BIT(GPIO_BSBR_BS13_POS) - -#define GPIO_BSBR_BS12_POS 12U -#define GPIO_BSBR_BS12_MSK BIT(GPIO_BSBR_BS12_POS) - -#define GPIO_BSBR_BS11_POS 11U -#define GPIO_BSBR_BS11_MSK BIT(GPIO_BSBR_BS11_POS) - -#define GPIO_BSBR_BS10_POS 10U -#define GPIO_BSBR_BS10_MSK BIT(GPIO_BSBR_BS10_POS) - -#define GPIO_BSBR_BS9_POS 9U -#define GPIO_BSBR_BS9_MSK BIT(GPIO_BSBR_BS9_POS) - -#define GPIO_BSBR_BS8_POS 8U -#define GPIO_BSBR_BS8_MSK BIT(GPIO_BSBR_BS8_POS) - -#define GPIO_BSBR_BS7_POS 7U -#define GPIO_BSBR_BS7_MSK BIT(GPIO_BSBR_BS7_POS) - -#define GPIO_BSBR_BS6_POS 6U -#define GPIO_BSBR_BS6_MSK BIT(GPIO_BSBR_BS6_POS) - -#define GPIO_BSBR_BS5_POS 5U -#define GPIO_BSBR_BS5_MSK BIT(GPIO_BSBR_BS5_POS) - -#define GPIO_BSBR_BS4_POS 4U -#define GPIO_BSBR_BS4_MSK BIT(GPIO_BSBR_BS4_POS) - -#define GPIO_BSBR_BS3_POS 3U -#define GPIO_BSBR_BS3_MSK BIT(GPIO_BSBR_BS3_POS) - -#define GPIO_BSBR_BS2_POS 2U -#define GPIO_BSBR_BS2_MSK BIT(GPIO_BSBR_BS2_POS) - -#define GPIO_BSBR_BS1_POS 1U -#define GPIO_BSBR_BS1_MSK BIT(GPIO_BSBR_BS1_POS) - -#define GPIO_BSBR_BS0_POS 0U -#define GPIO_BSBR_BS0_MSK BIT(GPIO_BSBR_BS0_POS) - -/****************** Bit definition for GPIO_LCK register ************************/ - -#define GPIO_LCK_LCKK_POS 16U -#define GPIO_LCK_LCKK_MSK BIT(GPIO_LCK_LCKK_POS) - -#define GPIO_LCK_LCK15_POS 15U -#define GPIO_LCK_LCK15_MSK BIT(GPIO_LCK_LCK15_POS) - -#define GPIO_LCK_LCK14_POS 14U -#define GPIO_LCK_LCK14_MSK BIT(GPIO_LCK_LCK14_POS) - -#define GPIO_LCK_LCK13_POS 13U -#define GPIO_LCK_LCK13_MSK BIT(GPIO_LCK_LCK13_POS) - -#define GPIO_LCK_LCK12_POS 12U -#define GPIO_LCK_LCK12_MSK BIT(GPIO_LCK_LCK12_POS) - -#define GPIO_LCK_LCK11_POS 11U -#define GPIO_LCK_LCK11_MSK BIT(GPIO_LCK_LCK11_POS) - -#define GPIO_LCK_LCK10_POS 10U -#define GPIO_LCK_LCK10_MSK BIT(GPIO_LCK_LCK10_POS) - -#define GPIO_LCK_LCK9_POS 9U -#define GPIO_LCK_LCK9_MSK BIT(GPIO_LCK_LCK9_POS) - -#define GPIO_LCK_LCK8_POS 8U -#define GPIO_LCK_LCK8_MSK BIT(GPIO_LCK_LCK8_POS) - -#define GPIO_LCK_LCK7_POS 7U -#define GPIO_LCK_LCK7_MSK BIT(GPIO_LCK_LCK7_POS) - -#define GPIO_LCK_LCK6_POS 6U -#define GPIO_LCK_LCK6_MSK BIT(GPIO_LCK_LCK6_POS) - -#define GPIO_LCK_LCK5_POS 5U -#define GPIO_LCK_LCK5_MSK BIT(GPIO_LCK_LCK5_POS) - -#define GPIO_LCK_LCK4_POS 4U -#define GPIO_LCK_LCK4_MSK BIT(GPIO_LCK_LCK4_POS) - -#define GPIO_LCK_LCK3_POS 3U -#define GPIO_LCK_LCK3_MSK BIT(GPIO_LCK_LCK3_POS) - -#define GPIO_LCK_LCK2_POS 2U -#define GPIO_LCK_LCK2_MSK BIT(GPIO_LCK_LCK2_POS) - -#define GPIO_LCK_LCK1_POS 1U -#define GPIO_LCK_LCK1_MSK BIT(GPIO_LCK_LCK1_POS) - -#define GPIO_LCK_LCK0_POS 0U -#define GPIO_LCK_LCK0_MSK BIT(GPIO_LCK_LCK0_POS) - -/****************** Bit definition for GPIO_MOD register ************************/ - -#define GPIO_MOD_MOD15_POSS 30U -#define GPIO_MOD_MOD15_POSE 31U -#define GPIO_MOD_MOD15_MSK BITS(GPIO_MOD_MOD15_POSS,GPIO_MOD_MOD15_POSE) - -#define GPIO_MOD_MOD14_POSS 28U -#define GPIO_MOD_MOD14_POSE 29U -#define GPIO_MOD_MOD14_MSK BITS(GPIO_MOD_MOD14_POSS,GPIO_MOD_MOD14_POSE) - -#define GPIO_MOD_MOD13_POSS 26U -#define GPIO_MOD_MOD13_POSE 27U -#define GPIO_MOD_MOD13_MSK BITS(GPIO_MOD_MOD13_POSS,GPIO_MOD_MOD13_POSE) - -#define GPIO_MOD_MOD12_POSS 24U -#define GPIO_MOD_MOD12_POSE 25U -#define GPIO_MOD_MOD12_MSK BITS(GPIO_MOD_MOD12_POSS,GPIO_MOD_MOD12_POSE) - -#define GPIO_MOD_MOD11_POSS 22U -#define GPIO_MOD_MOD11_POSE 23U -#define GPIO_MOD_MOD11_MSK BITS(GPIO_MOD_MOD11_POSS,GPIO_MOD_MOD11_POSE) - -#define GPIO_MOD_MOD10_POSS 20U -#define GPIO_MOD_MOD10_POSE 21U -#define GPIO_MOD_MOD10_MSK BITS(GPIO_MOD_MOD10_POSS,GPIO_MOD_MOD10_POSE) - -#define GPIO_MOD_MOD9_POSS 18U -#define GPIO_MOD_MOD9_POSE 19U -#define GPIO_MOD_MOD9_MSK BITS(GPIO_MOD_MOD9_POSS,GPIO_MOD_MOD9_POSE) - -#define GPIO_MOD_MOD8_POSS 16U -#define GPIO_MOD_MOD8_POSE 17U -#define GPIO_MOD_MOD8_MSK BITS(GPIO_MOD_MOD8_POSS,GPIO_MOD_MOD8_POSE) - -#define GPIO_MOD_MOD7_POSS 14U -#define GPIO_MOD_MOD7_POSE 15U -#define GPIO_MOD_MOD7_MSK BITS(GPIO_MOD_MOD7_POSS,GPIO_MOD_MOD7_POSE) - -#define GPIO_MOD_MOD6_POSS 12U -#define GPIO_MOD_MOD6_POSE 13U -#define GPIO_MOD_MOD6_MSK BITS(GPIO_MOD_MOD6_POSS,GPIO_MOD_MOD6_POSE) - -#define GPIO_MOD_MOD5_POSS 10U -#define GPIO_MOD_MOD5_POSE 11U -#define GPIO_MOD_MOD5_MSK BITS(GPIO_MOD_MOD5_POSS,GPIO_MOD_MOD5_POSE) - -#define GPIO_MOD_MOD4_POSS 8U -#define GPIO_MOD_MOD4_POSE 9U -#define GPIO_MOD_MOD4_MSK BITS(GPIO_MOD_MOD4_POSS,GPIO_MOD_MOD4_POSE) - -#define GPIO_MOD_MOD3_POSS 6U -#define GPIO_MOD_MOD3_POSE 7U -#define GPIO_MOD_MOD3_MSK BITS(GPIO_MOD_MOD3_POSS,GPIO_MOD_MOD3_POSE) - -#define GPIO_MOD_MOD2_POSS 4U -#define GPIO_MOD_MOD2_POSE 5U -#define GPIO_MOD_MOD2_MSK BITS(GPIO_MOD_MOD2_POSS,GPIO_MOD_MOD2_POSE) - -#define GPIO_MOD_MOD1_POSS 2U -#define GPIO_MOD_MOD1_POSE 3U -#define GPIO_MOD_MOD1_MSK BITS(GPIO_MOD_MOD1_POSS,GPIO_MOD_MOD1_POSE) - -#define GPIO_MOD_MOD0_POSS 0U -#define GPIO_MOD_MOD0_POSE 1U -#define GPIO_MOD_MOD0_MSK BITS(GPIO_MOD_MOD0_POSS,GPIO_MOD_MOD0_POSE) - -/****************** Bit definition for GPIO_PUD register ************************/ - -#define GPIO_PUD_PUD15_POSS 30U -#define GPIO_PUD_PUD15_POSE 31U -#define GPIO_PUD_PUD15_MSK BITS(GPIO_PUD_PUD15_POSS,GPIO_PUD_PUD15_POSE) - -#define GPIO_PUD_PUD14_POSS 28U -#define GPIO_PUD_PUD14_POSE 29U -#define GPIO_PUD_PUD14_MSK BITS(GPIO_PUD_PUD14_POSS,GPIO_PUD_PUD14_POSE) - -#define GPIO_PUD_PUD13_POSS 26U -#define GPIO_PUD_PUD13_POSE 27U -#define GPIO_PUD_PUD13_MSK BITS(GPIO_PUD_PUD13_POSS,GPIO_PUD_PUD13_POSE) - -#define GPIO_PUD_PUD12_POSS 24U -#define GPIO_PUD_PUD12_POSE 25U -#define GPIO_PUD_PUD12_MSK BITS(GPIO_PUD_PUD12_POSS,GPIO_PUD_PUD12_POSE) - -#define GPIO_PUD_PUD11_POSS 22U -#define GPIO_PUD_PUD11_POSE 23U -#define GPIO_PUD_PUD11_MSK BITS(GPIO_PUD_PUD11_POSS,GPIO_PUD_PUD11_POSE) - -#define GPIO_PUD_PUD10_POSS 20U -#define GPIO_PUD_PUD10_POSE 21U -#define GPIO_PUD_PUD10_MSK BITS(GPIO_PUD_PUD10_POSS,GPIO_PUD_PUD10_POSE) - -#define GPIO_PUD_PUD9_POSS 18U -#define GPIO_PUD_PUD9_POSE 19U -#define GPIO_PUD_PUD9_MSK BITS(GPIO_PUD_PUD9_POSS,GPIO_PUD_PUD9_POSE) - -#define GPIO_PUD_PUD8_POSS 16U -#define GPIO_PUD_PUD8_POSE 17U -#define GPIO_PUD_PUD8_MSK BITS(GPIO_PUD_PUD8_POSS,GPIO_PUD_PUD8_POSE) - -#define GPIO_PUD_PUD7_POSS 14U -#define GPIO_PUD_PUD7_POSE 15U -#define GPIO_PUD_PUD7_MSK BITS(GPIO_PUD_PUD7_POSS,GPIO_PUD_PUD7_POSE) - -#define GPIO_PUD_PUD6_POSS 12U -#define GPIO_PUD_PUD6_POSE 13U -#define GPIO_PUD_PUD6_MSK BITS(GPIO_PUD_PUD6_POSS,GPIO_PUD_PUD6_POSE) - -#define GPIO_PUD_PUD5_POSS 10U -#define GPIO_PUD_PUD5_POSE 11U -#define GPIO_PUD_PUD5_MSK BITS(GPIO_PUD_PUD5_POSS,GPIO_PUD_PUD5_POSE) - -#define GPIO_PUD_PUD4_POSS 8U -#define GPIO_PUD_PUD4_POSE 9U -#define GPIO_PUD_PUD4_MSK BITS(GPIO_PUD_PUD4_POSS,GPIO_PUD_PUD4_POSE) - -#define GPIO_PUD_PUD3_POSS 6U -#define GPIO_PUD_PUD3_POSE 7U -#define GPIO_PUD_PUD3_MSK BITS(GPIO_PUD_PUD3_POSS,GPIO_PUD_PUD3_POSE) - -#define GPIO_PUD_PUD2_POSS 4U -#define GPIO_PUD_PUD2_POSE 5U -#define GPIO_PUD_PUD2_MSK BITS(GPIO_PUD_PUD2_POSS,GPIO_PUD_PUD2_POSE) - -#define GPIO_PUD_PUD1_POSS 2U -#define GPIO_PUD_PUD1_POSE 3U -#define GPIO_PUD_PUD1_MSK BITS(GPIO_PUD_PUD1_POSS,GPIO_PUD_PUD1_POSE) - -#define GPIO_PUD_PUD0_POSS 0U -#define GPIO_PUD_PUD0_POSE 1U -#define GPIO_PUD_PUD0_MSK BITS(GPIO_PUD_PUD0_POSS,GPIO_PUD_PUD0_POSE) - -/****************** Bit definition for GPIO_OT register ************************/ - -#define GPIO_OT_OT15_POS 15U -#define GPIO_OT_OT15_MSK BIT(GPIO_OT_OT15_POS) - -#define GPIO_OT_OT14_POS 14U -#define GPIO_OT_OT14_MSK BIT(GPIO_OT_OT14_POS) - -#define GPIO_OT_OT13_POS 13U -#define GPIO_OT_OT13_MSK BIT(GPIO_OT_OT13_POS) - -#define GPIO_OT_OT12_POS 12U -#define GPIO_OT_OT12_MSK BIT(GPIO_OT_OT12_POS) - -#define GPIO_OT_OT11_POS 11U -#define GPIO_OT_OT11_MSK BIT(GPIO_OT_OT11_POS) - -#define GPIO_OT_OT10_POS 10U -#define GPIO_OT_OT10_MSK BIT(GPIO_OT_OT10_POS) - -#define GPIO_OT_OT9_POS 9U -#define GPIO_OT_OT9_MSK BIT(GPIO_OT_OT9_POS) - -#define GPIO_OT_OT8_POS 8U -#define GPIO_OT_OT8_MSK BIT(GPIO_OT_OT8_POS) - -#define GPIO_OT_OT7_POS 7U -#define GPIO_OT_OT7_MSK BIT(GPIO_OT_OT7_POS) - -#define GPIO_OT_OT6_POS 6U -#define GPIO_OT_OT6_MSK BIT(GPIO_OT_OT6_POS) - -#define GPIO_OT_OT5_POS 5U -#define GPIO_OT_OT5_MSK BIT(GPIO_OT_OT5_POS) - -#define GPIO_OT_OT4_POS 4U -#define GPIO_OT_OT4_MSK BIT(GPIO_OT_OT4_POS) - -#define GPIO_OT_OT3_POS 3U -#define GPIO_OT_OT3_MSK BIT(GPIO_OT_OT3_POS) - -#define GPIO_OT_OT2_POS 2U -#define GPIO_OT_OT2_MSK BIT(GPIO_OT_OT2_POS) - -#define GPIO_OT_OT1_POS 1U -#define GPIO_OT_OT1_MSK BIT(GPIO_OT_OT1_POS) - -#define GPIO_OT_OT0_POS 0U -#define GPIO_OT_OT0_MSK BIT(GPIO_OT_OT0_POS) - -#define GPIO_OT_OT_POSS 0U -#define GPIO_OT_OT_POSE 15U -#define GPIO_OT_OT_MSK BITS(GPIO_OT_OT_POSS,GPIO_OT_OT_POSE) - -/****************** Bit definition for GPIO_DS register ************************/ - -#define GPIO_DS_DS15_POS 15U -#define GPIO_DS_DS15_MSK BIT(GPIO_DS_DS15_POS) - -#define GPIO_DS_DS14_POS 14U -#define GPIO_DS_DS14_MSK BIT(GPIO_DS_DS14_POS) - -#define GPIO_DS_DS13_POS 13U -#define GPIO_DS_DS13_MSK BIT(GPIO_DS_DS13_POS) - -#define GPIO_DS_DS12_POS 12U -#define GPIO_DS_DS12_MSK BIT(GPIO_DS_DS12_POS) - -#define GPIO_DS_DS11_POS 11U -#define GPIO_DS_DS11_MSK BIT(GPIO_DS_DS11_POS) - -#define GPIO_DS_DS10_POS 10U -#define GPIO_DS_DS10_MSK BIT(GPIO_DS_DS10_POS) - -#define GPIO_DS_DS9_POS 9U -#define GPIO_DS_DS9_MSK BIT(GPIO_DS_DS9_POS) - -#define GPIO_DS_DS8_POS 8U -#define GPIO_DS_DS8_MSK BIT(GPIO_DS_DS8_POS) - -#define GPIO_DS_DS7_POS 7U -#define GPIO_DS_DS7_MSK BIT(GPIO_DS_DS7_POS) - -#define GPIO_DS_DS6_POS 6U -#define GPIO_DS_DS6_MSK BIT(GPIO_DS_DS6_POS) - -#define GPIO_DS_DS5_POS 5U -#define GPIO_DS_DS5_MSK BIT(GPIO_DS_DS5_POS) - -#define GPIO_DS_DS4_POS 4U -#define GPIO_DS_DS4_MSK BIT(GPIO_DS_DS4_POS) - -#define GPIO_DS_DS3_POS 3U -#define GPIO_DS_DS3_MSK BIT(GPIO_DS_DS3_POS) - -#define GPIO_DS_DS2_POS 2U -#define GPIO_DS_DS2_MSK BIT(GPIO_DS_DS2_POS) - -#define GPIO_DS_DS1_POS 1U -#define GPIO_DS_DS1_MSK BIT(GPIO_DS_DS1_POS) - -#define GPIO_DS_DS0_POS 0U -#define GPIO_DS_DS0_MSK BIT(GPIO_DS_DS0_POS) - -#define GPIO_DS_DS_POSS 0U -#define GPIO_DS_DS_POSE 15U -#define GPIO_DS_DS_MSK BITS(GPIO_DS_DS_POSS,GPIO_DS_DS_POSE) - -/****************** Bit definition for GPIO_FIR register ************************/ - -#define GPIO_FIR_FIR15_POS 15U -#define GPIO_FIR_FIR15_MSK BIT(GPIO_FIR_FIR15_POS) - -#define GPIO_FIR_FIR14_POS 14U -#define GPIO_FIR_FIR14_MSK BIT(GPIO_FIR_FIR14_POS) - -#define GPIO_FIR_FIR13_POS 13U -#define GPIO_FIR_FIR13_MSK BIT(GPIO_FIR_FIR13_POS) - -#define GPIO_FIR_FIR12_POS 12U -#define GPIO_FIR_FIR12_MSK BIT(GPIO_FIR_FIR12_POS) - -#define GPIO_FIR_FIR11_POS 11U -#define GPIO_FIR_FIR11_MSK BIT(GPIO_FIR_FIR11_POS) - -#define GPIO_FIR_FIR10_POS 10U -#define GPIO_FIR_FIR10_MSK BIT(GPIO_FIR_FIR10_POS) - -#define GPIO_FIR_FIR9_POS 9U -#define GPIO_FIR_FIR9_MSK BIT(GPIO_FIR_FIR9_POS) - -#define GPIO_FIR_FIR8_POS 8U -#define GPIO_FIR_FIR8_MSK BIT(GPIO_FIR_FIR8_POS) - -#define GPIO_FIR_FIR7_POS 7U -#define GPIO_FIR_FIR7_MSK BIT(GPIO_FIR_FIR7_POS) - -#define GPIO_FIR_FIR6_POS 6U -#define GPIO_FIR_FIR6_MSK BIT(GPIO_FIR_FIR6_POS) - -#define GPIO_FIR_FIR5_POS 5U -#define GPIO_FIR_FIR5_MSK BIT(GPIO_FIR_FIR5_POS) - -#define GPIO_FIR_FIR4_POS 4U -#define GPIO_FIR_FIR4_MSK BIT(GPIO_FIR_FIR4_POS) - -#define GPIO_FIR_FIR3_POS 3U -#define GPIO_FIR_FIR3_MSK BIT(GPIO_FIR_FIR3_POS) - -#define GPIO_FIR_FIR2_POS 2U -#define GPIO_FIR_FIR2_MSK BIT(GPIO_FIR_FIR2_POS) - -#define GPIO_FIR_FIR1_POS 1U -#define GPIO_FIR_FIR1_MSK BIT(GPIO_FIR_FIR1_POS) - -#define GPIO_FIR_FIR0_POS 0U -#define GPIO_FIR_FIR0_MSK BIT(GPIO_FIR_FIR0_POS) - -/****************** Bit definition for GPIO_IST register ************************/ - -#define GPIO_IST_IST15_POS 15U -#define GPIO_IST_IST15_MSK BIT(GPIO_IST_IST15_POS) - -#define GPIO_IST_IST14_POS 14U -#define GPIO_IST_IST14_MSK BIT(GPIO_IST_IST14_POS) - -#define GPIO_IST_IST13_POS 13U -#define GPIO_IST_IST13_MSK BIT(GPIO_IST_IST13_POS) - -#define GPIO_IST_IST12_POS 12U -#define GPIO_IST_IST12_MSK BIT(GPIO_IST_IST12_POS) - -#define GPIO_IST_IST11_POS 11U -#define GPIO_IST_IST11_MSK BIT(GPIO_IST_IST11_POS) - -#define GPIO_IST_IST10_POS 10U -#define GPIO_IST_IST10_MSK BIT(GPIO_IST_IST10_POS) - -#define GPIO_IST_IST9_POS 9U -#define GPIO_IST_IST9_MSK BIT(GPIO_IST_IST9_POS) - -#define GPIO_IST_IST8_POS 8U -#define GPIO_IST_IST8_MSK BIT(GPIO_IST_IST8_POS) - -#define GPIO_IST_IST7_POS 7U -#define GPIO_IST_IST7_MSK BIT(GPIO_IST_IST7_POS) - -#define GPIO_IST_IST6_POS 6U -#define GPIO_IST_IST6_MSK BIT(GPIO_IST_IST6_POS) - -#define GPIO_IST_IST5_POS 5U -#define GPIO_IST_IST5_MSK BIT(GPIO_IST_IST5_POS) - -#define GPIO_IST_IST4_POS 4U -#define GPIO_IST_IST4_MSK BIT(GPIO_IST_IST4_POS) - -#define GPIO_IST_IST3_POS 3U -#define GPIO_IST_IST3_MSK BIT(GPIO_IST_IST3_POS) - -#define GPIO_IST_IST2_POS 2U -#define GPIO_IST_IST2_MSK BIT(GPIO_IST_IST2_POS) - -#define GPIO_IST_IST1_POS 1U -#define GPIO_IST_IST1_MSK BIT(GPIO_IST_IST1_POS) - -#define GPIO_IST_IST0_POS 0U -#define GPIO_IST_IST0_MSK BIT(GPIO_IST_IST0_POS) - -#define GPIO_IST_IST_POSS 0U -#define GPIO_IST_IST_POSE 15U -#define GPIO_IST_IST_MSK BITS(GPIO_IST_IST_POSS, GPIO_IST_IST_POSE) - -/****************** Bit definition for GPIO_AFL register ************************/ - -#define GPIO_AFL_AF7_POSS 28U -#define GPIO_AFL_AF7_POSE 31U -#define GPIO_AFL_AF7_MSK BITS(GPIO_AFL_AF7_POSS,GPIO_AFL_AF7_POSE) - -#define GPIO_AFL_AF6_POSS 24U -#define GPIO_AFL_AF6_POSE 27U -#define GPIO_AFL_AF6_MSK BITS(GPIO_AFL_AF6_POSS,GPIO_AFL_AF6_POSE) - -#define GPIO_AFL_AF5_POSS 20U -#define GPIO_AFL_AF5_POSE 23U -#define GPIO_AFL_AF5_MSK BITS(GPIO_AFL_AF5_POSS,GPIO_AFL_AF5_POSE) - -#define GPIO_AFL_AF4_POSS 16U -#define GPIO_AFL_AF4_POSE 19U -#define GPIO_AFL_AF4_MSK BITS(GPIO_AFL_AF4_POSS,GPIO_AFL_AF4_POSE) - -#define GPIO_AFL_AF3_POSS 12U -#define GPIO_AFL_AF3_POSE 15U -#define GPIO_AFL_AF3_MSK BITS(GPIO_AFL_AF3_POSS,GPIO_AFL_AF3_POSE) - -#define GPIO_AFL_AF2_POSS 8U -#define GPIO_AFL_AF2_POSE 11U -#define GPIO_AFL_AF2_MSK BITS(GPIO_AFL_AF2_POSS,GPIO_AFL_AF2_POSE) - -#define GPIO_AFL_AF1_POSS 4U -#define GPIO_AFL_AF1_POSE 7U -#define GPIO_AFL_AF1_MSK BITS(GPIO_AFL_AF1_POSS,GPIO_AFL_AF1_POSE) - -#define GPIO_AFL_AF0_POSS 0U -#define GPIO_AFL_AF0_POSE 3U -#define GPIO_AFL_AF0_MSK BITS(GPIO_AFL_AF0_POSS,GPIO_AFL_AF0_POSE) - -/****************** Bit definition for GPIO_AFH register ************************/ - -#define GPIO_AFH_AF15_POSS 28U -#define GPIO_AFH_AF15_POSE 31U -#define GPIO_AFH_AF15_MSK BITS(GPIO_AFH_AF15_POSS,GPIO_AFH_AF15_POSE) - -#define GPIO_AFH_AF14_POSS 24U -#define GPIO_AFH_AF14_POSE 27U -#define GPIO_AFH_AF14_MSK BITS(GPIO_AFH_AF14_POSS,GPIO_AFH_AF14_POSE) - -#define GPIO_AFH_AF13_POSS 20U -#define GPIO_AFH_AF13_POSE 23U -#define GPIO_AFH_AF13_MSK BITS(GPIO_AFH_AF13_POSS,GPIO_AFH_AF13_POSE) - -#define GPIO_AFH_AF12_POSS 16U -#define GPIO_AFH_AF12_POSE 19U -#define GPIO_AFH_AF12_MSK BITS(GPIO_AFH_AF12_POSS,GPIO_AFH_AF12_POSE) - -#define GPIO_AFH_AF11_POSS 12U -#define GPIO_AFH_AF11_POSE 15U -#define GPIO_AFH_AF11_MSK BITS(GPIO_AFH_AF11_POSS,GPIO_AFH_AF11_POSE) - -#define GPIO_AFH_AF10_POSS 8U -#define GPIO_AFH_AF10_POSE 11U -#define GPIO_AFH_AF10_MSK BITS(GPIO_AFH_AF10_POSS,GPIO_AFH_AF10_POSE) - -#define GPIO_AFH_AF9_POSS 4U -#define GPIO_AFH_AF9_POSE 7U -#define GPIO_AFH_AF9_MSK BITS(GPIO_AFH_AF9_POSS,GPIO_AFH_AF9_POSE) - -#define GPIO_AFH_AF8_POSS 0U -#define GPIO_AFH_AF8_POSE 3U -#define GPIO_AFH_AF8_MSK BITS(GPIO_AFH_AF8_POSS,GPIO_AFH_AF8_POSE) - -typedef struct -{ - __I uint32_t IDATA; - __IO uint32_t ODATA; - __O uint32_t BSBR; - __IO uint32_t LCK; - __IO uint32_t MOD; - __IO uint32_t PUD; - __IO uint32_t OT; - __IO uint32_t DS; - __IO uint32_t FIR; - __IO uint32_t IST; - __IO uint32_t AFL; - __IO uint32_t AFH; -} GPIO_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_hdiv.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_hdiv.h deleted file mode 100644 index d1ffd0d102..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_hdiv.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - ************************************************************************************** - * @file REG_HDIV.h - * @brief HDIV Head File - * - * @version V0.01 - * @data 12/3/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __hdiv_H__ -#define __hdiv_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for HDIV_DIVDR register ************************/ - -#define HDIV_DIVDR_DIVS_POSS 0U -#define HDIV_DIVDR_DIVS_POSE 31U -#define HDIV_DIVDR_DIVD_MSK BITS(HDIV_DIVDR_DIVD_POSS,HDIV_DIVDR_DIVD_POSE) - -/****************** Bit definition for HDIV_DIVSR register ************************/ - -#define HDIV_DIVSR_DIVS_POSS 0U -#define HDIV_DIVSR_DIVS_POSE 31U -#define HDIV_DIVSR_DIVS_MSK BITS(HDIV_DIVSR_DIVS_POSS,HDIV_DIVSR_DIVS_POSE) - -/****************** Bit definition for HDIV_DIVQR register ************************/ - -#define HDIV_DIVQR_DIVQ_POSS 0U -#define HDIV_DIVQR_DIVQ_POSE 31U -#define HDIV_DIVQR_DIVQ_MSK BITS(HDIV_DIVQR_DIVQ_POSS,HDIV_DIVQR_DIVQ_POSE) - -/****************** Bit definition for HDIV_DIVRR register ************************/ - -#define HDIV_DIVRR_DIVR_POSS 0U -#define HDIV_DIVRR_DIVR_POSE 31U -#define HDIV_DIVRR_DIVR_MSK BITS(HDIV_DIVRR_DIVR_POSS,HDIV_DIVRR_DIVR_POSE) - -/****************** Bit definition for HDIV_DIVSTAT register ************************/ - -#define HDIV_DIVSTAT_SIGN_POS 2U -#define HDIV_DIVSTAT_SIGN_MSK BIT(HDIV_DIVSTAT_SIGN_POS) - -#define HDIV_DIVSTAT_DIV0_POS 1U -#define HDIV_DIVSTAT_DIV0_MSK BIT(HDIV_DIVSTAT_DIV0_POS) - -#define HDIV_DIVSTAT_BUSY_POS 0U -#define HDIV_DIVSTAT_BUSY_MSK BIT(HDIV_DIVSTAT_BUSY_POS) - -typedef struct -{ - __IO uint32_t DIVDR; - __IO uint32_t DIVSR; - __I uint32_t DIVQR; - __I uint32_t DIVRR; - __I uint32_t DIVSTAT; -} HDIV_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_i2c.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_i2c.h deleted file mode 100644 index 887eb01e03..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_i2c.h +++ /dev/null @@ -1,623 +0,0 @@ -/** - ************************************************************************************** - * @file REG_I2C.h - * @brief I2C Head File - * - * @version V0.01 - * @date 4/12/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __REG_I2C_H__ -#define __REG_I2C_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for I2C_CON1 register ************************/ - -#define I2C_CON1_PECEN_POS 23U -#define I2C_CON1_PECEN_MSK BIT(I2C_CON1_PECEN_POS) - -#define I2C_CON1_ALERTEN_POS 22U -#define I2C_CON1_ALERTEN_MSK BIT(I2C_CON1_ALERTEN_POS) - -#define I2C_CON1_SMBDEN_POS 21U -#define I2C_CON1_SMBDEN_MSK BIT(I2C_CON1_SMBDEN_POS) - -#define I2C_CON1_SMBHEN_POS 20U -#define I2C_CON1_SMBHEN_MSK BIT(I2C_CON1_SMBHEN_POS) - -#define I2C_CON1_GCEN_POS 19U -#define I2C_CON1_GCEN_MSK BIT(I2C_CON1_GCEN_POS) - -#define I2C_CON1_NOSTRETCH_POS 17U -#define I2C_CON1_NOSTRETCH_MSK BIT(I2C_CON1_NOSTRETCH_POS) - -#define I2C_CON1_SBC_POS 16U -#define I2C_CON1_SBC_MSK BIT(I2C_CON1_SBC_POS) - -#define I2C_CON1_RXDMAEN_POS 15U -#define I2C_CON1_RXDMAEN_MSK BIT(I2C_CON1_RXDMAEN_POS) - -#define I2C_CON1_TXDMAEN_POS 14U -#define I2C_CON1_TXDMAEN_MSK BIT(I2C_CON1_TXDMAEN_POS) - -#define I2C_CON1_DNF_POSS 8U -#define I2C_CON1_DNF_POSE 11U -#define I2C_CON1_DNF_MSK BITS(I2C_CON1_DNF_POSS,I2C_CON1_DNF_POSE) - -#define I2C_CON1_PE_POS 0U -#define I2C_CON1_PE_MSK BIT(I2C_CON1_PE_POS) - -/****************** Bit definition for I2C_CON2 register ************************/ - -#define I2C_CON2_ACK_UPD_POS 29U -#define I2C_CON2_ACK_UPD_MSK BIT(I2C_CON2_ACK_UPD_POS) - -#define I2C_CON2_HOLDACK_POS 28U -#define I2C_CON2_HOLDACK_MSK BIT(I2C_CON2_HOLDACK_POS) - -#define I2C_CON2_PECBYTE_POS 26U -#define I2C_CON2_PECBYTE_MSK BIT(I2C_CON2_PECBYTE_POS) - -#define I2C_CON2_AUTOEND_POS 25U -#define I2C_CON2_AUTOEND_MSK BIT(I2C_CON2_AUTOEND_POS) - -#define I2C_CON2_RELOAD_POS 24U -#define I2C_CON2_RELOAD_MSK BIT(I2C_CON2_RELOAD_POS) - -#define I2C_CON2_NBYTES_POSS 16U -#define I2C_CON2_NBYTES_POSE 23U -#define I2C_CON2_NBYTES_MSK BITS(I2C_CON2_NBYTES_POSS,I2C_CON2_NBYTES_POSE) - -#define I2C_CON2_NACK_POS 15U -#define I2C_CON2_NACK_MSK BIT(I2C_CON2_NACK_POS) - -#define I2C_CON2_STOP_POS 14U -#define I2C_CON2_STOP_MSK BIT(I2C_CON2_STOP_POS) - -#define I2C_CON2_START_POS 13U -#define I2C_CON2_START_MSK BIT(I2C_CON2_START_POS) - -#define I2C_CON2_HEAD10R_POS 12U -#define I2C_CON2_HEAD10R_MSK BIT(I2C_CON2_HEAD10R_POS) - -#define I2C_CON2_ADD10_POS 11U -#define I2C_CON2_ADD10_MSK BIT(I2C_CON2_ADD10_POS) - -#define I2C_CON2_RD_WRN_POS 10U -#define I2C_CON2_RD_WRN_MSK BIT(I2C_CON2_RD_WRN_POS) - -#define I2C_CON2_SADD_POSS 0U -#define I2C_CON2_SADD_POSE 9U -#define I2C_CON2_SADD_MSK BITS(I2C_CON2_SADD_POSS,I2C_CON2_SADD_POSE) - -/****************** Bit definition for I2C_ADDR1 register ************************/ - -#define I2C_ADDR1_OA1EN_POS 15U -#define I2C_ADDR1_OA1EN_MSK BIT(I2C_ADDR1_OA1EN_POS) - -#define I2C_ADDR1_OA1MODE_POS 10U -#define I2C_ADDR1_OA1MODE_MSK BIT(I2C_ADDR1_OA1MODE_POS) - -#define I2C_ADDR1_OA1_POSS 0U -#define I2C_ADDR1_OA1_POSE 9U -#define I2C_ADDR1_OA1_MSK BITS(I2C_ADDR1_OA1_POSS,I2C_ADDR1_OA1_POSE) - -/****************** Bit definition for I2C_ADDR2 register ************************/ - -#define I2C_ADDR2_OA2EN_POS 15U -#define I2C_ADDR2_OA2EN_MSK BIT(I2C_ADDR2_OA2EN_POS) - -#define I2C_ADDR2_OA2MSK_POSS 8U -#define I2C_ADDR2_OA2MSK_POSE 10U -#define I2C_ADDR2_OA2MSK_MSK BITS(I2C_ADDR2_OA2MSK_POSS,I2C_ADDR2_OA2MSK_POSE) - -#define I2C_ADDR2_OA2_POSS 1U -#define I2C_ADDR2_OA2_POSE 7U -#define I2C_ADDR2_OA2_MSK BITS(I2C_ADDR2_OA2_POSS,I2C_ADDR2_OA2_POSE) - -/****************** Bit definition for I2C_TIMINGR register ************************/ - -#define I2C_TIMINGR_PRESC_POSS 28U -#define I2C_TIMINGR_PRESC_POSE 31U -#define I2C_TIMINGR_PRESC_MSK BITS(I2C_TIMINGR_PRESC_POSS,I2C_TIMINGR_PRESC_POSE) - -#define I2C_TIMINGR_SCLDEL_POSS 20U -#define I2C_TIMINGR_SCLDEL_POSE 23U -#define I2C_TIMINGR_SCLDEL_MSK BITS(I2C_TIMINGR_SCLDEL_POSS,I2C_TIMINGR_SCLDEL_POSE) - -#define I2C_TIMINGR_SDADEL_POSS 16U -#define I2C_TIMINGR_SDADEL_POSE 19U -#define I2C_TIMINGR_SDADEL_MSK BITS(I2C_TIMINGR_SDADEL_POSS,I2C_TIMINGR_SDADEL_POSE) - -#define I2C_TIMINGR_SCLH_POSS 8U -#define I2C_TIMINGR_SCLH_POSE 15U -#define I2C_TIMINGR_SCLH_MSK BITS(I2C_TIMINGR_SCLH_POSS,I2C_TIMINGR_SCLH_POSE) - -#define I2C_TIMINGR_SCLL_POSS 0U -#define I2C_TIMINGR_SCLL_POSE 7U -#define I2C_TIMINGR_SCLL_MSK BITS(I2C_TIMINGR_SCLL_POSS,I2C_TIMINGR_SCLL_POSE) - -/****************** Bit definition for I2C_TIMEOUTR register ************************/ - -#define I2C_TIMEOUTR_TEXTEN_POS 31U -#define I2C_TIMEOUTR_TEXTEN_MSK BIT(I2C_TIMEOUTR_TEXTEN_POS) - -#define I2C_TIMEOUTR_TIMEOUTB_POSS 16U -#define I2C_TIMEOUTR_TIMEOUTB_POSE 27U -#define I2C_TIMEOUTR_TIMEOUTB_MSK BITS(I2C_TIMEOUTR_TIMEOUTB_POSS,I2C_TIMEOUTR_TIMEOUTB_POSE) - -#define I2C_TIMEOUTR_TIMEOUTEN_POS 15U -#define I2C_TIMEOUTR_TIMEOUTEN_MSK BIT(I2C_TIMEOUTR_TIMEOUTEN_POS) - -#define I2C_TIMEOUTR_TIDLE_POS 12U -#define I2C_TIMEOUTR_TIDLE_MSK BIT(I2C_TIMEOUTR_TIDLE_POS) - -#define I2C_TIMEOUTR_TIMEOUTA_POSS 0U -#define I2C_TIMEOUTR_TIMEOUTA_POSE 11U -#define I2C_TIMEOUTR_TIMEOUTA_MSK BITS(I2C_TIMEOUTR_TIMEOUTA_POSS,I2C_TIMEOUTR_TIMEOUTA_POSE) - -/****************** Bit definition for I2C_STAT register ************************/ - -#define I2C_STAT_ADDCODE_POSS 17U -#define I2C_STAT_ADDCODE_POSE 23U -#define I2C_STAT_ADDCODE_MSK BITS(I2C_STAT_ADDCODE_POSS,I2C_STAT_ADDCODE_POSE) - -#define I2C_STAT_DIR_POS 16U -#define I2C_STAT_DIR_MSK BIT(I2C_STAT_DIR_POS) - -#define I2C_STAT_BUSY_POS 15U -#define I2C_STAT_BUSY_MSK BIT(I2C_STAT_BUSY_POS) - -#define I2C_STAT_TCR_POS 11U -#define I2C_STAT_TCR_MSK BIT(I2C_STAT_TCR_POS) - -#define I2C_STAT_TC_POS 10U -#define I2C_STAT_TC_MSK BIT(I2C_STAT_TC_POS) - -#define I2C_STAT_RXTH_POS 9U -#define I2C_STAT_RXTH_MSK BIT(I2C_STAT_RXTH_POS) - -#define I2C_STAT_RXUD_POS 8U -#define I2C_STAT_RXUD_MSK BIT(I2C_STAT_RXUD_POS) - -#define I2C_STAT_RXOV_POS 7U -#define I2C_STAT_RXOV_MSK BIT(I2C_STAT_RXOV_POS) - -#define I2C_STAT_RXF_POS 6U -#define I2C_STAT_RXF_MSK BIT(I2C_STAT_RXF_POS) - -#define I2C_STAT_RXE_POS 5U -#define I2C_STAT_RXE_MSK BIT(I2C_STAT_RXE_POS) - -#define I2C_STAT_TXTH_POS 4U -#define I2C_STAT_TXTH_MSK BIT(I2C_STAT_TXTH_POS) - -#define I2C_STAT_TXUD_POS 3U -#define I2C_STAT_TXUD_MSK BIT(I2C_STAT_TXUD_POS) - -#define I2C_STAT_TXOV_POS 2U -#define I2C_STAT_TXOV_MSK BIT(I2C_STAT_TXOV_POS) - -#define I2C_STAT_TXF_POS 1U -#define I2C_STAT_TXF_MSK BIT(I2C_STAT_TXF_POS) - -#define I2C_STAT_TXE_POS 0U -#define I2C_STAT_TXE_MSK BIT(I2C_STAT_TXE_POS) - -/****************** Bit definition for I2C_FCON register ************************/ - -#define I2C_FCON_RXFTH_POSS 14U -#define I2C_FCON_RXFTH_POSE 15U -#define I2C_FCON_RXFTH_MSK BITS(I2C_FCON_RXFTH_POSS,I2C_FCON_RXFTH_POSE) - -#define I2C_FCON_RXFRST_POS 13U -#define I2C_FCON_RXFRST_MSK BIT(I2C_FCON_RXFRST_POS) - -#define I2C_FCON_RXFLV_POSS 8U -#define I2C_FCON_RXFLV_POSE 12U -#define I2C_FCON_RXFLV_MSK BITS(I2C_FCON_RXFLV_POSS,I2C_FCON_RXFLV_POSE) - -#define I2C_FCON_TXFTH_POSS 6U -#define I2C_FCON_TXFTH_POSE 7U -#define I2C_FCON_TXFTH_MSK BITS(I2C_FCON_TXFTH_POSS,I2C_FCON_TXFTH_POSE) - -#define I2C_FCON_TXFRST_POS 5U -#define I2C_FCON_TXFRST_MSK BIT(I2C_FCON_TXFRST_POS) - -#define I2C_FCON_TXFLV_POSS 0U -#define I2C_FCON_TXFLV_POSE 4U -#define I2C_FCON_TXFLV_MSK BITS(I2C_FCON_TXFLV_POSS,I2C_FCON_TXFLV_POSE) - -/****************** Bit definition for I2C_PECR register ************************/ - -#define I2C_PECR_PEC_POSS 0U -#define I2C_PECR_PEC_POSE 7U -#define I2C_PECR_PEC_MSK BITS(I2C_PECR_PEC_POSS,I2C_PECR_PEC_POSE) - -/****************** Bit definition for I2C_RXDATA register ************************/ - -#define I2C_RXDATA_RXDATA_POSS 0U -#define I2C_RXDATA_RXDATA_POSE 7U -#define I2C_RXDATA_RXDATA_MSK BITS(I2C_RXDATA_RXDATA_POSS,I2C_RXDATA_RXDATA_POSE) - -/****************** Bit definition for I2C_TXDATA register ************************/ - -#define I2C_TXDATA_TXDATA_POSS 0U -#define I2C_TXDATA_TXDATA_POSE 7U -#define I2C_TXDATA_TXDATA_MSK BITS(I2C_TXDATA_TXDATA_POSS,I2C_TXDATA_TXDATA_POSE) - -/****************** Bit definition for I2C_IER register ************************/ - -#define I2C_IER_ALERTIE_POS 20U -#define I2C_IER_ALERTIE_MSK BIT(I2C_IER_ALERTIE_POS) - -#define I2C_IER_TOUTIE_POS 19U -#define I2C_IER_TOUTIE_MSK BIT(I2C_IER_TOUTIE_POS) - -#define I2C_IER_PECEIE_POS 18U -#define I2C_IER_PECEIE_MSK BIT(I2C_IER_PECEIE_POS) - -#define I2C_IER_ARLOIE_POS 17U -#define I2C_IER_ARLOIE_MSK BIT(I2C_IER_ARLOIE_POS) - -#define I2C_IER_BERRIE_POS 16U -#define I2C_IER_BERRIE_MSK BIT(I2C_IER_BERRIE_POS) - -#define I2C_IER_STOPIE_POS 14U -#define I2C_IER_STOPIE_MSK BIT(I2C_IER_STOPIE_POS) - -#define I2C_IER_NACKIE_POS 13U -#define I2C_IER_NACKIE_MSK BIT(I2C_IER_NACKIE_POS) - -#define I2C_IER_ADDRIE_POS 12U -#define I2C_IER_ADDRIE_MSK BIT(I2C_IER_ADDRIE_POS) - -#define I2C_IER_TCRIE_POS 11U -#define I2C_IER_TCRIE_MSK BIT(I2C_IER_TCRIE_POS) - -#define I2C_IER_TCIE_POS 10U -#define I2C_IER_TCIE_MSK BIT(I2C_IER_TCIE_POS) - -#define I2C_IER_RXTHIE_POS 9U -#define I2C_IER_RXTHIE_MSK BIT(I2C_IER_RXTHIE_POS) - -#define I2C_IER_RXUDIE_POS 8U -#define I2C_IER_RXUDIE_MSK BIT(I2C_IER_RXUDIE_POS) - -#define I2C_IER_RXOVIE_POS 7U -#define I2C_IER_RXOVIE_MSK BIT(I2C_IER_RXOVIE_POS) - -#define I2C_IER_RXFIE_POS 6U -#define I2C_IER_RXFIE_MSK BIT(I2C_IER_RXFIE_POS) - -#define I2C_IER_TXTHIE_POS 4U -#define I2C_IER_TXTHIE_MSK BIT(I2C_IER_TXTHIE_POS) - -#define I2C_IER_TXUDIE_POS 3U -#define I2C_IER_TXUDIE_MSK BIT(I2C_IER_TXUDIE_POS) - -#define I2C_IER_TXOVIE_POS 2U -#define I2C_IER_TXOVIE_MSK BIT(I2C_IER_TXOVIE_POS) - -#define I2C_IER_TXEIE_POS 0U -#define I2C_IER_TXEIE_MSK BIT(I2C_IER_TXEIE_POS) - -/****************** Bit definition for I2C_IDR register ************************/ - -#define I2C_IDR_ALERTID_POS 20U -#define I2C_IDR_ALERTID_MSK BIT(I2C_IDR_ALERTID_POS) - -#define I2C_IDR_TOUTID_POS 19U -#define I2C_IDR_TOUTID_MSK BIT(I2C_IDR_TOUTID_POS) - -#define I2C_IDR_PECEID_POS 18U -#define I2C_IDR_PECEID_MSK BIT(I2C_IDR_PECEID_POS) - -#define I2C_IDR_ARLOID_POS 17U -#define I2C_IDR_ARLOID_MSK BIT(I2C_IDR_ARLOID_POS) - -#define I2C_IDR_BERRID_POS 16U -#define I2C_IDR_BERRID_MSK BIT(I2C_IDR_BERRID_POS) - -#define I2C_IDR_STOPID_POS 14U -#define I2C_IDR_STOPID_MSK BIT(I2C_IDR_STOPID_POS) - -#define I2C_IDR_NACKID_POS 13U -#define I2C_IDR_NACKID_MSK BIT(I2C_IDR_NACKID_POS) - -#define I2C_IDR_ADDRID_POS 12U -#define I2C_IDR_ADDRID_MSK BIT(I2C_IDR_ADDRID_POS) - -#define I2C_IDR_TCRID_POS 11U -#define I2C_IDR_TCRID_MSK BIT(I2C_IDR_TCRID_POS) - -#define I2C_IDR_TCID_POS 10U -#define I2C_IDR_TCID_MSK BIT(I2C_IDR_TCID_POS) - -#define I2C_IDR_RXTHID_POS 9U -#define I2C_IDR_RXTHID_MSK BIT(I2C_IDR_RXTHID_POS) - -#define I2C_IDR_RXUDID_POS 8U -#define I2C_IDR_RXUDID_MSK BIT(I2C_IDR_RXUDID_POS) - -#define I2C_IDR_RXOVID_POS 7U -#define I2C_IDR_RXOVID_MSK BIT(I2C_IDR_RXOVID_POS) - -#define I2C_IDR_RXFID_POS 6U -#define I2C_IDR_RXFID_MSK BIT(I2C_IDR_RXFID_POS) - -#define I2C_IDR_TXTHID_POS 4U -#define I2C_IDR_TXTHID_MSK BIT(I2C_IDR_TXTHID_POS) - -#define I2C_IDR_TXUDID_POS 3U -#define I2C_IDR_TXUDID_MSK BIT(I2C_IDR_TXUDID_POS) - -#define I2C_IDR_TXOVID_POS 2U -#define I2C_IDR_TXOVID_MSK BIT(I2C_IDR_TXOVID_POS) - -#define I2C_IDR_TXEID_POS 0U -#define I2C_IDR_TXEID_MSK BIT(I2C_IDR_TXEID_POS) - -/****************** Bit definition for I2C_IVS register ************************/ - -#define I2C_IVS_ALERTIV_POS 20U -#define I2C_IVS_ALERTIV_MSK BIT(I2C_IVS_ALERTIV_POS) - -#define I2C_IVS_TOUTIV_POS 19U -#define I2C_IVS_TOUTIV_MSK BIT(I2C_IVS_TOUTIV_POS) - -#define I2C_IVS_PECEIV_POS 18U -#define I2C_IVS_PECEIV_MSK BIT(I2C_IVS_PECEIV_POS) - -#define I2C_IVS_ARLOIV_POS 17U -#define I2C_IVS_ARLOIV_MSK BIT(I2C_IVS_ARLOIV_POS) - -#define I2C_IVS_BERRIV_POS 16U -#define I2C_IVS_BERRIV_MSK BIT(I2C_IVS_BERRIV_POS) - -#define I2C_IVS_STOPIV_POS 14U -#define I2C_IVS_STOPIV_MSK BIT(I2C_IVS_STOPIV_POS) - -#define I2C_IVS_NACKIV_POS 13U -#define I2C_IVS_NACKIV_MSK BIT(I2C_IVS_NACKIV_POS) - -#define I2C_IVS_ADDRIV_POS 12U -#define I2C_IVS_ADDRIV_MSK BIT(I2C_IVS_ADDRIV_POS) - -#define I2C_IVS_TCRIV_POS 11U -#define I2C_IVS_TCRIV_MSK BIT(I2C_IVS_TCRIV_POS) - -#define I2C_IVS_TCIV_POS 10U -#define I2C_IVS_TCIV_MSK BIT(I2C_IVS_TCIV_POS) - -#define I2C_IVS_RXTHIV_POS 9U -#define I2C_IVS_RXTHIV_MSK BIT(I2C_IVS_RXTHIV_POS) - -#define I2C_IVS_RXUDIV_POS 8U -#define I2C_IVS_RXUDIV_MSK BIT(I2C_IVS_RXUDIV_POS) - -#define I2C_IVS_RXOVIV_POS 7U -#define I2C_IVS_RXOVIV_MSK BIT(I2C_IVS_RXOVIV_POS) - -#define I2C_IVS_RXFIV_POS 6U -#define I2C_IVS_RXFIV_MSK BIT(I2C_IVS_RXFIV_POS) - -#define I2C_IVS_TXTHIV_POS 4U -#define I2C_IVS_TXTHIV_MSK BIT(I2C_IVS_TXTHIV_POS) - -#define I2C_IVS_TXUDIV_POS 3U -#define I2C_IVS_TXUDIV_MSK BIT(I2C_IVS_TXUDIV_POS) - -#define I2C_IVS_TXOVIV_POS 2U -#define I2C_IVS_TXOVIV_MSK BIT(I2C_IVS_TXOVIV_POS) - -#define I2C_IVS_TXEIV_POS 0U -#define I2C_IVS_TXEIV_MSK BIT(I2C_IVS_TXEIV_POS) - -/****************** Bit definition for I2C_RIF register ************************/ - -#define I2C_RIF_ALERTRI_POS 20U -#define I2C_RIF_ALERTRI_MSK BIT(I2C_RIF_ALERTRI_POS) - -#define I2C_RIF_TOUTRI_POS 19U -#define I2C_RIF_TOUTRI_MSK BIT(I2C_RIF_TOUTRI_POS) - -#define I2C_RIF_PECERI_POS 18U -#define I2C_RIF_PECERI_MSK BIT(I2C_RIF_PECERI_POS) - -#define I2C_RIF_ARLORI_POS 17U -#define I2C_RIF_ARLORI_MSK BIT(I2C_RIF_ARLORI_POS) - -#define I2C_RIF_BERRRI_POS 16U -#define I2C_RIF_BERRRI_MSK BIT(I2C_RIF_BERRRI_POS) - -#define I2C_RIF_STOPRI_POS 14U -#define I2C_RIF_STOPRI_MSK BIT(I2C_RIF_STOPRI_POS) - -#define I2C_RIF_NACKRI_POS 13U -#define I2C_RIF_NACKRI_MSK BIT(I2C_RIF_NACKRI_POS) - -#define I2C_RIF_ADDRRI_POS 12U -#define I2C_RIF_ADDRRI_MSK BIT(I2C_RIF_ADDRRI_POS) - -#define I2C_RIF_TCRRI_POS 11U -#define I2C_RIF_TCRRI_MSK BIT(I2C_RIF_TCRRI_POS) - -#define I2C_RIF_TCRI_POS 10U -#define I2C_RIF_TCRI_MSK BIT(I2C_RIF_TCRI_POS) - -#define I2C_RIF_RXTHRI_POS 9U -#define I2C_RIF_RXTHRI_MSK BIT(I2C_RIF_RXTHRI_POS) - -#define I2C_RIF_RXUDRI_POS 8U -#define I2C_RIF_RXUDRI_MSK BIT(I2C_RIF_RXUDRI_POS) - -#define I2C_RIF_RXOVRI_POS 7U -#define I2C_RIF_RXOVRI_MSK BIT(I2C_RIF_RXOVRI_POS) - -#define I2C_RIF_RXFRI_POS 6U -#define I2C_RIF_RXFRI_MSK BIT(I2C_RIF_RXFRI_POS) - -#define I2C_RIF_TXTHRI_POS 4U -#define I2C_RIF_TXTHRI_MSK BIT(I2C_RIF_TXTHRI_POS) - -#define I2C_RIF_TXUDRI_POS 3U -#define I2C_RIF_TXUDRI_MSK BIT(I2C_RIF_TXUDRI_POS) - -#define I2C_RIF_TXOVRI_POS 2U -#define I2C_RIF_TXOVRI_MSK BIT(I2C_RIF_TXOVRI_POS) - -#define I2C_RIF_TXERI_POS 0U -#define I2C_RIF_TXERI_MSK BIT(I2C_RIF_TXERI_POS) - -/****************** Bit definition for I2C_IFM register ************************/ - -#define I2C_IFM_ALERTFM_POS 20U -#define I2C_IFM_ALERTFM_MSK BIT(I2C_IFM_ALERTFM_POS) - -#define I2C_IFM_TOUTFM_POS 19U -#define I2C_IFM_TOUTFM_MSK BIT(I2C_IFM_TOUTFM_POS) - -#define I2C_IFM_PECEFM_POS 18U -#define I2C_IFM_PECEFM_MSK BIT(I2C_IFM_PECEFM_POS) - -#define I2C_IFM_ARLOFM_POS 17U -#define I2C_IFM_ARLOFM_MSK BIT(I2C_IFM_ARLOFM_POS) - -#define I2C_IFM_BERRFM_POS 16U -#define I2C_IFM_BERRFM_MSK BIT(I2C_IFM_BERRFM_POS) - -#define I2C_IFM_STOPFM_POS 14U -#define I2C_IFM_STOPFM_MSK BIT(I2C_IFM_STOPFM_POS) - -#define I2C_IFM_NACKFM_POS 13U -#define I2C_IFM_NACKFM_MSK BIT(I2C_IFM_NACKFM_POS) - -#define I2C_IFM_ADDRFM_POS 12U -#define I2C_IFM_ADDRFM_MSK BIT(I2C_IFM_ADDRFM_POS) - -#define I2C_IFM_TCRFM_POS 11U -#define I2C_IFM_TCRFM_MSK BIT(I2C_IFM_TCRFM_POS) - -#define I2C_IFM_TCFM_POS 10U -#define I2C_IFM_TCFM_MSK BIT(I2C_IFM_TCFM_POS) - -#define I2C_IFM_RXTHFM_POS 9U -#define I2C_IFM_RXTHFM_MSK BIT(I2C_IFM_RXTHFM_POS) - -#define I2C_IFM_RXUDFM_POS 8U -#define I2C_IFM_RXUDFM_MSK BIT(I2C_IFM_RXUDFM_POS) - -#define I2C_IFM_RXOVFM_POS 7U -#define I2C_IFM_RXOVFM_MSK BIT(I2C_IFM_RXOVFM_POS) - -#define I2C_IFM_RXFFM_POS 6U -#define I2C_IFM_RXFFM_MSK BIT(I2C_IFM_RXFFM_POS) - -#define I2C_IFM_TXTHFM_POS 4U -#define I2C_IFM_TXTHFM_MSK BIT(I2C_IFM_TXTHFM_POS) - -#define I2C_IFM_TXUDFM_POS 3U -#define I2C_IFM_TXUDFM_MSK BIT(I2C_IFM_TXUDFM_POS) - -#define I2C_IFM_TXOVFM_POS 2U -#define I2C_IFM_TXOVFM_MSK BIT(I2C_IFM_TXOVFM_POS) - -#define I2C_IFM_TXEFM_POS 0U -#define I2C_IFM_TXEFM_MSK BIT(I2C_IFM_TXEFM_POS) - -/****************** Bit definition for I2C_ICR register ************************/ - -#define I2C_ICR_ALERTIC_POS 20U -#define I2C_ICR_ALERTIC_MSK BIT(I2C_ICR_ALERTIC_POS) - -#define I2C_ICR_TOUTIC_POS 19U -#define I2C_ICR_TOUTIC_MSK BIT(I2C_ICR_TOUTIC_POS) - -#define I2C_ICR_PECEIC_POS 18U -#define I2C_ICR_PECEIC_MSK BIT(I2C_ICR_PECEIC_POS) - -#define I2C_ICR_ARLOIC_POS 17U -#define I2C_ICR_ARLOIC_MSK BIT(I2C_ICR_ARLOIC_POS) - -#define I2C_ICR_BERRIC_POS 16U -#define I2C_ICR_BERRIC_MSK BIT(I2C_ICR_BERRIC_POS) - -#define I2C_ICR_STOPIC_POS 14U -#define I2C_ICR_STOPIC_MSK BIT(I2C_ICR_STOPIC_POS) - -#define I2C_ICR_NACKIC_POS 13U -#define I2C_ICR_NACKIC_MSK BIT(I2C_ICR_NACKIC_POS) - -#define I2C_ICR_ADDRIC_POS 12U -#define I2C_ICR_ADDRIC_MSK BIT(I2C_ICR_ADDRIC_POS) - -#define I2C_ICR_TCRIC_POS 11U -#define I2C_ICR_TCRIC_MSK BIT(I2C_ICR_TCRIC_POS) - -#define I2C_ICR_TCIC_POS 10U -#define I2C_ICR_TCIC_MSK BIT(I2C_ICR_TCIC_POS) - -#define I2C_ICR_RXTHIC_POS 9U -#define I2C_ICR_RXTHIC_MSK BIT(I2C_ICR_RXTHIC_POS) - -#define I2C_ICR_RXUDIC_POS 8U -#define I2C_ICR_RXUDIC_MSK BIT(I2C_ICR_RXUDIC_POS) - -#define I2C_ICR_RXOVIC_POS 7U -#define I2C_ICR_RXOVIC_MSK BIT(I2C_ICR_RXOVIC_POS) - -#define I2C_ICR_RXFIC_POS 6U -#define I2C_ICR_RXFIC_MSK BIT(I2C_ICR_RXFIC_POS) - -#define I2C_ICR_TXTHIC_POS 4U -#define I2C_ICR_TXTHIC_MSK BIT(I2C_ICR_TXTHIC_POS) - -#define I2C_ICR_TXUDIC_POS 3U -#define I2C_ICR_TXUDIC_MSK BIT(I2C_ICR_TXUDIC_POS) - -#define I2C_ICR_TXOVIC_POS 2U -#define I2C_ICR_TXOVIC_MSK BIT(I2C_ICR_TXOVIC_POS) - -#define I2C_ICR_TXEIC_POS 0U -#define I2C_ICR_TXEIC_MSK BIT(I2C_ICR_TXEIC_POS) - -typedef struct -{ - __IO uint32_t CON1; - __IO uint32_t CON2; - __IO uint32_t ADDR1; - __IO uint32_t ADDR2; - __IO uint32_t TIMINGR; - __IO uint32_t TIMEOUTR; - __I uint32_t STAT; - __IO uint32_t FCON; - __I uint32_t PECR; - __I uint32_t RXDATA; - __O uint32_t TXDATA; - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; -} I2C_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_iwdg.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_iwdg.h deleted file mode 100644 index a5c657c89a..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_iwdg.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - ************************************************************************************** - * @file reg_IWDG.h - * @brief IWDG Head File - * - * @version V1.00.01 - * @data 19/10/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __IWDG_H__ -#define __IWDG_H__ - -typedef struct -{ - __O uint32_t KR ; /* 0x00 IWDG_KR - Key register */ - __IO uint32_t PR ; /* 0x04 IWDG_PR - Prescaler register */ - __IO uint32_t RLR ; /* 0x08 IWDG_RLR - Reload register */ - __I uint32_t FR ; /* 0x0C IWDG_SR - Status register */ - __IO uint32_t WINR; /* 0x10 IWDG_WINR - Window register */ -} IWDG_TypeDef; - -/******************************************************************************/ -/* Ȧs줸wq */ -/******************************************************************************/ - -/* #pragma anon_unions */ - -/****************** Bit definition for IWDG_KR register ************************/ - -#define IWDG_KR_KEY_POSS 0U -#define IWDG_KR_KEY_POSE 15U -#define IWDG_KR_KEY_MSK BITS(IWDG_KR_KEY_POSS,IWDG_KR_KEY_POSE) - -/****************** Bit definition for IWDG_PR register ************************/ - -#define IWDG_PR_PR_POSS 0U -#define IWDG_PR_PR_POSE 2U -#define IWDG_PR_PR_MSK BITS(IWDG_PR_PR_POSS,IWDG_PR_PR_POSE) - -/****************** Bit definition for IWDG_RLR register ************************/ - -#define IWDG_RLR_RL_POSS 0U -#define IWDG_RLR_RL_POSE 12U -#define IWDG_RLR_RL_MSK BITS(IWDG_RLR_RL_POSS,IWDG_RLR_RL_POSE) - -/****************** Bit definition for IWDG_FR register ************************/ - -#define IWDG_FR_BUSY_POS 15U -#define IWDG_FR_BUSY_MSK BIT(IWDG_FR_BUSY_POS) - -#define IWDG_FR_STR_POS 12U -#define IWDG_FR_STR_MSK BIT(IWDG_FR_STR_POS) - -#define IWDG_FR_CNT_POSS 0U -#define IWDG_FR_CNT_POSE 11U -#define IWDG_FR_CNT_MSK BITS(IWDG_FR_CNT_POSS,IWDG_FR_CNT_POSE) - -/****************** Bit definition for IWDG_WINR register ************************/ - -#define IWDG_WINR_WIN_POSS 0U -#define IWDG_WINR_WIN_POSE 31U -#define IWDG_WINR_WIN_MSK BITS(IWDG_WINR_WIN_POSS,IWDG_WINR_WIN_POSE) - - -#else -/* */ -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mcm.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mcm.h deleted file mode 100644 index ebb675dafe..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mcm.h +++ /dev/null @@ -1,211 +0,0 @@ -/** - ************************************************************************************** - * @file reg_MCM.h - * @brief MCM Head File - * - * @version V1.00.01 - * @data 19/10/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __MCM_H__ -#define __MCM_H__ - -typedef struct -{ - __IO uint32_t RAMP_INI; // 0x00 MCM Ramp Generator Initialization Register - __IO uint32_t RAMP_IDATA; // 0x04 MCM Ramp Generator Initial Data Register - __IO uint32_t RAMP_DIV; // 0x08 MCM Ramp Clock Divider Register - __IO uint32_t RAMP_SCALE; // 0x0C MCM Ramp Generator Output Scale Register - __IO uint32_t RAMP_STEP; // 0x10 MCM Step Increment of the Ramp Output Register - __IO uint32_t RAMP_SET; // 0x14 MCM Ramp Generator Reference Data Register - __IO uint32_t RAMP_EN; // 0x18 MCM Ramp Generator Enable Register - __I uint32_t RAMP_DO; // 0x1C MCM Ramp Generator Output Register - __IO uint32_t RMAP_CON; // 0x20 MCM Connect Ramp Generator to PI control Register - __IO uint32_t IX_UPD; // 0x24 MCM Inverse Transform Update Register - __IO uint32_t IX_VQ; // 0x28 MCM Inverse Park Transform Vq Input Register - __IO uint32_t IX_VD; // 0x2C MCM Inverse Park Transform Vd Input Register - __I uint32_t IX_VA; // 0x30 MCM Inverse Clarke Transform Va Output Register - __I uint32_t IX_VB; // 0x34 MCM Inverse Clarke Transform Vb Output Register - __I uint32_t IX_VC; // 0x38 MCM Inverse Clarke Transform Vc Output Register - __I uint32_t IX_VALPHA; // 0x3C MCM Inverse Clarke Transform Valpha Output Register - __I uint32_t IX_VBETA; // 0x40 MCM Inverse Clarke Transform Vbeta Output Register - __I uint32_t IX_SVMVA; // 0x44 MCM Inverse Clarke Transform SVPWM Va Output Register - __I uint32_t IX_SVMVB; // 0x48 MCM Inverse Clarke Transform SVPWM Vb Output Register - __I uint32_t IX_SVMVC; // 0x4C MCM Inverse Clarke Transform SVPWM Vc Output Register - __I uint32_t IX_DONE; // 0x50 MCM Inverse Transform Processing Status Register - __I uint32_t IX_SDONE; // 0x54 MCM Inverse SVPWM Process Status Register - __IO uint32_t IX_CON; // 0x58 MCM Connect PI Control To The Inverse Transform Register - __IO uint32_t IX_NORMAL; // 0x5C MCM Normal Clarke Inverse Transform Register - __IO uint32_t X_UPD; // 0x60 MCM Transform Function Update Register - __IO uint32_t X_IA; // 0x64 MCM Clarke Transform Ia Input Register - __IO uint32_t X_IB; // 0x68 MCM Clarke Transform Ib Input Register - __IO uint32_t X_IC; // 0x6C MCM Clarke Transform Ic Input Register - __I uint32_t X_IALPHA; // 0x70 MCM Clarke Transform Ialpha Output Register - __I uint32_t X_IBETA; // 0x74 MCM Clarke Transform Ibeta Output Register - __I uint32_t X_ID; // 0x78 MCM Park Transform Id Output Register - __I uint32_t X_IQ; // 0x7C MCM Park Transform Iq Output Register - __I uint32_t X_DONE; // 0x80 MCM Transform Process Status Register - __IO uint32_t X_CON; // 0x84 MCM Forward Transform Input Source Selection Register - uint32_t REV88; // 0x88 RESERVED - __IO uint32_t PI0_UPD; // 0x8C MCM PI Control 0 Update Register - __IO uint32_t PI0_INI; // 0x90 MCM Initialize PI Control 0 Register - __IO uint32_t PI0_IDATA; // 0x94 MCM PI Control 0 Initial Data Register - __IO uint32_t PI0_ELIMIT; // 0x98 MCM PI Control 0 Error Limit Register - __IO uint32_t PI0_KP; // 0x9C MCM PI Control 0 Kp Coefficient Register - __IO uint32_t PI0_KI; // 0xA0 MCM PI Control 0 Ki Coefficient Register - __IO uint32_t PI0_REF; // 0xA4 MCM PI Control 0 Reference Value Register - __IO uint32_t PI0_ACTUAL; // 0xA8 MCM PI Control 0 Actual Value Register - __IO uint32_t PI0_MIN; // 0xAC MCM PI Control 0 Minimum Output Register - __IO uint32_t PI0_MAX; // 0xB0 MCM PI Control 0 Maximum Output Register - __I uint32_t PI0_DO; // 0xB4 MCM PI Control 0 Data Out Register - __IO uint32_t PI0_OSCALE; // 0xB8 MCM PI Control 0 Data Output Scale Register - __I uint32_t PI_DONE; // 0xBC MCM PI Control Processing Status Register - __IO uint32_t PI1_UPD; // 0xC0 MCM PI Control 1 Update Register - __IO uint32_t PI1_INI; // 0xC4 MCM Initialize PI Control 1 Register - __IO uint32_t PI1_IDATA; // 0xC8 MCM PI Control 1 Initial Data Register - __IO uint32_t PI1_ELIMIT; // 0xCC MCM PI Control 1 Error Limit Register - __IO uint32_t PI1_KP; // 0xD0 MCM PI Control 1 Kp Coefficient Register - __IO uint32_t PI1_KI; // 0xD4 MCM PI Control 1 Ki Coefficient Register - __IO uint32_t PI1_REF; // 0xD8 MCM PI Control 1 Reference Value Register - __IO uint32_t PI1_ACTUAL; // 0xDC MCM PI Control 1 Actual Value Register - __IO uint32_t PI1_MIN; // 0xE0 MCM PI Control 1 Minimum Output Register - __IO uint32_t PI1_MAX; // 0xE4 MCM PI Control 1 Maximum Output Register - __I uint32_t PI1_DO; // 0xE8 MCM PI Control 1 Data Out Register - __IO uint32_t PI1_OSCALE; // 0xEC MCM PI Control 1 Data Output Scale Register - __IO uint32_t PI2_UPD; // 0xF0 MCM PI Control 2 Update Register - __IO uint32_t PI2_INI; // 0xF4 MCM Initialize PI Control 2 Register - __IO uint32_t PI2_IDATA; // 0xF8 MCM PI Control 2 Initial Data Register - __IO uint32_t PI2_ELIMIT; // 0xFC MCM PI Control 2 Error Limit Register - __IO uint32_t PI2_KP; // 0x100 MCM PI Control 2 Kp Coefficient Register - __IO uint32_t PI2_KI; // 0x104 MCM PI Control 2 Ki Coefficient Register - __IO uint32_t PI2_REF; // 0x108 MCM PI Control 2 Reference Value Register - __IO uint32_t PI2_ACTUAL; // 0x10C MCM PI Control 2 Actual Value Register - __IO uint32_t PI2_MIN; // 0x110 MCM PI Control 2 Minimum Output Register - __IO uint32_t PI2_MAX; // 0x114 MCM PI Control 2 Maximum Output Register - __I uint32_t PI2_DO; // 0x118 MCM PI Control 2 Data Out Register - __IO uint32_t PI2_OSCALE; // 0x11C MCM PI Control 2 Data Output Scale Register - __IO uint32_t COR_START; // 0x120 MCM Start CORDIC Calculation Register - __IO uint32_t COR_X; // 0x124 MCM CORDIC X Input Register - __IO uint32_t COR_Y; // 0x128 MCM CORDIC Y Input Register - __I uint32_t COR_RES; // 0x12C MCM CORDIC Result Register - __I uint32_t COR_DONE; // 0x130 MCM CORDIC Processing Status Register - __IO uint32_t COR_CON; // 0x134 MCM CORDIC Input Selection Register - uint32_t REV138; // 0x138 RESERVED - uint32_t REV13C; // 0x13C RESERVED - __IO uint32_t LPFA_INI; // 0x140 MCM LPF A Channel Initialize Register - __IO uint32_t LPFA_UPD; // 0x144 MCM LPF A Channel Update Register - __IO uint32_t LPFA_DIN; // 0x148 MCM LPF A Input Register - __IO uint32_t LPFA_A0; // 0x14C MCM LPF A a0 Coefficient Register - __IO uint32_t LPFA_B0; // 0x150 MCM LPF A b0 Coefficient Register - __IO uint32_t LPFA_B1; // 0x154 MCM LPF A b1 Coefficient Register - - __IO uint32_t LPFA_A0SCALE; // 0x158 MCM LPF A a0 Coefficient Scale Register - __IO uint32_t LPFA_B0SCALE; // 0x15C MCM LPF A b0 Coefficient Scale Register - __IO uint32_t LPFA_B1SCALE; // 0x160 MCM LPF A b1 Coefficient Scale Register - - __I uint32_t LPFA_DO; // 0x164 MCM LPF A Data Output Register - __I uint32_t LPFA_DONE; // 0x168 MCM LPF A Process Status Register - __IO uint32_t LPFB_INI; // 0x16C MCM LPF B Channel Initialize Register - __IO uint32_t LPFB_UPD; // 0x170 MCM LPF B Channel Update Register - __IO uint32_t LPFB_DIN; // 0x174 MCM LPF B Input Register - __IO uint32_t LPFB_A0; // 0x178 MCM LPF B a0 Coefficient Register - __IO uint32_t LPFB_B0; // 0x17C MCM LPF B b0 Coefficient Register - __IO uint32_t LPFB_B1; // 0x180 MCM LPF B b1 Coefficient Register - - __IO uint32_t LPFB_A0SCALE; // 0x184 MCM LPF B a0 Coefficient Scale Register - __IO uint32_t LPFB_B0SCALE; // 0x188 MCM LPF B b0 Coefficient Scale Register - __IO uint32_t LPFB_B1SCALE; // 0x18C MCM LPF B b1 Coefficient Scale Register - - __I uint32_t LPFB_DO; // 0x190 MCM LPF B Data Output Register - __I uint32_t LPFB_DONE; // 0x194 MCM LPF B Process Status Register - __IO uint32_t LPFC_INI; // 0x198 MCM LPF C Channel Initialize Register - __IO uint32_t LPFC_UPD; // 0x19C MCM LPF C Channel Update Register - __IO uint32_t LPFC_DIN; // 0x1A0 MCM LPF C Input Register - __IO uint32_t LPFC_A0; // 0x1A4 MCM LPF C a0 Coefficient Register - __IO uint32_t LPFC_B0; // 0x1A8 MCM LPF C b0 Coefficient Register - __IO uint32_t LPFC_B1; // 0x1AC MCM LPF C b1 Coefficient Register - - __IO uint32_t LPFC_A0SCALE; // 0x1B0 MCM LPF C a0 Coefficient Scale Register - __IO uint32_t LPFC_B0SCALE; // 0x1B4 MCM LPF C b0 Coefficient Scale Register - __IO uint32_t LPFC_B1SCALE; // 0x1B8 MCM LPF C b1 Coefficient Scale Register - - __I uint32_t LPFC_DO; // 0x1BC MCM LPF C Data Output Register - __I uint32_t LPFC_DONE; // 0x1C0 MCM LPF C Process Status Register - __IO uint32_t GL_UPD; // 0x1C4 MCM Global Update Register - __IO uint32_t GL_STAT; // 0x1C8 MCM Global Status Register - __IO uint32_t THETA_SIN; // 0x1CC MCM Sine Angle Register - __IO uint32_t THETA_COS; // 0x1D0 MCM Cosine Angle Register - __IO uint32_t PI_TYPE; // 0x1D4 MCM PI Control Type Register - __IO uint32_t MOTOR_DIR; // 0x1D8 MCM Motor Direction Register - __I uint32_t MCM_VER; // 0x1DC MCM Version Register - __IO uint32_t SMC_UPD; // 0x1E0 MCM Slide Mode Controller Update Register - __IO uint32_t SMC_INI; // 0x1E4 MCM Slide Mode Controller Initialization Register - __IO uint32_t SMC_ALPHAINI; // 0x1E8 MCM Slide Mode Controller Alpha Initial Data Register - __IO uint32_t SMC_BETAINI; // 0x1EC MCM Slide Mode Controller Beta Initial Data Register - __IO uint32_t SMC_A0; // 0x1F0 MCM Slide Mode Controller Dynamic LPF coefficient Register - __IO uint32_t SMC_ELIMIT; // 0x1F4 MCM Slide Mode Controller Error Limit Register - __IO uint32_t SMC_KSLIDE; // 0x1F8 MCM Slide Mode Controller Z Factor Error Amplification Register - __I uint32_t SMC_DONE; // 0x1FC MCM Slide Mode Controller Process Status Register - __IO uint32_t SMC_IEALPHA; // 0x200 MCM SMC Estimated Current Alpha Register - __IO uint32_t SMC_IEBETA; // 0x204 MCM SMC Estimated Current Beta Register - __IO uint32_t SMC_IALPHA; // 0x208 MCM SMC Measured Current Alpha Register - __IO uint32_t SMC_IBETA; // 0x20C MCM SMC Measured Current Beta Register - __IO uint32_t SMC_DISI; // 0x210 MCM SMC Estimated Current Input Selection Register - __I uint32_t SMC_ZALPHA; // 0x214 MCM SMC Z Factor Alpha Register - __I uint32_t SMC_ZBETA; // 0x218 MCM SMC Z Factor Beta Register - __I uint32_t SMC_BEMF1A; // 0x21C MCM SMC Estimated BEMF Alpha Register - __I uint32_t SMC_BEMF1B; // 0x220 MCM SMC Estimated BEMF Beta Register - __I uint32_t SMC_BEMF2A; // 0x224 MCM SMC BEMF Filtered Alpha Register - __I uint32_t SMC_BEMF2B; // 0x228 MCM SMC BEMF Filtered Beta Register - __IO uint32_t SMC_LPFSCALE; // 0x22C MCM SMC LPF Coefficient Scale Factor Register - uint32_t REV230; // 0x230 RESERVED - __IO uint32_t VM_UPD; // 0x234 MCM Virtual Motor Update Register - __IO uint32_t VM_INI; // 0x238 MCM Virtual Motor Initialization Register - __IO uint32_t VM_ALPHAINI; // 0x23C MCM Virtual Motor Initial Data Alpha Register - __IO uint32_t VM_BETAINI; // 0x240 MCM Virtual Motor Initial Data Beta Register - __IO uint32_t VM_KF; // 0x244 MCM Virtual Motor F Constant Register - __IO uint32_t VM_KG; // 0x248 MCM Virtual Motor G Constant Register - __IO uint32_t VM_VALPHA; // 0x24C MCM Virtual Motor Voltage Vector Alpha Register - __IO uint32_t VM_VBETA; // 0x250 MCM Virtual Motor Voltage Vector BETA Register - __IO uint32_t VM_BEMFA; // 0x254 MCM Virtual Motor BEMF Vector Alpha Register - __IO uint32_t VM_BEMFB; // 0x258 MCM Virtual Motor BEMF Vector BETA Register - __IO uint32_t VM_ZALPHA; // 0x25C MCM Virtual Motor Z Vector Alpha Register - __IO uint32_t VM_ZBETA; // 0x260 MCM Virtual Motor Z Vector BETA Register - __IO uint32_t VM_DISZ; // 0x264 MCM Virtual Motor Z Factor Input Selection Register - __I uint32_t VM_DONE; // 0x268 MCM Virtual Motor Process Status Register - __I uint32_t VM_IEALPHA; // 0x26C MCM Virtual Motor Estimated IS Result Alpha Register - __I uint32_t VM_IEBETA; // 0x270 MCM Virtual Motor Estimated IS Result BETA Register - __IO uint32_t VM_CON; // 0x274 MCM Virtual Motor Connect Register - - __IO uint32_t VM_KFSCALE; // 0x278 MCM Virtual Motor F Constant Scale Register - __IO uint32_t VM_KGSCALE; // 0x27C MCM Virtual Motor G Constant Scale Register - __IO uint32_t VM_CONVS; // 0x280 MCM Virtual Motor Voltage Connect Register - - uint32_t REV284; // 0x284 RESERVED - __IO uint32_t SVM_UPD; // 0x288 MCM SVM Update Register - __IO uint32_t SVM_CON; // 0x28C MCM SVM Source Input Select Register - __IO uint32_t SVM_DINA; // 0x290 MCM SVM Phase A Register - __IO uint32_t SVM_DINB; // 0x294 MCM SVM Phase B Register - __IO uint32_t SVM_DINC; // 0x298 MCM SVM Phase C Register -} MCM_TypeDef; - -/******************************************************************************/ -/* Ȧs줸wq */ -/******************************************************************************/ - -/* #pragma anon_unions */ - -/****************** Bit definition for WWDG_CR register ************************/ - - - - -#else -/* */ -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mswd.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mswd.h deleted file mode 100644 index 3a7d2f5dcf..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_mswd.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - ************************************************************************************** - * @file reg_MSWD.h - * @brief WWDG Head File - * - * @version V1.00.01 - * @data 19/10/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __MSWD_H__ -#define __MSWD_H__ - -typedef struct -{ - __IO uint32_t CFG; // 0x00 SW_CFG Serial Wire Configure Register - __IO uint32_t JTAG2SWD; // 0x04 SW_JTAG2SW Serial Wire JTAG2SWD Register - __IO uint32_t LINERESET; // 0x08 SW_LINERESET Serial Wire LINERESET Resister - __O uint32_t STS; // 0x0C SW_STS Serial Wire STATUS Register - __IO uint32_t DP_IDR_ABORT; // 0x10 SW_DP_IDR_ABORT Serial Wire DP R-IDR W-ABORT Register - __IO uint32_t DP_CSR_WCR; // 0x14 SW_DP_CSR_WCR Serial Wire DP R-CSR W-WCR Register - __IO uint32_t DP_RESEND_SELECT; // 0x18 SW_DP_RESEND_SELECT Serial Wire DP R-RESEND W-SELECT Register - __IO uint32_t DP_RDBUF_ROUTESEL; // 0x1C SW_DP_RDBUF_ROUTESEL Serial Wire DP R-RDBUF W-ROUTESEL Register - __IO uint32_t AP_CSW; // 0x20 SW_AP_CSW Serial Wire AP CSW Register - __IO uint32_t AP_TAR; // 0x24 SW_AP_TAR Serial Wire AP TAR Register - __IO uint32_t AP_DRW; // 0x28 SW_AP_DRW Serial Wire AP DRW Register - __IO uint32_t AP_BD0; // 0x2C SW_AP_BD0 Serial Wire AP BD0 Register - __IO uint32_t AP_BD1; // 0x30 SW_AP_BD1 Serial Wire AP BD1 Register - __IO uint32_t AP_BD2; // 0x34 SW_AP_BD2 Serial Wire AP BD2 Register - __IO uint32_t AP_BD3; // 0x38 SW_AP_BD3 Serial Wire AP BD3 Register - __IO uint32_t AP_CFG; // 0x3C SW_AP_CFG Serial Wire AP CFG Register - __IO uint32_t AP_BASE; // 0x40 SW_AP_BASE Serial Wire AP BASE Register - __IO uint32_t AP_IDR; // 0x44 SW_AP_IDR Serial Wire AP IDR Register - uint32_t RES0; // 0x48 - uint32_t RES1; // 0x4C - __IO uint32_t ISP_CMD; // 0x50 SW_ISP_CMD Serial Wire ISP Command Register - __IO uint32_t ISP_DAT; // 0x54 SW_ISP_DAT Serial Wire ISP Data Register -} MSWD_TypeDef; - -/******************************************************************************/ -/* Ȧs줸wq */ -/******************************************************************************/ - -/* #pragma anon_unions */ - -/****************** Bit definition for WWDG_CR register ************************/ - - - - -#else -/* */ -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rcu.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rcu.h deleted file mode 100644 index af6a59c419..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rcu.h +++ /dev/null @@ -1,585 +0,0 @@ -/** - ************************************************************************************** - * @file REG_RCU.h - * @brief RCU Head File - * - * @version V0.01 - * @date 12/5/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __RCU_H__ -#define __RCU_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for RCU_CON register ************************/ - -#define RCU_CON_SWRDY_POS 24U -#define RCU_CON_SWRDY_MSK BIT(RCU_CON_SWRDY_POS) - -#define RCU_CON_CSSFLG_POS 23U -#define RCU_CON_CSSFLG_MSK BIT(RCU_CON_CSSFLG_POS) - -#define RCU_CON_PLL1RDY_POS 21U -#define RCU_CON_PLL1RDY_MSK BIT(RCU_CON_PLL1RDY_POS) - -#define RCU_CON_PLL0RDY_POS 20U -#define RCU_CON_PLL0RDY_MSK BIT(RCU_CON_PLL0RDY_POS) - -#define RCU_CON_LOSCRDY_POS 19U -#define RCU_CON_LOSCRDY_MSK BIT(RCU_CON_LOSCRDY_POS) - -#define RCU_CON_LRCRDY_POS 18U -#define RCU_CON_LRCRDY_MSK BIT(RCU_CON_LRCRDY_POS) - -#define RCU_CON_HOSCRDY_POS 17U -#define RCU_CON_HOSCRDY_MSK BIT(RCU_CON_HOSCRDY_POS) - -#define RCU_CON_HRCRDY_POS 16U -#define RCU_CON_HRCRDY_MSK BIT(RCU_CON_HRCRDY_POS) - -#define RCU_CON_CSSON_POS 7U -#define RCU_CON_CSSON_MSK BIT(RCU_CON_CSSON_POS) - -#define RCU_CON_PLL1ON_POS 5U -#define RCU_CON_PLL1ON_MSK BIT(RCU_CON_PLL1ON_POS) - -#define RCU_CON_PLL0ON_POS 4U -#define RCU_CON_PLL0ON_MSK BIT(RCU_CON_PLL0ON_POS) - -#define RCU_CON_LOSCON_POS 3U -#define RCU_CON_LOSCON_MSK BIT(RCU_CON_LOSCON_POS) - -#define RCU_CON_LRCON_POS 2U -#define RCU_CON_LRCON_MSK BIT(RCU_CON_LRCON_POS) - -#define RCU_CON_HOSCON_POS 1U -#define RCU_CON_HOSCON_MSK BIT(RCU_CON_HOSCON_POS) - -#define RCU_CON_HRCON_POS 0U -#define RCU_CON_HRCON_MSK BIT(RCU_CON_HRCON_POS) - -/****************** Bit definition for RCU_CFG register ************************/ - -#define RCU_CFG_CKCFG_POS 31U -#define RCU_CFG_CKCFG_MSK BIT(RCU_CFG_CKCFG_POS) - -#define RCU_CFG_MPRE_POSS 28U -#define RCU_CFG_MPRE_POSE 30U -#define RCU_CFG_MPRE_MSK BITS(RCU_CFG_MPRE_POSS,RCU_CFG_MPRE_POSE) - -#define RCU_CFG_MSW_POSS 24U -#define RCU_CFG_MSW_POSE 27U -#define RCU_CFG_MSW_MSK BITS(RCU_CFG_MSW_POSS,RCU_CFG_MSW_POSE) - -#define RCU_CFG_PLLMUL_POSS 17U -#define RCU_CFG_PLLMUL_POSE 21U -#define RCU_CFG_PLLMUL_MSK BITS(RCU_CFG_PLLMUL_POSS,RCU_CFG_PLLMUL_POSE) - -#define RCU_CFG_PLLSRC_POS 16U -#define RCU_CFG_PLLSRC_MSK BIT(RCU_CFG_PLLSRC_POS) - -#define RCU_CFG_HOSCDIV_POSS 12U -#define RCU_CFG_HOSCDIV_POSE 14U -#define RCU_CFG_HOSCDIV_MSK BITS(RCU_CFG_HOSCDIV_POSS,RCU_CFG_HOSCDIV_POSE) - -#define RCU_CFG_PPRE_POSS 8U -#define RCU_CFG_PPRE_POSE 10U -#define RCU_CFG_PPRE_MSK BITS(RCU_CFG_PPRE_POSS,RCU_CFG_PPRE_POSE) - -#define RCU_CFG_HPRE_POSS 4U -#define RCU_CFG_HPRE_POSE 7U -#define RCU_CFG_HPRE_MSK BITS(RCU_CFG_HPRE_POSS,RCU_CFG_HPRE_POSE) - -#define RCU_CFG_SW_POSS 0U -#define RCU_CFG_SW_POSE 2U -#define RCU_CFG_SW_MSK BITS(RCU_CFG_SW_POSS,RCU_CFG_SW_POSE) - -/****************** Bit definition for RCU_STCALIB register ************************/ - -#define RCU_STCALIB_SKEW_POS 30U -#define RCU_STCALIB_SKEW_MSK BIT(RCU_STCALIB_SKEW_POS) - -#define RCU_STCALIB_TENMS_POSS 0U -#define RCU_STCALIB_TENMS_POSE 23U -#define RCU_STCALIB_TENMS_MSK BITS(RCU_STCALIB_TENMS_POSS,RCU_STCALIB_TENMS_POSE) - -/****************** Bit definition for RCU_PSCK register ************************/ - -#define RCU_PSCK_I2S2CKSL_POSS 2U -#define RCU_PSCK_I2S2CKSL_POSE 3U -#define RCU_PSCK_I2S2CKSL_MSK BITS(RCU_PSCK_I2S2CKSL_POSS,RCU_PSCK_I2S2CKSL_POSE) - -#define RCU_PSCK_I2S1CKSL_POSS 0U -#define RCU_PSCK_I2S1CKSL_POSE 1U -#define RCU_PSCK_I2S1CKSL_MSK BITS(RCU_PSCK_I2S1CKSL_POSS,RCU_PSCK_I2S1CKSL_POSE) - -/****************** Bit definition for RCU_AHBRST register ************************/ - -#define RCU_AHBRST_GPDEN_POS 19U -#define RCU_AHBRST_GPDEN_MSK BIT(RCU_AHBRST_GPDEN_POS) - -#define RCU_AHBRST_GPCEN_POS 18U -#define RCU_AHBRST_GPCEN_MSK BIT(RCU_AHBRST_GPCEN_POS) - -#define RCU_AHBRST_GPBEN_POS 17U -#define RCU_AHBRST_GPBEN_MSK BIT(RCU_AHBRST_GPBEN_POS) - -#define RCU_AHBRST_GPAEN_POS 16U -#define RCU_AHBRST_GPAEN_MSK BIT(RCU_AHBRST_GPAEN_POS) - -#define RCU_AHBRST_HDIVEN_POS 15U -#define RCU_AHBRST_HDIVEN_MSK BIT(RCU_AHBRST_HDIVEN_POS) - -#define RCU_AHBRST_USBEN_POS 14U -#define RCU_AHBRST_USBEN_MSK BIT(RCU_AHBRST_USBEN_POS) - -#define RCU_AHBRST_AESEN_POS 13U -#define RCU_AHBRST_AESEN_MSK BIT(RCU_AHBRST_AESEN_POS) - -#define RCU_AHBRST_CRCEN_POS 12U -#define RCU_AHBRST_CRCEN_MSK BIT(RCU_AHBRST_CRCEN_POS) - -#define RCU_AHBRST_RTCEN_POS 6U -#define RCU_AHBRST_RTCEN_MSK BIT(RCU_AHBRST_RTCEN_POS) - -#define RCU_AHBRST_DMA1EN_POS 0U -#define RCU_AHBRST_DMA1EN_MSK BIT(RCU_AHBRST_DMA1EN_POS) - -/****************** Bit definition for RCU_APB1RST register ************************/ - -#define RCU_APB1RST_DACEN_POS 23U -#define RCU_APB1RST_DACEN_MSK BIT(RCU_APB1RST_DACEN_POS) - -#define RCU_APB1RST_I2C2EN_POS 22U -#define RCU_APB1RST_I2C2EN_MSK BIT(RCU_APB1RST_I2C2EN_POS) - -#define RCU_APB1RST_I2C1EN_POS 21U -#define RCU_APB1RST_I2C1EN_MSK BIT(RCU_APB1RST_I2C1EN_POS) - -#define RCU_APB1RST_SUART2EN_POS 20U -#define RCU_APB1RST_SUART2EN_MSK BIT(RCU_APB1RST_SUART2EN_POS) - -#define RCU_APB1RST_SUART1EN_POS 19U -#define RCU_APB1RST_SUART1EN_MSK BIT(RCU_APB1RST_SUART1EN_POS) - -#define RCU_APB1RST_UART3EN_POS 18U -#define RCU_APB1RST_UART3EN_MSK BIT(RCU_APB1RST_UART3EN_POS) - -#define RCU_APB1RST_UART2EN_POS 17U -#define RCU_APB1RST_UART2EN_MSK BIT(RCU_APB1RST_UART2EN_POS) - -#define RCU_APB1RST_SPI2EN_POS 14U -#define RCU_APB1RST_SPI2EN_MSK BIT(RCU_APB1RST_SPI2EN_POS) - -#define RCU_APB1RST_IWDTEN_POS 12U -#define RCU_APB1RST_IWDTEN_MSK BIT(RCU_APB1RST_IWDTEN_POS) - -#define RCU_APB1RST_WWDTEN_POS 11U -#define RCU_APB1RST_WWDTEN_MSK BIT(RCU_APB1RST_WWDTEN_POS) - -#define RCU_APB1RST_BS16T1EN_POS 4U -#define RCU_APB1RST_BS16T1EN_MSK BIT(RCU_APB1RST_BS16T1EN_POS) - -#define RCU_APB1RST_GP16C4T3EN_POS 3U -#define RCU_APB1RST_GP16C4T3EN_MSK BIT(RCU_APB1RST_GP16C4T3EN_POS) - -#define RCU_APB1RST_GP16C4T2EN_POS 2U -#define RCU_APB1RST_GP16C4T2EN_MSK BIT(RCU_APB1RST_GP16C4T2EN_POS) - -#define RCU_APB1RST_GP16C4T1EN_POS 1U -#define RCU_APB1RST_GP16C4T1EN_MSK BIT(RCU_APB1RST_GP16C4T1EN_POS) - -#define RCU_APB1RST_GP32C4T1EN_POS 0U -#define RCU_APB1RST_GP32C4T1EN_MSK BIT(RCU_APB1RST_GP32C4T1EN_POS) - -/****************** Bit definition for RCU_APB2RST register ************************/ - -#define RCU_APB2RST_CMPEN_POS 23U -#define RCU_APB2RST_CMPEN_MSK BIT(RCU_APB2RST_CMPEN_POS) - -#define RCU_APB2RST_GP16C2T4EN_POS 19U -#define RCU_APB2RST_GP16C2T4EN_MSK BIT(RCU_APB2RST_GP16C2T4EN_POS) - -#define RCU_APB2RST_GP16C2T3EN_POS 18U -#define RCU_APB2RST_GP16C2T3EN_MSK BIT(RCU_APB2RST_GP16C2T3EN_POS) - -#define RCU_APB2RST_GP16C2T2EN_POS 17U -#define RCU_APB2RST_GP16C2T2EN_MSK BIT(RCU_APB2RST_GP16C2T2EN_POS) - -#define RCU_APB2RST_GP16C2T1EN_POS 16U -#define RCU_APB2RST_GP16C2T1EN_MSK BIT(RCU_APB2RST_GP16C2T1EN_POS) - -#define RCU_APB2RST_UART1EN_POS 14U -#define RCU_APB2RST_UART1EN_MSK BIT(RCU_APB2RST_UART1EN_POS) - -#define RCU_APB2RST_SPI1EN_POS 12U -#define RCU_APB2RST_SPI1EN_MSK BIT(RCU_APB2RST_SPI1EN_POS) - -#define RCU_APB2RST_AD16C4T1EN_POS 11U -#define RCU_APB2RST_AD16C4T1EN_MSK BIT(RCU_APB2RST_AD16C4T1EN_POS) - -#define RCU_APB2RST_ADCEN_POS 9U -#define RCU_APB2RST_ADCEN_MSK BIT(RCU_APB2RST_ADCEN_POS) - -/****************** Bit definition for RCU_AHBEN register ************************/ - -#define RCU_AHBEN_GPDEN_POS 19U -#define RCU_AHBEN_GPDEN_MSK BIT(RCU_AHBEN_GPDEN_POS) - -#define RCU_AHBEN_GPCEN_POS 18U -#define RCU_AHBEN_GPCEN_MSK BIT(RCU_AHBEN_GPCEN_POS) - -#define RCU_AHBEN_GPBEN_POS 17U -#define RCU_AHBEN_GPBEN_MSK BIT(RCU_AHBEN_GPBEN_POS) - -#define RCU_AHBEN_GPAEN_POS 16U -#define RCU_AHBEN_GPAEN_MSK BIT(RCU_AHBEN_GPAEN_POS) - -#define RCU_AHBEN_HDIVEN_POS 15U -#define RCU_AHBEN_HDIVEN_MSK BIT(RCU_AHBEN_HDIVEN_POS) - -#define RCU_AHBEN_USBEN_POS 14U -#define RCU_AHBEN_USBEN_MSK BIT(RCU_AHBEN_USBEN_POS) - -#define RCU_AHBEN_AESEN_POS 13U -#define RCU_AHBEN_AESEN_MSK BIT(RCU_AHBEN_AESEN_POS) - -#define RCU_AHBEN_CRCEN_POS 12U -#define RCU_AHBEN_CRCEN_MSK BIT(RCU_AHBEN_CRCEN_POS) - -#define RCU_AHBEN_RTCEN_POS 6U -#define RCU_AHBEN_RTCEN_MSK BIT(RCU_AHBEN_RTCEN_POS) - -#define RCU_AHBEN_DMA1EN_POS 0U -#define RCU_AHBEN_DMA1EN_MSK BIT(RCU_AHBEN_DMA1EN_POS) - -/****************** Bit definition for RCU_APB1EN register ************************/ - -#define RCU_APB1EN_DACEN_POS 23U -#define RCU_APB1EN_DACEN_MSK BIT(RCU_APB1EN_DACEN_POS) - -#define RCU_APB1EN_I2C2EN_POS 22U -#define RCU_APB1EN_I2C2EN_MSK BIT(RCU_APB1EN_I2C2EN_POS) - -#define RCU_APB1EN_I2C1EN_POS 21U -#define RCU_APB1EN_I2C1EN_MSK BIT(RCU_APB1EN_I2C1EN_POS) - -#define RCU_APB1EN_SUART2EN_POS 20U -#define RCU_APB1EN_SUART2EN_MSK BIT(RCU_APB1EN_SUART2EN_POS) - -#define RCU_APB1EN_SUART1EN_POS 19U -#define RCU_APB1EN_SUART1EN_MSK BIT(RCU_APB1EN_SUART1EN_POS) - -#define RCU_APB1EN_UART3EN_POS 18U -#define RCU_APB1EN_UART3EN_MSK BIT(RCU_APB1EN_UART3EN_POS) - -#define RCU_APB1EN_UART2EN_POS 17U -#define RCU_APB1EN_UART2EN_MSK BIT(RCU_APB1EN_UART2EN_POS) - -#define RCU_APB1EN_SPI2EN_POS 14U -#define RCU_APB1EN_SPI2EN_MSK BIT(RCU_APB1EN_SPI2EN_POS) - -#define RCU_APB1EN_IWDTEN_POS 12U -#define RCU_APB1EN_IWDTEN_MSK BIT(RCU_APB1EN_IWDTEN_POS) - -#define RCU_APB1EN_WWDTEN_POS 11U -#define RCU_APB1EN_WWDTEN_MSK BIT(RCU_APB1EN_WWDTEN_POS) - -#define RCU_APB1EN_BS16T1EN_POS 4U -#define RCU_APB1EN_BS16T1EN_MSK BIT(RCU_APB1EN_BS16T1EN_POS) - -#define RCU_APB1EN_GP16C4T3EN_POS 3U -#define RCU_APB1EN_GP16C4T3EN_MSK BIT(RCU_APB1EN_GP16C4T3EN_POS) - -#define RCU_APB1EN_GP16C4T2EN_POS 2U -#define RCU_APB1EN_GP16C4T2EN_MSK BIT(RCU_APB1EN_GP16C4T2EN_POS) - -#define RCU_APB1EN_GP16C4T1EN_POS 1U -#define RCU_APB1EN_GP16C4T1EN_MSK BIT(RCU_APB1EN_GP16C4T1EN_POS) - -#define RCU_APB1EN_GP32C4T1EN_POS 0U -#define RCU_APB1EN_GP32C4T1EN_MSK BIT(RCU_APB1EN_GP32C4T1EN_POS) - -/****************** Bit definition for RCU_APB2EN register ************************/ - -#define RCU_APB2EN_CMPEN_POS 23U -#define RCU_APB2EN_CMPEN_MSK BIT(RCU_APB2EN_CMPEN_POS) - -#define RCU_APB2EN_GP16C2T4EN_POS 19U -#define RCU_APB2EN_GP16C2T4EN_MSK BIT(RCU_APB2EN_GP16C2T4EN_POS) - -#define RCU_APB2EN_GP16C2T3EN_POS 18U -#define RCU_APB2EN_GP16C2T3EN_MSK BIT(RCU_APB2EN_GP16C2T3EN_POS) - -#define RCU_APB2EN_GP16C2T2EN_POS 17U -#define RCU_APB2EN_GP16C2T2EN_MSK BIT(RCU_APB2EN_GP16C2T2EN_POS) - -#define RCU_APB2EN_GP16C2T1EN_POS 16U -#define RCU_APB2EN_GP16C2T1EN_MSK BIT(RCU_APB2EN_GP16C2T1EN_POS) - -#define RCU_APB2EN_UART1EN_POS 14U -#define RCU_APB2EN_UART1EN_MSK BIT(RCU_APB2EN_UART1EN_POS) - -#define RCU_APB2EN_SPI1EN_POS 12U -#define RCU_APB2EN_SPI1EN_MSK BIT(RCU_APB2EN_SPI1EN_POS) - -#define RCU_APB2EN_AD16C4T1EN_POS 11U -#define RCU_APB2EN_AD16C4T1EN_MSK BIT(RCU_APB2EN_AD16C4T1EN_POS) - -#define RCU_APB2EN_ADCEN_POS 9U -#define RCU_APB2EN_ADCEN_MSK BIT(RCU_APB2EN_ADCEN_POS) - -/****************** Bit definition for RCU_AHBSL register ************************/ - -#define RCU_AHBSL_GPDEN_POS 19U -#define RCU_AHBSL_GPDEN_MSK BIT(RCU_AHBSL_GPDEN_POS) - -#define RCU_AHBSL_GPCEN_POS 18U -#define RCU_AHBSL_GPCEN_MSK BIT(RCU_AHBSL_GPCEN_POS) - -#define RCU_AHBSL_GPBEN_POS 17U -#define RCU_AHBSL_GPBEN_MSK BIT(RCU_AHBSL_GPBEN_POS) - -#define RCU_AHBSL_GPAEN_POS 16U -#define RCU_AHBSL_GPAEN_MSK BIT(RCU_AHBSL_GPAEN_POS) - -#define RCU_AHBSL_HDIVEN_POS 15U -#define RCU_AHBSL_HDIVEN_MSK BIT(RCU_AHBSL_HDIVEN_POS) - -#define RCU_AHBSL_USBEN_POS 14U -#define RCU_AHBSL_USBEN_MSK BIT(RCU_AHBSL_USBEN_POS) - -#define RCU_AHBSL_AESEN_POS 13U -#define RCU_AHBSL_AESEN_MSK BIT(RCU_AHBSL_AESEN_POS) - -#define RCU_AHBSL_CRCEN_POS 12U -#define RCU_AHBSL_CRCEN_MSK BIT(RCU_AHBSL_CRCEN_POS) - -#define RCU_AHBSL_RTCEN_POS 6U -#define RCU_AHBSL_RTCEN_MSK BIT(RCU_AHBSL_RTCEN_POS) - -#define RCU_AHBSL_DMA1EN_POS 0U -#define RCU_AHBSL_DMA1EN_MSK BIT(RCU_AHBSL_DMA1EN_POS) - -/****************** Bit definition for RCU_APB1SL register ************************/ - -#define RCU_APB1SL_DACEN_POS 23U -#define RCU_APB1SL_DACEN_MSK BIT(RCU_APB1SL_DACEN_POS) - -#define RCU_APB1SL_I2C2EN_POS 22U -#define RCU_APB1SL_I2C2EN_MSK BIT(RCU_APB1SL_I2C2EN_POS) - -#define RCU_APB1SL_I2C1EN_POS 21U -#define RCU_APB1SL_I2C1EN_MSK BIT(RCU_APB1SL_I2C1EN_POS) - -#define RCU_APB1SL_SUART2EN_POS 20U -#define RCU_APB1SL_SUART2EN_MSK BIT(RCU_APB1SL_SUART2EN_POS) - -#define RCU_APB1SL_SUART1EN_POS 19U -#define RCU_APB1SL_SUART1EN_MSK BIT(RCU_APB1SL_SUART1EN_POS) - -#define RCU_APB1SL_UART3EN_POS 18U -#define RCU_APB1SL_UART3EN_MSK BIT(RCU_APB1SL_UART3EN_POS) - -#define RCU_APB1SL_UART2EN_POS 17U -#define RCU_APB1SL_UART2EN_MSK BIT(RCU_APB1SL_UART2EN_POS) - -#define RCU_APB1SL_SPI2EN_POS 14U -#define RCU_APB1SL_SPI2EN_MSK BIT(RCU_APB1SL_SPI2EN_POS) - -#define RCU_APB1SL_IWDTEN_POS 12U -#define RCU_APB1SL_IWDTEN_MSK BIT(RCU_APB1SL_IWDTEN_POS) - -#define RCU_APB1SL_WWDTEN_POS 11U -#define RCU_APB1SL_WWDTEN_MSK BIT(RCU_APB1SL_WWDTEN_POS) - -#define RCU_APB1SL_BS16T1EN_POS 4U -#define RCU_APB1SL_BS16T1EN_MSK BIT(RCU_APB1SL_BS16T1EN_POS) - -#define RCU_APB1SL_GP16C4T3EN_POS 3U -#define RCU_APB1SL_GP16C4T3EN_MSK BIT(RCU_APB1SL_GP16C4T3EN_POS) - -#define RCU_APB1SL_GP16C4T2EN_POS 2U -#define RCU_APB1SL_GP16C4T2EN_MSK BIT(RCU_APB1SL_GP16C4T2EN_POS) - -#define RCU_APB1SL_GP16C4T1EN_POS 1U -#define RCU_APB1SL_GP16C4T1EN_MSK BIT(RCU_APB1SL_GP16C4T1EN_POS) - -#define RCU_APB1SL_GP32C4T1EN_POS 0U -#define RCU_APB1SL_GP32C4T1EN_MSK BIT(RCU_APB1SL_GP32C4T1EN_POS) - -/****************** Bit definition for RCU_APB2SL register ************************/ - -#define RCU_APB2SL_CMPEN_POS 23U -#define RCU_APB2SL_CMPEN_MSK BIT(RCU_APB2SL_CMPEN_POS) - -#define RCU_APB2SL_GP16C2T4EN_POS 19U -#define RCU_APB2SL_GP16C2T4EN_MSK BIT(RCU_APB2SL_GP16C2T4EN_POS) - -#define RCU_APB2SL_GP16C2T3EN_POS 18U -#define RCU_APB2SL_GP16C2T3EN_MSK BIT(RCU_APB2SL_GP16C2T3EN_POS) - -#define RCU_APB2SL_GP16C2T2EN_POS 17U -#define RCU_APB2SL_GP16C2T2EN_MSK BIT(RCU_APB2SL_GP16C2T2EN_POS) - -#define RCU_APB2SL_GP16C2T1EN_POS 16U -#define RCU_APB2SL_GP16C2T1EN_MSK BIT(RCU_APB2SL_GP16C2T1EN_POS) - -#define RCU_APB2SL_UART1EN_POS 14U -#define RCU_APB2SL_UART1EN_MSK BIT(RCU_APB2SL_UART1EN_POS) - -#define RCU_APB2SL_SPI1EN_POS 12U -#define RCU_APB2SL_SPI1EN_MSK BIT(RCU_APB2SL_SPI1EN_POS) - -#define RCU_APB2SL_AD16C4T1EN_POS 11U -#define RCU_APB2SL_AD16C4T1EN_MSK BIT(RCU_APB2SL_AD16C4T1EN_POS) - -#define RCU_APB2SL_ADCEN_POS 9U -#define RCU_APB2SL_ADCEN_MSK BIT(RCU_APB2SL_ADCEN_POS) - -/****************** Bit definition for RCU_AHBDSL register ************************/ - -#define RCU_AHBDSL_GPDEN_POS 19U -#define RCU_AHBDSL_GPDEN_MSK BIT(RCU_AHBDSL_GPDEN_POS) - -#define RCU_AHBDSL_GPCEN_POS 18U -#define RCU_AHBDSL_GPCEN_MSK BIT(RCU_AHBDSL_GPCEN_POS) - -#define RCU_AHBDSL_GPBEN_POS 17U -#define RCU_AHBDSL_GPBEN_MSK BIT(RCU_AHBDSL_GPBEN_POS) - -#define RCU_AHBDSL_GPAEN_POS 16U -#define RCU_AHBDSL_GPAEN_MSK BIT(RCU_AHBDSL_GPAEN_POS) - -#define RCU_AHBDSL_HDIVEN_POS 15U -#define RCU_AHBDSL_HDIVEN_MSK BIT(RCU_AHBDSL_HDIVEN_POS) - -#define RCU_AHBDSL_USBEN_POS 14U -#define RCU_AHBDSL_USBEN_MSK BIT(RCU_AHBDSL_USBEN_POS) - -#define RCU_AHBDSL_AESEN_POS 13U -#define RCU_AHBDSL_AESEN_MSK BIT(RCU_AHBDSL_AESEN_POS) - -#define RCU_AHBDSL_CRCEN_POS 12U -#define RCU_AHBDSL_CRCEN_MSK BIT(RCU_AHBDSL_CRCEN_POS) - -#define RCU_AHBDSL_RTCEN_POS 6U -#define RCU_AHBDSL_RTCEN_MSK BIT(RCU_AHBDSL_RTCEN_POS) - -#define RCU_AHBDSL_DMA1EN_POS 0U -#define RCU_AHBDSL_DMA1EN_MSK BIT(RCU_AHBDSL_DMA1EN_POS) - -/****************** Bit definition for RCU_APB1DSL register ************************/ - -#define RCU_APB1DSL_DACEN_POS 23U -#define RCU_APB1DSL_DACEN_MSK BIT(RCU_APB1DSL_DACEN_POS) - -#define RCU_APB1DSL_I2C2EN_POS 22U -#define RCU_APB1DSL_I2C2EN_MSK BIT(RCU_APB1DSL_I2C2EN_POS) - -#define RCU_APB1DSL_I2C1EN_POS 21U -#define RCU_APB1DSL_I2C1EN_MSK BIT(RCU_APB1DSL_I2C1EN_POS) - -#define RCU_APB1DSL_SUART2EN_POS 20U -#define RCU_APB1DSL_SUART2EN_MSK BIT(RCU_APB1DSL_SUART2EN_POS) - -#define RCU_APB1DSL_SUART1EN_POS 19U -#define RCU_APB1DSL_SUART1EN_MSK BIT(RCU_APB1DSL_SUART1EN_POS) - -#define RCU_APB1DSL_UART3EN_POS 18U -#define RCU_APB1DSL_UART3EN_MSK BIT(RCU_APB1DSL_UART3EN_POS) - -#define RCU_APB1DSL_UART2EN_POS 17U -#define RCU_APB1DSL_UART2EN_MSK BIT(RCU_APB1DSL_UART2EN_POS) - -#define RCU_APB1DSL_SPI2EN_POS 14U -#define RCU_APB1DSL_SPI2EN_MSK BIT(RCU_APB1DSL_SPI2EN_POS) - -#define RCU_APB1DSL_IWDTEN_POS 12U -#define RCU_APB1DSL_IWDTEN_MSK BIT(RCU_APB1DSL_IWDTEN_POS) - -#define RCU_APB1DSL_WWDTEN_POS 11U -#define RCU_APB1DSL_WWDTEN_MSK BIT(RCU_APB1DSL_WWDTEN_POS) - -#define RCU_APB1DSL_BS16T1EN_POS 4U -#define RCU_APB1DSL_BS16T1EN_MSK BIT(RCU_APB1DSL_BS16T1EN_POS) - -#define RCU_APB1DSL_GP16C4T3EN_POS 3U -#define RCU_APB1DSL_GP16C4T3EN_MSK BIT(RCU_APB1DSL_GP16C4T3EN_POS) - -#define RCU_APB1DSL_GP16C4T2EN_POS 2U -#define RCU_APB1DSL_GP16C4T2EN_MSK BIT(RCU_APB1DSL_GP16C4T2EN_POS) - -#define RCU_APB1DSL_GP16C4T1EN_POS 1U -#define RCU_APB1DSL_GP16C4T1EN_MSK BIT(RCU_APB1DSL_GP16C4T1EN_POS) - -#define RCU_APB1DSL_GP32C4T1EN_POS 0U -#define RCU_APB1DSL_GP32C4T1EN_MSK BIT(RCU_APB1DSL_GP32C4T1EN_POS) - -/****************** Bit definition for RCU_APB2DSL register ************************/ - -#define RCU_APB2DSL_CMPEN_POS 23U -#define RCU_APB2DSL_CMPEN_MSK BIT(RCU_APB2DSL_CMPEN_POS) - -#define RCU_APB2DSL_GP16C2T4EN_POS 19U -#define RCU_APB2DSL_GP16C2T4EN_MSK BIT(RCU_APB2DSL_GP16C2T4EN_POS) - -#define RCU_APB2DSL_GP16C2T3EN_POS 18U -#define RCU_APB2DSL_GP16C2T3EN_MSK BIT(RCU_APB2DSL_GP16C2T3EN_POS) - -#define RCU_APB2DSL_GP16C2T2EN_POS 17U -#define RCU_APB2DSL_GP16C2T2EN_MSK BIT(RCU_APB2DSL_GP16C2T2EN_POS) - -#define RCU_APB2DSL_GP16C2T1EN_POS 16U -#define RCU_APB2DSL_GP16C2T1EN_MSK BIT(RCU_APB2DSL_GP16C2T1EN_POS) - -#define RCU_APB2DSL_UART1EN_POS 14U -#define RCU_APB2DSL_UART1EN_MSK BIT(RCU_APB2DSL_UART1EN_POS) - -#define RCU_APB2DSL_SPI1EN_POS 12U -#define RCU_APB2DSL_SPI1EN_MSK BIT(RCU_APB2DSL_SPI1EN_POS) - -#define RCU_APB2DSL_AD16C4T1EN_POS 11U -#define RCU_APB2DSL_AD16C4T1EN_MSK BIT(RCU_APB2DSL_AD16C4T1EN_POS) - -#define RCU_APB2DSL_ADCEN_POS 9U -#define RCU_APB2DSL_ADCEN_MSK BIT(RCU_APB2DSL_ADCEN_POS) - -typedef struct -{ - __IO uint32_t CON; - __IO uint32_t CFG; - __IO uint32_t STCALIB; - __IO uint32_t PSCK; - __IO uint32_t AHBRST; - __IO uint32_t APB1RST; - __IO uint32_t APB2RST; - __IO uint32_t AHBEN; - __IO uint32_t APB1EN; - __IO uint32_t APB2EN; - __IO uint32_t AHBSL; - __IO uint32_t APB1SL; - __IO uint32_t APB2SL; - __IO uint32_t AHBDSL; - __IO uint32_t APB1DSL; - __IO uint32_t APB2DSL; -} RCU_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rtc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rtc.h deleted file mode 100644 index a22674f22b..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_rtc.h +++ /dev/null @@ -1,613 +0,0 @@ -/** - ************************************************************************************** - * @file REG_RTC.h - * @brief RTC Head File - * - * @version V0.01 - * @date 12/5/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __RTC_H__ -#define __RTC_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for RTC_CON register ************************/ - -#define RTC_CON_MODE_POS 30U -#define RTC_CON_MODE_MSK BIT(RTC_CON_MODE_POS) - -#define RTC_CON_CALVAL_POSS 24U -#define RTC_CON_CALVAL_POSE 29U -#define RTC_CON_CALVAL_MSK BITS(RTC_CON_CALVAL_POSS,RTC_CON_CALVAL_POSE) - -#define RTC_CON_SCALE_POSS 16U -#define RTC_CON_SCALE_POSE 23U -#define RTC_CON_SCALE_MSK BITS(RTC_CON_SCALE_POSS,RTC_CON_SCALE_POSE) - -#define RTC_CON_PSCALE_POSS 8U -#define RTC_CON_PSCALE_POSE 14U -#define RTC_CON_PSCALE_MSK BITS(RTC_CON_PSCALE_POSS,RTC_CON_PSCALE_POSE) - -#define RTC_CON_CYCLE_POS 5U -#define RTC_CON_CYCLE_MSK BIT(RTC_CON_CYCLE_POS) - -#define RTC_CON_CALIB_POS 4U -#define RTC_CON_CALIB_MSK BIT(RTC_CON_CALIB_POS) - -#define RTC_CON_CKSEL_POSS 2U -#define RTC_CON_CKSEL_POSE 3U -#define RTC_CON_CKSEL_MSK BITS(RTC_CON_CKSEL_POSS,RTC_CON_CKSEL_POSE) - -#define RTC_CON_RTCEN_POS 0U -#define RTC_CON_RTCEN_MSK BIT(RTC_CON_RTCEN_POS) - -/****************** Bit definition for RTC_WKUP register ************************/ - -#define RTC_WKUP_WKSCAL_POSS 26U -#define RTC_WKUP_WKSCAL_POSE 29U -#define RTC_WKUP_WKSCAL_MSK BITS(RTC_WKUP_WKSCAL_POSS,RTC_WKUP_WKSCAL_POSE) - -#define RTC_WKUP_WKSEL_POSS 24U -#define RTC_WKUP_WKSEL_POSE 25U -#define RTC_WKUP_WKSEL_MSK BITS(RTC_WKUP_WKSEL_POSS,RTC_WKUP_WKSEL_POSE) - -#define RTC_WKUP_WKCAL_POSS 0U -#define RTC_WKUP_WKCAL_POSE 23U -#define RTC_WKUP_WKCAL_MSK BITS(RTC_WKUP_WKCAL_POSS,RTC_WKUP_WKCAL_POSE) - -/****************** Bit definition for RTC_TIME register ************************/ - -#define RTC_TIME_WEEK_POSS 24U -#define RTC_TIME_WEEK_POSE 26U -#define RTC_TIME_WEEK_MSK BITS(RTC_TIME_WEEK_POSS,RTC_TIME_WEEK_POSE) - -#define RTC_TIME_HOUR_T_POSS 20U -#define RTC_TIME_HOUR_T_POSE 21U -#define RTC_TIME_HOUR_T_MSK BITS(RTC_TIME_HOUR_T_POSS,RTC_TIME_HOUR_T_POSE) - -#define RTC_TIME_HOUR_U_POSS 16U -#define RTC_TIME_HOUR_U_POSE 19U -#define RTC_TIME_HOUR_U_MSK BITS(RTC_TIME_HOUR_U_POSS,RTC_TIME_HOUR_U_POSE) - -#define RTC_TIME_MIN_T_POSS 12U -#define RTC_TIME_MIN_T_POSE 14U -#define RTC_TIME_MIN_T_MSK BITS(RTC_TIME_MIN_T_POSS,RTC_TIME_MIN_T_POSE) - -#define RTC_TIME_MIN_U_POSS 8U -#define RTC_TIME_MIN_U_POSE 11U -#define RTC_TIME_MIN_U_MSK BITS(RTC_TIME_MIN_U_POSS,RTC_TIME_MIN_U_POSE) - -#define RTC_TIME_SEC_T_POSS 4U -#define RTC_TIME_SEC_T_POSE 6U -#define RTC_TIME_SEC_T_MSK BITS(RTC_TIME_SEC_T_POSS,RTC_TIME_SEC_T_POSE) - -#define RTC_TIME_SEC_U_POSS 0U -#define RTC_TIME_SEC_U_POSE 3U -#define RTC_TIME_SEC_U_MSK BITS(RTC_TIME_SEC_U_POSS,RTC_TIME_SEC_U_POSE) - -/****************** Bit definition for RTC_CAL register ************************/ - -#define RTC_CAL_YEAR_T_POSS 20U -#define RTC_CAL_YEAR_T_POSE 23U -#define RTC_CAL_YEAR_T_MSK BITS(RTC_CAL_YEAR_T_POSS,RTC_CAL_YEAR_T_POSE) - -#define RTC_CAL_YEAR_U_POSS 16U -#define RTC_CAL_YEAR_U_POSE 19U -#define RTC_CAL_YEAR_U_MSK BITS(RTC_CAL_YEAR_U_POSS,RTC_CAL_YEAR_U_POSE) - -#define RTC_CAL_MON_T_POS 12U -#define RTC_CAL_MON_T_MSK BIT(RTC_CAL_MON_T_POS) - -#define RTC_CAL_MON_U_POSS 8U -#define RTC_CAL_MON_U_POSE 11U -#define RTC_CAL_MON_U_MSK BITS(RTC_CAL_MON_U_POSS,RTC_CAL_MON_U_POSE) - -#define RTC_CAL_DATE_T_POSS 4U -#define RTC_CAL_DATE_T_POSE 5U -#define RTC_CAL_DATE_T_MSK BITS(RTC_CAL_DATE_T_POSS,RTC_CAL_DATE_T_POSE) - -#define RTC_CAL_DATE_U_POSS 0U -#define RTC_CAL_DATE_U_POSE 3U -#define RTC_CAL_DATE_U_MSK BITS(RTC_CAL_DATE_U_POSS,RTC_CAL_DATE_U_POSE) - -/****************** Bit definition for RTC_ALTIME register ************************/ - -#define RTC_ALTIME_WEEK_POSS 24U -#define RTC_ALTIME_WEEK_POSE 26U -#define RTC_ALTIME_WEEK_MSK BITS(RTC_ALTIME_WEEK_POSS,RTC_ALTIME_WEEK_POSE) - -#define RTC_ALTIME_HOUR_T_POSS 20U -#define RTC_ALTIME_HOUR_T_POSE 21U -#define RTC_ALTIME_HOUR_T_MSK BITS(RTC_ALTIME_HOUR_T_POSS,RTC_ALTIME_HOUR_T_POSE) - -#define RTC_ALTIME_HOUR_U_POSS 16U -#define RTC_ALTIME_HOUR_U_POSE 19U -#define RTC_ALTIME_HOUR_U_MSK BITS(RTC_ALTIME_HOUR_U_POSS,RTC_ALTIME_HOUR_U_POSE) - -#define RTC_ALTIME_MIN_T_POSS 12U -#define RTC_ALTIME_MIN_T_POSE 14U -#define RTC_ALTIME_MIN_T_MSK BITS(RTC_ALTIME_MIN_T_POSS,RTC_ALTIME_MIN_T_POSE) - -#define RTC_ALTIME_MIN_U_POSS 8U -#define RTC_ALTIME_MIN_U_POSE 11U -#define RTC_ALTIME_MIN_U_MSK BITS(RTC_ALTIME_MIN_U_POSS,RTC_ALTIME_MIN_U_POSE) - -#define RTC_ALTIME_SEC_T_POSS 4U -#define RTC_ALTIME_SEC_T_POSE 6U -#define RTC_ALTIME_SEC_T_MSK BITS(RTC_ALTIME_SEC_T_POSS,RTC_ALTIME_SEC_T_POSE) - -#define RTC_ALTIME_SEC_U_POSS 0U -#define RTC_ALTIME_SEC_U_POSE 3U -#define RTC_ALTIME_SEC_U_MSK BITS(RTC_ALTIME_SEC_U_POSS,RTC_ALTIME_SEC_U_POSE) - -/****************** Bit definition for RTC_ALCAL register ************************/ - -#define RTC_ALCAL_YEAR_T_POSS 20U -#define RTC_ALCAL_YEAR_T_POSE 23U -#define RTC_ALCAL_YEAR_T_MSK BITS(RTC_ALCAL_YEAR_T_POSS,RTC_ALCAL_YEAR_T_POSE) - -#define RTC_ALCAL_YEAR_U_POSS 16U -#define RTC_ALCAL_YEAR_U_POSE 19U -#define RTC_ALCAL_YEAR_U_MSK BITS(RTC_ALCAL_YEAR_U_POSS,RTC_ALCAL_YEAR_U_POSE) - -#define RTC_ALCAL_MON_T_POS 12U -#define RTC_ALCAL_MON_T_MSK BIT(RTC_ALCAL_MON_T_POS) - -#define RTC_ALCAL_MON_U_POSS 8U -#define RTC_ALCAL_MON_U_POSE 11U -#define RTC_ALCAL_MON_U_MSK BITS(RTC_ALCAL_MON_U_POSS,RTC_ALCAL_MON_U_POSE) - -#define RTC_ALCAL_DATE_T_POSS 4U -#define RTC_ALCAL_DATE_T_POSE 5U -#define RTC_ALCAL_DATE_T_MSK BITS(RTC_ALCAL_DATE_T_POSS,RTC_ALCAL_DATE_T_POSE) - -#define RTC_ALCAL_DATE_U_POSS 0U -#define RTC_ALCAL_DATE_U_POSE 3U -#define RTC_ALCAL_DATE_U_MSK BITS(RTC_ALCAL_DATE_U_POSS,RTC_ALCAL_DATE_U_POSE) - -/****************** Bit definition for RTC_ALEN register ************************/ - -#define RTC_ALEN_YEAR_POS 6U -#define RTC_ALEN_YEAR_MSK BIT(RTC_ALEN_YEAR_POS) - -#define RTC_ALEN_MONTH_POS 5U -#define RTC_ALEN_MONTH_MSK BIT(RTC_ALEN_MONTH_POS) - -#define RTC_ALEN_DATE_POS 4U -#define RTC_ALEN_DATE_MSK BIT(RTC_ALEN_DATE_POS) - -#define RTC_ALEN_WEEK_POS 3U -#define RTC_ALEN_WEEK_MSK BIT(RTC_ALEN_WEEK_POS) - -#define RTC_ALEN_HOUR_POS 2U -#define RTC_ALEN_HOUR_MSK BIT(RTC_ALEN_HOUR_POS) - -#define RTC_ALEN_MIN_POS 1U -#define RTC_ALEN_MIN_MSK BIT(RTC_ALEN_MIN_POS) - -#define RTC_ALEN_SEC_POS 0U -#define RTC_ALEN_SEC_MSK BIT(RTC_ALEN_SEC_POS) - -/****************** Bit definition for RTC_TRIG register ************************/ - -#define RTC_TRIG_WKTM_POS 16U -#define RTC_TRIG_WKTM_MSK BIT(RTC_TRIG_WKTM_POS) - -#define RTC_TRIG_F1HZ_POS 15U -#define RTC_TRIG_F1HZ_MSK BIT(RTC_TRIG_F1HZ_POS) - -#define RTC_TRIG_RYEAR_POS 14U -#define RTC_TRIG_RYEAR_MSK BIT(RTC_TRIG_RYEAR_POS) - -#define RTC_TRIG_RMON_POS 13U -#define RTC_TRIG_RMON_MSK BIT(RTC_TRIG_RMON_POS) - -#define RTC_TRIG_RDATE_POS 12U -#define RTC_TRIG_RDATE_MSK BIT(RTC_TRIG_RDATE_POS) - -#define RTC_TRIG_RWEEK_POS 11U -#define RTC_TRIG_RWEEK_MSK BIT(RTC_TRIG_RWEEK_POS) - -#define RTC_TRIG_RHOUR_POS 10U -#define RTC_TRIG_RHOUR_MSK BIT(RTC_TRIG_RHOUR_POS) - -#define RTC_TRIG_RMIN_POS 9U -#define RTC_TRIG_RMIN_MSK BIT(RTC_TRIG_RMIN_POS) - -#define RTC_TRIG_RSEC_POS 8U -#define RTC_TRIG_RSEC_MSK BIT(RTC_TRIG_RSEC_POS) - -#define RTC_TRIG_AMALL_POS 7U -#define RTC_TRIG_AMALL_MSK BIT(RTC_TRIG_AMALL_POS) - -#define RTC_TRIG_AYEAR_POS 6U -#define RTC_TRIG_AYEAR_MSK BIT(RTC_TRIG_AYEAR_POS) - -#define RTC_TRIG_AMON_POS 5U -#define RTC_TRIG_AMON_MSK BIT(RTC_TRIG_AMON_POS) - -#define RTC_TRIG_ADTAE_POS 4U -#define RTC_TRIG_ADTAE_MSK BIT(RTC_TRIG_ADTAE_POS) - -#define RTC_TRIG_AWEEK_POS 3U -#define RTC_TRIG_AWEEK_MSK BIT(RTC_TRIG_AWEEK_POS) - -#define RTC_TRIG_AHOUR_POS 2U -#define RTC_TRIG_AHOUR_MSK BIT(RTC_TRIG_AHOUR_POS) - -#define RTC_TRIG_AMIN_POS 1U -#define RTC_TRIG_AMIN_MSK BIT(RTC_TRIG_AMIN_POS) - -#define RTC_TRIG_ASEC_POS 0U -#define RTC_TRIG_ASEC_MSK BIT(RTC_TRIG_ASEC_POS) - -/****************** Bit definition for RTC_IER register ************************/ - -#define RTC_IER_WKTM_POS 16U -#define RTC_IER_WKTM_MSK BIT(RTC_IER_WKTM_POS) - -#define RTC_IER_F1HZ_POS 15U -#define RTC_IER_F1HZ_MSK BIT(RTC_IER_F1HZ_POS) - -#define RTC_IER_RYEAR_POS 14U -#define RTC_IER_RYEAR_MSK BIT(RTC_IER_RYEAR_POS) - -#define RTC_IER_RMON_POS 13U -#define RTC_IER_RMON_MSK BIT(RTC_IER_RMON_POS) - -#define RTC_IER_RDATE_POS 12U -#define RTC_IER_RDATE_MSK BIT(RTC_IER_RDATE_POS) - -#define RTC_IER_RWEEK_POS 11U -#define RTC_IER_RWEEK_MSK BIT(RTC_IER_RWEEK_POS) - -#define RTC_IER_RHOUR_POS 10U -#define RTC_IER_RHOUR_MSK BIT(RTC_IER_RHOUR_POS) - -#define RTC_IER_RMIN_POS 9U -#define RTC_IER_RMIN_MSK BIT(RTC_IER_RMIN_POS) - -#define RTC_IER_RSEC_POS 8U -#define RTC_IER_RSEC_MSK BIT(RTC_IER_RSEC_POS) - -#define RTC_IER_AMALL_POS 7U -#define RTC_IER_AMALL_MSK BIT(RTC_IER_AMALL_POS) - -#define RTC_IER_AYEAR_POS 6U -#define RTC_IER_AYEAR_MSK BIT(RTC_IER_AYEAR_POS) - -#define RTC_IER_AMON_POS 5U -#define RTC_IER_AMON_MSK BIT(RTC_IER_AMON_POS) - -#define RTC_IER_ADTAE_POS 4U -#define RTC_IER_ADTAE_MSK BIT(RTC_IER_ADTAE_POS) - -#define RTC_IER_AWEEK_POS 3U -#define RTC_IER_AWEEK_MSK BIT(RTC_IER_AWEEK_POS) - -#define RTC_IER_AHOUR_POS 2U -#define RTC_IER_AHOUR_MSK BIT(RTC_IER_AHOUR_POS) - -#define RTC_IER_AMIN_POS 1U -#define RTC_IER_AMIN_MSK BIT(RTC_IER_AMIN_POS) - -#define RTC_IER_ASEC_POS 0U -#define RTC_IER_ASEC_MSK BIT(RTC_IER_ASEC_POS) - -/****************** Bit definition for RTC_IDR register ************************/ - -#define RTC_IDR_WKTM_POS 16U -#define RTC_IDR_WKTM_MSK BIT(RTC_IDR_WKTM_POS) - -#define RTC_IDR_F1HZ_POS 15U -#define RTC_IDR_F1HZ_MSK BIT(RTC_IDR_F1HZ_POS) - -#define RTC_IDR_RYEAR_POS 14U -#define RTC_IDR_RYEAR_MSK BIT(RTC_IDR_RYEAR_POS) - -#define RTC_IDR_RMON_POS 13U -#define RTC_IDR_RMON_MSK BIT(RTC_IDR_RMON_POS) - -#define RTC_IDR_RDATE_POS 12U -#define RTC_IDR_RDATE_MSK BIT(RTC_IDR_RDATE_POS) - -#define RTC_IDR_RWEEK_POS 11U -#define RTC_IDR_RWEEK_MSK BIT(RTC_IDR_RWEEK_POS) - -#define RTC_IDR_RHOUR_POS 10U -#define RTC_IDR_RHOUR_MSK BIT(RTC_IDR_RHOUR_POS) - -#define RTC_IDR_RMIN_POS 9U -#define RTC_IDR_RMIN_MSK BIT(RTC_IDR_RMIN_POS) - -#define RTC_IDR_RSEC_POS 8U -#define RTC_IDR_RSEC_MSK BIT(RTC_IDR_RSEC_POS) - -#define RTC_IDR_AMALL_POS 7U -#define RTC_IDR_AMALL_MSK BIT(RTC_IDR_AMALL_POS) - -#define RTC_IDR_AYEAR_POS 6U -#define RTC_IDR_AYEAR_MSK BIT(RTC_IDR_AYEAR_POS) - -#define RTC_IDR_AMON_POS 5U -#define RTC_IDR_AMON_MSK BIT(RTC_IDR_AMON_POS) - -#define RTC_IDR_ADTAE_POS 4U -#define RTC_IDR_ADTAE_MSK BIT(RTC_IDR_ADTAE_POS) - -#define RTC_IDR_AWEEK_POS 3U -#define RTC_IDR_AWEEK_MSK BIT(RTC_IDR_AWEEK_POS) - -#define RTC_IDR_AHOUR_POS 2U -#define RTC_IDR_AHOUR_MSK BIT(RTC_IDR_AHOUR_POS) - -#define RTC_IDR_AMIN_POS 1U -#define RTC_IDR_AMIN_MSK BIT(RTC_IDR_AMIN_POS) - -#define RTC_IDR_ASEC_POS 0U -#define RTC_IDR_ASEC_MSK BIT(RTC_IDR_ASEC_POS) - -/****************** Bit definition for RTC_IVS register ************************/ - -#define RTC_IVS_WKTM_POS 16U -#define RTC_IVS_WKTM_MSK BIT(RTC_IVS_WKTM_POS) - -#define RTC_IVS_F1HZ_POS 15U -#define RTC_IVS_F1HZ_MSK BIT(RTC_IVS_F1HZ_POS) - -#define RTC_IVS_RYEAR_POS 14U -#define RTC_IVS_RYEAR_MSK BIT(RTC_IVS_RYEAR_POS) - -#define RTC_IVS_RMON_POS 13U -#define RTC_IVS_RMON_MSK BIT(RTC_IVS_RMON_POS) - -#define RTC_IVS_RDATE_POS 12U -#define RTC_IVS_RDATE_MSK BIT(RTC_IVS_RDATE_POS) - -#define RTC_IVS_RWEEK_POS 11U -#define RTC_IVS_RWEEK_MSK BIT(RTC_IVS_RWEEK_POS) - -#define RTC_IVS_RHOUR_POS 10U -#define RTC_IVS_RHOUR_MSK BIT(RTC_IVS_RHOUR_POS) - -#define RTC_IVS_RMIN_POS 9U -#define RTC_IVS_RMIN_MSK BIT(RTC_IVS_RMIN_POS) - -#define RTC_IVS_RSEC_POS 8U -#define RTC_IVS_RSEC_MSK BIT(RTC_IVS_RSEC_POS) - -#define RTC_IVS_AMALL_POS 7U -#define RTC_IVS_AMALL_MSK BIT(RTC_IVS_AMALL_POS) - -#define RTC_IVS_AYEAR_POS 6U -#define RTC_IVS_AYEAR_MSK BIT(RTC_IVS_AYEAR_POS) - -#define RTC_IVS_AMON_POS 5U -#define RTC_IVS_AMON_MSK BIT(RTC_IVS_AMON_POS) - -#define RTC_IVS_ADTAE_POS 4U -#define RTC_IVS_ADTAE_MSK BIT(RTC_IVS_ADTAE_POS) - -#define RTC_IVS_AWEEK_POS 3U -#define RTC_IVS_AWEEK_MSK BIT(RTC_IVS_AWEEK_POS) - -#define RTC_IVS_AHOUR_POS 2U -#define RTC_IVS_AHOUR_MSK BIT(RTC_IVS_AHOUR_POS) - -#define RTC_IVS_AMIN_POS 1U -#define RTC_IVS_AMIN_MSK BIT(RTC_IVS_AMIN_POS) - -#define RTC_IVS_ASEC_POS 0U -#define RTC_IVS_ASEC_MSK BIT(RTC_IVS_ASEC_POS) - -/****************** Bit definition for RTC_RIF register ************************/ - -#define RTC_RIF_WKTM_POS 16U -#define RTC_RIF_WKTM_MSK BIT(RTC_RIF_WKTM_POS) - -#define RTC_RIF_F1HZ_POS 15U -#define RTC_RIF_F1HZ_MSK BIT(RTC_RIF_F1HZ_POS) - -#define RTC_RIF_RYEAR_POS 14U -#define RTC_RIF_RYEAR_MSK BIT(RTC_RIF_RYEAR_POS) - -#define RTC_RIF_RMON_POS 13U -#define RTC_RIF_RMON_MSK BIT(RTC_RIF_RMON_POS) - -#define RTC_RIF_RDATE_POS 12U -#define RTC_RIF_RDATE_MSK BIT(RTC_RIF_RDATE_POS) - -#define RTC_RIF_RWEEK_POS 11U -#define RTC_RIF_RWEEK_MSK BIT(RTC_RIF_RWEEK_POS) - -#define RTC_RIF_RHOUR_POS 10U -#define RTC_RIF_RHOUR_MSK BIT(RTC_RIF_RHOUR_POS) - -#define RTC_RIF_RMIN_POS 9U -#define RTC_RIF_RMIN_MSK BIT(RTC_RIF_RMIN_POS) - -#define RTC_RIF_RSEC_POS 8U -#define RTC_RIF_RSEC_MSK BIT(RTC_RIF_RSEC_POS) - -#define RTC_RIF_AMALL_POS 7U -#define RTC_RIF_AMALL_MSK BIT(RTC_RIF_AMALL_POS) - -#define RTC_RIF_AYEAR_POS 6U -#define RTC_RIF_AYEAR_MSK BIT(RTC_RIF_AYEAR_POS) - -#define RTC_RIF_AMON_POS 5U -#define RTC_RIF_AMON_MSK BIT(RTC_RIF_AMON_POS) - -#define RTC_RIF_ADTAE_POS 4U -#define RTC_RIF_ADTAE_MSK BIT(RTC_RIF_ADTAE_POS) - -#define RTC_RIF_AWEEK_POS 3U -#define RTC_RIF_AWEEK_MSK BIT(RTC_RIF_AWEEK_POS) - -#define RTC_RIF_AHOUR_POS 2U -#define RTC_RIF_AHOUR_MSK BIT(RTC_RIF_AHOUR_POS) - -#define RTC_RIF_AMIN_POS 1U -#define RTC_RIF_AMIN_MSK BIT(RTC_RIF_AMIN_POS) - -#define RTC_RIF_ASEC_POS 0U -#define RTC_RIF_ASEC_MSK BIT(RTC_RIF_ASEC_POS) - -/****************** Bit definition for RTC_IFM register ************************/ - -#define RTC_IFM_WKTM_POS 16U -#define RTC_IFM_WKTM_MSK BIT(RTC_IFM_WKTM_POS) - -#define RTC_IFM_F1HZ_POS 15U -#define RTC_IFM_F1HZ_MSK BIT(RTC_IFM_F1HZ_POS) - -#define RTC_IFM_RYEAR_POS 14U -#define RTC_IFM_RYEAR_MSK BIT(RTC_IFM_RYEAR_POS) - -#define RTC_IFM_RMON_POS 13U -#define RTC_IFM_RMON_MSK BIT(RTC_IFM_RMON_POS) - -#define RTC_IFM_RDATE_POS 12U -#define RTC_IFM_RDATE_MSK BIT(RTC_IFM_RDATE_POS) - -#define RTC_IFM_RWEEK_POS 11U -#define RTC_IFM_RWEEK_MSK BIT(RTC_IFM_RWEEK_POS) - -#define RTC_IFM_RHOUR_POS 10U -#define RTC_IFM_RHOUR_MSK BIT(RTC_IFM_RHOUR_POS) - -#define RTC_IFM_RMIN_POS 9U -#define RTC_IFM_RMIN_MSK BIT(RTC_IFM_RMIN_POS) - -#define RTC_IFM_RSEC_POS 8U -#define RTC_IFM_RSEC_MSK BIT(RTC_IFM_RSEC_POS) - -#define RTC_IFM_AMALL_POS 7U -#define RTC_IFM_AMALL_MSK BIT(RTC_IFM_AMALL_POS) - -#define RTC_IFM_AYEAR_POS 6U -#define RTC_IFM_AYEAR_MSK BIT(RTC_IFM_AYEAR_POS) - -#define RTC_IFM_AMON_POS 5U -#define RTC_IFM_AMON_MSK BIT(RTC_IFM_AMON_POS) - -#define RTC_IFM_ADTAE_POS 4U -#define RTC_IFM_ADTAE_MSK BIT(RTC_IFM_ADTAE_POS) - -#define RTC_IFM_AWEEK_POS 3U -#define RTC_IFM_AWEEK_MSK BIT(RTC_IFM_AWEEK_POS) - -#define RTC_IFM_AHOUR_POS 2U -#define RTC_IFM_AHOUR_MSK BIT(RTC_IFM_AHOUR_POS) - -#define RTC_IFM_AMIN_POS 1U -#define RTC_IFM_AMIN_MSK BIT(RTC_IFM_AMIN_POS) - -#define RTC_IFM_ASEC_POS 0U -#define RTC_IFM_ASEC_MSK BIT(RTC_IFM_ASEC_POS) - -/****************** Bit definition for RTC_ICR register ************************/ - -#define RTC_ICR_WKTM_POS 16U -#define RTC_ICR_WKTM_MSK BIT(RTC_ICR_WKTM_POS) - -#define RTC_ICR_F1HZ_POS 15U -#define RTC_ICR_F1HZ_MSK BIT(RTC_ICR_F1HZ_POS) - -#define RTC_ICR_RYEAR_POS 14U -#define RTC_ICR_RYEAR_MSK BIT(RTC_ICR_RYEAR_POS) - -#define RTC_ICR_RMON_POS 13U -#define RTC_ICR_RMON_MSK BIT(RTC_ICR_RMON_POS) - -#define RTC_ICR_RDATE_POS 12U -#define RTC_ICR_RDATE_MSK BIT(RTC_ICR_RDATE_POS) - -#define RTC_ICR_RWEEK_POS 11U -#define RTC_ICR_RWEEK_MSK BIT(RTC_ICR_RWEEK_POS) - -#define RTC_ICR_RHOUR_POS 10U -#define RTC_ICR_RHOUR_MSK BIT(RTC_ICR_RHOUR_POS) - -#define RTC_ICR_RMIN_POS 9U -#define RTC_ICR_RMIN_MSK BIT(RTC_ICR_RMIN_POS) - -#define RTC_ICR_RSEC_POS 8U -#define RTC_ICR_RSEC_MSK BIT(RTC_ICR_RSEC_POS) - -#define RTC_ICR_AMALL_POS 7U -#define RTC_ICR_AMALL_MSK BIT(RTC_ICR_AMALL_POS) - -#define RTC_ICR_AYEAR_POS 6U -#define RTC_ICR_AYEAR_MSK BIT(RTC_ICR_AYEAR_POS) - -#define RTC_ICR_AMON_POS 5U -#define RTC_ICR_AMON_MSK BIT(RTC_ICR_AMON_POS) - -#define RTC_ICR_ADTAE_POS 4U -#define RTC_ICR_ADTAE_MSK BIT(RTC_ICR_ADTAE_POS) - -#define RTC_ICR_AWEEK_POS 3U -#define RTC_ICR_AWEEK_MSK BIT(RTC_ICR_AWEEK_POS) - -#define RTC_ICR_AHOUR_POS 2U -#define RTC_ICR_AHOUR_MSK BIT(RTC_ICR_AHOUR_POS) - -#define RTC_ICR_AMIN_POS 1U -#define RTC_ICR_AMIN_MSK BIT(RTC_ICR_AMIN_POS) - -#define RTC_ICR_ASEC_POS 0U -#define RTC_ICR_ASEC_MSK BIT(RTC_ICR_ASEC_POS) - -/****************** Bit definition for RTC_STAT register ************************/ - -#define RTC_STAT_SYNDONE_POS 1U -#define RTC_STAT_SYNDONE_MSK BIT(RTC_STAT_SYNDONE_POS) - -#define RTC_STAT_EMPTY_POS 0U -#define RTC_STAT_EMPTY_MSK BIT(RTC_STAT_EMPTY_POS) - -/****************** Bit definition for RTC_BKEN register ************************/ - -#define RTC_BKEN_BKEN_POS 0U -#define RTC_BKEN_BKEN_MSK BIT(RTC_BKEN_BKEN_POS) - -typedef struct -{ - __IO uint32_t CON; - __IO uint32_t WKUP; - __IO uint32_t TIME; - __IO uint32_t CAL; - __IO uint32_t ALTIME; - __IO uint32_t ALCAL; - __IO uint32_t ALEN; - __IO uint32_t TRIG; - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; - uint32_t RESERVED0[2] ; - __I uint32_t STAT; - __IO uint32_t BKEN; -} RTC_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_spi.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_spi.h deleted file mode 100644 index 0d7fbf6ccc..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_spi.h +++ /dev/null @@ -1,444 +0,0 @@ -/** - ************************************************************************************** - * @file REG_SPI.h - * @brief SPI Head File - * - * @version V0.01 - * @data 12/3/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __SPI_H__ -#define __SPI_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for SPI_CON1 register ************************/ - -#define SPI_CON1_BIDEN_POS 15U -#define SPI_CON1_BIDEN_MSK BIT(SPI_CON1_BIDEN_POS) - -#define SPI_CON1_BIDOEN_POS 14U -#define SPI_CON1_BIDOEN_MSK BIT(SPI_CON1_BIDOEN_POS) - -#define SPI_CON1_CRCEN_POS 13U -#define SPI_CON1_CRCEN_MSK BIT(SPI_CON1_CRCEN_POS) - -#define SPI_CON1_NXTCRC_POS 12U -#define SPI_CON1_NXTCRC_MSK BIT(SPI_CON1_NXTCRC_POS) - -#define SPI_CON1_FLEN_POS 11U -#define SPI_CON1_FLEN_MSK BIT(SPI_CON1_FLEN_POS) - -#define SPI_CON1_RXO_POS 10U -#define SPI_CON1_RXO_MSK BIT(SPI_CON1_RXO_POS) - -#define SPI_CON1_SSEN_POS 9U -#define SPI_CON1_SSEN_MSK BIT(SPI_CON1_SSEN_POS) - -#define SPI_CON1_SSOUT_POS 8U -#define SPI_CON1_SSOUT_MSK BIT(SPI_CON1_SSOUT_POS) - -#define SPI_CON1_LSBFST_POS 7U -#define SPI_CON1_LSBFST_MSK BIT(SPI_CON1_LSBFST_POS) - -#define SPI_CON1_SPIEN_POS 6U -#define SPI_CON1_SPIEN_MSK BIT(SPI_CON1_SPIEN_POS) - -#define SPI_CON1_BAUD_POSS 3U -#define SPI_CON1_BAUD_POSE 5U -#define SPI_CON1_BAUD_MSK BITS(SPI_CON1_BAUD_POSS,SPI_CON1_BAUD_POSE) - -#define SPI_CON1_MSTREN_POS 2U -#define SPI_CON1_MSTREN_MSK BIT(SPI_CON1_MSTREN_POS) - -#define SPI_CON1_CPOL_POS 1U -#define SPI_CON1_CPOL_MSK BIT(SPI_CON1_CPOL_POS) - -#define SPI_CON1_CPHA_POS 0U -#define SPI_CON1_CPHA_MSK BIT(SPI_CON1_CPHA_POS) - -/****************** Bit definition for SPI_CON2 register ************************/ - -#define SPI_CON2_RXFTH_POSS 14U -#define SPI_CON2_RXFTH_POSE 15U -#define SPI_CON2_RXFTH_MSK BITS(SPI_CON2_RXFTH_POSS,SPI_CON2_RXFTH_POSE) - -#define SPI_CON2_TXFTH_POSS 12U -#define SPI_CON2_TXFTH_POSE 13U -#define SPI_CON2_TXFTH_MSK BITS(SPI_CON2_TXFTH_POSS,SPI_CON2_TXFTH_POSE) - -#define SPI_CON2_FRF_POS 4U -#define SPI_CON2_FRF_MSK BIT(SPI_CON2_FRF_POS) - -#define SPI_CON2_NSSP_POS 3U -#define SPI_CON2_NSSP_MSK BIT(SPI_CON2_NSSP_POS) - -#define SPI_CON2_NSSOE_POS 2U -#define SPI_CON2_NSSOE_MSK BIT(SPI_CON2_NSSOE_POS) - -#define SPI_CON2_TXDMA_POS 1U -#define SPI_CON2_TXDMA_MSK BIT(SPI_CON2_TXDMA_POS) - -#define SPI_CON2_RXDMA_POS 0U -#define SPI_CON2_RXDMA_MSK BIT(SPI_CON2_RXDMA_POS) - -/****************** Bit definition for SPI_STAT register ************************/ - -#define SPI_STAT_RXFLV_POSS 24U -#define SPI_STAT_RXFLV_POSE 28U -#define SPI_STAT_RXFLV_MSK BITS(SPI_STAT_RXFLV_POSS,SPI_STAT_RXFLV_POSE) - -#define SPI_STAT_TXFLV_POSS 16U -#define SPI_STAT_TXFLV_POSE 20U -#define SPI_STAT_TXFLV_MSK BITS(SPI_STAT_TXFLV_POSS,SPI_STAT_TXFLV_POSE) - -#define SPI_STAT_BUSY_POS 15U -#define SPI_STAT_BUSY_MSK BIT(SPI_STAT_BUSY_POS) - -#define SPI_STAT_CHSIDE_POS 14U -#define SPI_STAT_CHSIDE_MSK BIT(SPI_STAT_CHSIDE_POS) - -#define SPI_STAT_RXTH_POS 12U -#define SPI_STAT_RXTH_MSK BIT(SPI_STAT_RXTH_POS) - -#define SPI_STAT_RXUD_POS 11U -#define SPI_STAT_RXUD_MSK BIT(SPI_STAT_RXUD_POS) - -#define SPI_STAT_RXOV_POS 10U -#define SPI_STAT_RXOV_MSK BIT(SPI_STAT_RXOV_POS) - -#define SPI_STAT_RXF_POS 9U -#define SPI_STAT_RXF_MSK BIT(SPI_STAT_RXF_POS) - -#define SPI_STAT_RXE_POS 8U -#define SPI_STAT_RXE_MSK BIT(SPI_STAT_RXE_POS) - -#define SPI_STAT_TXTH_POS 4U -#define SPI_STAT_TXTH_MSK BIT(SPI_STAT_TXTH_POS) - -#define SPI_STAT_TXUD_POS 3U -#define SPI_STAT_TXUD_MSK BIT(SPI_STAT_TXUD_POS) - -#define SPI_STAT_TXOV_POS 2U -#define SPI_STAT_TXOV_MSK BIT(SPI_STAT_TXOV_POS) - -#define SPI_STAT_TXF_POS 1U -#define SPI_STAT_TXF_MSK BIT(SPI_STAT_TXF_POS) - -#define SPI_STAT_TXE_POS 0U -#define SPI_STAT_TXE_MSK BIT(SPI_STAT_TXE_POS) - -/****************** Bit definition for SPI_DATA register ************************/ - -#define SPI_DATA_DATA_POSS 0U -#define SPI_DATA_DATA_POSE 15U -#define SPI_DATA_DATA_MSK BITS(SPI_DATA_DATA_POSS,SPI_DATA_DATA_POSE) - -/****************** Bit definition for SPI_CRCPOLY register ************************/ - -#define SPI_CRCPOLY_CRCPOLY_POSS 0U -#define SPI_CRCPOLY_CRCPOLY_POSE 15U -#define SPI_CRCPOLY_CRCPOLY_MSK BITS(SPI_CRCPOLY_CRCPOLY_POSS,SPI_CRCPOLY_CRCPOLY_POSE) - -/****************** Bit definition for SPI_RXCRC register ************************/ - -#define SPI_RXCRC_RXCRC_POSS 0U -#define SPI_RXCRC_RXCRC_POSE 15U -#define SPI_RXCRC_RXCRC_MSK BITS(SPI_RXCRC_RXCRC_POSS,SPI_RXCRC_RXCRC_POSE) - -/****************** Bit definition for SPI_TXCRC register ************************/ - -#define SPI_TXCRC_TXCRC_POSS 0U -#define SPI_TXCRC_TXCRC_POSE 15U -#define SPI_TXCRC_TXCRC_MSK BITS(SPI_TXCRC_TXCRC_POSS,SPI_TXCRC_TXCRC_POSE) - -/****************** Bit definition for SPI_I2SCFG register ************************/ - -#define SPI_I2SCFG_I2SMOD_POS 11U -#define SPI_I2SCFG_I2SMOD_MSK BIT(SPI_I2SCFG_I2SMOD_POS) - -#define SPI_I2SCFG_I2SE_POS 10U -#define SPI_I2SCFG_I2SE_MSK BIT(SPI_I2SCFG_I2SE_POS) - -#define SPI_I2SCFG_I2SCFG_POSS 8U -#define SPI_I2SCFG_I2SCFG_POSE 9U -#define SPI_I2SCFG_I2SCFG_MSK BITS(SPI_I2SCFG_I2SCFG_POSS,SPI_I2SCFG_I2SCFG_POSE) - -#define SPI_I2SCFG_PCMSYNC_POS 7U -#define SPI_I2SCFG_PCMSYNC_MSK BIT(SPI_I2SCFG_PCMSYNC_POS) - -#define SPI_I2SCFG_I2SSTD_POSS 4U -#define SPI_I2SCFG_I2SSTD_POSE 5U -#define SPI_I2SCFG_I2SSTD_MSK BITS(SPI_I2SCFG_I2SSTD_POSS,SPI_I2SCFG_I2SSTD_POSE) - -#define SPI_I2SCFG_CKPOL_POS 3U -#define SPI_I2SCFG_CKPOL_MSK BIT(SPI_I2SCFG_CKPOL_POS) - -#define SPI_I2SCFG_DATLEN_POSS 1U -#define SPI_I2SCFG_DATLEN_POSE 2U -#define SPI_I2SCFG_DATLEN_MSK BITS(SPI_I2SCFG_DATLEN_POSS,SPI_I2SCFG_DATLEN_POSE) - -#define SPI_I2SCFG_CHLEN_POS 0U -#define SPI_I2SCFG_CHLEN_MSK BIT(SPI_I2SCFG_CHLEN_POS) - -/****************** Bit definition for SPI_I2SPR register ************************/ - -#define SPI_I2SPR_EXTCKEN_POS 10U -#define SPI_I2SPR_EXTCKEN_MSK BIT(SPI_I2SPR_EXTCKEN_POS) - -#define SPI_I2SPR_MCKOE_POS 9U -#define SPI_I2SPR_MCKOE_MSK BIT(SPI_I2SPR_MCKOE_POS) - -#define SPI_I2SPR_ODD_POS 8U -#define SPI_I2SPR_ODD_MSK BIT(SPI_I2SPR_ODD_POS) - -#define SPI_I2SPR_I2SDIV_POSS 0U -#define SPI_I2SPR_I2SDIV_POSE 7U -#define SPI_I2SPR_I2SDIV_MSK BITS(SPI_I2SPR_I2SDIV_POSS,SPI_I2SPR_I2SDIV_POSE) - -/****************** Bit definition for SPI_IER register ************************/ - -#define SPI_IER_FREIE_POS 18U -#define SPI_IER_FREIE_MSK BIT(SPI_IER_FREIE_POS) - -#define SPI_IER_MODFIE_POS 17U -#define SPI_IER_MODFIE_MSK BIT(SPI_IER_MODFIE_POS) - -#define SPI_IER_CRCERRIE_POS 16U -#define SPI_IER_CRCERRIE_MSK BIT(SPI_IER_CRCERRIE_POS) - -#define SPI_IER_RXTHIE_POS 12U -#define SPI_IER_RXTHIE_MSK BIT(SPI_IER_RXTHIE_POS) - -#define SPI_IER_RXUDIE_POS 11U -#define SPI_IER_RXUDIE_MSK BIT(SPI_IER_RXUDIE_POS) - -#define SPI_IER_RXOVIE_POS 10U -#define SPI_IER_RXOVIE_MSK BIT(SPI_IER_RXOVIE_POS) - -#define SPI_IER_RXFIE_POS 9U -#define SPI_IER_RXFIE_MSK BIT(SPI_IER_RXFIE_POS) - -#define SPI_IER_TXTHIE_POS 4U -#define SPI_IER_TXTHIE_MSK BIT(SPI_IER_TXTHIE_POS) - -#define SPI_IER_TXUDIE_POS 3U -#define SPI_IER_TXUDIE_MSK BIT(SPI_IER_TXUDIE_POS) - -#define SPI_IER_TXOVIE_POS 2U -#define SPI_IER_TXOVIE_MSK BIT(SPI_IER_TXOVIE_POS) - -#define SPI_IER_TXEIE_POS 0U -#define SPI_IER_TXEIE_MSK BIT(SPI_IER_TXEIE_POS) - -/****************** Bit definition for SPI_IDR register ************************/ - -#define SPI_IDR_FREID_POS 18U -#define SPI_IDR_FREID_MSK BIT(SPI_IDR_FREID_POS) - -#define SPI_IDR_MODFID_POS 17U -#define SPI_IDR_MODFID_MSK BIT(SPI_IDR_MODFID_POS) - -#define SPI_IDR_CRCERRID_POS 16U -#define SPI_IDR_CRCERRID_MSK BIT(SPI_IDR_CRCERRID_POS) - -#define SPI_IDR_RXTHID_POS 12U -#define SPI_IDR_RXTHID_MSK BIT(SPI_IDR_RXTHID_POS) - -#define SPI_IDR_RXUDID_POS 11U -#define SPI_IDR_RXUDID_MSK BIT(SPI_IDR_RXUDID_POS) - -#define SPI_IDR_RXOVID_POS 10U -#define SPI_IDR_RXOVID_MSK BIT(SPI_IDR_RXOVID_POS) - -#define SPI_IDR_RXFID_POS 9U -#define SPI_IDR_RXFID_MSK BIT(SPI_IDR_RXFID_POS) - -#define SPI_IDR_TXTHID_POS 4U -#define SPI_IDR_TXTHID_MSK BIT(SPI_IDR_TXTHID_POS) - -#define SPI_IDR_TXUDID_POS 3U -#define SPI_IDR_TXUDID_MSK BIT(SPI_IDR_TXUDID_POS) - -#define SPI_IDR_TXOVID_POS 2U -#define SPI_IDR_TXOVID_MSK BIT(SPI_IDR_TXOVID_POS) - -#define SPI_IDR_TXEID_POS 0U -#define SPI_IDR_TXEID_MSK BIT(SPI_IDR_TXEID_POS) - -/****************** Bit definition for SPI_IVS register ************************/ - -#define SPI_IVS_FREIV_POS 18U -#define SPI_IVS_FREIV_MSK BIT(SPI_IVS_FREIV_POS) - -#define SPI_IVS_MODFIV_POS 17U -#define SPI_IVS_MODFIV_MSK BIT(SPI_IVS_MODFIV_POS) - -#define SPI_IVS_CRCERRIV_POS 16U -#define SPI_IVS_CRCERRIV_MSK BIT(SPI_IVS_CRCERRIV_POS) - -#define SPI_IVS_RXTHIV_POS 12U -#define SPI_IVS_RXTHIV_MSK BIT(SPI_IVS_RXTHIV_POS) - -#define SPI_IVS_RXUDIV_POS 11U -#define SPI_IVS_RXUDIV_MSK BIT(SPI_IVS_RXUDIV_POS) - -#define SPI_IVS_RXOVIV_POS 10U -#define SPI_IVS_RXOVIV_MSK BIT(SPI_IVS_RXOVIV_POS) - -#define SPI_IVS_RXFIV_POS 9U -#define SPI_IVS_RXFIV_MSK BIT(SPI_IVS_RXFIV_POS) - -#define SPI_IVS_TXTHIV_POS 4U -#define SPI_IVS_TXTHIV_MSK BIT(SPI_IVS_TXTHIV_POS) - -#define SPI_IVS_TXUDIV_POS 3U -#define SPI_IVS_TXUDIV_MSK BIT(SPI_IVS_TXUDIV_POS) - -#define SPI_IVS_TXOVIV_POS 2U -#define SPI_IVS_TXOVIV_MSK BIT(SPI_IVS_TXOVIV_POS) - -#define SPI_IVS_TXEIV_POS 0U -#define SPI_IVS_TXEIV_MSK BIT(SPI_IVS_TXEIV_POS) - -/****************** Bit definition for SPI_RIF register ************************/ - -#define SPI_RIF_FRERI_POS 18U -#define SPI_RIF_FRERI_MSK BIT(SPI_RIF_FRERI_POS) - -#define SPI_RIF_MODFRI_POS 17U -#define SPI_RIF_MODFRI_MSK BIT(SPI_RIF_MODFRI_POS) - -#define SPI_RIF_CRCERRRI_POS 16U -#define SPI_RIF_CRCERRRI_MSK BIT(SPI_RIF_CRCERRRI_POS) - -#define SPI_RIF_RXTHRI_POS 12U -#define SPI_RIF_RXTHRI_MSK BIT(SPI_RIF_RXTHRI_POS) - -#define SPI_RIF_RXUDRI_POS 11U -#define SPI_RIF_RXUDRI_MSK BIT(SPI_RIF_RXUDRI_POS) - -#define SPI_RIF_RXOVRI_POS 10U -#define SPI_RIF_RXOVRI_MSK BIT(SPI_RIF_RXOVRI_POS) - -#define SPI_RIF_RXFRI_POS 9U -#define SPI_RIF_RXFRI_MSK BIT(SPI_RIF_RXFRI_POS) - -#define SPI_RIF_TXTHRI_POS 4U -#define SPI_RIF_TXTHRI_MSK BIT(SPI_RIF_TXTHRI_POS) - -#define SPI_RIF_TXUDRI_POS 3U -#define SPI_RIF_TXUDRI_MSK BIT(SPI_RIF_TXUDRI_POS) - -#define SPI_RIF_TXOVRI_POS 2U -#define SPI_RIF_TXOVRI_MSK BIT(SPI_RIF_TXOVRI_POS) - -#define SPI_RIF_TXERI_POS 0U -#define SPI_RIF_TXERI_MSK BIT(SPI_RIF_TXERI_POS) - -/****************** Bit definition for SPI_IFM register ************************/ - -#define SPI_IFM_FREFM_POS 18U -#define SPI_IFM_FREFM_MSK BIT(SPI_IFM_FREFM_POS) - -#define SPI_IFM_MODFFM_POS 17U -#define SPI_IFM_MODFFM_MSK BIT(SPI_IFM_MODFFM_POS) - -#define SPI_IFM_CRCERRFM_POS 16U -#define SPI_IFM_CRCERRFM_MSK BIT(SPI_IFM_CRCERRFM_POS) - -#define SPI_IFM_RXTHFM_POS 12U -#define SPI_IFM_RXTHFM_MSK BIT(SPI_IFM_RXTHFM_POS) - -#define SPI_IFM_RXUDFM_POS 11U -#define SPI_IFM_RXUDFM_MSK BIT(SPI_IFM_RXUDFM_POS) - -#define SPI_IFM_RXOVFM_POS 10U -#define SPI_IFM_RXOVFM_MSK BIT(SPI_IFM_RXOVFM_POS) - -#define SPI_IFM_RXFFM_POS 9U -#define SPI_IFM_RXFFM_MSK BIT(SPI_IFM_RXFFM_POS) - -#define SPI_IFM_TXTHFM_POS 4U -#define SPI_IFM_TXTHFM_MSK BIT(SPI_IFM_TXTHFM_POS) - -#define SPI_IFM_TXUDFM_POS 3U -#define SPI_IFM_TXUDFM_MSK BIT(SPI_IFM_TXUDFM_POS) - -#define SPI_IFM_TXOVFM_POS 2U -#define SPI_IFM_TXOVFM_MSK BIT(SPI_IFM_TXOVFM_POS) - -#define SPI_IFM_TXEFM_POS 0U -#define SPI_IFM_TXEFM_MSK BIT(SPI_IFM_TXEFM_POS) - -/****************** Bit definition for SPI_ICR register ************************/ - -#define SPI_ICR_FREIC_POS 18U -#define SPI_ICR_FREIC_MSK BIT(SPI_ICR_FREIC_POS) - -#define SPI_ICR_MODFIC_POS 17U -#define SPI_ICR_MODFIC_MSK BIT(SPI_ICR_MODFIC_POS) - -#define SPI_ICR_CRCERRIC_POS 16U -#define SPI_ICR_CRCERRIC_MSK BIT(SPI_ICR_CRCERRIC_POS) - -#define SPI_ICR_RXTHIC_POS 12U -#define SPI_ICR_RXTHIC_MSK BIT(SPI_ICR_RXTHIC_POS) - -#define SPI_ICR_RXUDIC_POS 11U -#define SPI_ICR_RXUDIC_MSK BIT(SPI_ICR_RXUDIC_POS) - -#define SPI_ICR_RXOVIC_POS 10U -#define SPI_ICR_RXOVIC_MSK BIT(SPI_ICR_RXOVIC_POS) - -#define SPI_ICR_RXFIC_POS 9U -#define SPI_ICR_RXFIC_MSK BIT(SPI_ICR_RXFIC_POS) - -#define SPI_ICR_TXTHIC_POS 4U -#define SPI_ICR_TXTHIC_MSK BIT(SPI_ICR_TXTHIC_POS) - -#define SPI_ICR_TXUDIC_POS 3U -#define SPI_ICR_TXUDIC_MSK BIT(SPI_ICR_TXUDIC_POS) - -#define SPI_ICR_TXOVIC_POS 2U -#define SPI_ICR_TXOVIC_MSK BIT(SPI_ICR_TXOVIC_POS) - -#define SPI_ICR_TXEIC_POS 0U -#define SPI_ICR_TXEIC_MSK BIT(SPI_ICR_TXEIC_POS) - -typedef struct -{ - __IO uint32_t CON1; - __IO uint32_t CON2; - __I uint32_t STAT; - __IO uint32_t DATA; - __IO uint32_t CRCPOLY; - __I uint32_t RXCRC; - __I uint32_t TXCRC; - __IO uint32_t I2SCFG; - __IO uint32_t I2SPR; - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; -} SPI_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_syscfg.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_syscfg.h deleted file mode 100644 index 675d9484c9..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_syscfg.h +++ /dev/null @@ -1,215 +0,0 @@ -/** - ************************************************************************************** - * @file REG_SYSCFG.h - * @brief SYSCFG Head File - * - * @version V0.01 - * @date 12/5/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __SYSCFG_H__ -#define __SYSCFG_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for SYSCFG_REMAP register ************************/ - -#define SYSCFG_REMAP_REALMOD_POSS 10U -#define SYSCFG_REMAP_REALMOD_POSE 11U -#define SYSCFG_REMAP_REALMOD_MSK BITS(SYSCFG_REMAP_REALMOD_POSS,SYSCFG_REMAP_REALMOD_POSE) - -#define SYSCFG_REMAP_EFBASE_POSS 4U -#define SYSCFG_REMAP_EFBASE_POSE 7U -#define SYSCFG_REMAP_EFBASE_MSK BITS(SYSCFG_REMAP_EFBASE_POSS,SYSCFG_REMAP_EFBASE_POSE) - -#define SYSCFG_REMAP_MEMMOD_POSS 2U -#define SYSCFG_REMAP_MEMMOD_POSE 3U -#define SYSCFG_REMAP_MEMMOD_MSK BITS(SYSCFG_REMAP_MEMMOD_POSS,SYSCFG_REMAP_MEMMOD_POSE) - -#define SYSCFG_REMAP_REMAP_POS 0U -#define SYSCFG_REMAP_REMAP_MSK BIT(SYSCFG_REMAP_REMAP_POS) - -/****************** Bit definition for SYSCFG_TRIM register ************************/ - -#define SYSCFG_TRIM_CNT_POSS 20U -#define SYSCFG_TRIM_CNT_POSE 31U -#define SYSCFG_TRIM_CNT_MSK BITS(SYSCFG_TRIM_CNT_POSS,SYSCFG_TRIM_CNT_POSE) - -#define SYSCFG_TRIM_FAIL_POS 18U -#define SYSCFG_TRIM_FAIL_MSK BIT(SYSCFG_TRIM_FAIL_POS) - -#define SYSCFG_TRIM_NOEQU_POS 17U -#define SYSCFG_TRIM_NOEQU_MSK BIT(SYSCFG_TRIM_NOEQU_POS) - -#define SYSCFG_TRIM_BUSY_POS 16U -#define SYSCFG_TRIM_BUSY_MSK BIT(SYSCFG_TRIM_BUSY_POS) - -#define SYSCFG_TRIM_HRCTRIM_POSS 8U -#define SYSCFG_TRIM_HRCTRIM_POSE 15U -#define SYSCFG_TRIM_HRCTRIM_MSK BITS(SYSCFG_TRIM_HRCTRIM_POSS,SYSCFG_TRIM_HRCTRIM_POSE) - -#define SYSCFG_TRIM_TSRC_POS 1U -#define SYSCFG_TRIM_TSRC_MSK BIT(SYSCFG_TRIM_TSRC_POS) - -#define SYSCFG_TRIM_TRIM_POS 0U -#define SYSCFG_TRIM_TRIM_MSK BIT(SYSCFG_TRIM_TRIM_POS) - -/****************** Bit definition for SYSCFG_IRSEL register ************************/ - -#define SYSCFG_IRSEL_PLR_POS 8U -#define SYSCFG_IRSEL_PLR_MSK BIT(SYSCFG_IRSEL_PLR_POS) - -#define SYSCFG_IRSEL_SEL2_POSS 4U -#define SYSCFG_IRSEL_SEL2_POSE 7U -#define SYSCFG_IRSEL_SEL2_MSK BITS(SYSCFG_IRSEL_SEL2_POSS,SYSCFG_IRSEL_SEL2_POSE) - -#define SYSCFG_IRSEL_SEL1_POSS 0U -#define SYSCFG_IRSEL_SEL1_POSE 3U -#define SYSCFG_IRSEL_SEL1_MSK BITS(SYSCFG_IRSEL_SEL1_POSS,SYSCFG_IRSEL_SEL1_POSE) - -/****************** Bit definition for SYSCFG_CFG register ************************/ - -#define SYSCFG_CFG_DBGH_EN_POSS 16U -#define SYSCFG_CFG_DBGH_EN_POSE 31U -#define SYSCFG_CFG_DBGH_EN_MSK BITS(SYSCFG_CFG_DBGH_EN_POSS,SYSCFG_CFG_DBGH_EN_POSE) - -#define SYSCFG_CFG_PVD_LCK_POS 14U -#define SYSCFG_CFG_PVD_LCK_MSK BIT(SYSCFG_CFG_PVD_LCK_POS) - -#define SYSCFG_CFG_CSS_LCK_POS 13U -#define SYSCFG_CFG_CSS_LCK_MSK BIT(SYSCFG_CFG_CSS_LCK_POS) - -#define SYSCFG_CFG_CPU_LCK_POS 12U -#define SYSCFG_CFG_CPU_LCK_MSK BIT(SYSCFG_CFG_CPU_LCK_POS) - -#define SYSCFG_CFG_VTST_POSS 8U -#define SYSCFG_CFG_VTST_POSE 9U -#define SYSCFG_CFG_VTST_MSK BITS(SYSCFG_CFG_VTST_POSS,SYSCFG_CFG_VTST_POSE) - -#define SYSCFG_CFG_NRSTREQ_POS 7U -#define SYSCFG_CFG_NRSTREQ_MSK BIT(SYSCFG_CFG_NRSTREQ_POS) - -#define SYSCFG_CFG_CURRGEN_POS 5U -#define SYSCFG_CFG_CURRGEN_MSK BIT(SYSCFG_CFG_CURRGEN_POS) - -#define SYSCFG_CFG_TEMPEN_POS 4U -#define SYSCFG_CFG_TEMPEN_MSK BIT(SYSCFG_CFG_TEMPEN_POS) - -#define SYSCFG_CFG_VREFEN_POS 3U -#define SYSCFG_CFG_VREFEN_MSK BIT(SYSCFG_CFG_VREFEN_POS) - -#define SYSCFG_CFG_VRLS_POSS 0U -#define SYSCFG_CFG_VRLS_POSE 2U -#define SYSCFG_CFG_VRLS_MSK BITS(SYSCFG_CFG_VRLS_POSS,SYSCFG_CFG_VRLS_POSE) - -/****************** Bit definition for SYSCFG_PWCON register ************************/ - -#define SYSCFG_PWCON_IOLOCK_POS 23U -#define SYSCFG_PWCON_IOLOCK_MSK BIT(SYSCFG_PWCON_IOLOCK_POS) - -#define SYSCFG_PWCON_BGTRIM_POSS 17U -#define SYSCFG_PWCON_BGTRIM_POSE 20U -#define SYSCFG_PWCON_BGTRIM_MSK BITS(SYSCFG_PWCON_BGTRIM_POSS,SYSCFG_PWCON_BGTRIM_POSE) - -#define SYSCFG_PWCON_HRCLOCK_POS 16U -#define SYSCFG_PWCON_HRCLOCK_MSK BIT(SYSCFG_PWCON_HRCLOCK_POS) - -#define SYSCFG_PWCON_HRCTRIM_POSS 8U -#define SYSCFG_PWCON_HRCTRIM_POSE 15U -#define SYSCFG_PWCON_HRCTRIM_MSK BITS(SYSCFG_PWCON_HRCTRIM_POSS,SYSCFG_PWCON_HRCTRIM_POSE) - -#define SYSCFG_PWCON_LOSCDRV_POSS 5U -#define SYSCFG_PWCON_LOSCDRV_POSE 7U -#define SYSCFG_PWCON_LOSCDRV_MSK BITS(SYSCFG_PWCON_LOSCDRV_POSS,SYSCFG_PWCON_LOSCDRV_POSE) - -#define SYSCFG_PWCON_PVDEN_POS 4U -#define SYSCFG_PWCON_PVDEN_MSK BIT(SYSCFG_PWCON_PVDEN_POS) - -#define SYSCFG_PWCON_PVLS_POSS 0U -#define SYSCFG_PWCON_PVLS_POSE 3U -#define SYSCFG_PWCON_PVLS_MSK BITS(SYSCFG_PWCON_PVLS_POSS,SYSCFG_PWCON_PVLS_POSE) - -/****************** Bit definition for SYSCFG_WKCON register ************************/ - -#define SYSCFG_WKCON_WKCLR_POS 31U -#define SYSCFG_WKCON_WKCLR_MSK BIT(SYSCFG_WKCON_WKCLR_POS) - -#define SYSCFG_WKCON_LPLS_POSS 28U -#define SYSCFG_WKCON_LPLS_POSE 30U -#define SYSCFG_WKCON_LPLS_MSK BITS(SYSCFG_WKCON_LPLS_POSS,SYSCFG_WKCON_LPLS_POSE) - -#define SYSCFG_WKCON_WKEG_POSS 16U -#define SYSCFG_WKCON_WKEG_POSE 27U -#define SYSCFG_WKCON_WKEG_MSK BITS(SYSCFG_WKCON_WKEG_POSS,SYSCFG_WKCON_WKEG_POSE) - -#define SYSCFG_WKCON_WKEN_POSS 0U -#define SYSCFG_WKCON_WKEN_POSE 11U -#define SYSCFG_WKCON_WKEN_MSK BITS(SYSCFG_WKCON_WKEN_POSS,SYSCFG_WKCON_WKEN_POSE) - -/****************** Bit definition for SYSCFG_WKSTAT register ************************/ - -#define SYSCFG_WKSTAT_FLAG_POS 16U -#define SYSCFG_WKSTAT_FLAG_MSK BIT(SYSCFG_WKSTAT_FLAG_POS) - -#define SYSCFG_WKSTAT_FG_POSS 0U -#define SYSCFG_WKSTAT_FG_POSE 11U -#define SYSCFG_WKSTAT_FG_MSK BITS(SYSCFG_WKSTAT_FG_POSS,SYSCFG_WKSTAT_FG_POSE) - -/****************** Bit definition for SYSCFG_BKREG0 register ************************/ - -#define SYSCFG_BKREG0_BKREG0_POSS 0U -#define SYSCFG_BKREG0_BKREG0_POSE 31U -#define SYSCFG_BKREG0_BKREG0_MSK BITS(SYSCFG_BKREG0_BKREG0_POSS,SYSCFG_BKREG0_BKREG0_POSE) - -/****************** Bit definition for SYSCFG_BKREG1 register ************************/ - -#define SYSCFG_BKREG1_BKREG1_POSS 0U -#define SYSCFG_BKREG1_BKREG1_POSE 31U -#define SYSCFG_BKREG1_BKREG1_MSK BITS(SYSCFG_BKREG1_BKREG1_POSS,SYSCFG_BKREG1_BKREG1_POSE) - -/****************** Bit definition for SYSCFG_BKREG2 register ************************/ - -#define SYSCFG_BKREG2_BKREG2_POSS 0U -#define SYSCFG_BKREG2_BKREG2_POSE 31U -#define SYSCFG_BKREG2_BKREG2_MSK BITS(SYSCFG_BKREG2_BKREG2_POSS,SYSCFG_BKREG2_BKREG2_POSE) - -/****************** Bit definition for SYSCFG_BKREG3 register ************************/ - -#define SYSCFG_BKREG3_BKREG3_POSS 0U -#define SYSCFG_BKREG3_BKREG3_POSE 29U -#define SYSCFG_BKREG3_BKREG3_MSK BITS(SYSCFG_BKREG3_BKREG3_POSS,SYSCFG_BKREG3_BKREG3_POSE) - -typedef struct -{ - __O uint32_t REMAP; - __O uint32_t TRIM; - __IO uint32_t IRSEL; - uint32_t RESERVED0[12] ; - __IO uint32_t CFG; - __IO uint32_t PWCON; - uint32_t RESERVED1 ; - __IO uint32_t WKCON; - __I uint32_t WKSTAT; - __IO uint32_t BKREG0; - __IO uint32_t BKREG1; - __IO uint32_t BKREG2; - __IO uint32_t BKREG3; -} SYSCFG_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_tick.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_tick.h deleted file mode 100644 index 13122aef46..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_tick.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - ************************************************************************************** - * @file reg_TICK.h - * @brief TICK Head File - * - * @version V1.00.01 - * @date 19/10/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __TICK_H__ -#define __TICK_H__ - -/******************************************************************************/ -/* Ȧs줸wq */ -/******************************************************************************/ - -/* #pragma anon_unions */ - -/****************** Bit definition for TICK_CSR register ************************/ - -#define TICK_CSR_ENABLE_POS 0U -#define TICK_CSR_ENABLE_MSK BIT(TICK_CSR_ENABLE_POS) - -#define TICK_CSR_TICKINT_POS 1U -#define TICK_CSR_TICKINT_MSK BIT(TICK_CSR_TICKINT_POS) - -#define TICK_CSR_CLKSOURCE_POS 2U -#define TICK_CSR_CLKSOURCE_MSK BIT(TICK_CSR_CLKSOURCE_POS) - -#define TICK_CSR_COUNTFLAG_POS 16U -#define TICK_CSR_COUNTFLAG_MSK BIT(TICK_CSR_COUNTFLAG_POS) - -/****************** Bit definition for TICK_RVR register ************************/ - -#define TICK_RVR_RELOAD_POSS 0U -#define TICK_RVR_RELOAD_POSE 23U -#define TICK_RVR_RELOAD_MSK BITS(TICK_RVR_RELOAD_POSS,TICK_RVR_RELOAD_POSE) - -/****************** Bit definition for TICK_CVR register ************************/ - -#define TICK_CVR_CURRENT_POSS 0U -#define TICK_CVR_CURRENT_POSE 23U -#define TICK_CVR_CURRENT_MSK BITS(TICK_CVR_CURRENT_POSS,TICK_CVR_CURRENT_POSE) - - -/****************** Bit definition for TICK_CALIB register ************************/ - -#define TICK_CALIB_TENMS_POSS 0U -#define TICK_CALIB_TENMS_POSE 23U -#define TICK_CALIB_TENMS_MSK BITS(TICK_CALIB_TENMS_POSS,TICK_CALIB_TENMS_POSE) - -#define TICK_CALIB_SKEW_POS 30U -#define TICK_CALIB_SKEW_MSK BIT(TICK_CALIB_SKEW_POS) - -#define TICK_CALIB_NOREF_POS 31U -#define TICK_CALIB_NOREF_MSK BIT(TICK_CALIB_NOREF_POS) - - -/* TICK Register */ -#define pTICK TICK - -/* TICK CSR Register(TICK_CSR) */ -#define CSR_COUNTFLAG(x) (x<<16) /* Indicates whether the counter has counted to 0 since the last read of this register - 0 timer has not counted to 0 - 1 timer has counted to 0 */ -#define CSR_CLKSOURCE(x) (x<<2) /* Indicates the SysTick clock source: - 0 SysTick uses the optional external reference clock - 1 SysTick uses the processor clock */ -#define CSR_TICKINT(x) (x<<1) /* Indicates whether counting to 0 causes the status of the SysTick exception to change to pending: - 0 count to 0 does not affect the SysTick exception status - 1 count to 0 changes the SysTick exception status to pending */ -#define CSR_ENABLE(x) (x<<0) /* /Indicates the enabled status of the SysTick counter: - 0 counter is disabled - 1 counter is operating */ - - -/* TICK RVR Register(TICK_RVR) */ -#define RVR_RELOAD(x) (x<<0) /* The value to load into the SYST_CVR register when the counter reaches 0 */ - - -/* TICK CVR Register(TICK_CVR) */ -#define CVR_CURRENT(x) (x<<0) /* Current counter value - This is the value of the counter at the time it is sampled */ - - -/* TICK CALIB Register(TICK_CALIB) */ -#define CALIB_NOREF(x) (x<<31) /* Indicates whether the IMPLEMENTATION DEFINED reference clock is provided: - 0 the reference clock is implemented - 1 the reference clock is not implemented - When this bit is 1, the CLKSOURCE bit of the SYST_CSR register is forced to 1 and cannot be cleared to 0 */ -#define CALIB_SKEW(x) (x<<30) /* Indicates whether the 10ms calibration value is exact: - 0 10ms calibration value is exact - 1 10ms calibration value is inexact, because of the clock frequency */ -#define CALIB_TENMS(x) (x<<0) /* Optionally, holds a reload value to be used for 10ms (100Hz) timing, subject to system clock skew errors. - If this field is zero, the calibration value is not known */ -typedef struct -{ - __IO uint32_t CSR; /* 0x0, Control and Status */ - __IO uint32_t RVR; /* 0x4, Reload Value */ - __IO uint32_t CVR; /* 0x8, Current Value */ - __I uint32_t CALIB; /* 0xC, Calibration */ -} TICK_TypeDef; - - -#else -/* */ -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_uart.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_uart.h deleted file mode 100644 index 1cd5670f8e..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_uart.h +++ /dev/null @@ -1,606 +0,0 @@ -/** - ************************************************************************************** - * @file REG_UART.h - * @brief UART Head File - * - * @version V0.01 - * @data 12/3/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __UART_H__ -#define __UART_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for UART_RXBUF register ************************/ - -#define UART_RXBUF_RXBUF_POSS 0U -#define UART_RXBUF_RXBUF_POSE 8U -#define UART_RXBUF_RXBUF_MSK BITS(UART_RXBUF_RXBUF_POSS,UART_RXBUF_RXBUF_POSE) - -/****************** Bit definition for UART_TXBUF register ************************/ - -#define UART_TXBUF_TXBUF_POSS 0U -#define UART_TXBUF_TXBUF_POSE 8U -#define UART_TXBUF_TXBUF_MSK BITS(UART_TXBUF_TXBUF_POSS,UART_TXBUF_TXBUF_POSE) - -/****************** Bit definition for UART_BRR register ************************/ - -#define UART_BRR_BRR_POSS 0U -#define UART_BRR_BRR_POSE 15U -#define UART_BRR_BRR_MSK BITS(UART_BRR_BRR_POSS,UART_BRR_BRR_POSE) - -/****************** Bit definition for UART_LCON register ************************/ - -#define UART_LCON_TXEN_POS 15U -#define UART_LCON_TXEN_MSK BIT(UART_LCON_TXEN_POS) - -#define UART_LCON_RXEN_POS 14U -#define UART_LCON_RXEN_MSK BIT(UART_LCON_RXEN_POS) - -#define UART_LCON_DBCEN_POS 13U -#define UART_LCON_DBCEN_MSK BIT(UART_LCON_DBCEN_POS) - -#define UART_LCON_BREAK_POS 10U -#define UART_LCON_BREAK_MSK BIT(UART_LCON_BREAK_POS) - -#define UART_LCON_SWAP_POS 9U -#define UART_LCON_SWAP_MSK BIT(UART_LCON_SWAP_POS) - -#define UART_LCON_TXINV_POS 8U -#define UART_LCON_TXINV_MSK BIT(UART_LCON_TXINV_POS) - -#define UART_LCON_RXINV_POS 7U -#define UART_LCON_RXINV_MSK BIT(UART_LCON_RXINV_POS) - -#define UART_LCON_DATAINV_POS 6U -#define UART_LCON_DATAINV_MSK BIT(UART_LCON_DATAINV_POS) - -#define UART_LCON_MSB_POS 5U -#define UART_LCON_MSB_MSK BIT(UART_LCON_MSB_POS) - -#define UART_LCON_PS_POS 4U -#define UART_LCON_PS_MSK BIT(UART_LCON_PS_POS) - -#define UART_LCON_PE_POS 3U -#define UART_LCON_PE_MSK BIT(UART_LCON_PE_POS) - -#define UART_LCON_STOP_POS 2U -#define UART_LCON_STOP_MSK BIT(UART_LCON_STOP_POS) - -#define UART_LCON_DLS_POSS 0U -#define UART_LCON_DLS_POSE 1U -#define UART_LCON_DLS_MSK BITS(UART_LCON_DLS_POSS,UART_LCON_DLS_POSE) - -/****************** Bit definition for UART_MCON register ************************/ - -#define UART_MCON_TXDMAEN_POS 15U -#define UART_MCON_TXDMAEN_MSK BIT(UART_MCON_TXDMAEN_POS) - -#define UART_MCON_RXDMAEN_POS 14U -#define UART_MCON_RXDMAEN_MSK BIT(UART_MCON_RXDMAEN_POS) - -#define UART_MCON_ABRREPT_POS 11U -#define UART_MCON_ABRREPT_MSK BIT(UART_MCON_ABRREPT_POS) - -#define UART_MCON_ABRMOD_POSS 9U -#define UART_MCON_ABRMOD_POSE 10U -#define UART_MCON_ABRMOD_MSK BITS(UART_MCON_ABRMOD_POSS,UART_MCON_ABRMOD_POSE) - -#define UART_MCON_ABREN_POS 8U -#define UART_MCON_ABREN_MSK BIT(UART_MCON_ABREN_POS) - -#define UART_MCON_BKREQ_POS 5U -#define UART_MCON_BKREQ_MSK BIT(UART_MCON_BKREQ_POS) - -#define UART_MCON_HDEN_POS 4U -#define UART_MCON_HDEN_MSK BIT(UART_MCON_HDEN_POS) - -#define UART_MCON_IREN_POS 3U -#define UART_MCON_IREN_MSK BIT(UART_MCON_IREN_POS) - -#define UART_MCON_AFCEN_POS 2U -#define UART_MCON_AFCEN_MSK BIT(UART_MCON_AFCEN_POS) - -#define UART_MCON_RTSSET_POS 1U -#define UART_MCON_RTSSET_MSK BIT(UART_MCON_RTSSET_POS) - -#define UART_MCON_LPBKEN_POS 0U -#define UART_MCON_LPBKEN_MSK BIT(UART_MCON_LPBKEN_POS) - -/****************** Bit definition for UART_RS485 register ************************/ - -#define UART_RS485_DLY_POSS 16U -#define UART_RS485_DLY_POSE 23U -#define UART_RS485_DLY_MSK BITS(UART_RS485_DLY_POSS,UART_RS485_DLY_POSE) - -#define UART_RS485_ADDR_POSS 8U -#define UART_RS485_ADDR_POSE 15U -#define UART_RS485_ADDR_MSK BITS(UART_RS485_ADDR_POSS,UART_RS485_ADDR_POSE) - -#define UART_RS485_AADINV_POS 3U -#define UART_RS485_AADINV_MSK BIT(UART_RS485_AADINV_POS) - -#define UART_RS485_AADACEN_POS 2U -#define UART_RS485_AADACEN_MSK BIT(UART_RS485_AADACEN_POS) - -#define UART_RS485_AADNEN_POS 1U -#define UART_RS485_AADNEN_MSK BIT(UART_RS485_AADNEN_POS) - -#define UART_RS485_AADEN_POS 0U -#define UART_RS485_AADEN_MSK BIT(UART_RS485_AADEN_POS) - -/****************** Bit definition for UART_SCARD register ************************/ - -#define UART_SCARD_BLEN_POSS 24U -#define UART_SCARD_BLEN_POSE 31U -#define UART_SCARD_BLEN_MSK BITS(UART_SCARD_BLEN_POSS,UART_SCARD_BLEN_POSE) - -#define UART_SCARD_GT_POSS 16U -#define UART_SCARD_GT_POSE 23U -#define UART_SCARD_GT_MSK BITS(UART_SCARD_GT_POSS,UART_SCARD_GT_POSE) - -#define UART_SCARD_PSC_POSS 8U -#define UART_SCARD_PSC_POSE 15U -#define UART_SCARD_PSC_MSK BITS(UART_SCARD_PSC_POSS,UART_SCARD_PSC_POSE) - -#define UART_SCARD_SCCNT_POSS 3U -#define UART_SCARD_SCCNT_POSE 5U -#define UART_SCARD_SCCNT_MSK BITS(UART_SCARD_SCCNT_POSS,UART_SCARD_SCCNT_POSE) - -#define UART_SCARD_SCLKEN_POS 2U -#define UART_SCARD_SCLKEN_MSK BIT(UART_SCARD_SCLKEN_POS) - -#define UART_SCARD_SCNACK_POS 1U -#define UART_SCARD_SCNACK_MSK BIT(UART_SCARD_SCNACK_POS) - -#define UART_SCARD_SCEN_POS 0U -#define UART_SCARD_SCEN_MSK BIT(UART_SCARD_SCEN_POS) - -/****************** Bit definition for UART_LIN register ************************/ - -#define UART_LIN_LINBKREQ_POS 2U -#define UART_LIN_LINBKREQ_MSK BIT(UART_LIN_LINBKREQ_POS) - -#define UART_LIN_LINBDL_POS 1U -#define UART_LIN_LINBDL_MSK BIT(UART_LIN_LINBDL_POS) - -#define UART_LIN_LINEN_POS 0U -#define UART_LIN_LINEN_MSK BIT(UART_LIN_LINEN_POS) - -/****************** Bit definition for UART_RTOR register ************************/ - -#define UART_RTOR_RTOEN_POS 24U -#define UART_RTOR_RTOEN_MSK BIT(UART_RTOR_RTOEN_POS) - -#define UART_RTOR_RTO_POSS 0U -#define UART_RTOR_RTO_POSE 23U -#define UART_RTOR_RTO_MSK BITS(UART_RTOR_RTO_POSS,UART_RTOR_RTO_POSE) - -/****************** Bit definition for UART_FCON register ************************/ - -#define UART_FCON_TXFL_POSS 11U -#define UART_FCON_TXFL_POSE 15U -#define UART_FCON_TXFL_MSK BITS(UART_FCON_TXFL_POSS,UART_FCON_TXFL_POSE) - -#define UART_FCON_TXTH_POSS 9U -#define UART_FCON_TXTH_POSE 10U -#define UART_FCON_TXTH_MSK BITS(UART_FCON_TXTH_POSS,UART_FCON_TXTH_POSE) - -#define UART_FCON_TFRST_POS 8U -#define UART_FCON_TFRST_MSK BIT(UART_FCON_TFRST_POS) - -#define UART_FCON_RXFL_POSS 3U -#define UART_FCON_RXFL_POSE 7U -#define UART_FCON_RXFL_MSK BITS(UART_FCON_RXFL_POSS,UART_FCON_RXFL_POSE) - -#define UART_FCON_RXTH_POSS 1U -#define UART_FCON_RXTH_POSE 2U -#define UART_FCON_RXTH_MSK BITS(UART_FCON_RXTH_POSS,UART_FCON_RXTH_POSE) - -#define UART_FCON_RFRST_POS 0U -#define UART_FCON_RFRST_MSK BIT(UART_FCON_RFRST_POS) - -/****************** Bit definition for UART_STAT register ************************/ - -#define UART_STAT_TFOERR_POS 18U -#define UART_STAT_TFOERR_MSK BIT(UART_STAT_TFOERR_POS) - -#define UART_STAT_TFFULL_POS 17U -#define UART_STAT_TFFULL_MSK BIT(UART_STAT_TFFULL_POS) - -#define UART_STAT_TFEMPTY_POS 16U -#define UART_STAT_TFEMPTY_MSK BIT(UART_STAT_TFEMPTY_POS) - -#define UART_STAT_TFTH_POS 15U -#define UART_STAT_TFTH_MSK BIT(UART_STAT_TFTH_POS) - -#define UART_STAT_TSBUSY_POS 14U -#define UART_STAT_TSBUSY_MSK BIT(UART_STAT_TSBUSY_POS) - -#define UART_STAT_RFUERR_POS 13U -#define UART_STAT_RFUERR_MSK BIT(UART_STAT_RFUERR_POS) - -#define UART_STAT_RFOERR_POS 12U -#define UART_STAT_RFOERR_MSK BIT(UART_STAT_RFOERR_POS) - -#define UART_STAT_RFFULL_POS 11U -#define UART_STAT_RFFULL_MSK BIT(UART_STAT_RFFULL_POS) - -#define UART_STAT_RFEMPTY_POS 10U -#define UART_STAT_RFEMPTY_MSK BIT(UART_STAT_RFEMPTY_POS) - -#define UART_STAT_RFTH_POS 9U -#define UART_STAT_RFTH_MSK BIT(UART_STAT_RFTH_POS) - -#define UART_STAT_RSBUSY_POS 8U -#define UART_STAT_RSBUSY_MSK BIT(UART_STAT_RSBUSY_POS) - -#define UART_STAT_CTSSTA_POS 3U -#define UART_STAT_CTSSTA_MSK BIT(UART_STAT_CTSSTA_POS) - -#define UART_STAT_BKERR_POS 2U -#define UART_STAT_BKERR_MSK BIT(UART_STAT_BKERR_POS) - -#define UART_STAT_FERR_POS 1U -#define UART_STAT_FERR_MSK BIT(UART_STAT_FERR_POS) - -#define UART_STAT_PERR_POS 0U -#define UART_STAT_PERR_MSK BIT(UART_STAT_PERR_POS) - -/****************** Bit definition for UART_IER register ************************/ - -#define UART_IER_TFOVER_POS 18U -#define UART_IER_TFOVER_MSK BIT(UART_IER_TFOVER_POS) - -#define UART_IER_TFEMPTY_POS 16U -#define UART_IER_TFEMPTY_MSK BIT(UART_IER_TFEMPTY_POS) - -#define UART_IER_TFTH_POS 15U -#define UART_IER_TFTH_MSK BIT(UART_IER_TFTH_POS) - -#define UART_IER_TBC_POS 14U -#define UART_IER_TBC_MSK BIT(UART_IER_TBC_POS) - -#define UART_IER_RFUERR_POS 13U -#define UART_IER_RFUERR_MSK BIT(UART_IER_RFUERR_POS) - -#define UART_IER_RFOERR_POS 12U -#define UART_IER_RFOERR_MSK BIT(UART_IER_RFOERR_POS) - -#define UART_IER_RFFULL_POS 11U -#define UART_IER_RFFULL_MSK BIT(UART_IER_RFFULL_POS) - -#define UART_IER_RFTH_POS 9U -#define UART_IER_RFTH_MSK BIT(UART_IER_RFTH_POS) - -#define UART_IER_NOISE_POS 8U -#define UART_IER_NOISE_MSK BIT(UART_IER_NOISE_POS) - -#define UART_IER_EOB_POS 7U -#define UART_IER_EOB_MSK BIT(UART_IER_EOB_POS) - -#define UART_IER_LINBK_POS 6U -#define UART_IER_LINBK_MSK BIT(UART_IER_LINBK_POS) - -#define UART_IER_ADDRM_POS 5U -#define UART_IER_ADDRM_MSK BIT(UART_IER_ADDRM_POS) - -#define UART_IER_RXTO_POS 4U -#define UART_IER_RXTO_MSK BIT(UART_IER_RXTO_POS) - -#define UART_IER_DCTS_POS 3U -#define UART_IER_DCTS_MSK BIT(UART_IER_DCTS_POS) - -#define UART_IER_ABTO_POS 2U -#define UART_IER_ABTO_MSK BIT(UART_IER_ABTO_POS) - -#define UART_IER_ABEND_POS 1U -#define UART_IER_ABEND_MSK BIT(UART_IER_ABEND_POS) - -#define UART_IER_RXBERR_POS 0U -#define UART_IER_RXBERR_MSK BIT(UART_IER_RXBERR_POS) - -/****************** Bit definition for UART_IDR register ************************/ - -#define UART_IDR_TFOVER_POS 18U -#define UART_IDR_TFOVER_MSK BIT(UART_IDR_TFOVER_POS) - -#define UART_IDR_TFEMPTY_POS 16U -#define UART_IDR_TFEMPTY_MSK BIT(UART_IDR_TFEMPTY_POS) - -#define UART_IDR_TFTH_POS 15U -#define UART_IDR_TFTH_MSK BIT(UART_IDR_TFTH_POS) - -#define UART_IDR_TBC_POS 14U -#define UART_IDR_TBC_MSK BIT(UART_IDR_TBC_POS) - -#define UART_IDR_RFUERR_POS 13U -#define UART_IDR_RFUERR_MSK BIT(UART_IDR_RFUERR_POS) - -#define UART_IDR_RFOERR_POS 12U -#define UART_IDR_RFOERR_MSK BIT(UART_IDR_RFOERR_POS) - -#define UART_IDR_RFFULL_POS 11U -#define UART_IDR_RFFULL_MSK BIT(UART_IDR_RFFULL_POS) - -#define UART_IDR_RFTH_POS 9U -#define UART_IDR_RFTH_MSK BIT(UART_IDR_RFTH_POS) - -#define UART_IDR_NOISE_POS 8U -#define UART_IDR_NOISE_MSK BIT(UART_IDR_NOISE_POS) - -#define UART_IDR_EOB_POS 7U -#define UART_IDR_EOB_MSK BIT(UART_IDR_EOB_POS) - -#define UART_IDR_LINBK_POS 6U -#define UART_IDR_LINBK_MSK BIT(UART_IDR_LINBK_POS) - -#define UART_IDR_ADDRM_POS 5U -#define UART_IDR_ADDRM_MSK BIT(UART_IDR_ADDRM_POS) - -#define UART_IDR_RXTO_POS 4U -#define UART_IDR_RXTO_MSK BIT(UART_IDR_RXTO_POS) - -#define UART_IDR_DCTS_POS 3U -#define UART_IDR_DCTS_MSK BIT(UART_IDR_DCTS_POS) - -#define UART_IDR_ABTO_POS 2U -#define UART_IDR_ABTO_MSK BIT(UART_IDR_ABTO_POS) - -#define UART_IDR_ABEND_POS 1U -#define UART_IDR_ABEND_MSK BIT(UART_IDR_ABEND_POS) - -#define UART_IDR_RXBERR_POS 0U -#define UART_IDR_RXBERR_MSK BIT(UART_IDR_RXBERR_POS) - -/****************** Bit definition for UART_IVS register ************************/ - -#define UART_IVS_TFOVER_POS 18U -#define UART_IVS_TFOVER_MSK BIT(UART_IVS_TFOVER_POS) - -#define UART_IVS_TFEMPTY_POS 16U -#define UART_IVS_TFEMPTY_MSK BIT(UART_IVS_TFEMPTY_POS) - -#define UART_IVS_TFTH_POS 15U -#define UART_IVS_TFTH_MSK BIT(UART_IVS_TFTH_POS) - -#define UART_IVS_TBC_POS 14U -#define UART_IVS_TBC_MSK BIT(UART_IVS_TBC_POS) - -#define UART_IVS_RFUERR_POS 13U -#define UART_IVS_RFUERR_MSK BIT(UART_IVS_RFUERR_POS) - -#define UART_IVS_RFOERR_POS 12U -#define UART_IVS_RFOERR_MSK BIT(UART_IVS_RFOERR_POS) - -#define UART_IVS_RFFULL_POS 11U -#define UART_IVS_RFFULL_MSK BIT(UART_IVS_RFFULL_POS) - -#define UART_IVS_RFTH_POS 9U -#define UART_IVS_RFTH_MSK BIT(UART_IVS_RFTH_POS) - -#define UART_IVS_NOISE_POS 8U -#define UART_IVS_NOISE_MSK BIT(UART_IVS_NOISE_POS) - -#define UART_IVS_EOB_POS 7U -#define UART_IVS_EOB_MSK BIT(UART_IVS_EOB_POS) - -#define UART_IVS_LINBK_POS 6U -#define UART_IVS_LINBK_MSK BIT(UART_IVS_LINBK_POS) - -#define UART_IVS_ADDRM_POS 5U -#define UART_IVS_ADDRM_MSK BIT(UART_IVS_ADDRM_POS) - -#define UART_IVS_RXTO_POS 4U -#define UART_IVS_RXTO_MSK BIT(UART_IVS_RXTO_POS) - -#define UART_IVS_DCTS_POS 3U -#define UART_IVS_DCTS_MSK BIT(UART_IVS_DCTS_POS) - -#define UART_IVS_ABTO_POS 2U -#define UART_IVS_ABTO_MSK BIT(UART_IVS_ABTO_POS) - -#define UART_IVS_ABEND_POS 1U -#define UART_IVS_ABEND_MSK BIT(UART_IVS_ABEND_POS) - -#define UART_IVS_RXBERR_POS 0U -#define UART_IVS_RXBERR_MSK BIT(UART_IVS_RXBERR_POS) - -/****************** Bit definition for UART_RIF register ************************/ - -#define UART_RIF_TFOVER_POS 18U -#define UART_RIF_TFOVER_MSK BIT(UART_RIF_TFOVER_POS) - -#define UART_RIF_TFEMPTY_POS 16U -#define UART_RIF_TFEMPTY_MSK BIT(UART_RIF_TFEMPTY_POS) - -#define UART_RIF_TFTH_POS 15U -#define UART_RIF_TFTH_MSK BIT(UART_RIF_TFTH_POS) - -#define UART_RIF_TBC_POS 14U -#define UART_RIF_TBC_MSK BIT(UART_RIF_TBC_POS) - -#define UART_RIF_RFUERR_POS 13U -#define UART_RIF_RFUERR_MSK BIT(UART_RIF_RFUERR_POS) - -#define UART_RIF_RFOERR_POS 12U -#define UART_RIF_RFOERR_MSK BIT(UART_RIF_RFOERR_POS) - -#define UART_RIF_RFFULL_POS 11U -#define UART_RIF_RFFULL_MSK BIT(UART_RIF_RFFULL_POS) - -#define UART_RIF_RFTH_POS 9U -#define UART_RIF_RFTH_MSK BIT(UART_RIF_RFTH_POS) - -#define UART_RIF_NOISE_POS 8U -#define UART_RIF_NOISE_MSK BIT(UART_RIF_NOISE_POS) - -#define UART_RIF_EOB_POS 7U -#define UART_RIF_EOB_MSK BIT(UART_RIF_EOB_POS) - -#define UART_RIF_LINBK_POS 6U -#define UART_RIF_LINBK_MSK BIT(UART_RIF_LINBK_POS) - -#define UART_RIF_ADDRM_POS 5U -#define UART_RIF_ADDRM_MSK BIT(UART_RIF_ADDRM_POS) - -#define UART_RIF_RXTO_POS 4U -#define UART_RIF_RXTO_MSK BIT(UART_RIF_RXTO_POS) - -#define UART_RIF_DCTS_POS 3U -#define UART_RIF_DCTS_MSK BIT(UART_RIF_DCTS_POS) - -#define UART_RIF_ABTO_POS 2U -#define UART_RIF_ABTO_MSK BIT(UART_RIF_ABTO_POS) - -#define UART_RIF_ABEND_POS 1U -#define UART_RIF_ABEND_MSK BIT(UART_RIF_ABEND_POS) - -#define UART_RIF_RXBERR_POS 0U -#define UART_RIF_RXBERR_MSK BIT(UART_RIF_RXBERR_POS) - -/****************** Bit definition for UART_IFM register ************************/ - -#define UART_IFM_TFOVER_POS 18U -#define UART_IFM_TFOVER_MSK BIT(UART_IFM_TFOVER_POS) - -#define UART_IFM_TFEMPTY_POS 16U -#define UART_IFM_TFEMPTY_MSK BIT(UART_IFM_TFEMPTY_POS) - -#define UART_IFM_TFTH_POS 15U -#define UART_IFM_TFTH_MSK BIT(UART_IFM_TFTH_POS) - -#define UART_IFM_TBC_POS 14U -#define UART_IFM_TBC_MSK BIT(UART_IFM_TBC_POS) - -#define UART_IFM_RFUERR_POS 13U -#define UART_IFM_RFUERR_MSK BIT(UART_IFM_RFUERR_POS) - -#define UART_IFM_RFOERR_POS 12U -#define UART_IFM_RFOERR_MSK BIT(UART_IFM_RFOERR_POS) - -#define UART_IFM_RFFULL_POS 11U -#define UART_IFM_RFFULL_MSK BIT(UART_IFM_RFFULL_POS) - -#define UART_IFM_RFTH_POS 9U -#define UART_IFM_RFTH_MSK BIT(UART_IFM_RFTH_POS) - -#define UART_IFM_NOISE_POS 8U -#define UART_IFM_NOISE_MSK BIT(UART_IFM_NOISE_POS) - -#define UART_IFM_EOB_POS 7U -#define UART_IFM_EOB_MSK BIT(UART_IFM_EOB_POS) - -#define UART_IFM_LINBK_POS 6U -#define UART_IFM_LINBK_MSK BIT(UART_IFM_LINBK_POS) - -#define UART_IFM_ADDRM_POS 5U -#define UART_IFM_ADDRM_MSK BIT(UART_IFM_ADDRM_POS) - -#define UART_IFM_RXTO_POS 4U -#define UART_IFM_RXTO_MSK BIT(UART_IFM_RXTO_POS) - -#define UART_IFM_DCTS_POS 3U -#define UART_IFM_DCTS_MSK BIT(UART_IFM_DCTS_POS) - -#define UART_IFM_ABTO_POS 2U -#define UART_IFM_ABTO_MSK BIT(UART_IFM_ABTO_POS) - -#define UART_IFM_ABEND_POS 1U -#define UART_IFM_ABEND_MSK BIT(UART_IFM_ABEND_POS) - -#define UART_IFM_RXBERR_POS 0U -#define UART_IFM_RXBERR_MSK BIT(UART_IFM_RXBERR_POS) - -/****************** Bit definition for UART_ICR register ************************/ - -#define UART_ICR_TFOVER_POS 18U -#define UART_ICR_TFOVER_MSK BIT(UART_ICR_TFOVER_POS) - -#define UART_ICR_TFEMPTY_POS 16U -#define UART_ICR_TFEMPTY_MSK BIT(UART_ICR_TFEMPTY_POS) - -#define UART_ICR_TFTH_POS 15U -#define UART_ICR_TFTH_MSK BIT(UART_ICR_TFTH_POS) - -#define UART_ICR_TBC_POS 14U -#define UART_ICR_TBC_MSK BIT(UART_ICR_TBC_POS) - -#define UART_ICR_RFUERR_POS 13U -#define UART_ICR_RFUERR_MSK BIT(UART_ICR_RFUERR_POS) - -#define UART_ICR_RFOERR_POS 12U -#define UART_ICR_RFOERR_MSK BIT(UART_ICR_RFOERR_POS) - -#define UART_ICR_RFFULL_POS 11U -#define UART_ICR_RFFULL_MSK BIT(UART_ICR_RFFULL_POS) - -#define UART_ICR_RFTH_POS 9U -#define UART_ICR_RFTH_MSK BIT(UART_ICR_RFTH_POS) - -#define UART_ICR_NOISE_POS 8U -#define UART_ICR_NOISE_MSK BIT(UART_ICR_NOISE_POS) - -#define UART_ICR_EOB_POS 7U -#define UART_ICR_EOB_MSK BIT(UART_ICR_EOB_POS) - -#define UART_ICR_LINBK_POS 6U -#define UART_ICR_LINBK_MSK BIT(UART_ICR_LINBK_POS) - -#define UART_ICR_ADDRM_POS 5U -#define UART_ICR_ADDRM_MSK BIT(UART_ICR_ADDRM_POS) - -#define UART_ICR_RXTO_POS 4U -#define UART_ICR_RXTO_MSK BIT(UART_ICR_RXTO_POS) - -#define UART_ICR_DCTS_POS 3U -#define UART_ICR_DCTS_MSK BIT(UART_ICR_DCTS_POS) - -#define UART_ICR_ABTO_POS 2U -#define UART_ICR_ABTO_MSK BIT(UART_ICR_ABTO_POS) - -#define UART_ICR_ABEND_POS 1U -#define UART_ICR_ABEND_MSK BIT(UART_ICR_ABEND_POS) - -#define UART_ICR_RXBERR_POS 0U -#define UART_ICR_RXBERR_MSK BIT(UART_ICR_RXBERR_POS) - -typedef struct -{ - __I uint32_t RXBUF; - __IO uint32_t TXBUF; - __IO uint32_t BRR; - __IO uint32_t LCON; - __IO uint32_t MCON; - __IO uint32_t RS485; - __IO uint32_t SCARD; - __IO uint32_t LIN; - __IO uint32_t RTOR; - __O uint32_t FCON; - __I uint32_t STAT; - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; -} UART_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_usb.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_usb.h deleted file mode 100644 index 9685806551..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_usb.h +++ /dev/null @@ -1,873 +0,0 @@ -/** - ************************************************************************************** - * @file reg_usb.h - * @brief USB Head File - * @data 5/22/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __REG_USB_H__ -#define __REG_USB_H__ - - -/******************************************************************************/ -/* ṹ嶨 */ -/******************************************************************************/ - -/* ṹ */ -/* #pragma anon_unions */ - -/****************** Bit definition for USB_FADDR register ************************/ - -#define USB_FADDR_ADDR_POSS 0U -#define USB_FADDR_ADDR_POSE 6U -#define USB_FADDR_ADDR_MSK BITS(USB_FADDR_ADDR_POSS,USB_FADDR_ADDR_POSE) - -/****************** Bit definition for USB_POWER register ************************/ - -#define USB_POWER_ISOUDT_POSS 7U -#define USB_POWER_ISOUDT_MSK BIT(USB_POWER_ISOUDT_POSS) - -#define USB_POWER_RESET_POSS 3U -#define USB_POWER_RESET_MSK BIT(USB_POWER_RESET_POSS) - -#define USB_POWER_RESUME_POSS 2U -#define USB_POWER_RESUME_MSK BIT(USB_POWER_RESUME_POSS) - -#define USB_POWER_SUSPEND_POSS 1U -#define USB_POWER_SUSPEND_MSK BIT(USB_POWER_SUSPEND_POSS) - -#define USB_POWER_SUSPENDEN_POSS 0U -#define USB_POWER_SUSPENDEN_MSK BIT(USB_POWER_SUSPENDEN_POSS) - -/****************** Bit definition for USB_DPDMCTL register ************************/ - -#define USB_DPDMCTL_DPPUD_POSS 3U -#define USB_DPDMCTL_DPPUD_POSE 4U -#define USB_DPDMCTL_DPPUD_MSK BITS(USB_DPDMCTL_DPPUD_POSS,USB_DPDMCTL_DPPUD_POSE) - -#define USB_DPDMCTL_DMPUD_POSS 1U -#define USB_DPDMCTL_DMPUD_POSE 2U -#define USB_DPDMCTL_DMPUD_MSK BITS(USB_DPDMCTL_DMPUD_POSS,USB_DPDMCTL_DMPUD_POSE) - -#define USB_DPDMCTL_PHYPWREN_POS 0U -#define USB_DPDMCTL_PHYPWREN_MSK BIT(USB_DPDMCTL_PHYPWREN_POS) - -/****************** Bit definition for USB_SWCID register ************************/ - -#define USB_SWCID_HOST_POSS 1U -#define USB_SWCID_HOST_MSK BIT(USB_SWCID_HOST_POSS) - -#define USB_SWCID_CIDCTRL_POSS 0U -#define USB_SWCID_CIDCTRL_MSK BIT(USB_SWCID_CIDCTRL_POSS) - -/****************** Bit definition for USB_SWVBUS register ************************/ - -#define USB_SWVBUS_VALTH_POS 3U -#define USB_SWVBUS_VALTH_MSK BIT(USB_SWVBUS_VALTH_POS) - -#define USB_SWVBUS_SESVALTH_POS 2U -#define USB_SWVBUS_SESVALTH_MSK BIT(USB_SWVBUS_SESVALTH_POS) - -#define USB_SWVBUS_SESENDTH_POS 1U -#define USB_SWVBUS_SESENDTH_MSK BIT(USB_SWVBUS_SESENDTH_POS) - -#define USB_SWVBUS_SIGCTRL_POS 0U -#define USB_SWVBUS_SIGCTRL_MSK BIT(USB_SWVBUS_SIGCTRL_POS) - -/****************** Bit definition for USB_TMODE register ************************/ - -#define USB_TMODE_PROTECT_POSS 1U -#define USB_TMODE_PROTECT_POSE 7U -#define USB_TMODE_PROTECT_MSK BITS(USB_TMODE_PROTECT_POSS,USB_TMODE_PROTECT_POSE) - -#define USB_TMODE_ENABLE_POS 0U -#define USB_TMODE_ENABLE_MSK BIT(USB_TMODE_ENABLE_POS) - -/****************** Bit definition for USB_FRAME1 register ************************/ - -#define USB_FRAME1_LOWFRAME_POSS 0U -#define USB_FRAME1_LOWFRAME_POSE 7U -#define USB_FRAME1_LOWFRAME_MSK BITS(USB_FRAME1_LOWFRAME_POSS,USB_FRAME1_LOWFRAME_POSE) - -/****************** Bit definition for USB_FRAME2 register ************************/ - -#define USB_FRAME2_UPFRAME_POSS 0U -#define USB_FRAME2_UPFRAME_POSE 2U -#define USB_FRAME2_UPFRAME_MSK BITS(USB_FRAME2_UPFRAME_POSS,USB_FRAME2_UPFRAME_POSE) - -/****************** Bit definition for USB_INDEX register ************************/ - -#define USB_INDEX_EPTIDX_POSS 0U -#define USB_INDEX_EPTIDX_POSE 3U -#define USB_INDEX_EPTIDX_MSK BITS(USB_INDEX_EPTIDX_POSS,USB_INDEX_EPTIDX_POSE) - -/****************** Bit definition for USB_DEVCTRL register ************************/ - -#define USB_DEVCTRL_FSDEV_POS 6U -#define USB_DEVCTRL_FSDEV_MSK BIT(USB_DEVCTRL_FSDEV_POS) - -#define USB_DEVCTRL_LSDEV_POS 5U -#define USB_DEVCTRL_LSDEV_MSK BIT(USB_DEVCTRL_LSDEV_POS) - -#define USB_DEVCTRL_HOST_POS 2U -#define USB_DEVCTRL_HOST_MSK BIT(USB_DEVCTRL_HOST_POS) - -#define USB_DEVCTRL_HOSTREQ_POS 1U -#define USB_DEVCTRL_HOSTREQ_MSK BIT(USB_DEVCTRL_HOSTREQ_POS) - -#define USB_DEVCTRL_SESSION_POS 0U -#define USB_DEVCTRL_SESSION_MSK BIT(USB_DEVCTRL_SESSION_POS) - -/****************** Bit definition for USB_TXMAXP register ************************/ - -#define USB_TXMAXP_MAXSIZE_POSS 0U -#define USB_TXMAXP_MAXSIZE_POSE 7U -#define USB_TXMAXP_MAXSIZE_MSK BITS(USB_TXMAXP_MAXSIZE_POSS,USB_TXMAXP_MAXSIZE_POSE) - -/****************** Bit definition for USB_CSR0L_TXCSRL register ************************/ - -// -//Endpoint 0 -// -/* host mode */ -#define USB_CSR0L_TXCSRL_NAKTO_POS 7U -#define USB_CSR0L_TXCSRL_NAKTO_MSK BIT(USB_CSR0L_TXCSRL_NAKTO_POS) - -#define USB_CSR0L_TXCSRL_STATUSPKT_POS 6U -#define USB_CSR0L_TXCSRL_STATUSPKT_MSK BIT(USB_CSR0L_TXCSRL_STATUSPKT_POS) - -#define USB_CSR0L_TXCSRL_REQPKT_POS 5U -#define USB_CSR0L_TXCSRL_REQPKT_MSK BIT(USB_CSR0L_TXCSRL_REQPKT_POS) - -#define USB_CSR0L_TXCSRL_ERROR_POS 4U -#define USB_CSR0L_TXCSRL_ERROR_MSK BIT(USB_CSR0L_TXCSRL_ERROR_POS) - -#define USB_CSR0L_TXCSRL_SETUPPKT_POS 3U -#define USB_CSR0L_TXCSRL_SETUPPKT_MSK BIT(USB_CSR0L_TXCSRL_SETUPPKT_POS) - -/* device mode */ -#define USB_CSR0L_TXCSRL_SETENDC_POS 7U -#define USB_CSR0L_TXCSRL_SETENDC_MSK BIT(USB_CSR0L_TXCSRL_SETENDC_POS) - -#define USB_CSR0L_TXCSRL_RXRDYC_POS 6U -#define USB_CSR0L_TXCSRL_RXRDYC_MSK BIT(USB_CSR0L_TXCSRL_RXRDYC_POS) - -#define USB_CSR0L_TXCSRL_STALL_POS 5U -#define USB_CSR0L_TXCSRL_STALL_MSK BIT(USB_CSR0L_TXCSRL_STALL_POS) - -#define USB_CSR0L_TXCSRL_SETEND_POS 4U -#define USB_CSR0L_TXCSRL_SETEND_MSK BIT(USB_CSR0L_TXCSRL_SETEND_POS) - -#define USB_CSR0L_TXCSRL_DATAEND_POS 3U -#define USB_CSR0L_TXCSRL_DATAEND_MSK BIT(USB_CSR0L_TXCSRL_DATAEND_POS) - -#define USB_CSR0L_TXCSRL_STALLED_POS 2U -#define USB_CSR0L_TXCSRL_STALLED_MSK BIT(USB_CSR0L_TXCSRL_STALLED_POS) - -#define USB_CSR0L_TXCSRL_TXRDY_POS 1U -#define USB_CSR0L_TXCSRL_TXRDY_MSK BIT(USB_CSR0L_TXCSRL_TXRDY_POS) - -#define USB_CSR0L_TXCSRL_RXRDY_POS 0U -#define USB_CSR0L_TXCSRL_RXRDY_MSK BIT(USB_CSR0L_TXCSRL_RXRDY_POS) - -// -//Endpoint 1-6 -// -/* host mode */ -#define USB_CSR0L_TXCSRL_NACKOUT_POS 7U -#define USB_CSR0L_TXCSRL_NACKOUT_MSK BIT(USB_CSR0L_TXCSRL_NACKOUT_POS) - -#define USB_CSR0L_TXCSRL_CLRDATAT_POS 6U -#define USB_CSR0L_TXCSRL_CLRDATAT_MSK BIT(USB_CSR0L_TXCSRL_CLRDATAT_POS) - -#define USB_CSR0L_TXCSRL_RXSTALL_POS 5U -#define USB_CSR0L_TXCSRL_RXSTALL_MSK BIT(USB_CSR0L_TXCSRL_RXSTALL_POS) - -#define USB_CSR0L_TXCSRL_TXPKTRDY_POS 0U -#define USB_CSR0L_TXCSRL_TXPKTRDY_MSK BIT(USB_CSR0L_TXCSRL_TXPKTRDY_POS) - -/* device mode */ -#define USB_CSR0L_TXCSRL_INCOMPTX_POS 7U -#define USB_CSR0L_TXCSRL_INCOMPTX_MSK BIT(USB_CSR0L_TXCSRL_INCOMPTX_POS) - -#define USB_CSR0L_TXCSRL_CLRDATAT_POS 6U -#define USB_CSR0L_TXCSRL_CLRDATAT_MSK BIT(USB_CSR0L_TXCSRL_CLRDATAT_POS) - -#define USB_CSR0L_TXCSRL_SENTSTALL_POS 5U -#define USB_CSR0L_TXCSRL_SENTSTALL_MSK BIT(USB_CSR0L_TXCSRL_SENTSTALL_POS) - -#define USB_CSR0L_TXCSRL_SENDSTALL_POS 4U -#define USB_CSR0L_TXCSRL_SENDSTALL_MSK BIT(USB_CSR0L_TXCSRL_SENDSTALL_POS) - -#define USB_CSR0L_TXCSRL_FLUSHFIFO_POS 3U -#define USB_CSR0L_TXCSRL_FLUSHFIFO_MSK BIT(USB_CSR0L_TXCSRL_FLUSHFIFO_POS) - -#define USB_CSR0L_TXCSRL_UNDERRUN_POS 2U -#define USB_CSR0L_TXCSRL_UNDERRUN_MSK BIT(USB_CSR0L_TXCSRL_UNDERRUN_POS) - -#define USB_CSR0L_TXCSRL_FIFONE_POS 1U -#define USB_CSR0L_TXCSRL_FIFONE_MSK BIT(USB_CSR0L_TXCSRL_FIFONE_POS) - -#define USB_CSR0L_TXCSRL_TXPKTRDY_POS 0U -#define USB_CSR0L_TXCSRL_TXPKTRDY_MSK BIT(USB_CSR0L_TXCSRL_TXPKTRDY_POS) - -/****************** Bit definition for USB_CSR0H_TXCSRH register ************************/ -// -//For endpoint 0 -// -#define USB_CSR0H_TXCSRH_FLUSH_POS 0U -#define USB_CSR0H_TXCSRH_FLUSH_MSK BIT(USB_CSR0H_TXCSRH_FLUSH_POS) - -// -//For endpoint 1-6 -// -#define USB_CSR0H_TXCSRH_AUTOSET_POS 7U -#define USB_CSR0H_TXCSRH_AUTOSET_MSK BIT(USB_CSR0H_TXCSRH_AUTOSET_POS) - -#define USB_CSR0H_TXCSRH_ISO_POS 6U -#define USB_CSR0H_TXCSRH_ISO_MSK BIT(USB_CSR0H_TXCSRH_ISO_POS) - -#define USB_CSR0H_TXCSRH_MODE_POS 5U -#define USB_CSR0H_TXCSRH_MODE_MSK BIT(USB_CSR0H_TXCSRH_MODE_POS) - -#define USB_CSR0H_TXCSRH_FDT_POS 3U -#define USB_CSR0H_TXCSRH_FDT_MSK BIT(USB_CSR0H_TXCSRH_FDT_POS) - -/****************** Bit definition for USB_RXMAXP register ************************/ - -#define USB_RXMAXP_MAXSIZE_POSS 0U -#define USB_RXMAXP_MAXSIZE_POSE 7U -#define USB_RXMAXP_MAXSIZE_MSK BITS(USB_RXMAXP_MAXSIZE_POSS,USB_RXMAXP_MAXSIZE_POSE) - -/****************** Bit definition for USB_RXCSRL register ************************/ - -#define USB_RXCSRL_CLRDT_POS 7U -#define USB_RXCSRL_CLRDT_MSK BIT(USB_RXCSRL_CLRDT_POS) - -#define USB_RXCSRL_STALLED_POS 6U -#define USB_RXCSRL_STALLED_MSK BIT(USB_RXCSRL_STALLED_POS) - -#define USB_RXCSRL_REQPKT_POS 5U -#define USB_RXCSRL_REQPKT_MSK BIT(USB_RXCSRL_REQPKT_POS) - -#define USB_RXCSRL_STALL_POS 5U -#define USB_RXCSRL_STALL_MSK BIT(USB_RXCSRL_STALL_POS) - -#define USB_RXCSRL_FLUSH_POS 4U -#define USB_RXCSRL_FLUSH_MSK BIT(USB_RXCSRL_FLUSH_POS) - -#define USB_RXCSRL_DATAERR_NAKTO_POS 3U -#define USB_RXCSRL_DATAERR_NAKTO_MSK BIT(USB_RXCSRL_DATAERR_NAKTO_POS) - -#define USB_RXCSRL_ERROR_POS 2U -#define USB_RXCSRL_ERROR_MSK BIT(USB_RXCSRL_ERROR_POS) - -#define USB_RXCSRL_OVERRUN_POS 2U -#define USB_RXCSRL_OVERRUN_MSK BIT(USB_RXCSRL_OVERRUN_POS) - -#define USB_RXCSRL_FULL_POS 1U -#define USB_RXCSRL_FULL_MSK BIT(USB_RXCSRL_FULL_POS) - -#define USB_RXCSRL_RXRDY_POS 0U -#define USB_RXCSRL_RXRDY_MSK BIT(USB_RXCSRL_RXRDY_POS) - -/****************** Bit definition for USB_RXCSRH register ************************/ - -#define USB_RXCSRH_AUTOCLR_POS 7U -#define USB_RXCSRH_AUTOCLR_MSK BIT(USB_RXCSRH_AUTOCLR_POS) - -#define USB_RXCSRH_AUTOREQ_POS 6U -#define USB_RXCSRH_AUTOREQ_MSK BIT(USB_RXCSRH_AUTOREQ_POS) - -#define USB_RXCSRH_ISO_POS 6U -#define USB_RXCSRH_ISO_MSK BIT(USB_RXCSRH_ISO_POS) - -/****************** Bit definition for USB_RXCOUNT1 register ************************/ - -#define USB_RXCOUNT1_COUNT_POSS 0U -#define USB_RXCOUNT1_COUNT_POSE 6U -#define USB_RXCOUNT1_COUNT_MSK BITS(USB_RXCOUNT1_COUNT_POSS,USB_RXCOUNT1_COUNT_POSE) - -#define USB_RXCOUNT1_PKTLOW_POSS 0U -#define USB_RXCOUNT1_PKTLOW_POSE 7U -#define USB_RXCOUNT1_PKTLOW_MSK BITS(USB_RXCOUNT1_PKTLOW_POSS,USB_RXCOUNT1_PKTLOW_POSE) - -/****************** Bit definition for USB_RXCOUNT2 register ************************/ - -#define USB_RXCOUNT2_PKTHIGH_POSS 0U -#define USB_RXCOUNT2_PKTHIGH_POSE 2U -#define USB_RXCOUNT2_PKTHIGH_MSK BITS(USB_RXCOUNT2_PKTHIGH_POSS,USB_RXCOUNT2_PKTHIGH_POSE) - -/****************** Bit definition for USB_TXTYPE register ************************/ - -#define USB_TXTYPE_PROTOCOL_POSS 4U -#define USB_TXTYPE_PROTOCOL_POSE 5U -#define USB_TXTYPE_PROTOCOL_MSK BITS(USB_TXTYPE_PROTOCOL_POSS,USB_TXTYPE_PROTOCOL_POSE) - -#define USB_TXTYPE_TEPN_POSS 0U -#define USB_TXTYPE_TEPN_POSE 3U -#define USB_TXTYPE_TEPN_MSK BITS(USB_TXTYPE_TEPN_POSS,USB_TXTYPE_TEPN_POSE) - -/****************** Bit definition for USB_NAKLIMIT0_TXINTERVAL register ************************/ - -#define USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSS 0U -#define USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSE 7U -#define USB_NAKLIMIT0_TXINTERVAL_NAKLMT_MSK BITS(USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSS,USB_NAKLIMIT0_TXINTERVAL_NAKLMT_POSE) - -/****************** Bit definition for USB_RXTYPE register ************************/ - -#define USB_RXTYPE_PROTOCOL_POSS 4U -#define USB_RXTYPE_PROTOCOL_POSE 5U -#define USB_RXTYPE_PROTOCOL_MSK BITS(USB_RXTYPE_PROTOCOL_POSS,USB_RXTYPE_PROTOCOL_POSE) - -#define USB_RXTYPE_TEPN_POSS 0U -#define USB_RXTYPE_TEPN_POSE 3U -#define USB_RXTYPE_TEPN_MSK BITS(USB_RXTYPE_TEPN_POSS,USB_RXTYPE_TEPN_POSE) - -/****************** Bit definition for USB_RXINTERVAL register ************************/ - -#define USB_RXINTERVAL_NAKLMT_POSS 0U -#define USB_RXINTERVAL_NAKLMT_POSE 7U -#define USB_RXINTERVAL_NAKLMT_MSK BITS(USB_RXINTERVAL_NAKLMT_POSS,USB_RXINTERVAL_NAKLMT_POSE) - -/****************** Bit definition for USB_TXFIFO1 register ************************/ - -#define USB_TXFIFO1_ADDRL_POSS 0U -#define USB_TXFIFO1_ADDRL_POSE 7U -#define USB_TXFIFO1_ADDRL_MSK BITS(USB_TXFIFO1_ADDRL_POSS,USB_TXFIFO1_ADDRL_POSE) - -/****************** Bit definition for USB_TXFIFO2 register ************************/ - -#define USB_TXFIFO2_MAXPKTSIZE_POSS 5U -#define USB_TXFIFO2_MAXPKTSIZE_POSE 7U -#define USB_TXFIFO2_MAXPKTSIZE_MSK BITS(USB_TXFIFO2_MAXPKTSIZE_POSS,USB_TXFIFO2_MAXPKTSIZE_POSE) - -#define USB_TXFIFO2_DPB_POS 4U -#define USB_TXFIFO2_DPB_MSK BIT(USB_TXFIFO2_DPB_POS) - -#define USB_TXFIFO2_ADDRH_POSS 0U -#define USB_TXFIFO2_ADDRH_POSE 3U -#define USB_TXFIFO2_ADDRH_MSK BITS(USB_TXFIFO2_ADDRH_POSS,USB_TXFIFO2_ADDRH_POSE) - -/****************** Bit definition for USB_RXFIFO1 register ************************/ - -#define USB_RXFIFO1_ADDRL_POSS 0U -#define USB_RXFIFO1_ADDRL_POSE 7U -#define USB_RXFIFO1_ADDRL_MSK BITS(USB_RXFIFO1_ADDRL_POSS,USB_RXFIFO1_ADDRL_POSE) - -/****************** Bit definition for USB_RXFIFO2 register ************************/ - -#define USB_RXFIFO2_MAXPKTSIZE_POSS 5U -#define USB_RXFIFO2_MAXPKTSIZE_POSE 7U -#define USB_RXFIFO2_MAXPKTSIZE_MSK BITS(USB_RXFIFO2_MAXPKTSIZE_POSS,USB_RXFIFO2_MAXPKTSIZE_POSE) - -#define USB_RXFIFO2_DPB_POS 4U -#define USB_RXFIFO2_DPB_MSK BIT(USB_RXFIFO2_DPB_POS) - -#define USB_RXFIFO2_ADDRH_POSS 0U -#define USB_RXFIFO2_ADDRH_POSE 3U -#define USB_RXFIFO2_ADDRH_MSK BITS(USB_RXFIFO2_ADDRH_POSS,USB_RXFIFO2_ADDRH_POSE) - -/************* Bit definition for USB_EP0FIFO/USB_EPxFIFO register *****************/ - -#define USB_EPxFIFO_FIFO_POSS 0U -#define USB_EPxFIFO_FIFO_POSE 7U -#define USB_EPxFIFO_FIFO_MSK BITS(USB_EPxFIFO_FIFO_POSS,USB_EPxFIFO_FIFO_POSE) - -/****************** Bit definition for USB_TXIER register ************************/ - -#define USB_TXIER_EP6IE_POS 6U -#define USB_TXIER_EP6IE_MSK BIT(USB_TXIER_EP6IE_POS) - -#define USB_TXIER_EP5IE_POS 5U -#define USB_TXIER_EP5IE_MSK BIT(USB_TXIER_EP5IE_POS) - -#define USB_TXIER_EP4IE_POS 4U -#define USB_TXIER_EP4IE_MSK BIT(USB_TXIER_EP4IE_POS) - -#define USB_TXIER_EP3IE_POS 3U -#define USB_TXIER_EP3IE_MSK BIT(USB_TXIER_EP3IE_POS) - -#define USB_TXIER_EP2IE_POS 2U -#define USB_TXIER_EP2IE_MSK BIT(USB_TXIER_EP2IE_POS) - -#define USB_TXIER_EP1IE_POS 1U -#define USB_TXIER_EP1IE_MSK BIT(USB_TXIER_EP1IE_POS) - -#define USB_TXIER_EP0IE_POS 0U -#define USB_TXIER_EP0IE_MSK BIT(USB_TXIER_EP0IE_POS) - -/****************** Bit definition for USB_RXIER register ************************/ - -#define USB_RXIER_EP6IE_POS 6U -#define USB_RXIER_EP6IE_MSK BIT(USB_RXIER_EP6IE_POS) - -#define USB_RXIER_EP5IE_POS 5U -#define USB_RXIER_EP5IE_MSK BIT(USB_RXIER_EP5IE_POS) - -#define USB_RXIER_EP4IE_POS 4U -#define USB_RXIER_EP4IE_MSK BIT(USB_RXIER_EP4IE_POS) - -#define USB_RXIER_EP3IE_POS 3U -#define USB_RXIER_EP3IE_MSK BIT(USB_RXIER_EP3IE_POS) - -#define USB_RXIER_EP2IE_POS 2U -#define USB_RXIER_EP2IE_MSK BIT(USB_RXIER_EP2IE_POS) - -#define USB_RXIER_EP1IE_POS 1U -#define USB_RXIER_EP1IE_MSK BIT(USB_RXIER_EP1IE_POS) - -/****************** Bit definition for USB_TXIDR register ************************/ - -#define USB_TXIDR_EP6ID_POS 6U -#define USB_TXIDR_EP6ID_MSK BIT(USB_TXIDR_EP6ID_POS) - -#define USB_TXIDR_EP5ID_POS 5U -#define USB_TXIDR_EP5ID_MSK BIT(USB_TXIDR_EP5ID_POS) - -#define USB_TXIDR_EP4ID_POS 4U -#define USB_TXIDR_EP4ID_MSK BIT(USB_TXIDR_EP4ID_POS) - -#define USB_TXIDR_EP3ID_POS 3U -#define USB_TXIDR_EP3ID_MSK BIT(USB_TXIDR_EP3ID_POS) - -#define USB_TXIDR_EP2ID_POS 2U -#define USB_TXIDR_EP2ID_MSK BIT(USB_TXIDR_EP2ID_POS) - -#define USB_TXIDR_EP1ID_POS 1U -#define USB_TXIDR_EP1ID_MSK BIT(USB_TXIDR_EP1ID_POS) - -#define USB_TXIDR_EP0ID_POS 0U -#define USB_TXIDR_EP0ID_MSK BIT(USB_TXIDR_EP0ID_POS) - -/****************** Bit definition for USB_RXIDR register ************************/ - -#define USB_RXIDR_EP6ID_POS 6U -#define USB_RXIDR_EP6ID_MSK BIT(USB_RXIDR_EP6ID_POS) - -#define USB_RXIDR_EP5ID_POS 5U -#define USB_RXIDR_EP5ID_MSK BIT(USB_RXIDR_EP5ID_POS) - -#define USB_RXIDR_EP4ID_POS 4U -#define USB_RXIDR_EP4ID_MSK BIT(USB_RXIDR_EP4ID_POS) - -#define USB_RXIDR_EP3ID_POS 3U -#define USB_RXIDR_EP3ID_MSK BIT(USB_RXIDR_EP3ID_POS) - -#define USB_RXIDR_EP2ID_POS 2U -#define USB_RXIDR_EP2ID_MSK BIT(USB_RXIDR_EP2ID_POS) - -#define USB_RXIDR_EP1ID_POS 1U -#define USB_RXIDR_EP1ID_MSK BIT(USB_RXIDR_EP1ID_POS) - -/****************** Bit definition for USB_TXIVS register ************************/ - -#define USB_TXIVS_EP6IVS_POS 6U -#define USB_TXIVS_EP6IVS_MSK BIT(USB_TXIVS_EP6IVS_POS) - -#define USB_TXIVS_EP5IVS_POS 5U -#define USB_TXIVS_EP5IVS_MSK BIT(USB_TXIVS_EP5IVS_POS) - -#define USB_TXIVS_EP4IVS_POS 4U -#define USB_TXIVS_EP4IVS_MSK BIT(USB_TXIVS_EP4IVS_POS) - -#define USB_TXIVS_EP3IVS_POS 3U -#define USB_TXIVS_EP3IVS_MSK BIT(USB_TXIVS_EP3IVS_POS) - -#define USB_TXIVS_EP2IVS_POS 2U -#define USB_TXIVS_EP2IVS_MSK BIT(USB_TXIVS_EP2IVS_POS) - -#define USB_TXIVS_EP1IVS_POS 1U -#define USB_TXIVS_EP1IVS_MSK BIT(USB_TXIVS_EP1IVS_POS) - -#define USB_TXIVS_EP0IVS_POS 0U -#define USB_TXIVS_EP0IVS_MSK BIT(USB_TXIVS_EP0IVS_POS) - -/****************** Bit definition for USB_RXIVS register ************************/ - -#define USB_RXIVS_EP6IVS_POS 6U -#define USB_RXIVS_EP6IVS_MSK BIT(USB_RXIVS_EP6IVS_POS) - -#define USB_RXIVS_EP5IVS_POS 5U -#define USB_RXIVS_EP5IVS_MSK BIT(USB_RXIVS_EP5IVS_POS) - -#define USB_RXIVS_EP4IVS_POS 4U -#define USB_RXIVS_EP4IVS_MSK BIT(USB_RXIVS_EP4IVS_POS) - -#define USB_RXIVS_EP3IVS_POS 3U -#define USB_RXIVS_EP3IVS_MSK BIT(USB_RXIVS_EP3IVS_POS) - -#define USB_RXIVS_EP2IVS_POS 2U -#define USB_RXIVS_EP2IVS_MSK BIT(USB_RXIVS_EP2IVS_POS) - -#define USB_RXIVS_EP1IVS_POS 1U -#define USB_RXIVS_EP1IVS_MSK BIT(USB_RXIVS_EP1IVS_POS) - -/****************** Bit definition for USB_TXRIF register ************************/ - -#define USB_TXRIF_EP6RIF_POS 6U -#define USB_TXRIF_EP6RIF_MSK BIT(USB_TXRIF_EP6RIF_POS) - -#define USB_TXRIF_EP5RIF_POS 5U -#define USB_TXRIF_EP5RIF_MSK BIT(USB_TXRIF_EP5RIF_POS) - -#define USB_TXRIF_EP4RIF_POS 4U -#define USB_TXRIF_EP4RIF_MSK BIT(USB_TXRIF_EP4RIF_POS) - -#define USB_TXRIF_EP3RIF_POS 3U -#define USB_TXRIF_EP3RIF_MSK BIT(USB_TXRIF_EP3RIF_POS) - -#define USB_TXRIF_EP2RIF_POS 2U -#define USB_TXRIF_EP2RIF_MSK BIT(USB_TXRIF_EP2RIF_POS) - -#define USB_TXRIF_EP1RIF_POS 1U -#define USB_TXRIF_EP1RIF_MSK BIT(USB_TXRIF_EP1RIF_POS) - -#define USB_TXRIF_EP0RIF_POS 0U -#define USB_TXRIF_EP0RIF_MSK BIT(USB_TXRIF_EP0RIF_POS) - -/****************** Bit definition for USB_RXRIF register ************************/ - -#define USB_RXRIF_EP6RIF_POS 6U -#define USB_RXRIF_EP6RIF_MSK BIT(USB_RXRIF_EP6RIF_POS) - -#define USB_RXRIF_EP5RIF_POS 5U -#define USB_RXRIF_EP5RIF_MSK BIT(USB_RXRIF_EP5RIF_POS) - -#define USB_RXRIF_EP4RIF_POS 4U -#define USB_RXRIF_EP4RIF_MSK BIT(USB_RXRIF_EP4RIF_POS) - -#define USB_RXRIF_EP3RIF_POS 3U -#define USB_RXRIF_EP3RIF_MSK BIT(USB_RXRIF_EP3RIF_POS) - -#define USB_RXRIF_EP2RIF_POS 2U -#define USB_RXRIF_EP2RIF_MSK BIT(USB_RXRIF_EP2RIF_POS) - -#define USB_RXRIF_EP1RIF_POS 1U -#define USB_RXRIF_EP1RIF_MSK BIT(USB_RXRIF_EP1RIF_POS) - -/****************** Bit definition for USB_TXIFM register ************************/ - -#define USB_TXIFM_EP6IFM_POS 6U -#define USB_TXIFM_EP6IFM_MSK BIT(USB_TXIFM_EP6IFM_POS) - -#define USB_TXIFM_EP5IFM_POS 5U -#define USB_TXIFM_EP5IFM_MSK BIT(USB_TXIFM_EP5IFM_POS) - -#define USB_TXIFM_EP4IFM_POS 4U -#define USB_TXIFM_EP4IFM_MSK BIT(USB_TXIFM_EP4IFM_POS) - -#define USB_TXIFM_EP3IFM_POS 3U -#define USB_TXIFM_EP3IFM_MSK BIT(USB_TXIFM_EP3IFM_POS) - -#define USB_TXIFM_EP2IFM_POS 2U -#define USB_TXIFM_EP2IFM_MSK BIT(USB_TXIFM_EP2IFM_POS) - -#define USB_TXIFM_EP1IFM_POS 1U -#define USB_TXIFM_EP1IFM_MSK BIT(USB_TXIFM_EP1IFM_POS) - -#define USB_TXIFM_EP0IFM_POS 0U -#define USB_TXIFM_EP0IFM_MSK BIT(USB_TXIFM_EP0IFM_POS) - -/****************** Bit definition for USB_RXIFM register ************************/ - -#define USB_RXIFM_EP6IFM_POS 6U -#define USB_RXIFM_EP6IFM_MSK BIT(USB_RXIFM_EP6IFM_POS) - -#define USB_RXIFM_EP5IFM_POS 5U -#define USB_RXIFM_EP5IFM_MSK BIT(USB_RXIFM_EP5IFM_POS) - -#define USB_RXIFM_EP4IFM_POS 4U -#define USB_RXIFM_EP4IFM_MSK BIT(USB_RXIFM_EP4IFM_POS) - -#define USB_RXIFM_EP3IFM_POS 3U -#define USB_RXIFM_EP3IFM_MSK BIT(USB_RXIFM_EP3IFM_POS) - -#define USB_RXIFM_EP2IFM_POS 2U -#define USB_RXIFM_EP2IFM_MSK BIT(USB_RXIFM_EP2IFM_POS) - -#define USB_RXIFM_EP1IFM_POS 1U -#define USB_RXIFM_EP1IFM_MSK BIT(USB_RXIFM_EP1IFM_POS) - -/****************** Bit definition for USB_TXICR register ************************/ - -#define USB_TXICR_EP6ICR_POS 6U -#define USB_TXICR_EP6ICR_MSK BIT(USB_TXICR_EP6ICR_POS) - -#define USB_TXICR_EP5ICR_POS 5U -#define USB_TXICR_EP5ICR_MSK BIT(USB_TXICR_EP5ICR_POS) - -#define USB_TXICR_EP4ICR_POS 4U -#define USB_TXICR_EP4ICR_MSK BIT(USB_TXICR_EP4ICR_POS) - -#define USB_TXICR_EP3ICR_POS 3U -#define USB_TXICR_EP3ICR_MSK BIT(USB_TXICR_EP3ICR_POS) - -#define USB_TXICR_EP2ICR_POS 2U -#define USB_TXICR_EP2ICR_MSK BIT(USB_TXICR_EP2ICR_POS) - -#define USB_TXICR_EP1ICR_POS 1U -#define USB_TXICR_EP1ICR_MSK BIT(USB_TXICR_EP1ICR_POS) - -#define USB_TXICR_EP0ICR_POS 0U -#define USB_TXICR_EP0ICR_MSK BIT(USB_TXICR_EP0ICR_POS) - -/****************** Bit definition for USB_RXICR register ************************/ - -#define USB_RXICR_EP6ICR_POS 6U -#define USB_RXICR_EP6ICR_MSK BIT(USB_RXICR_EP6ICR_POS) - -#define USB_RXICR_EP5ICR_POS 5U -#define USB_RXICR_EP5ICR_MSK BIT(USB_RXICR_EP5ICR_POS) - -#define USB_RXICR_EP4ICR_POS 4U -#define USB_RXICR_EP4ICR_MSK BIT(USB_RXICR_EP4ICR_POS) - -#define USB_RXICR_EP3ICR_POS 3U -#define USB_RXICR_EP3ICR_MSK BIT(USB_RXICR_EP3ICR_POS) - -#define USB_RXICR_EP2ICR_POS 2U -#define USB_RXICR_EP2ICR_MSK BIT(USB_RXICR_EP2ICR_POS) - -#define USB_RXICR_EP1ICR_POS 1U -#define USB_RXICR_EP1ICR_MSK BIT(USB_RXICR_EP1ICR_POS) - -/****************** Bit definition for USB_IER register ************************/ - -#define USB_IER_SESREQIE_POS 6U -#define USB_IER_SESREQIE_MSK BIT(USB_IER_SESREQIE_POS) - -#define USB_IER_DISCONIE_POS 5U -#define USB_IER_DISCONIE_MSK BIT(USB_IER_DISCONIE_POS) - -#define USB_IER_CONIE_POS 4U -#define USB_IER_CONIE_MSK BIT(USB_IER_CONIE_POS) - -#define USB_IER_SOFIE_POS 3U -#define USB_IER_SOFIE_MSK BIT(USB_IER_SOFIE_POS) - -#define USB_IER_BABIE_POS 2U -#define USB_IER_BABIE_MSK BIT(USB_IER_BABIE_POS) - -#define USB_IER_RESTIE_POS 2U -#define USB_IER_RESTIE_MSK BIT(USB_IER_RESTIE_POS) - -#define USB_IER_RESIE_POS 1U -#define USB_IER_RESIE_MSK BIT(USB_IER_RESIE_POS) - -#define USB_IER_SUSPDIE_POS 0U -#define USB_IER_SUSPDIE_MSK BIT(USB_IER_SUSPDIE_POS) - -/****************** Bit definition for USB_IDR register ************************/ - -#define USB_IDR_SESREQID_POS 6U -#define USB_IDR_SESREQID_MSK BIT(USB_IDR_SESREQID_POS) - -#define USB_IDR_DISCONID_POS 5U -#define USB_IDR_DISCONID_MSK BIT(USB_IDR_DISCONID_POS) - -#define USB_IDR_CONID_POS 4U -#define USB_IDR_CONID_MSK BIT(USB_IDR_CONID_POS) - -#define USB_IDR_SOFID_POS 3U -#define USB_IDR_SOFID_MSK BIT(USB_IDR_SOFID_POS) - -#define USB_IDR_BABID_POS 2U -#define USB_IDR_BABID_MSK BIT(USB_IDR_BABID_POS) - -#define USB_IDR_RESTID_POS 2U -#define USB_IDR_RESTID_MSK BIT(USB_IDR_RESTID_POS) - -#define USB_IDR_RESID_POS 1U -#define USB_IDR_RESID_MSK BIT(USB_IDR_RESID_POS) - -#define USB_IDR_SUSPDID_POS 0U -#define USB_IDR_SUSPDID_MSK BIT(USB_IDR_SUSPDID_POS) - -/****************** Bit definition for USB_IVS register ************************/ - -#define USB_IVS_SESREQIVS_POS 6U -#define USB_IVS_SESREQIVS_MSK BIT(USB_IVS_SESREQIVS_POS) - -#define USB_IVS_DISCONIVS_POS 5U -#define USB_IVS_DISCONIVS_MSK BIT(USB_IVS_DISCONIVS_POS) - -#define USB_IVS_CONIVS_POS 4U -#define USB_IVS_CONIVS_MSK BIT(USB_IVS_CONIVS_POS) - -#define USB_IVS_SOFIVS_POS 3U -#define USB_IVS_SOFIVS_MSK BIT(USB_IVS_SOFIVS_POS) - -#define USB_IVS_BABIVS_POS 2U -#define USB_IVS_BABIVS_MSK BIT(USB_IVS_BABIVS_POS) - -#define USB_IVS_RESTIVS_POS 2U -#define USB_IVS_RESTIVS_MSK BIT(USB_IVS_RESTIVS_POS) - -#define USB_IVS_RESIVS_POS 1U -#define USB_IVS_RESIVS_MSK BIT(USB_IVS_RESIVS_POS) - -#define USB_IVS_SUSPDIVS_POS 0U -#define USB_IVS_SUSPDIVS_MSK BIT(USB_IVS_SUSPDIVS_POS) - -/****************** Bit definition for USB_RIF register ************************/ - -#define USB_RIF_SESREQRIF_POS 6U -#define USB_RIF_SESREQRIF_MSK BIT(USB_RIF_SESREQRIF_POS) - -#define USB_RIF_DISCONRIF_POS 5U -#define USB_RIF_DISCONRIF_MSK BIT(USB_RIF_DISCONRIF_POS) - -#define USB_RIF_CONRIF_POS 4U -#define USB_RIF_CONRIF_MSK BIT(USB_RIF_CONRIF_POS) - -#define USB_RIF_SOFRIF_POS 3U -#define USB_RIF_SOFRIF_MSK BIT(USB_RIF_SOFRIF_POS) - -#define USB_RIF_BABRIF_POS 2U -#define USB_RIF_BABRIF_MSK BIT(USB_RIF_BABRIF_POS) - -#define USB_RIF_RESTRIF_POS 2U -#define USB_RIF_RESTRIF_MSK BIT(USB_RIF_RESTRIF_POS) - -#define USB_RIF_RESRIF_POS 1U -#define USB_RIF_RESRIF_MSK BIT(USB_RIF_RESRIF_POS) - -#define USB_RIF_SUSPDRIF_POS 0U -#define USB_RIF_SUSPDRIF_MSK BIT(USB_RIF_SUSPDRIF_POS) - -/****************** Bit definition for USB_IFM register ************************/ - -#define USB_IFM_SESREQIFM_POS 6U -#define USB_IFM_SESREQIFM_MSK BIT(USB_IFM_SESREQIFM_POS) - -#define USB_IFM_DISCONIFM_POS 5U -#define USB_IFM_DISCONIFM_MSK BIT(USB_IFM_DISCONIFM_POS) - -#define USB_IFM_CONIFM_POS 4U -#define USB_IFM_CONIFM_MSK BIT(USB_IFM_CONIFM_POS) - -#define USB_IFM_SOFIFM_POS 3U -#define USB_IFM_SOFIFM_MSK BIT(USB_IFM_SOFIFM_POS) - -#define USB_IFM_BABIFM_POS 2U -#define USB_IFM_BABIFM_MSK BIT(USB_IFM_BABIFM_POS) - -#define USB_IFM_RESTIFM_POS 2U -#define USB_IFM_RESTIFM_MSK BIT(USB_IFM_RESTIFM_POS) - -#define USB_IFM_RESIFM_POS 1U -#define USB_IFM_RESIFM_MSK BIT(USB_IFM_RESIFM_POS) - -#define USB_IFM_SUSPDIFM_POS 0U -#define USB_IFM_SUSPDIFM_MSK BIT(USB_IFM_SUSPDIFM_POS) - -/****************** Bit definition for USB_ICR register ************************/ - -#define USB_ICR_SESREQICR_POS 6U -#define USB_ICR_SESREQICR_MSK BIT(USB_ICR_SESREQICR_POS) - -#define USB_ICR_DISCONICR_POS 5U -#define USB_ICR_DISCONICR_MSK BIT(USB_ICR_DISCONICR_POS) - -#define USB_ICR_CONICR_POS 4U -#define USB_ICR_CONICR_MSK BIT(USB_ICR_CONICR_POS) - -#define USB_ICR_SOFICR_POS 3U -#define USB_ICR_SOFICR_MSK BIT(USB_ICR_SOFICR_POS) - -#define USB_ICR_BABICR_POS 2U -#define USB_ICR_BABICR_MSK BIT(USB_ICR_BABICR_POS) - -#define USB_ICR_RESTICR_POS 2U -#define USB_ICR_RESTICR_MSK BIT(USB_ICR_RESTICR_POS) - -#define USB_ICR_RESICR_POS 1U -#define USB_ICR_RESICR_MSK BIT(USB_ICR_RESICR_POS) - -#define USB_ICR_SUSPDICR_POS 0U -#define USB_ICR_SUSPDICR_MSK BIT(USB_ICR_SUSPDICR_POS) - -typedef struct -{ - __IO uint8_t FADDR ; //0x0000 Function address register. - __IO uint8_t POWER ; //0x0001 Power management register. - __IO uint8_t DPDMCTRL ; //0x0002 DP DM Control register. - __IO uint8_t SWCID ; //0x0003 Softwave CID register. - __IO uint8_t SWVBUS ; //0x0004 Softwave VBUS register. - __IO uint8_t TMODE ; //0x0005 Test Mode register. - __IO uint8_t RES002[6] ; //0x0006~0x0B, Reserved - __IO uint8_t FRAME1 ; //0x000C, Frame number bits 0 to 7. - __IO uint8_t FRAME2 ; //0x000D, Frame number bits 8 to 10. - __IO uint8_t INDEX ; //0x000E, Index register for selecting the endp - __IO uint8_t DEVCTRL ; //0x000F, USB device control register. - __IO uint8_t TXMAXP ; //0x0010, Peripheral mode - Maximum packet size - __IO uint8_t CSR0L_TXCSRL ;//0x0011, Peripheral mode - Control Status regi - __IO uint8_t CSR0H_TXCSRH ;//0x0012, Peripheral mode - Control Status regi - __IO uint8_t RXMAXP ; //0x0013, Peripheral mode - Maximum packet size - __IO uint8_t RXCSR1 ; //0x0014, Peripheral mode - Control Status regi - __IO uint8_t RXCSR2 ; //0x0015, Peripheral mode - Control Status regi - __IO uint8_t RXCOUNT1 ; //0x0016, Peripheral mode - Number of bytes in - __IO uint8_t RXCOUNT2 ; //0x0017, Peripheral mode - Number of bytes in - __IO uint8_t TXTYPE ; //0x0018, Peripheral mode - // - __IO uint8_t NAKLIMIT0_TXINTERVAL ; //0x0019, Peripheral mode - // - __IO uint8_t RXTYPE ; //0x001A, Peripheral mode - // - __IO uint8_t RXINTERVAL ; //0x001B, Peripheral mode - // - __IO uint8_t TXFIFO1 ; //0x001C, Tx Endpoint FIFO details - __IO uint8_t TXFIFO2 ; //0x001D, Tx Endpoint FIFO details - __IO uint8_t RXFIFO1 ; //0x001E, Rx Endpoint FIFO details - __IO uint8_t RXFIFO2 ; //0x001F, Rx Endpoint FIFO details - __IO uint8_t EP0FIFO ; //0x0020, FIFOs for Endpoints 0. - __IO uint8_t RES021[3] ; //0x0021~0x23, Reserved - __IO uint8_t EP1FIFO ; //0x0024, FIFOs for Endpoints 1. - __IO uint8_t RES025[3] ; //0x0025~0x27, Reserved - __IO uint8_t EP2FIFO ; //0x0028, FIFOs for Endpoints 2. - __IO uint8_t RES029[3] ; //0x0029~0x2B, Reserved - __IO uint8_t EP3FIFO ; //0x002C, FIFOs for Endpoints 3. - __IO uint8_t RES02D[3] ; //0x002D~0x2F, Reserved - __IO uint8_t EP4FIFO ; //0x0030, FIFOs for Endpoints 4. - __IO uint8_t RES031[3] ; //0x0031~0x33, Reserved - __IO uint8_t EP5FIFO ; //0x0034, FIFOs for Endpoints 5. - __IO uint8_t RES035[3] ; //0x0035~0x37, Reserved - __IO uint8_t EP6FIFO ; //0x0038, FIFOs for Endpoints 6. - __IO uint8_t RES039[71] ; //0x0039~0x7C, Reserved - __IO uint8_t TXIER ; //0x0080, TX Endpoint 0~6 Interrupt Enable - __IO uint8_t RES081 ; //0x0081, Reserved - __IO uint8_t RXIER ; //0x0082, RX Endpoint 0~6 Interrupt Enable - __IO uint8_t RES083 ; //0x0083, Reserved - __IO uint8_t TXIDR ; //0x0084, TX Endpoint 0~6 Interrupt Disable - __IO uint8_t RES085 ; //0x0085, Reserved - __IO uint8_t RXIDR ; //0x0086, RX Endpoint 0~6 Interrupt Disable - __IO uint8_t RES087 ; //0x0087, Reserved - __IO uint8_t TXIVS ; //0x0088, TX Endpoint 0~6 Interrupt Valid Status - __IO uint8_t RES089 ; //0x0089, Reserved - __IO uint8_t RXIVS ; //0x008A, RX Endpoint 0~6 Interrupt Valid Status - __IO uint8_t RES08B ; //0x008B, Reserved - __IO uint8_t TXRIF ; //0x008C, TX Endpoint 0~6 Raw Interrupt Flag Status - __IO uint8_t RES08D ; //0x008D, Reserved - __IO uint8_t RXRIF ; //0x008E, RX Endpoint 0~6 Raw Interrupt Flag Status - __IO uint8_t RES08F ; //0x008F, Reserved - __IO uint8_t TXIFM ; //0x0090, TX Endpoint 0~6 Interrupt Flag Masked Status - __IO uint8_t RES091 ; //0x0091, Reserved - __IO uint8_t RXIFM ; //0x0092, RX Endpoint 0~6 Interrupt Flag Masked Status - __IO uint8_t RES093 ; //0x0093, Reserved - __IO uint8_t TXICR ; //0x0094, TX Endpoint 0~6 Interrupt Clear Register - __IO uint8_t RES095 ; //0x0095, Reserved - __IO uint8_t RXICR ; //0x0096, RX Endpoint 0~6 Interrupt Clear Register - __IO uint8_t RES097[9] ; //0x0097~0x9C, Reserved - __O uint32_t IER ; //0x00A0, USB Interrupt Enable Register - __O uint32_t IDR ; //0x00A4, USB Interrupt Disable Register - __I uint32_t IVS ; //0x00A8, USB Interrupt Valid Register - __I uint32_t RIF ; //0x00AC, USB Raw Interrupt Flag Status Register - __I uint32_t IFM ; //0x00B0, USB Interrupt Flag Masked Status - __O uint32_t ICR ; //0x00B4, USB Interrupt Clear Register -} USBCTRL_TypeDef; - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdg.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdg.h deleted file mode 100644 index 0c64ea3d43..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdg.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - ************************************************************************************** - * @file reg_WWDG.h - * @brief WWDG Head File - * - * @version V1.00.01 - * @data 19/10/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __WWDG_H__ -#define __WWDG_H__ - -typedef struct -{ - __IO uint32_t CR; /* 0x00 WWDG_CR Control register */ - __IO uint32_t CFR; /* 0x04 WWDG_CFR Configuration register */ - __O uint32_t IER; /* 0x08 WWDG_IER Interrupt enable register */ - __O uint32_t IDR; /* 0x0C WWDG_IDR Interrupt disable register */ - __I uint32_t IVS; /* 0x10 WWDG_IVS Interrupt valid status */ - __I uint32_t RIF; /* 0x14 WWDG_RIF Raw interrupt flag */ - __I uint32_t IFM; /* 0x18 WWDG_IFM Interrupt flag masked */ - __O uint32_t ICR; /* 0x1C WWDG_ICR Interrupt clear register */ -} WWDG_TypeDef; - -/******************************************************************************/ -/* Ȧs줸wq */ -/******************************************************************************/ - -/* #pragma anon_unions */ - -/****************** Bit definition for WWDG_CR register ************************/ - -#define WWDG_CR_WDGA_POS 7U -#define WWDG_CR_WDGA_MSK BIT(WWDG_CR_WDGA_POS) - -#define WWDG_CR_T_POSS 0U -#define WWDG_CR_T_POSE 6U -#define WWDG_CR_T_MSK BITS(WWDG_CR_T_POSS,WWDG_CR_T_POSE) - -/****************** Bit definition for WWDG_CFR register ************************/ - -#define WWDG_CFR_WDGTB_POS 7U -#define WWDG_CFR_WDGTB_MSK BIT(WWDG_CFR_WDGTB_POS) - -#define WWDG_CFR_W_POSS 0U -#define WWDG_CFR_W_POSE 6U -#define WWDG_CFR_W_MSK BITS(WWDG_CFR_W_POSS,WWDG_CFR_W_POSE) - -/****************** Bit definition for WWDG_IER register ************************/ - -#define WWDG_IER_EWIS_POS 7U -#define WWDG_IER_EWIS_MSK BIT(WWDG_IER_EWIS_POS) - -/****************** Bit definition for WWDG_IDR register ************************/ - -#define WWDG_IDR_EWIS_POS 7U -#define WWDG_IDR_EWIS_MSK BIT(WWDG_IER_EWIS_POS) - -/****************** Bit definition for WWDG_IVS register ************************/ - -#define WWDG_IVS_EWIS_POS 7U -#define WWDG_IVS_EWIS_MSK BIT(WWDG_IER_EWIS_POS) - -/****************** Bit definition for WWDG_RIF register ************************/ - -#define WWDG_RIF_EWIS_POS 7U -#define WWDG_RIF_EWIS_MSK BIT(WWDG_IER_EWIS_POS) - -/****************** Bit definition for WWDG_IFM register ************************/ - -#define WWDG_IFM_EWIS_POS 7U -#define WWDG_IFM_EWIS_MSK BIT(WWDG_IER_EWIS_POS) - -/****************** Bit definition for WWDG_ICR register ************************/ - -#define WWDG_ICR_EWIS_POS 7U -#define WWDG_ICR_EWIS_MSK BIT(WWDG_IER_EWIS_POS) - - -#else -/* */ -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdt.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdt.h deleted file mode 100644 index b1ee6dcf18..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271/reg_wwdt.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - ************************************************************************************** - * @file REG_WWDT.h - * @brief WWDT Head File - * - * @version V0.01 - * @date 4/12/2018 - * @author Eastsoft MCU Software Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __REG_WWDT_H__ -#define __REG_WWDT_H__ - - -/******************************************************************************/ -/* 设备特殊寄存器结构定义 */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联合 */ -/* #pragma anon_unions */ - -/****************** Bit definition for WWDT_CON register ************************/ - -#define WWDT_CON_WDGA_POS 7U -#define WWDT_CON_WDGA_MSK BIT(WWDT_CON_WDGA_POS) - -#define WWDT_CON_T_POSS 0U -#define WWDT_CON_T_POSE 6U -#define WWDT_CON_T_MSK BITS(WWDT_CON_T_POSS,WWDT_CON_T_POSE) - -/****************** Bit definition for WWDT_CFG register ************************/ - -#define WWDT_CFG_WDGTB_POSS 7U -#define WWDT_CFG_WDGTB_POSE 8U -#define WWDT_CFG_WDGTB_MSK BITS(WWDT_CFG_WDGTB_POSS,WWDT_CFG_WDGTB_POSE) - -#define WWDT_CFG_W_POSS 0U -#define WWDT_CFG_W_POSE 6U -#define WWDT_CFG_W_MSK BITS(WWDT_CFG_W_POSS,WWDT_CFG_W_POSE) - -/****************** Bit definition for WWDT_IER register ************************/ - -#define WWDT_IER_EWIS_POS 0U -#define WWDT_IER_EWIS_MSK BIT(WWDT_IER_EWIS_POS) - -/****************** Bit definition for WWDT_IDR register ************************/ - -#define WWDT_IDR_EWIS_POS 0U -#define WWDT_IDR_EWIS_MSK BIT(WWDT_IDR_EWIS_POS) - -/****************** Bit definition for WWDT_IVS register ************************/ - -#define WWDT_IVS_EWIS_POS 0U -#define WWDT_IVS_EWIS_MSK BIT(WWDT_IVS_EWIS_POS) - -/****************** Bit definition for WWDT_RIF register ************************/ - -#define WWDT_RIF_EWIF_POS 0U -#define WWDT_RIF_EWIF_MSK BIT(WWDT_RIF_EWIF_POS) - -/****************** Bit definition for WWDT_IFM register ************************/ - -#define WWDT_IFM_EWIM_POS 0U -#define WWDT_IFM_EWIM_MSK BIT(WWDT_IFM_EWIM_POS) - -/****************** Bit definition for WWDT_ICR register ************************/ - -#define WWDT_ICR_EWIC_POS 0U -#define WWDT_ICR_EWIC_MSK BIT(WWDT_ICR_EWIC_POS) - -typedef struct -{ - __IO uint32_t CON; - __IO uint32_t CFG; - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; -} WWDT_TypeDef; - - - - - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/es32f0271.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/es32f0271.h deleted file mode 100644 index 2810051370..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/es32f0271.h +++ /dev/null @@ -1,389 +0,0 @@ -/******************************************************************* -* *file : ES32F0271_sub.h -* *description: ES32F0271 Device Head File -* *author : Eastsoft AE Team -* *version : V1.00.01 -* *data : 4/10/2018 -* -* *Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. -*******************************************************************/ - -/** @addtogroup CMSIS - * @{ - */ - -/** @addtogroup ES32F0271_SUB1 - * @{ - */ - -#ifndef __ES32F0271_SUB_H__ -#define __ES32F0271_SUB_H__ - -#ifdef __cplusplus -extern "C"{ -#endif - -/** - * @brief defines 'read only' 、'write only'、 'read / write' permissions. - */ -#define __I volatile const /* defines 'read only' permissions */ -#define __O volatile /* defines 'write only' permissions */ -#define __IO volatile /* defines 'read / write' permissions */ - -/** @addtogroup Configuration_section_for_CMSIS - * @{ - */ -/** - * @brief configuration of the cortex-M3 processor and core peripherals. - */ - -#define __MPU_PRESENT 0 /*!< cm0ikmcu does not provide a MPU present or not */ -#define __NVIC_PRIO_BITS 2 /*!< cm0ikmcu Supports 2 Bits for the Priority Levels */ -#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ -/** - * @} - */ - -/** @addtogroup peripherals_interrupt_number_definition - * @{ - */ - -typedef enum IRQn -{ - - /****** ES32 Processor Exceptions Numbers ******************************************************/ - - /*************** Cortex-M0 Processor Exceptions Numbers **************************/ - NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ - HardFault_IRQn = -13, /*!< 3 Cortex-M0 Hard Fault Interrupt */ - SVCall_IRQn = -5, /*!< 11 Cortex-M0 SV Call Interrupt */ - PendSV_IRQn = -2, /*!< 14 Cortex-M0 Pend SV Interrupt */ - SysTick_IRQn = -1, /*!< 15 Cortex-M0 System Tick Interrupt */ - - /**************** ES32F0271_SUB specific Exceptions Numbers **************************/ - WWDT_IRQn = 0, /* 0 | WWDT Interrupt */ - PVD_IRQn = 1, /* 1 | PVD Interrupt EXTI[20] */ - RTC_IRQn = 2, /* 2 | RTC Interrupt */ - WAKEUP_IRQn = 3, /* 3 | WAKEUP Interrupt EXTI[21] */ - CM0IKMCU_IRQ04_IRQn = 4, /* 4 | Interrupt */ - EXTI_0to1_IRQn = 5, /* 5 | EXTI[1:0] Interrupt GPIOx[1:0] */ - EXTI_2to3_IRQn = 6, /* 6 | EXTI[3:2] Interrupt GPIOx[3:2] */ - EXTI_4to15_IRQn = 7, /* 7 | EXTI[15:4] Interrupt GPIOx[15:4] */ - CM0IKMCU_IRQ08_IRQn = 8, /* 8 | Interrupt */ - DMA1_CH0_IRQn = 9, /* 9 | DMA1_CH0 Interrupt */ - DMA1_CH12_IRQn = 10, /* 10 | DMA1_CH12 Interrupt */ - DMA1_CH345_IRQn = 11, /* 11 | DMA1_CH345 Interrupt */ - ADC_CMP_IRQn = 12, /* 12 | ADC/COMP0-3 Interrupt EXTI[19:16]) */ - AD16C4T1_IRQn = 13, /* 13 | AD16C4T1 Interrupt */ - BS16T1_IRQn = 14, /* 14 | BS16T1 Interrupt */ - GP32C4T1_IRQn = 15, /* 15 | GP32C4T1 Interrupt */ - GP16C4T1_IRQn = 16, /* 16 | GP16C4T1 Interrupt */ - GP16C4T2_IRQn = 17, /* 17 | GP16C4T2 Interrupt */ - GP16C4T3_IRQn = 18, /* 18 | GP16C4T3 Interrupt */ - GP16C2T1_IRQn = 19, /* 19 | GP16C2T1 Interrupt */ - GP16C2T2_IRQn = 20, /* 20 | GP16C2T2 Interrupt */ - GP16C2T3_IRQn = 21, /* 21 | GP16C2T3 Interrupt */ - GP16C2T4_IRQn = 22, /* 22 | GP16C2T4 Interrupt */ - I2C1_IRQn = 23, /* 23 | I2C1 Interrupt */ - I2C2_IRQn = 24, /* 24 | I2C2 Interrupt */ - SPI1_IRQn = 25, /* 25 | SPI1 Interrupt */ - SPI2_IRQn = 26, /* 26 | SPI2 Interrupt */ - UART1_IRQn = 27, /* 27 | UART1 Interrupt */ - UART2_IRQn = 28, /* 28 | UART2 Interrupt */ - UART3_IRQn = 29, /* 29 | UART3 Interrupt */ - SUART12_IRQn = 30, /* 30 | SUART1/2 Interrupt */ - USB_IRQn = 31 /* 31 | USB Interrupt */ -} IRQn_Type; - -/** - * @} - */ - -/* Includes-------------------------------------------------------------------------------*/ - -#include "core_cm0.h" -#include -#include -#include "system_es32f027x.h" -/** - * @brief these files declare Peripheral register bit_definition. - */ -#include "reg_rcu.h" -#include "reg_syscfg.h" -#include "reg_fc.h" -#include "reg_dma.h" -#include "reg_gpio.h" -#include "reg_i2c.h" -#include "reg_uart.h" -#include "reg_adc.h" -#include "reg_cmp.h" -#include "reg_dac.h" -#include "reg_spi.h" -#include "reg_crc.h" -#include "reg_ad16c4t.h" -#include "reg_hdiv.h" -#include "reg_aes.h" -#include "reg_wwdt.h" -#include "reg_rtc.h" -#include "reg_mswd.h" -#include "reg_mcm.h" -#include "reg_exti.h" -#include "reg_usb.h" - -/******************************************************************************/ -/* Peripheral register */ -/******************************************************************************/ - -/* allow anonymous structures and anonymous enumeration */ -/* #pragma anon_unions */ - -/******************************************************************************/ -/* Peripheral memory map */ -/******************************************************************************/ - -/********************* Base addresses *************************/ -#define FLASH_BASE (0x08000000UL) -#define FLASH_INFO_BASE (0x1FFFE000UL) /* EFLASH Info ( 6K Bytes) - Boot Loader Memory */ -#define SRAM_BASE (0x20000000UL) -#define APB1_BASE (0x40000000UL) -#define APB2_BASE (0x40010000UL) -#define AHB1_BASE (0x40020000UL) -#define AHB2_BASE (0x48000000UL) -#define CM0IN_BASE (0xE0000000UL) - -/* Cortex簧-M0 internal Peripherals - CM0IN_BASE: 0xE0000000*/ -#define TICK_BASE (CM0IN_BASE + 0xE010) - -#define SRAM1_BASE (SRAM_BASE + 0x0000) // SRAM1 Memory ( 4K Bytes) -#define SRAM2_BASE (SRAM_BASE + 0x1000) // SRAM2 Memory ( 4K Bytes) for Rev.B -#define STACK_SIZE 0x00000400>>2 // Stack size (in Words) -#define SRAMTOP 0x1000//0x2000 // Jackey 2018.9.5 - -/***************** peripherals base addresses ********************/ -/* APB1 */ -#define GP32C4T1_BASE (APB1_BASE + 0x0000) -#define GP16C4T1_BASE (APB1_BASE + 0x0400) -#define GP16C4T2_BASE (APB1_BASE + 0x0800) -#define GP16C4T3_BASE (APB1_BASE + 0x0C00) -#define BS16T1_BASE (APB1_BASE + 0x1000) -#define WWDT_BASE (APB1_BASE + 0x2C00) -#define IWDT_BASE (APB1_BASE + 0x3000) -#define SPI2_BASE (APB1_BASE + 0x3800) -#define UART2_BASE (APB1_BASE + 0x4400) -#define UART3_BASE (APB1_BASE + 0x4800) -#define SUART1_BASE (APB1_BASE + 0x4C00) -#define SUART2_BASE (APB1_BASE + 0x5000) -#define I2C1_BASE (APB1_BASE + 0x5400) -#define I2C2_BASE (APB1_BASE + 0x5800) -#define DAC_BASE (APB1_BASE + 0x5C00) -#define PWR_BASE (APB1_BASE + 0x7000) -/* APB2 */ -#define EXTI_BASE (APB2_BASE + 0x0400) -#define ADC_BASE (APB2_BASE + 0x2400) -#define AD16C4T1_BASE (APB2_BASE + 0x2C00) -#define SPI1_BASE (APB2_BASE + 0x3000) -#define UART1_BASE (APB2_BASE + 0x3800) -#define GP16C2T1_BASE (APB2_BASE + 0x4000) -#define GP16C2T2_BASE (APB2_BASE + 0x4400) -#define GP16C2T3_BASE (APB2_BASE + 0x4800) -#define GP16C2T4_BASE (APB2_BASE + 0x4C00) -#define MCM_BASE (APB2_BASE + 0x5400) -#define DBGMCU_BASE (APB2_BASE + 0x5800) -#define COMP_BASE (APB2_BASE + 0x5C00) -/* AHB1 */ -#define DMA1_BASE (AHB1_BASE + 0x0000) -#define RCU_BASE (AHB1_BASE + 0x1000) -#define SYSCFG_BASE (AHB1_BASE + 0x1400) -#define RTC_BASE (AHB1_BASE + 0x1800) -#define EFLASH_BASE (AHB1_BASE + 0x2000) -#define MSWD_BASE (AHB1_BASE + 0x2C00) -#define CRC_BASE (AHB1_BASE + 0x3000) -#define AES_BASE (AHB1_BASE + 0x3400) -#define USB_BASE (AHB1_BASE + 0x3800) -#define HDIV_BASE (AHB1_BASE + 0x3C00) -/* AHB2 */ -#define GPIOA_BASE (AHB2_BASE + 0x0000) -#define GPIOB_BASE (AHB2_BASE + 0x0400) -#define GPIOC_BASE (AHB2_BASE + 0x0800) -#define GPIOD_BASE (AHB2_BASE + 0x0C00) -#define GPIOE_BASE (AHB2_BASE + 0x1000) -#define GPIOF_BASE (AHB2_BASE + 0x1400) - -/********************* Peripheral declaration *************************/ -#define TICK (( TICK_TypeDef *) TICK_BASE) -#define GPIOA (( GPIO_TypeDef *) GPIOA_BASE) -#define GPIOB (( GPIO_TypeDef *) GPIOB_BASE) -#define GPIOC (( GPIO_TypeDef *) GPIOC_BASE) -#define GPIOD (( GPIO_TypeDef *) GPIOD_BASE) -#define DMA1 (( DMA_TypeDef *) DMA1_BASE) -#define RCU (( RCU_TypeDef *) RCU_BASE) -#define SYSCFG (( SYSCFG_TypeDef *) SYSCFG_BASE) -#define FC (( FC_TypeDef *) EFLASH_BASE) -#define CRC (( CRC_TypeDef *) CRC_BASE) -#define AES (( AES_TypeDef *) AES_BASE) -#define HDIV (( HDIV_TypeDef *) HDIV_BASE) -#define MSWD (( MSWD_TypeDef *) MSWD_BASE) -#define USB (( USBCTRL_TypeDef *) USB_BASE) -#define USBH (( USBCTRL_TypeDef *) USB_BASE) -#define USBD (( USBCTRL_TypeDef *) USB_BASE) -#define IWDT (( IWDT_TypeDef *) IWDT_BASE) -#define WWDT (( WWDT_TypeDef *) WWDT_BASE) -#define ADC (( ADC_TypeDef *) ADC_BASE) -#define AD16C4T1 (( AD16C4T_TypeDef *) AD16C4T1_BASE) -#define GP32C4T1 (( AD16C4T_TypeDef *) GP32C4T1_BASE) -#define GP16C4T1 (( AD16C4T_TypeDef *) GP16C4T1_BASE) -#define GP16C4T2 (( AD16C4T_TypeDef *) GP16C4T2_BASE) -#define GP16C4T3 (( AD16C4T_TypeDef *) GP16C4T3_BASE) -#define GP16C2T1 (( AD16C4T_TypeDef *) GP16C2T1_BASE) -#define GP16C2T2 (( AD16C4T_TypeDef *) GP16C2T2_BASE) -#define GP16C2T3 (( AD16C4T_TypeDef *) GP16C2T3_BASE) -#define GP16C2T4 (( AD16C4T_TypeDef *) GP16C2T4_BASE) -#define BS16T1 (( AD16C4T_TypeDef *) BS16T1_BASE) -#define SPI1 (( SPI_TypeDef *) SPI1_BASE) -#define SPI2 (( SPI_TypeDef *) SPI2_BASE) -#define I2C1 (( I2C_TypeDef *) I2C1_BASE) -#define I2C2 (( I2C_TypeDef *) I2C2_BASE) -#define DAC (( DAC_TypeDef *) DAC_BASE) -#define CMP (( CMP_TypeDef *) COMP_BASE) -#define UART1 (( UART_TypeDef *) UART1_BASE) -#define UART2 (( UART_TypeDef *) UART2_BASE) -#define UART3 (( UART_TypeDef *) UART3_BASE) -#define SUART1 (( UART_TypeDef *) SUART1_BASE) -#define SUART2 (( UART_TypeDef *) SUART2_BASE) -#define EXTI (( EXTI_TypeDef *) EXTI_BASE) -#define RTC (( RTC_TypeDef *) RTC_BASE) -#define MCM (( MCM_TypeDef *) MCM_BASE) -/* Special stuff */ -#define MSG_INCR ( __IO uint8_t *) (DBGMCU_BASE + 0x50) -#define MSG_WR ( __IO uint32_t *) (DBGMCU_BASE + 0x54) -#define MSG_END ( __IO uint32_t *) (DBGMCU_BASE + 0x58) -#define MSG_INCR_S ( __IO uint32_t *) (DBGMCU_BASE + 0x5C) -#define MSG_INCR_X ( __IO uint32_t *) (DBGMCU_BASE + 0x60) -#define MSG_INCR_B ( __IO uint32_t *) (DBGMCU_BASE + 0x64) -#define MSG_PTR ( __IO uint8_t **) (DBGMCU_BASE + 0x68) -#define MSG_INCR_D ( __IO uint32_t *) (DBGMCU_BASE + 0x78) -#define INCR_ERR_CNT ( __IO uint32_t *) (DBGMCU_BASE + 0x6C) - -#define END_SIM *MSG_END -#define SIM_FAIL 0xFFFFAAAA -#define SIM_PASS 0xFFFF5555 -/******************************************************************************/ -/* macros */ -/******************************************************************************/ - -/** @addtogroup Public_macros - * @{ - */ -#if defined (__CC_ARM) -#define __INLINE__ __inline -#else -#define __INLINE__ inline -#endif - -#define __isr__ - -#define UNUSED(x) ((void)(x)) - -#ifdef USE_ASSERT -#define assert_param(x) \ -do \ -{ \ - if (!(x)) \ - { \ - __disable_irq(); \ - while (1) \ - ; \ - } \ -} while (0) -#else -#define assert_param(x) -#endif - -#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x))) - -#define BITS(start, end) ((0xFFFFFFFFUL << (start)) &\ - (0xFFFFFFFFUL >> (31U - (uint32_t)(end)))) - -#define SET_BIT(REG, SETMASK) ((REG) |= (SETMASK)) - -#define CLEAR_BIT(REG, SETMASK) ((REG) &= ~(SETMASK)) - -#define READ_BIT(REG, SETMASK) ((REG) & (SETMASK)) - -#define CLEAR_REG(REG) ((REG) = (0x0)) - -#define WRITE_REG(REG, VAL) ((REG) = (VAL)) - -#define READ_REG(REG) ((REG)) - -#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) - -#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) - -/** - * @} - */ - -/******************************************************************************/ -/* types */ -/******************************************************************************/ -/** @addtogroup Public_types - * @{ - */ -typedef enum -{ - DISABLE = 0, - ENABLE = !DISABLE -} TypeFunc,FuncState; -#define IS_FUNC_STATE(x) (((x) == DISABLE) || ((x) == ENABLE)) - -typedef enum -{ - RESET = 0, - SET = !RESET -} FlagStatus, ITStatus, PinStatus; - -typedef enum -{ - ERROR = 0, - SUCCESS = !ERROR -} ErrorStatus; - -typedef enum -{ - BIT_RESET = 0x0, - BIT_SET = 0x1, -} BitStatus; - -typedef enum -{ - FALSE = 0x0, - TRUE = 0x1, -} TypeBool; - -typedef enum -{ - UNLOCK = 0x0, - LOCK = 0x1, -} LockState; -#define IS_LOCK_STATE(x) (((x) == UNLOCK) || ((x) == LOCK)) - -/** - * @} Public_types - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/** - * @} ES32F0271_SUB - */ - -/** - * @} CMSIS - */ - -/************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/rt_misc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/rt_misc.h deleted file mode 100644 index 71a3270c6e..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Include/rt_misc.h +++ /dev/null @@ -1,183 +0,0 @@ -/* rt_misc.h: definitions for miscellaneous retargetable functions - * - * Copyright 1999,2013-2014 ARM Limited. All rights reserved. - * - * RCS $Revision$ - * Checkin $Date$ - * Revising $Author$ - */ - -#ifndef __RT_MISC_H -#define __RT_MISC_H -#define __ARMCLIB_VERSION 5060019 - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/* - * This will be called during startup if it's defined, in order to - * allow a user reimplementation of getenv() to initialise itself. - */ -extern void _getenv_init(void); - -/* - * This will be called during startup if it's defined, in order to - * allow a user reimplementation of clock() to initialise itself. - */ -extern void _clock_init(void); - -/* - * This must return a pointer to __USER_LIBSPACE_SIZE bytes of - * zero-initialised space, used to store vital static data such as - * errno, the heap state, and the FP status word. - */ -#define __USER_LIBSPACE_SIZE 96 -extern void *__user_libspace(void); - -/* - * This is the library init function itself, provided just in case - * a user needs to call it directly. It is called just after - * __rt_stackheap_init(), and passed an initial chunk of memory to - * use as a heap. It returns argc and argv ready to be passed to - * main(). (The __argc_argv structure contains four words rather - * than just two, in case you need to pass anything else to main() - * such as the Unix envp. For AArch64 struct __argc_argv is 8 words - * (4 registers) and explicit padding is used to ensure argc is in w0.) - */ -struct __argc_argv { -#if (defined(__ARM_64BIT_STATE) || defined(__TARGET_ARCH_AARCH64)) && \ - (defined(__ARM_BIG_ENDIAN) || defined(__BIG_ENDIAN)) - int padding; -#endif - int argc; -#if (defined(__ARM_64BIT_STATE) || defined(__TARGET_ARCH_AARCH64)) && \ - !(defined(__ARM_BIG_ENDIAN) || defined(__BIG_ENDIAN)) - int padding; -#endif - char **argv; - void *r2; - void *r3; -}; -extern __value_in_regs struct __argc_argv -__rt_lib_init(unsigned /*heapbase*/, unsigned /*heaptop*/); - -/* - * This function is responsible for constructing argc and argv to - * be passed to main(). Normally it works by calling - * _sys_command_string() and then splitting up the returned command - * line. If you define main() without arguments, the compiler also - * defines an empty version of this function to save time. In - * special circumstances, you might need to redefine this function - * explicitly yourself. - */ -__value_in_regs struct __argc_argv __ARM_get_argv(void */*internal use only*/); - -/* - * This is the library shutdown function, analogous to - * __rt_lib_init(). - */ -extern void __rt_lib_shutdown(void); - -/* - * The medium-level exit function. exit() calls atexit()-registered - * functions and shuts down the library; _sys_exit() does neither - * of those things; __rt_exit() shuts down the library but doesn't - * call atexit() functions. - */ -extern void __rt_exit(int /*returncode*/); /* never returns */ - -/* - * This can be defined to override the standard memory models' way - * of determining where to put the initial stack and heap. - * - * The input parameters R0 and R2 contain nothing useful. The input - * parameters SP and SL are the values that were in SP and SL when - * the program began execution (so you can return them if you want - * to keep that stack). - * - * The two `limit' fields in the return structure are ignored if - * you are using the one-region memory model: the memory region is - * taken to be all the space between heap_base and stack_base. - */ -struct __initial_stackheap { - unsigned heap_base; /* low-address end of initial heap */ - unsigned stack_base; /* high-address end of initial stack */ - unsigned heap_limit; /* high-address end of initial heap */ - unsigned stack_limit; /* low-address end of initial stack */ -}; -extern __value_in_regs struct __initial_stackheap -__user_initial_stackheap(unsigned /*R0*/, unsigned /*SP*/, - unsigned /*R2*/, unsigned /*SL*/); - -/* - * This can be defined to give bounds on the address space the heap - * will ever use. - */ -struct __heap_extent { - uintptr_t base; - size_t range; -}; -extern __value_in_regs struct __heap_extent -__user_heap_extent(uintptr_t /*ignore*/, size_t /*ignore*/); - -/* - * This can be defined to specify how much spare stack is needed - * below SL in addition to the 256 bytes required by ATPCS: - * `always' gives the number of bytes of extra stack required at - * all instants (so that an interrupt handler has space to run in, - * for example), while `cleanup' gives the number of bytes of extra - * stack required to be available after a stack overflow has - * occurred, so that the stack overflow routine (e.g. SIGSTAK - * handler) has room to tidy up. - */ -struct __stack_slop { - unsigned always, cleanup; -}; -extern __value_in_regs struct __stack_slop -__user_stack_slop(unsigned /*ignore*/, unsigned /*ignore*/); - -/* - * This can be defined to return extra blocks of memory, separate - * from the initial one, to be used by the heap. It should place a - * pointer to a block of at least the requested size in `*base', - * and return the size of the block. It should return 0 if no such - * block can be returned, in which case the value stored at `*base' - * is never used. - */ -extern size_t __user_heap_extend(int /*ignore*/, - void ** /*base*/, - size_t /*requestedsize*/); - -/* - * Redefine this to completely override the C handling of signals - * (bypassing the signal() mechanism). Return values are 0 to - * continue execution, or a non-zero value to cause an exit with - * that return code. - */ -int __raise(int /*sig*/, intptr_t /*type*/); - -/* - * Redefine this to change the default handling of signals. The - * interface is the same as __raise(), but this function will only - * get called after the C signal handling mechanism has declined to - * process the signal. - */ -int __default_signal_handler(int /*sig*/, intptr_t /*type*/); - -/* - * Redefine this to replace the library's entire signal handling - * mechanism in the most efficient possible way. The default - * implementation of this is what calls __raise (above). - */ -void __rt_raise(int /*sig*/, intptr_t /*type*/); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/ReleaseNote.html b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/ReleaseNote.html deleted file mode 100644 index dce80ba62c..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/ReleaseNote.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - -ReleaseNote -

ES32F0271 Device Release Note

-

V1.00 2019-1-4

-

初版发布

-

V1.03 2019-09-23

-
    -
  1. Drivers\CMSIS\Device\EastSoft\ES32F0271\Startup\iar\ : 增加startup_es32f027x.s
  2. - -
-

 

- - \ No newline at end of file diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/iar/startup_es32f027x.s b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/iar/startup_es32f027x.s deleted file mode 100644 index bda1ad6ecd..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/iar/startup_es32f027x.s +++ /dev/null @@ -1,256 +0,0 @@ -;******************************************************************************* -; file : startup_ES32f027x.s -; description: ES32F027x Device Startup File -; author : Eastsoft MCU Software Team -; data : 10 Dec 2018 -; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. -;******************************************************************************* - - MODULE ?cstartup - - ;; Forward declaration of sections. - SECTION CSTACK:DATA:NOROOT(3) - SECTION .intvec:CODE:NOROOT(2) - - EXTERN __iar_program_start - PUBLIC __vector_table - - DATA -__vector_table - DCD sfe(CSTACK) ;0, load top of stack - DCD Reset_Handler ;1, reset handler - DCD NMI_Handler ;2, nmi handler - DCD HardFault_Handler ;3, hard fault handler - DCD 0 ;4, MPU Fault Handler - DCD 0 ;5, Bus Fault Handler - DCD 0 ;6, Usage Fault Handler - DCD 0 ;7, Reserved - DCD 0 ;8, Reserved - DCD 0 ;9, Reserved - DCD 0 ;10, Reserved - DCD SVC_Handler ;11, svcall handler - DCD 0 ;12, Reserved - DCD 0 ;13, Reserved - DCD PENDSV_Handler ;14, PENDSV Handler - DCD SYSTICK_Handler ;15, SYSTICK Handler - DCD WWDT_IRQHandler ;16, WWDT IRQHandler - DCD PVD_IRQHandler ;17, PVD IRQHandler - DCD RTC_IRQHandler ;18, RTC IRQHandler - DCD LowPowerWakeup_IRQHandler ;19, LowPowerWakeup IRQHandler - DCD 0 ;20, Reserved - DCD EXTI0_1_IRQHandler ;21, EXTI01_1 IRQHandler - DCD EXTI2_3_IRQHandler ;22, EXTI2_3 IRQHandler - DCD EXTI4_15_IRQHandler ;23, EXTI4_15 IRQHandler - DCD 0 ;24, Reserved - DCD DMA1_CH0_IRQHandler ;25, DMA1_CH1 IRQHandler - DCD DMA1_CH1_2_IRQHandler ;26, DMA1_CH2_3 IRQHandler - DCD DMA1_CH3_5_IRQHandler ;27, DMA1_CH4_7 IRQHandler - DCD ADC_CMP_IRQHandler ;28, ADC_CMP IRQHandler - DCD AD16C4T1_IRQHandler ;29, AD16C4T1 IRQHandler - DCD BS16T1_IRQHandler ;30, BS16T1 IRQHandler - DCD GP32C4T1_IRQHandler ;31, GP32C4T1 IRQHandler - DCD GP16C4T1_IRQHandler ;32, GP16C4T1 IRQHandler - DCD GP16C4T2_IRQHandler ;33, GP16C4T2 IRQHandler - DCD GP16C4T3_IRQHandler ;34, GP16C4T3 IRQHandler - DCD GP16C2T1_IRQHandler ;35, GP16C2T1 IRQHandler - DCD GP16C2T2_IRQHandler ;36, GP16C2T2 IRQHandler - DCD GP16C2T3_IRQHandler ;37, GP16C2T3 IRQHandler - DCD GP16C2T4_IRQHandler ;38, GP16C2T4 IRQHandler - DCD I2C1_IRQHandler ;39, I2C1 IRQHandler - DCD I2C2_IRQHandler ;40, I2C2 IRQHandler - DCD SPI1_IRQHandler ;41, SPI1 IRQHandler - DCD SPI2_IRQHandler ;42, SPI2 IRQHandler - DCD UART1_IRQHandler ;43, UART1 IRQHandler - DCD UART2_IRQHandler ;44, UART2 IRQHandler - DCD UART3_AES_IRQHandler ;45, UART3_AES IRQHandler - DCD SUART1_SUART2_IRQHandler ;46, SUART1_SUART2 IRQHandler - DCD USB_IRQHandler ;47, USB IRQHandler - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; Default interrupt handlers. -;; - THUMB - - PUBWEAK Reset_Handler - SECTION .text:CODE:NOROOT:REORDER(2) -Reset_Handler - 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 WWDT_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -WWDT_IRQHandler - B WWDT_IRQHandler - - PUBWEAK PVD_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -PVD_IRQHandler - B PVD_IRQHandler - - PUBWEAK RTC_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -RTC_IRQHandler - B RTC_IRQHandler - - PUBWEAK LowPowerWakeup_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -LowPowerWakeup_IRQHandler - B LowPowerWakeup_IRQHandler - - PUBWEAK EXTI0_1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -EXTI0_1_IRQHandler - B EXTI0_1_IRQHandler - - PUBWEAK EXTI2_3_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -EXTI2_3_IRQHandler - B EXTI2_3_IRQHandler - - PUBWEAK EXTI4_15_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -EXTI4_15_IRQHandler - B EXTI4_15_IRQHandler - - PUBWEAK DMA1_CH0_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -DMA1_CH0_IRQHandler - B DMA1_CH0_IRQHandler - - PUBWEAK DMA1_CH1_2_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -DMA1_CH1_2_IRQHandler - B DMA1_CH1_2_IRQHandler - - PUBWEAK DMA1_CH3_5_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -DMA1_CH3_5_IRQHandler - B DMA1_CH3_5_IRQHandler - - PUBWEAK ADC_CMP_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -ADC_CMP_IRQHandler - B ADC_CMP_IRQHandler - - PUBWEAK AD16C4T1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -AD16C4T1_IRQHandler - B AD16C4T1_IRQHandler - - PUBWEAK BS16T1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -BS16T1_IRQHandler - B BS16T1_IRQHandler - - PUBWEAK GP32C4T1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP32C4T1_IRQHandler - B GP32C4T1_IRQHandler - - PUBWEAK GP16C4T1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C4T1_IRQHandler - B GP16C4T1_IRQHandler - - PUBWEAK GP16C4T2_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C4T2_IRQHandler - B GP16C4T2_IRQHandler - - PUBWEAK GP16C4T3_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C4T3_IRQHandler - B GP16C4T3_IRQHandler - - PUBWEAK GP16C2T1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C2T1_IRQHandler - B GP16C2T1_IRQHandler - - PUBWEAK GP16C2T2_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C2T2_IRQHandler - B GP16C2T2_IRQHandler - - PUBWEAK GP16C2T3_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C2T3_IRQHandler - B GP16C2T3_IRQHandler - - PUBWEAK GP16C2T4_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C2T4_IRQHandler - B GP16C2T4_IRQHandler - - PUBWEAK I2C1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -I2C1_IRQHandler - B I2C1_IRQHandler - - PUBWEAK I2C2_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -I2C2_IRQHandler - B I2C2_IRQHandler - - PUBWEAK SPI1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -SPI1_IRQHandler - B SPI1_IRQHandler - - PUBWEAK SPI2_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -SPI2_IRQHandler - B SPI2_IRQHandler - - PUBWEAK UART1_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -UART1_IRQHandler - B UART1_IRQHandler - - PUBWEAK UART2_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -UART2_IRQHandler - B UART2_IRQHandler - - PUBWEAK UART3_AES_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -UART3_AES_IRQHandler - B UART3_AES_IRQHandler - - PUBWEAK SUART1_SUART2_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -SUART1_SUART2_IRQHandler - B SUART1_SUART2_IRQHandler - - PUBWEAK USB_IRQHandler - SECTION .text:CODE:NOROOT:REORDER(1) -USB_IRQHandler - B USB_IRQHandler - - END diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/boot.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/boot.c deleted file mode 100644 index 4c4e15ee4c..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/boot.c +++ /dev/null @@ -1,321 +0,0 @@ - -// -// Boot (vectors) file for Cortex-M0 Integration Kit -// - -#include -#include -#include -#include "es32F0271_sub.h" - -// -// Build a stand-alone image -// - -#pragma import(__use_no_semihosting) - - -/*----------------------------------------------------------------------*/ -/*-------------- Interrupt Handlers --------------*/ -/*----------------------------------------------------------------------*/ -// The following functions are defined weakly to allow the user -// to override them at link time simply by declaring their own -// function of the same name. -// -// If no user function is provided, the weak function is used. -// -//------------------------------------ IRQ NMI Handler -__weak void NMI_Handler(void) -{ - while(1); -} -//------------------------------------ IRQ Hard Fault Handler -__weak void HardFault_Handler(void) -{ - //printf("Hard Fault\r\n"); - while(1); -} -//------------------------------------ IRQ SVCall Handler -__weak void SVC_Handler(void) -{ - while(1); -} -//------------------------------------ IRQ PendSV Handler -__weak void PendSV_Handler(void) -{ - while(1); -} -//------------------------------------ IRQ SysTick Handler -__weak void SysTick_Handler(void) -{ - while(1); -} -//------------------------------------ IRQ 31 -__weak void USB_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 30 -__weak void SUART12_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 29 -__weak void UART3_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 28 -__weak void UART2_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 27 -__weak void UART1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 26 -__weak void SPI2_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 25 -__weak void SPI1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 24 -__weak void I2C2_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 23 -__weak void I2C1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 22 -__weak void GPTIMC4_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 21 -__weak void GPTIMC3_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 20 -__weak void GPTIMC2_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 19 -__weak void GPTIMC1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 18 -__weak void GPTIMB3_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 17 -__weak void GPTIMB2_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 16 -__weak void GPTIMB1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 15 -__weak void GPTIMA1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 14 -__weak void BSTIM1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 13 -__weak void ADTIM1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 12 -__weak void ADC_COMP_IRQHandler(void) -{ - // while(1); -} -//------------------------------------ IRQ 11 -__weak void DMA1_CH345_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 10 -__weak void DMA1_CH12_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 9 -__weak void DMA1_CH0_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 8 -//------------------------------------ IRQ 7 -__weak void EXTI_4to15_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 6 -__weak void EXTI_2to3_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 5 -__weak void EXTI_0to1_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 4 -//------------------------------------ IRQ 3 -__weak void WAKEUP_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 2 -__weak void RTC_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 1 -__weak void PVD_IRQHandler(void) -{ - while(1); -} -//------------------------------------ IRQ 0 -__weak void WWDT_IRQHandler(void) -{ - while(1); -} - - -/*----------------------------------------------------------------------*/ -/*-------------- Defined Handler --------------*/ -/*----------------------------------------------------------------------*/ -__weak void Default_IRQHandler(void) -{ - while(1); -} - -/*----------------------------------------------------------------------*/ -/*-------------- Symbols defined in linker script ---------*/ -/*----------------------------------------------------------------------*/ - -extern void __main(void); - -/*----------------------------------------------------------------------*/ -/*-------------- Reset Handler --------------*/ -/*----------------------------------------------------------------------*/ -void Reset_Handler(void) -{ - __main(); - while(1) {;} // In case main() fails -} - -/*----------------------------------------------------------------------*/ -/*-------------- Set up Vector Table --------------*/ -/*----------------------------------------------------------------------*/ -typedef void (*const vect_t)(void) __irq; - -vect_t __Vectors[] -__attribute__ ((section("vectors"))) = { - (vect_t)(SRAM1_BASE+SRAMTOP),//(vect_t)(0x20000F80), // Top of Stack - Allowing 4 words for DEBUGDRIVERDATA - (vect_t)Reset_Handler, // Reset Handler - (vect_t)NMI_Handler, // NMI Handler - (vect_t)HardFault_Handler,// Hard Fault Handler - 0, // Reserved - 0, // Reserved - 0, // Reserved - 0, // Reserved - 0, // Reserved - 0, // Reserved - 0, // Reserved - (vect_t)SVC_Handler, // SVCall Handler - 0, // Reserved - 0, // Reserved - (vect_t)PendSV_Handler, // PendSV Handler - (vect_t)SysTick_Handler, // SysTick Handler - /*----------External Exceptions---------------------------------------------*/ - // External Interrupts 0 - 31 - // These are essentially unused, so will all - // take the same default handler if invoked. - // External Interrupts - //|=========================================| - //| IRQ NO. | M621 | - //|-----------------------------------------| - (vect_t)WWDT_IRQHandler, //| 0 | WWDG | | - (vect_t)PVD_IRQHandler, //| 1 | PVD | EXTI[20] | - (vect_t)RTC_IRQHandler, //| 2 | RTC | | - (vect_t)WAKEUP_IRQHandler, //| 3 | WAKEUP | EXTI[21] | - (vect_t)Default_IRQHandler, //| 4 | | | - (vect_t)EXTI_0to1_IRQHandler, //| 5 | EXTI[1:0] | GPIOx[1:0] | - (vect_t)EXTI_2to3_IRQHandler, //| 6 | EXTI[3:2] | GPIOx[3:2] | - (vect_t)EXTI_4to15_IRQHandler, //| 7 | EXTI[15:4] | GPIOx[15:4] | - (vect_t)Default_IRQHandler, //| 8 | | | - (vect_t)DMA1_CH0_IRQHandler, //| 9 | DMA1_CH0 | | - (vect_t)DMA1_CH12_IRQHandler, //| 10 | DMA1_CH12 | | - (vect_t)DMA1_CH345_IRQHandler, //| 11 | DMA1_CH345 | | - (vect_t)ADC_COMP_IRQHandler, //| 12 | ADC/COMP0-3 | EXTI[19:16] | - (vect_t)ADTIM1_IRQHandler, //| 13 | ADTIM1 | | - (vect_t)BSTIM1_IRQHandler, //| 14 | BSTIM1 | | - (vect_t)GPTIMA1_IRQHandler, //| 15 | GPTIMA1 | | - (vect_t)GPTIMB1_IRQHandler, //| 16 | GPTIMB1 | | - (vect_t)GPTIMB2_IRQHandler, //| 17 | GPTIMB2 | | - (vect_t)GPTIMB3_IRQHandler, //| 18 | GPTIMB3 | | - (vect_t)GPTIMC1_IRQHandler, //| 19 | GPTIMC1 | | - (vect_t)GPTIMC2_IRQHandler, //| 20 | GPTIMC2 | | - (vect_t)GPTIMC3_IRQHandler, //| 21 | GPTIMC3 | | - (vect_t)GPTIMC4_IRQHandler, //| 22 | GPTIMC4 | | - (vect_t)I2C1_IRQHandler, //| 23 | I2C1 | | - (vect_t)I2C2_IRQHandler, //| 24 | I2C2 | | - (vect_t)SPI1_IRQHandler, //| 25 | SPI1 | | - (vect_t)SPI2_IRQHandler, //| 26 | SPI2 | | - (vect_t)UART1_IRQHandler, //| 27 | UART1 | | - (vect_t)UART2_IRQHandler, //| 28 | UART2 | | - (vect_t)UART3_IRQHandler, //| 29 | UART3 | | - (vect_t)SUART12_IRQHandler, //| 30 | SUART1/2 | | - (vect_t)USB_IRQHandler //| 31 | USB | | - //==========================================| -}; - - -/*----------------------------------------------------------------------*/ -/*-------------- Set up initial stack and heap --------------*/ -/*----------------------------------------------------------------------*/ -__value_in_regs struct __initial_stackheap -__user_initial_stackheap(unsigned hb, unsigned sb, unsigned hl, unsigned sl) -{ - struct __initial_stackheap s; - - s.heap_base = hb; - s.stack_base = sb; - s.heap_limit = s.stack_base; - s.stack_limit = s.heap_base; - return s; -} - -/*----------------------------------------------------------------------*/ -/*------ Set test status bits in testbench when main() exits -------*/ -/*----------------------------------------------------------------------*/ -void _sys_exit(int return_code) -{ - while(1); -} - - - diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/startup_es32f027x.s b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/startup_es32f027x.s deleted file mode 100644 index 78c14566c3..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/Startup/keil/startup_es32f027x.s +++ /dev/null @@ -1,244 +0,0 @@ -;******************************************************************************* -; *file : startup_ES32F027x.s -; *description: ES32F027x Device Startup File -; *author : Eastsoft MCU Software Team -; *version : V0.01 -; *data : 12/10/2018 -; -; *Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. -; * -; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED -; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF -; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. -; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR -; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. -;******************************************************************************* - - -; Stack Configuration -; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> -; - -Stack_Size EQU 0x00000400 - - 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 0x00000000 - - 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 - -__Vectors DCD __initial_sp ; Top of Stack - ; External Interrupts - DCD Reset_Handler ;1, Reset Handler - DCD NMI_Handler ;2, NMI Handler - DCD HardFault_Handler ;3, HARDFAULT Handler - DCD 0 ;4, Reserved - DCD 0 ;5, Reserved - DCD 0 ;6, Reserved - DCD 0 ;7, Reserved - DCD 0 ;8, Reserved - DCD 0 ;9, Reserved - DCD 0 ;10, Reserved - DCD SVC_Handler ;11, SVC Handler - DCD 0 ;12, Reserved - DCD 0 ;13, Reserved - DCD PendSV_Handler ;14, PENDSV Handler - DCD SysTick_Handler ;15, SYSTICK Handler - DCD WWDT_IRQHandler ;16, WWDT IRQHandler - DCD PVD_IRQHandler ;17, PVD IRQHandler - DCD RTC_IRQHandler ;18, RTC IRQHandler - DCD LowPowerWakeup_IRQHandler ;19, LowPowerWakeup IRQHandler - DCD 0 ;20, Reserved - DCD EXTI0_1_IRQHandler ;21, EXTI01_1 IRQHandler - DCD EXTI2_3_IRQHandler ;22, EXTI2_3 IRQHandler - DCD EXTI4_15_IRQHandler ;23, EXTI4_15 IRQHandler - DCD 0 ;24, Reserved - DCD DMA1_CH0_IRQHandler ;25, DMA1_CH0 IRQHandler - DCD DMA1_CH1_2_IRQHandler ;26, DMA1_CH1_2 IRQHandler - DCD DMA1_CH3_5_IRQHandler ;27, DMA1_CH3_5 IRQHandler - DCD ADC_CMP_IRQHandler ;28, ADC_CMP IRQHandler - DCD AD16C4T1_IRQHandler ;29, AD16C4T1 IRQHandler - DCD BS16T1_IRQHandler ;30, BS16T1 IRQHandler - DCD GP32C4T1_IRQHandler ;31, GP32C4T1 IRQHandler - DCD GP16C4T1_IRQHandler ;32, GP16C4T1 IRQHandler - DCD GP16C4T2_IRQHandler ;33, GP16C4T2 IRQHandler - DCD GP16C4T3_IRQHandler ;34, GP16C4T3 IRQHandler - DCD GP16C2T1_IRQHandler ;35, GP16C2T1 IRQHandler - DCD GP16C2T2_IRQHandler ;36, GP16C2T2 IRQHandler - DCD GP16C2T3_IRQHandler ;37, GP16C2T3 IRQHandler - DCD GP16C2T4_IRQHandler ;38, GP16C2T4 IRQHandler - DCD I2C1_IRQHandler ;39, I2C1 IRQHandler - DCD I2C2_IRQHandler ;40, I2C2 IRQHandler - DCD SPI1_IRQHandler ;41, SPI1 IRQHandler - DCD SPI2_IRQHandler ;42, SPI2 IRQHandler - DCD UART1_IRQHandler ;43, UART1 IRQHandler - DCD UART2_IRQHandler ;44, UART2 IRQHandler - DCD UART3_AES_IRQHandler ;45, UART3_AES IRQHandler - DCD SUART1_SUART2_IRQHandler ;46, SUART1_SUART2 IRQHandler - DCD USB_IRQHandler ;47, USB IRQHandler - - - AREA |.text|, CODE, READONLY - - -; Reset Handler - -Reset_Handler PROC - EXPORT Reset_Handler [WEAK] - IMPORT __main - IMPORT SystemInit - LDR R0, =SystemInit - BLX R0 - LDR R0, =__main - BX R0 - ENDP - -; Dummy Exception IRQHandlers (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 WWDT_IRQHandler [WEAK] - EXPORT PVD_IRQHandler [WEAK] - EXPORT RTC_IRQHandler [WEAK] - EXPORT LowPowerWakeup_IRQHandler [WEAK] - EXPORT EXTI0_1_IRQHandler [WEAK] - EXPORT EXTI2_3_IRQHandler [WEAK] - EXPORT EXTI4_15_IRQHandler [WEAK] - EXPORT DMA1_CH0_IRQHandler [WEAK] - EXPORT DMA1_CH1_2_IRQHandler [WEAK] - EXPORT DMA1_CH3_5_IRQHandler [WEAK] - EXPORT ADC_CMP_IRQHandler [WEAK] - EXPORT AD16C4T1_IRQHandler [WEAK] - EXPORT BS16T1_IRQHandler [WEAK] - EXPORT GP32C4T1_IRQHandler [WEAK] - EXPORT GP16C4T1_IRQHandler [WEAK] - EXPORT GP16C4T2_IRQHandler [WEAK] - EXPORT GP16C4T3_IRQHandler [WEAK] - EXPORT GP16C2T1_IRQHandler [WEAK] - EXPORT GP16C2T2_IRQHandler [WEAK] - EXPORT GP16C2T3_IRQHandler [WEAK] - EXPORT GP16C2T4_IRQHandler [WEAK] - EXPORT I2C1_IRQHandler [WEAK] - EXPORT I2C2_IRQHandler [WEAK] - EXPORT SPI1_IRQHandler [WEAK] - EXPORT SPI2_IRQHandler [WEAK] - EXPORT UART1_IRQHandler [WEAK] - EXPORT UART2_IRQHandler [WEAK] - EXPORT UART3_AES_IRQHandler [WEAK] - EXPORT SUART1_SUART2_IRQHandler [WEAK] - EXPORT USB_IRQHandler [WEAK] - - - -WWDT_IRQHandler -PVD_IRQHandler -RTC_IRQHandler -LowPowerWakeup_IRQHandler -EXTI0_1_IRQHandler -EXTI2_3_IRQHandler -EXTI4_15_IRQHandler -DMA1_CH0_IRQHandler -DMA1_CH1_2_IRQHandler -DMA1_CH3_5_IRQHandler -ADC_CMP_IRQHandler -AD16C4T1_IRQHandler -BS16T1_IRQHandler -GP32C4T1_IRQHandler -GP16C4T1_IRQHandler -GP16C4T2_IRQHandler -GP16C4T3_IRQHandler -GP16C2T1_IRQHandler -GP16C2T2_IRQHandler -GP16C2T3_IRQHandler -GP16C2T4_IRQHandler -I2C1_IRQHandler -I2C2_IRQHandler -SPI1_IRQHandler -SPI2_IRQHandler -UART1_IRQHandler -UART2_IRQHandler -UART3_AES_IRQHandler -SUART1_SUART2_IRQHandler -USB_IRQHandler - - - 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/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/core_cm0.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/core_cm0.c deleted file mode 100644 index e8a1ed21c0..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/core_cm0.c +++ /dev/null @@ -1,472 +0,0 @@ -/* - *----------------------------------------------------------------------------- - * The confidential and proprietary information contained in this file may - * only be used by a person authorised under and to the extent permitted - * by a subsisting licensing agreement from ARM Limited. - * - * (C) COPYRIGHT 2009-2010 ARM Limited. - * ALL RIGHTS RESERVED - * - * This entire notice must be reproduced on all copies of this file - * and copies of this file may only be made by a person if such person is - * permitted to do so under the terms of a subsisting license agreement - * from ARM Limited. - * - * SVN Information - * - * Checked In : $Date: 2008-12-31 10:59:44 +0000 (Wed, 31 Dec 2008) $ - * - * Revision : $Revision: 97564 $ - * - * Release Information : Cortex-M0-AT510-r0p0-03rel0 - *----------------------------------------------------------------------------- - */ - - -#include - - -/* define compiler specific symbols */ -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for armcc */ - #define __INLINE __inline /*!< inline keyword for armcc */ - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for iarcc */ - #define __INLINE inline /*!< inline keyword for iarcc. Only avaiable in High optimization mode! */ - #define __nop __no_operation /*!< no operation intrinsic in iarcc */ - -#elif defined ( __GNUC__ ) - #define __ASM asm /*!< asm keyword for gcc */ - #define __INLINE inline /*!< inline keyword for gcc */ -#endif - - - -#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ - -/** - * @brief Return the Process Stack Pointer - * - * @param none - * @return uint32_t ProcessStackPointer - * - * Return the actual process stack pointer - */ -__ASM uint32_t __get_PSP(void) -{ - mrs r0, psp - bx lr -} - -/** - * @brief Set the Process Stack Pointer - * - * @param uint32_t Process Stack Pointer - * @return none - * - * Assign the value ProcessStackPointer to the MSP - * (process stack pointer) Cortex processor register - */ -__ASM void __set_PSP(uint32_t topOfProcStack) -{ - msr psp, r0 - bx lr -} - -/** - * @brief Return the Main Stack Pointer - * - * @param none - * @return uint32_t Main Stack Pointer - * - * Return the current value of the MSP (main stack pointer) - * Cortex processor register - */ -__ASM uint32_t __get_MSP(void) -{ - mrs r0, msp - bx lr -} - -/** - * @brief Set the Main Stack Pointer - * - * @param uint32_t Main Stack Pointer - * @return none - * - * Assign the value mainStackPointer to the MSP - * (main stack pointer) Cortex processor register - */ -__ASM void __set_MSP(uint32_t mainStackPointer) -{ - msr msp, r0 - bx lr -} - -/** - * @brief Reverse byte order in unsigned short value - * - * @param uint16_t value to reverse - * @return uint32_t reversed value - * - * Reverse byte order in unsigned short value - */ -__ASM uint32_t __REV16(uint16_t value) -{ - rev16 r0, r0 - bx lr -} - -/** - * @brief Reverse byte order in signed short value with sign extension to integer - * - * @param int16_t value to reverse - * @return int32_t reversed value - * - * Reverse byte order in signed short value with sign extension to integer - */ -__ASM int32_t __REVSH(int16_t value) -{ - revsh r0, r0 - bx lr -} - - -#if (__ARMCC_VERSION < 400000) - - -/** - * @brief Return the Priority Mask value - * - * @param none - * @return uint32_t PriMask - * - * Return the state of the priority mask bit from the priority mask - * register - */ -__ASM uint32_t __get_PRIMASK(void) -{ - mrs r0, primask - bx lr -} - -/** - * @brief Set the Priority Mask value - * - * @param uint32_t PriMask - * @return none - * - * Set the priority mask bit in the priority mask register - */ -__ASM void __set_PRIMASK(uint32_t priMask) -{ - msr primask, r0 - bx lr -} - - -/** - * @brief Return the Control Register value - * - * @param none - * @return uint32_t Control value - * - * Return the content of the control register - */ -__ASM uint32_t __get_CONTROL(void) -{ - mrs r0, control - bx lr -} - -/** - * @brief Set the Control Register value - * - * @param uint32_t Control value - * @return none - * - * Set the control register - */ -__ASM void __set_CONTROL(uint32_t control) -{ - msr control, r0 - bx lr -} - -#endif /* __ARMCC_VERSION */ - - -#elif (defined (__ICCARM__)) /*------------------ ICC Compiler -------------------*/ -#pragma diag_suppress=Pe940 - -/** - * @brief Return the Process Stack Pointer - * - * @param none - * @return uint32_t ProcessStackPointer - * - * Return the actual process stack pointer - */ -uint32_t __get_PSP(void) -{ - __ASM("mrs r0, psp"); - __ASM("bx lr"); -} - -/** - * @brief Set the Process Stack Pointer - * - * @param uint32_t Process Stack Pointer - * @return none - * - * Assign the value ProcessStackPointer to the MSP - * (process stack pointer) Cortex processor register - */ -void __set_PSP(uint32_t topOfProcStack) -{ - __ASM("msr psp, r0"); - __ASM("bx lr"); -} - -/** - * @brief Return the Main Stack Pointer - * - * @param none - * @return uint32_t Main Stack Pointer - * - * Return the current value of the MSP (main stack pointer) - * Cortex processor register - */ -uint32_t __get_MSP(void) -{ - __ASM("mrs r0, msp"); - __ASM("bx lr"); -} - -/** - * @brief Set the Main Stack Pointer - * - * @param uint32_t Main Stack Pointer - * @return none - * - * Assign the value mainStackPointer to the MSP - * (main stack pointer) Cortex processor register - */ -void __set_MSP(uint32_t topOfMainStack) -{ - __ASM("msr msp, r0"); - __ASM("bx lr"); -} - -/** - * @brief Reverse byte order in unsigned short value - * - * @param uint16_t value to reverse - * @return uint32_t reversed value - * - * Reverse byte order in unsigned short value - */ -uint32_t __REV16(uint16_t value) -{ - __ASM("rev16 r0, r0"); - __ASM("bx lr"); -} - - -#pragma diag_default=Pe940 - - - - -#elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/ - -/** - * @brief Return the Process Stack Pointer - * - * @param none - * @return uint32_t ProcessStackPointer - * - * Return the actual process stack pointer - */ -uint32_t __get_PSP(void) -{ - uint32_t result=0; - - __ASM volatile ("MRS %0, psp" : "=r" (result) ); - return(result); -} - -/** - * @brief Set the Process Stack Pointer - * - * @param uint32_t Process Stack Pointer - * @return none - * - * Assign the value ProcessStackPointer to the MSP - * (process stack pointer) Cortex processor register - */ -void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) ); -} - -/** - * @brief Return the Main Stack Pointer - * - * @param none - * @return uint32_t Main Stack Pointer - * - * Return the current value of the MSP (main stack pointer) - * Cortex processor register - */ -uint32_t __get_MSP(void) -{ - uint32_t result=0; - - __ASM volatile ("MRS %0, msp" : "=r" (result) ); - return(result); -} - -/** - * @brief Set the Main Stack Pointer - * - * @param uint32_t Main Stack Pointer - * @return none - * - * Assign the value mainStackPointer to the MSP - * (main stack pointer) Cortex processor register - */ -void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) ); -} - - -/** - * @brief Return the Priority Mask value - * - * @param none - * @return uint32_t PriMask - * - * Return the state of the priority mask bit from the priority mask - * register - */ -uint32_t __get_PRIMASK(void) -{ - uint32_t result=0; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - -/** - * @brief Set the Priority Mask value - * - * @param uint32_t PriMask - * @return none - * - * Set the priority mask bit in the priority mask register - */ -void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) ); -} - - -/** - * @brief Reverse byte order in integer value - * - * @param uint32_t value to reverse - * @return uint32_t reversed value - * - * Reverse byte order in integer value - */ -uint32_t __REV(uint32_t value) -{ - uint32_t result=0; - - __ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) ); - return(result); -} - -/** - * @brief Reverse byte order in unsigned short value - * - * @param uint16_t value to reverse - * @return uint32_t reversed value - * - * Reverse byte order in unsigned short value - */ -uint32_t __REV16(uint16_t value) -{ - uint32_t result=0; - - __ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) ); - return(result); -} - -/** - * @brief Reverse byte order in signed short value with sign extension to integer - * - * @param int32_t value to reverse - * @return int32_t reversed value - * - * Reverse byte order in signed short value with sign extension to integer - */ -int32_t __REVSH(int16_t value) -{ - uint32_t result=0; - - __ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) ); - return(result); -} - - -/** - * @brief Return the Control Register value - * - * @param none - * @return uint32_t Control value - * - * Return the content of the control register - */ -uint32_t __get_CONTROL(void) -{ - uint32_t result=0; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - -/** - * @brief Set the Control Register value - * - * @param uint32_t Control value - * @return none - * - * Set the control register - */ -void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) ); -} - -#endif - - - - - - - - - - - - - - - - - diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/retarget.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/retarget.c deleted file mode 100644 index 1303e0765e..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/retarget.c +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************/ -/* RETARGET.C: 'Retarget' layer for target-dependent low level functions */ -/******************************************************************************/ -/* This file is part of the uVision/ARM development tools. */ -/* Copyright (c) 2005-2006 Keil Software. All rights reserved. */ -/* This software may only be used under the terms of a valid, current, */ -/* end user licence from KEIL for a compatible version of KEIL software */ -/* development tools. Nothing else gives you the right to use this software. */ -/******************************************************************************/ - -#include -#include - -//#pragma import(__use_no_semihosting_swi) - -__weak uint8_t sendchar(uint8_t ui8char) -{ - (void) ui8char; - return 0; -} - - -int ITM_fputc(int ch); /* ITM debug */ - -struct __FILE -{ -int handle; /* Add whatever you need here */ -}; -FILE __stdout; - - -int fputc(int ch, FILE *f) -{ - return (sendchar(ch)); -} - - -int ferror(FILE *f) -{ - /* Your implementation of ferror */ - return EOF; -} - - -void _ttywrch(int ch) -{ - sendchar(ch); -} - - -void _sys_exit(int return_code) -{ -label: - goto label; /* endless loop */ -} diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.c b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.c deleted file mode 100644 index 6112c52bb4..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.c +++ /dev/null @@ -1,79 +0,0 @@ -/** - ************************************************************************************** - * @file system_es32f027x.c - * @brief System File. - * - * @version V0.01 - * @data 5/17/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -/* Incudes--------------------------------------------------------*/ -#include "system_es32f027x.h" - -/** @addtogroup CMSIS - * @{ - */ - -/** @addtogroup System_ES32F027X - * @{ - */ - -/* Public Functions -----------------------------------------------------------*/ -/* Public Init Structure ------------------------------------------------------*/ -/* Public Macros --------------------------------------------------------------*/ -/* Public Constants -----------------------------------------------------------*/ -/* Private Macros -------------------------------------------------------------*/ -/* Private Constants-----------------------------------------------------------*/ - -/* Private Variables ----------------------------------------------------------*/ -/** @addtogroup Private_Variables - * @{ - */ - -/** - * @brief update the value of SystemCoreClock after changing the system clock. - */ -unsigned int SystemCoreClock = 4000000; -unsigned int SystemFrequency_SysClk = 4000000; -unsigned int SystemFrequency_AHBClk = 4000000; -unsigned int SystemFrequency_APBClk = 4000000; -unsigned int PLL1Frequency = 48000000; -unsigned int PLL0Frequency = 4000000; - -/** - * @} Private_Variables - */ - -/* Private Functions ----------------------------------------------------------*/ -/** @addtogroup Private_Functions - * @{ - */ - -/** - * @brief:SystemInit. - * @param:none - * @retval:none - */ -void SystemInit (void) -{ -} - -/** - * @} Private_Functions - */ - -/** - * @} System_ES32F072X - */ - -/** - * @} CMSIS - */ -/********** (C) COPYRIGHT Eastsoft Microelectronics END OF FILE SYSTEM_ES32F027X.H **********/ - diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.h b/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.h deleted file mode 100644 index d2cee80354..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - ************************************************************************************** - * @file SYSTEM_ES32F027x.H - * @brief es32f0271 system head file. - * - * @version V0.01 - * @data 5/17/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ - -#ifndef __SYSTEM_ES32F027x_H__ -#define __SYSTEM_ES32F027x_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes -------------------------------------------------------*/ -#include - -/** @addtogroup CMSIS - * @{ - */ - -/** @addtogroup System_ES32F027x - * @{ - */ - -/* Public Functions -----------------------------------------------------------*/ -/* Public Init Structure ------------------------------------------------------*/ -/* Public Macros --------------------------------------------------------------*/ -/* Public Constants -----------------------------------------------------------*/ -/* Private Variables ----------------------------------------------------------*/ -/* Private Macros -------------------------------------------------------------*/ -/* Private Constants-----------------------------------------------------------*/ - -/* Public Types ---------------------------------------------------------------*/ -/** @addtogroup Public_Types - * @{ - */ -extern unsigned int SystemCoreClock; -extern unsigned int SystemFrequency_SysClk; -extern unsigned int SystemFrequency_AHBClk; -extern unsigned int SystemFrequency_APBClk; -extern unsigned int PLL1Frequency; -extern unsigned int PLL0Frequency; - -/* Exported function -------------------------------------------------*/ -/** @addtogroup Public_Functions - * @{ - */ - -extern void SystemInit (void); - -#ifdef __cplusplus -} -#endif - -#endif - -/** - * @} Public_Functions - */ - -/** - * @} Public_Types - */ - -/** - * @} System_ES32F027x - */ - -/** - * @} CMSIS - */ -/********** (C) COPYRIGHT Eastsoft Microelectronics END OF FILE SYSTEM_ES32F027x.H **********/ diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_common_tables.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_common_tables.h deleted file mode 100644 index dfea7460e9..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_common_tables.h +++ /dev/null @@ -1,121 +0,0 @@ -/* ---------------------------------------------------------------------- - * Project: CMSIS DSP Library - * Title: arm_common_tables.h - * Description: Extern declaration for common tables - * - * $Date: 27. January 2017 - * $Revision: V.1.5.1 - * - * Target Processor: Cortex-M cores - * -------------------------------------------------------------------- */ -/* - * Copyright (C) 2010-2017 ARM Limited or its affiliates. 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 _ARM_COMMON_TABLES_H -#define _ARM_COMMON_TABLES_H - -#include "arm_math.h" - -extern const uint16_t armBitRevTable[1024]; -extern const q15_t armRecipTableQ15[64]; -extern const q31_t armRecipTableQ31[64]; -extern const float32_t twiddleCoef_16[32]; -extern const float32_t twiddleCoef_32[64]; -extern const float32_t twiddleCoef_64[128]; -extern const float32_t twiddleCoef_128[256]; -extern const float32_t twiddleCoef_256[512]; -extern const float32_t twiddleCoef_512[1024]; -extern const float32_t twiddleCoef_1024[2048]; -extern const float32_t twiddleCoef_2048[4096]; -extern const float32_t twiddleCoef_4096[8192]; -#define twiddleCoef twiddleCoef_4096 -extern const q31_t twiddleCoef_16_q31[24]; -extern const q31_t twiddleCoef_32_q31[48]; -extern const q31_t twiddleCoef_64_q31[96]; -extern const q31_t twiddleCoef_128_q31[192]; -extern const q31_t twiddleCoef_256_q31[384]; -extern const q31_t twiddleCoef_512_q31[768]; -extern const q31_t twiddleCoef_1024_q31[1536]; -extern const q31_t twiddleCoef_2048_q31[3072]; -extern const q31_t twiddleCoef_4096_q31[6144]; -extern const q15_t twiddleCoef_16_q15[24]; -extern const q15_t twiddleCoef_32_q15[48]; -extern const q15_t twiddleCoef_64_q15[96]; -extern const q15_t twiddleCoef_128_q15[192]; -extern const q15_t twiddleCoef_256_q15[384]; -extern const q15_t twiddleCoef_512_q15[768]; -extern const q15_t twiddleCoef_1024_q15[1536]; -extern const q15_t twiddleCoef_2048_q15[3072]; -extern const q15_t twiddleCoef_4096_q15[6144]; -extern const float32_t twiddleCoef_rfft_32[32]; -extern const float32_t twiddleCoef_rfft_64[64]; -extern const float32_t twiddleCoef_rfft_128[128]; -extern const float32_t twiddleCoef_rfft_256[256]; -extern const float32_t twiddleCoef_rfft_512[512]; -extern const float32_t twiddleCoef_rfft_1024[1024]; -extern const float32_t twiddleCoef_rfft_2048[2048]; -extern const float32_t twiddleCoef_rfft_4096[4096]; - -/* floating-point bit reversal tables */ -#define ARMBITREVINDEXTABLE_16_TABLE_LENGTH ((uint16_t)20) -#define ARMBITREVINDEXTABLE_32_TABLE_LENGTH ((uint16_t)48) -#define ARMBITREVINDEXTABLE_64_TABLE_LENGTH ((uint16_t)56) -#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208) -#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440) -#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448) -#define ARMBITREVINDEXTABLE_1024_TABLE_LENGTH ((uint16_t)1800) -#define ARMBITREVINDEXTABLE_2048_TABLE_LENGTH ((uint16_t)3808) -#define ARMBITREVINDEXTABLE_4096_TABLE_LENGTH ((uint16_t)4032) - -extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE_16_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE_32_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE_64_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE_1024_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE_2048_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE_4096_TABLE_LENGTH]; - -/* fixed-point bit reversal tables */ -#define ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH ((uint16_t)12) -#define ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH ((uint16_t)24) -#define ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH ((uint16_t)56) -#define ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH ((uint16_t)112) -#define ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH ((uint16_t)240) -#define ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH ((uint16_t)480) -#define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992) -#define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984) -#define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032) - -extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH]; - -/* Tables for Fast Math Sine and Cosine */ -extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1]; -extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1]; -extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1]; - -#endif /* ARM_COMMON_TABLES_H */ diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_const_structs.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_const_structs.h deleted file mode 100644 index 80a3e8bbe7..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_const_structs.h +++ /dev/null @@ -1,66 +0,0 @@ -/* ---------------------------------------------------------------------- - * Project: CMSIS DSP Library - * Title: arm_const_structs.h - * Description: Constant structs that are initialized for user convenience. - * For example, some can be given as arguments to the arm_cfft_f32() function. - * - * $Date: 27. January 2017 - * $Revision: V.1.5.1 - * - * Target Processor: Cortex-M cores - * -------------------------------------------------------------------- */ -/* - * Copyright (C) 2010-2017 ARM Limited or its affiliates. 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 _ARM_CONST_STRUCTS_H -#define _ARM_CONST_STRUCTS_H - -#include "arm_math.h" -#include "arm_common_tables.h" - - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; - - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; - - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_math.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_math.h deleted file mode 100644 index ea9dd26aa8..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/arm_math.h +++ /dev/null @@ -1,7157 +0,0 @@ -/****************************************************************************** - * @file arm_math.h - * @brief Public header file for CMSIS DSP LibraryU - * @version V1.5.3 - * @date 10. January 2018 - ******************************************************************************/ -/* - * Copyright (c) 2010-2018 Arm Limited or its affiliates. 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. - */ - -/** - \mainpage CMSIS DSP Software Library - * - * Introduction - * ------------ - * - * This user manual describes the CMSIS DSP software library, - * a suite of common signal processing functions for use on Cortex-M processor based devices. - * - * The library is divided into a number of functions each covering a specific category: - * - Basic math functions - * - Fast math functions - * - Complex math functions - * - Filters - * - Matrix functions - * - Transforms - * - Motor control functions - * - Statistical functions - * - Support functions - * - Interpolation functions - * - * The library has separate functions for operating on 8-bit integers, 16-bit integers, - * 32-bit integer and 32-bit floating-point values. - * - * Using the Library - * ------------ - * - * The library installer contains prebuilt versions of the libraries in the Lib folder. - * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit) - * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit) - * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit) - * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on) - * - arm_cortexM7l_math.lib (Cortex-M7, Little endian) - * - arm_cortexM7b_math.lib (Cortex-M7, Big endian) - * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit) - * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit) - * - arm_cortexM4l_math.lib (Cortex-M4, Little endian) - * - arm_cortexM4b_math.lib (Cortex-M4, Big endian) - * - arm_cortexM3l_math.lib (Cortex-M3, Little endian) - * - arm_cortexM3b_math.lib (Cortex-M3, Big endian) - * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian) - * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian) - * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian) - * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian) - * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit) - * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions) - * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit) - * - * The library functions are declared in the public file arm_math.h which is placed in the Include folder. - * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single - * public header file arm_math.h for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants. - * Define the appropriate preprocessor macro ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or - * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. - * For Armv8-M cores define preprocessor macro ARM_MATH_ARMV8MBL or ARM_MATH_ARMV8MML. - * Set preprocessor macro __DSP_PRESENT if Armv8-M Mainline core supports DSP instructions. - * - * - * Examples - * -------- - * - * The library ships with a number of examples which demonstrate how to use the library functions. - * - * Toolchain Support - * ------------ - * - * The library has been developed and tested with MDK version 5.14.0.0 - * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. - * - * Building the Library - * ------------ - * - * The library installer contains a project file to rebuild libraries on MDK toolchain in the CMSIS\\DSP_Lib\\Source\\ARM folder. - * - arm_cortexM_math.uvprojx - * - * - * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above. - * - * Preprocessor Macros - * ------------ - * - * Each library project have different preprocessor macros. - * - * - UNALIGNED_SUPPORT_DISABLE: - * - * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access - * - * - ARM_MATH_BIG_ENDIAN: - * - * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. - * - * - ARM_MATH_MATRIX_CHECK: - * - * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices - * - * - ARM_MATH_ROUNDING: - * - * Define macro ARM_MATH_ROUNDING for rounding on support functions - * - * - ARM_MATH_CMx: - * - * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target - * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and - * ARM_MATH_CM7 for building the library on cortex-M7. - * - * - ARM_MATH_ARMV8MxL: - * - * Define macro ARM_MATH_ARMV8MBL for building the library on Armv8-M Baseline target, ARM_MATH_ARMV8MML for building library - * on Armv8-M Mainline target. - * - * - __FPU_PRESENT: - * - * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for floating point libraries. - * - * - __DSP_PRESENT: - * - * Initialize macro __DSP_PRESENT = 1 when Armv8-M Mainline core supports DSP instructions. - * - *
- * CMSIS-DSP in ARM::CMSIS Pack - * ----------------------------- - * - * The following files relevant to CMSIS-DSP are present in the ARM::CMSIS Pack directories: - * |File/Folder |Content | - * |------------------------------|------------------------------------------------------------------------| - * |\b CMSIS\\Documentation\\DSP | This documentation | - * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) | - * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions | - * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library | - * - *
- * Revision History of CMSIS-DSP - * ------------ - * Please refer to \ref ChangeLog_pg. - * - * Copyright Notice - * ------------ - * - * Copyright (C) 2010-2015 Arm Limited. All rights reserved. - */ - - -/** - * @defgroup groupMath Basic Math Functions - */ - -/** - * @defgroup groupFastMath Fast Math Functions - * This set of functions provides a fast approximation to sine, cosine, and square root. - * As compared to most of the other functions in the CMSIS math library, the fast math functions - * operate on individual values and not arrays. - * There are separate functions for Q15, Q31, and floating-point data. - * - */ - -/** - * @defgroup groupCmplxMath Complex Math Functions - * This set of functions operates on complex data vectors. - * The data in the complex arrays is stored in an interleaved fashion - * (real, imag, real, imag, ...). - * In the API functions, the number of samples in a complex array refers - * to the number of complex values; the array contains twice this number of - * real values. - */ - -/** - * @defgroup groupFilters Filtering Functions - */ - -/** - * @defgroup groupMatrix Matrix Functions - * - * This set of functions provides basic matrix math operations. - * The functions operate on matrix data structures. For example, - * the type - * definition for the floating-point matrix structure is shown - * below: - *
- *     typedef struct
- *     {
- *       uint16_t numRows;     // number of rows of the matrix.
- *       uint16_t numCols;     // number of columns of the matrix.
- *       float32_t *pData;     // points to the data of the matrix.
- *     } arm_matrix_instance_f32;
- * 
- * There are similar definitions for Q15 and Q31 data types. - * - * The structure specifies the size of the matrix and then points to - * an array of data. The array is of size numRows X numCols - * and the values are arranged in row order. That is, the - * matrix element (i, j) is stored at: - *
- *     pData[i*numCols + j]
- * 
- * - * \par Init Functions - * There is an associated initialization function for each type of matrix - * data structure. - * The initialization function sets the values of the internal structure fields. - * Refer to the function arm_mat_init_f32(), arm_mat_init_q31() - * and arm_mat_init_q15() for floating-point, Q31 and Q15 types, respectively. - * - * \par - * Use of the initialization function is optional. However, if initialization function is used - * then the instance structure cannot be placed into a const data section. - * To place the instance structure in a const data - * section, manually initialize the data structure. For example: - *
- * arm_matrix_instance_f32 S = {nRows, nColumns, pData};
- * arm_matrix_instance_q31 S = {nRows, nColumns, pData};
- * arm_matrix_instance_q15 S = {nRows, nColumns, pData};
- * 
- * where nRows specifies the number of rows, nColumns - * specifies the number of columns, and pData points to the - * data array. - * - * \par Size Checking - * By default all of the matrix functions perform size checking on the input and - * output matrices. For example, the matrix addition function verifies that the - * two input matrices and the output matrix all have the same number of rows and - * columns. If the size check fails the functions return: - *
- *     ARM_MATH_SIZE_MISMATCH
- * 
- * Otherwise the functions return - *
- *     ARM_MATH_SUCCESS
- * 
- * There is some overhead associated with this matrix size checking. - * The matrix size checking is enabled via the \#define - *
- *     ARM_MATH_MATRIX_CHECK
- * 
- * within the library project settings. By default this macro is defined - * and size checking is enabled. By changing the project settings and - * undefining this macro size checking is eliminated and the functions - * run a bit faster. With size checking disabled the functions always - * return ARM_MATH_SUCCESS. - */ - -/** - * @defgroup groupTransforms Transform Functions - */ - -/** - * @defgroup groupController Controller Functions - */ - -/** - * @defgroup groupStats Statistics Functions - */ -/** - * @defgroup groupSupport Support Functions - */ - -/** - * @defgroup groupInterpolation Interpolation Functions - * These functions perform 1- and 2-dimensional interpolation of data. - * Linear interpolation is used for 1-dimensional data and - * bilinear interpolation is used for 2-dimensional data. - */ - -/** - * @defgroup groupExamples Examples - */ -#ifndef _ARM_MATH_H -#define _ARM_MATH_H - -/* Compiler specific diagnostic adjustment */ -#if defined ( __CC_ARM ) - -#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) - -#elif defined ( __GNUC__ ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wunused-parameter" - -#elif defined ( __ICCARM__ ) - -#elif defined ( __TI_ARM__ ) - -#elif defined ( __CSMC__ ) - -#elif defined ( __TASKING__ ) - -#else - #error Unknown compiler -#endif - - -#define __CMSIS_GENERIC /* disable NVIC and Systick functions */ - -#if defined(ARM_MATH_CM7) - #include "core_cm7.h" - #define ARM_MATH_DSP -#elif defined (ARM_MATH_CM4) - #include "core_cm4.h" - #define ARM_MATH_DSP -#elif defined (ARM_MATH_CM3) - #include "core_cm3.h" -#elif defined (ARM_MATH_CM0) - #include "core_cm0.h" - #define ARM_MATH_CM0_FAMILY -#elif defined (ARM_MATH_CM0PLUS) - #include "core_cm0plus.h" - #define ARM_MATH_CM0_FAMILY -#elif defined (ARM_MATH_ARMV8MBL) - #include "core_armv8mbl.h" - #define ARM_MATH_CM0_FAMILY -#elif defined (ARM_MATH_ARMV8MML) - #include "core_armv8mml.h" - #if (defined (__DSP_PRESENT) && (__DSP_PRESENT == 1)) - #define ARM_MATH_DSP - #endif -#else - #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML" -#endif - -#undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ -#include "string.h" -#include "math.h" -#ifdef __cplusplus -extern "C" -{ -#endif - - - /** - * @brief Macros required for reciprocal calculation in Normalized LMS - */ - -#define DELTA_Q31 (0x100) -#define DELTA_Q15 0x5 -#define INDEX_MASK 0x0000003F -#ifndef PI - #define PI 3.14159265358979f -#endif - - /** - * @brief Macros required for SINE and COSINE Fast math approximations - */ - -#define FAST_MATH_TABLE_SIZE 512 -#define FAST_MATH_Q31_SHIFT (32 - 10) -#define FAST_MATH_Q15_SHIFT (16 - 10) -#define CONTROLLER_Q31_SHIFT (32 - 9) -#define TABLE_SPACING_Q31 0x400000 -#define TABLE_SPACING_Q15 0x80 - - /** - * @brief Macros required for SINE and COSINE Controller functions - */ - /* 1.31(q31) Fixed value of 2/360 */ - /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ -#define INPUT_SPACING 0xB60B61 - - /** - * @brief Macro for Unaligned Support - */ -#ifndef UNALIGNED_SUPPORT_DISABLE - #define ALIGN4 -#else - #if defined (__GNUC__) - #define ALIGN4 __attribute__((aligned(4))) - #else - #define ALIGN4 __align(4) - #endif -#endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ - - /** - * @brief Error status returned by some functions in the library. - */ - - typedef enum - { - ARM_MATH_SUCCESS = 0, /**< No error */ - ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ - ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ - ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ - ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ - ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ - ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ - } arm_status; - - /** - * @brief 8-bit fractional data type in 1.7 format. - */ - typedef int8_t q7_t; - - /** - * @brief 16-bit fractional data type in 1.15 format. - */ - typedef int16_t q15_t; - - /** - * @brief 32-bit fractional data type in 1.31 format. - */ - typedef int32_t q31_t; - - /** - * @brief 64-bit fractional data type in 1.63 format. - */ - typedef int64_t q63_t; - - /** - * @brief 32-bit floating-point type definition. - */ - typedef float float32_t; - - /** - * @brief 64-bit floating-point type definition. - */ - typedef double float64_t; - - /** - * @brief definition to read/write two 16 bit values. - */ -#if defined ( __CC_ARM ) - #define __SIMD32_TYPE int32_t __packed - #define CMSIS_UNUSED __attribute__((unused)) - #define CMSIS_INLINE __attribute__((always_inline)) - -#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) - #define __SIMD32_TYPE int32_t - #define CMSIS_UNUSED __attribute__((unused)) - #define CMSIS_INLINE __attribute__((always_inline)) - -#elif defined ( __GNUC__ ) - #define __SIMD32_TYPE int32_t - #define CMSIS_UNUSED __attribute__((unused)) - #define CMSIS_INLINE __attribute__((always_inline)) - -#elif defined ( __ICCARM__ ) - #define __SIMD32_TYPE int32_t __packed - #define CMSIS_UNUSED - #define CMSIS_INLINE - -#elif defined ( __TI_ARM__ ) - #define __SIMD32_TYPE int32_t - #define CMSIS_UNUSED __attribute__((unused)) - #define CMSIS_INLINE - -#elif defined ( __CSMC__ ) - #define __SIMD32_TYPE int32_t - #define CMSIS_UNUSED - #define CMSIS_INLINE - -#elif defined ( __TASKING__ ) - #define __SIMD32_TYPE __unaligned int32_t - #define CMSIS_UNUSED - #define CMSIS_INLINE - -#else - #error Unknown compiler -#endif - -#define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) -#define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) -#define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) -#define __SIMD64(addr) (*(int64_t **) & (addr)) - -#if !defined (ARM_MATH_DSP) - /** - * @brief definition to pack two 16 bit values. - */ -#define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ - (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) -#define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ - (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) - -#endif /* !defined (ARM_MATH_DSP) */ - - /** - * @brief definition to pack four 8 bit values. - */ -#ifndef ARM_MATH_BIG_ENDIAN - -#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ - (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ - (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ - (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) -#else - -#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ - (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ - (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ - (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) - -#endif - - - /** - * @brief Clips Q63 to Q31 values. - */ - CMSIS_INLINE __STATIC_INLINE q31_t clip_q63_to_q31( - q63_t x) - { - return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? - ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; - } - - /** - * @brief Clips Q63 to Q15 values. - */ - CMSIS_INLINE __STATIC_INLINE q15_t clip_q63_to_q15( - q63_t x) - { - return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? - ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); - } - - /** - * @brief Clips Q31 to Q7 values. - */ - CMSIS_INLINE __STATIC_INLINE q7_t clip_q31_to_q7( - q31_t x) - { - return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? - ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; - } - - /** - * @brief Clips Q31 to Q15 values. - */ - CMSIS_INLINE __STATIC_INLINE q15_t clip_q31_to_q15( - q31_t x) - { - return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? - ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; - } - - /** - * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. - */ - - CMSIS_INLINE __STATIC_INLINE q63_t mult32x64( - q63_t x, - q31_t y) - { - return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + - (((q63_t) (x >> 32) * y))); - } - - /** - * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. - */ - - CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q31( - q31_t in, - q31_t * dst, - q31_t * pRecipTable) - { - q31_t out; - uint32_t tempVal; - uint32_t index, i; - uint32_t signBits; - - if (in > 0) - { - signBits = ((uint32_t) (__CLZ( in) - 1)); - } - else - { - signBits = ((uint32_t) (__CLZ(-in) - 1)); - } - - /* Convert input sample to 1.31 format */ - in = (in << signBits); - - /* calculation of index for initial approximated Val */ - index = (uint32_t)(in >> 24); - index = (index & INDEX_MASK); - - /* 1.31 with exp 1 */ - out = pRecipTable[index]; - - /* calculation of reciprocal value */ - /* running approximation for two iterations */ - for (i = 0U; i < 2U; i++) - { - tempVal = (uint32_t) (((q63_t) in * out) >> 31); - tempVal = 0x7FFFFFFFu - tempVal; - /* 1.31 with exp 1 */ - /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */ - out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30); - } - - /* write output */ - *dst = out; - - /* return num of signbits of out = 1/in value */ - return (signBits + 1U); - } - - - /** - * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. - */ - CMSIS_INLINE __STATIC_INLINE uint32_t arm_recip_q15( - q15_t in, - q15_t * dst, - q15_t * pRecipTable) - { - q15_t out = 0; - uint32_t tempVal = 0; - uint32_t index = 0, i = 0; - uint32_t signBits = 0; - - if (in > 0) - { - signBits = ((uint32_t)(__CLZ( in) - 17)); - } - else - { - signBits = ((uint32_t)(__CLZ(-in) - 17)); - } - - /* Convert input sample to 1.15 format */ - in = (in << signBits); - - /* calculation of index for initial approximated Val */ - index = (uint32_t)(in >> 8); - index = (index & INDEX_MASK); - - /* 1.15 with exp 1 */ - out = pRecipTable[index]; - - /* calculation of reciprocal value */ - /* running approximation for two iterations */ - for (i = 0U; i < 2U; i++) - { - tempVal = (uint32_t) (((q31_t) in * out) >> 15); - tempVal = 0x7FFFu - tempVal; - /* 1.15 with exp 1 */ - out = (q15_t) (((q31_t) out * tempVal) >> 14); - /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */ - } - - /* write output */ - *dst = out; - - /* return num of signbits of out = 1/in value */ - return (signBits + 1); - } - - -/* - * @brief C custom defined intrinsic function for M3 and M0 processors - */ -#if !defined (ARM_MATH_DSP) - - /* - * @brief C custom defined QADD8 for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __QADD8( - uint32_t x, - uint32_t y) - { - q31_t r, s, t, u; - - r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; - s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; - t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; - u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; - - return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); - } - - - /* - * @brief C custom defined QSUB8 for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB8( - uint32_t x, - uint32_t y) - { - q31_t r, s, t, u; - - r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; - s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; - t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; - u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; - - return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); - } - - - /* - * @brief C custom defined QADD16 for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __QADD16( - uint32_t x, - uint32_t y) - { -/* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */ - q31_t r = 0, s = 0; - - r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHADD16 for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SHADD16( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined QSUB16 for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __QSUB16( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHSUB16 for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SHSUB16( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined QASX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __QASX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHASX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SHASX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined QSAX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __QSAX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHSAX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SHSAX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SMUSDX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSDX( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); - } - - /* - * @brief C custom defined SMUADX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SMUADX( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); - } - - - /* - * @brief C custom defined QADD for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE int32_t __QADD( - int32_t x, - int32_t y) - { - return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y))); - } - - - /* - * @brief C custom defined QSUB for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE int32_t __QSUB( - int32_t x, - int32_t y) - { - return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y))); - } - - - /* - * @brief C custom defined SMLAD for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SMLAD( - uint32_t x, - uint32_t y, - uint32_t sum) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + - ( ((q31_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLADX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SMLADX( - uint32_t x, - uint32_t y, - uint32_t sum) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + - ( ((q31_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLSDX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SMLSDX( - uint32_t x, - uint32_t y, - uint32_t sum) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + - ( ((q31_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLALD for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALD( - uint32_t x, - uint32_t y, - uint64_t sum) - { -/* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */ - return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + - ( ((q63_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLALDX for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint64_t __SMLALDX( - uint32_t x, - uint32_t y, - uint64_t sum) - { -/* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */ - return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + - ( ((q63_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMUAD for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SMUAD( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); - } - - - /* - * @brief C custom defined SMUSD for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SMUSD( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) - - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); - } - - - /* - * @brief C custom defined SXTB16 for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE uint32_t __SXTB16( - uint32_t x) - { - return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) | - ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) )); - } - - /* - * @brief C custom defined SMMLA for M3 and M0 processors - */ - CMSIS_INLINE __STATIC_INLINE int32_t __SMMLA( - int32_t x, - int32_t y, - int32_t sum) - { - return (sum + (int32_t) (((int64_t) x * y) >> 32)); - } - -#endif /* !defined (ARM_MATH_DSP) */ - - - /** - * @brief Instance structure for the Q7 FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - } arm_fir_instance_q7; - - /** - * @brief Instance structure for the Q15 FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - } arm_fir_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - } arm_fir_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - } arm_fir_instance_f32; - - - /** - * @brief Processing function for the Q7 FIR filter. - * @param[in] S points to an instance of the Q7 FIR filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_q7( - const arm_fir_instance_q7 * S, - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q7 FIR filter. - * @param[in,out] S points to an instance of the Q7 FIR structure. - * @param[in] numTaps Number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed. - */ - void arm_fir_init_q7( - arm_fir_instance_q7 * S, - uint16_t numTaps, - q7_t * pCoeffs, - q7_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 FIR filter. - * @param[in] S points to an instance of the Q15 FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_q15( - const arm_fir_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q15 FIR filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_fast_q15( - const arm_fir_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 FIR filter. - * @param[in,out] S points to an instance of the Q15 FIR filter structure. - * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed at a time. - * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if - * numTaps is not a supported value. - */ - arm_status arm_fir_init_q15( - arm_fir_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 FIR filter. - * @param[in] S points to an instance of the Q31 FIR filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_q31( - const arm_fir_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q31 FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_fast_q31( - const arm_fir_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR filter. - * @param[in,out] S points to an instance of the Q31 FIR structure. - * @param[in] numTaps Number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed at a time. - */ - void arm_fir_init_q31( - arm_fir_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point FIR filter. - * @param[in] S points to an instance of the floating-point FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_f32( - const arm_fir_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point FIR filter. - * @param[in,out] S points to an instance of the floating-point FIR filter structure. - * @param[in] numTaps Number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed at a time. - */ - void arm_fir_init_f32( - arm_fir_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 Biquad cascade filter. - */ - typedef struct - { - int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ - q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ - int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ - } arm_biquad_casd_df1_inst_q15; - - /** - * @brief Instance structure for the Q31 Biquad cascade filter. - */ - typedef struct - { - uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ - q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ - uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ - } arm_biquad_casd_df1_inst_q31; - - /** - * @brief Instance structure for the floating-point Biquad cascade filter. - */ - typedef struct - { - uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ - float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_casd_df1_inst_f32; - - - /** - * @brief Processing function for the Q15 Biquad cascade filter. - * @param[in] S points to an instance of the Q15 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_q15( - const arm_biquad_casd_df1_inst_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 Biquad cascade filter. - * @param[in,out] S points to an instance of the Q15 Biquad cascade structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format - */ - void arm_biquad_cascade_df1_init_q15( - arm_biquad_casd_df1_inst_q15 * S, - uint8_t numStages, - q15_t * pCoeffs, - q15_t * pState, - int8_t postShift); - - - /** - * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q15 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_fast_q15( - const arm_biquad_casd_df1_inst_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 Biquad cascade filter - * @param[in] S points to an instance of the Q31 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_q31( - const arm_biquad_casd_df1_inst_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q31 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_fast_q31( - const arm_biquad_casd_df1_inst_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 Biquad cascade filter. - * @param[in,out] S points to an instance of the Q31 Biquad cascade structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format - */ - void arm_biquad_cascade_df1_init_q31( - arm_biquad_casd_df1_inst_q31 * S, - uint8_t numStages, - q31_t * pCoeffs, - q31_t * pState, - int8_t postShift); - - - /** - * @brief Processing function for the floating-point Biquad cascade filter. - * @param[in] S points to an instance of the floating-point Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_f32( - const arm_biquad_casd_df1_inst_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point Biquad cascade filter. - * @param[in,out] S points to an instance of the floating-point Biquad cascade structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_df1_init_f32( - arm_biquad_casd_df1_inst_f32 * S, - uint8_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Instance structure for the floating-point matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - float32_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_f32; - - - /** - * @brief Instance structure for the floating-point matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - float64_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_f64; - - /** - * @brief Instance structure for the Q15 matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - q15_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_q15; - - /** - * @brief Instance structure for the Q31 matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - q31_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_q31; - - - /** - * @brief Floating-point matrix addition. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_add_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix addition. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_add_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix addition. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_add_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point, complex, matrix multiplication. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_cmplx_mult_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15, complex, matrix multiplication. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_cmplx_mult_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst, - q15_t * pScratch); - - - /** - * @brief Q31, complex, matrix multiplication. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_cmplx_mult_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix transpose. - * @param[in] pSrc points to the input matrix - * @param[out] pDst points to the output matrix - * @return The function returns either ARM_MATH_SIZE_MISMATCH - * or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_trans_f32( - const arm_matrix_instance_f32 * pSrc, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix transpose. - * @param[in] pSrc points to the input matrix - * @param[out] pDst points to the output matrix - * @return The function returns either ARM_MATH_SIZE_MISMATCH - * or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_trans_q15( - const arm_matrix_instance_q15 * pSrc, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix transpose. - * @param[in] pSrc points to the input matrix - * @param[out] pDst points to the output matrix - * @return The function returns either ARM_MATH_SIZE_MISMATCH - * or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_trans_q31( - const arm_matrix_instance_q31 * pSrc, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix multiplication - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix multiplication - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @param[in] pState points to the array for storing intermediate results - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst, - q15_t * pState); - - - /** - * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @param[in] pState points to the array for storing intermediate results - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_fast_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst, - q15_t * pState); - - - /** - * @brief Q31 matrix multiplication - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_fast_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix subtraction - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_sub_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix subtraction - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_sub_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix subtraction - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_sub_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix scaling. - * @param[in] pSrc points to the input matrix - * @param[in] scale scale factor - * @param[out] pDst points to the output matrix - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_scale_f32( - const arm_matrix_instance_f32 * pSrc, - float32_t scale, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix scaling. - * @param[in] pSrc points to input matrix - * @param[in] scaleFract fractional portion of the scale factor - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to output matrix - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_scale_q15( - const arm_matrix_instance_q15 * pSrc, - q15_t scaleFract, - int32_t shift, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix scaling. - * @param[in] pSrc points to input matrix - * @param[in] scaleFract fractional portion of the scale factor - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_scale_q31( - const arm_matrix_instance_q31 * pSrc, - q31_t scaleFract, - int32_t shift, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Q31 matrix initialization. - * @param[in,out] S points to an instance of the floating-point matrix structure. - * @param[in] nRows number of rows in the matrix. - * @param[in] nColumns number of columns in the matrix. - * @param[in] pData points to the matrix data array. - */ - void arm_mat_init_q31( - arm_matrix_instance_q31 * S, - uint16_t nRows, - uint16_t nColumns, - q31_t * pData); - - - /** - * @brief Q15 matrix initialization. - * @param[in,out] S points to an instance of the floating-point matrix structure. - * @param[in] nRows number of rows in the matrix. - * @param[in] nColumns number of columns in the matrix. - * @param[in] pData points to the matrix data array. - */ - void arm_mat_init_q15( - arm_matrix_instance_q15 * S, - uint16_t nRows, - uint16_t nColumns, - q15_t * pData); - - - /** - * @brief Floating-point matrix initialization. - * @param[in,out] S points to an instance of the floating-point matrix structure. - * @param[in] nRows number of rows in the matrix. - * @param[in] nColumns number of columns in the matrix. - * @param[in] pData points to the matrix data array. - */ - void arm_mat_init_f32( - arm_matrix_instance_f32 * S, - uint16_t nRows, - uint16_t nColumns, - float32_t * pData); - - - - /** - * @brief Instance structure for the Q15 PID Control. - */ - typedef struct - { - q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ -#if !defined (ARM_MATH_DSP) - q15_t A1; - q15_t A2; -#else - q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ -#endif - q15_t state[3]; /**< The state array of length 3. */ - q15_t Kp; /**< The proportional gain. */ - q15_t Ki; /**< The integral gain. */ - q15_t Kd; /**< The derivative gain. */ - } arm_pid_instance_q15; - - /** - * @brief Instance structure for the Q31 PID Control. - */ - typedef struct - { - q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ - q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ - q31_t A2; /**< The derived gain, A2 = Kd . */ - q31_t state[3]; /**< The state array of length 3. */ - q31_t Kp; /**< The proportional gain. */ - q31_t Ki; /**< The integral gain. */ - q31_t Kd; /**< The derivative gain. */ - } arm_pid_instance_q31; - - /** - * @brief Instance structure for the floating-point PID Control. - */ - typedef struct - { - float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ - float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ - float32_t A2; /**< The derived gain, A2 = Kd . */ - float32_t state[3]; /**< The state array of length 3. */ - float32_t Kp; /**< The proportional gain. */ - float32_t Ki; /**< The integral gain. */ - float32_t Kd; /**< The derivative gain. */ - } arm_pid_instance_f32; - - - - /** - * @brief Initialization function for the floating-point PID Control. - * @param[in,out] S points to an instance of the PID structure. - * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. - */ - void arm_pid_init_f32( - arm_pid_instance_f32 * S, - int32_t resetStateFlag); - - - /** - * @brief Reset function for the floating-point PID Control. - * @param[in,out] S is an instance of the floating-point PID Control structure - */ - void arm_pid_reset_f32( - arm_pid_instance_f32 * S); - - - /** - * @brief Initialization function for the Q31 PID Control. - * @param[in,out] S points to an instance of the Q15 PID structure. - * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. - */ - void arm_pid_init_q31( - arm_pid_instance_q31 * S, - int32_t resetStateFlag); - - - /** - * @brief Reset function for the Q31 PID Control. - * @param[in,out] S points to an instance of the Q31 PID Control structure - */ - - void arm_pid_reset_q31( - arm_pid_instance_q31 * S); - - - /** - * @brief Initialization function for the Q15 PID Control. - * @param[in,out] S points to an instance of the Q15 PID structure. - * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. - */ - void arm_pid_init_q15( - arm_pid_instance_q15 * S, - int32_t resetStateFlag); - - - /** - * @brief Reset function for the Q15 PID Control. - * @param[in,out] S points to an instance of the q15 PID Control structure - */ - void arm_pid_reset_q15( - arm_pid_instance_q15 * S); - - - /** - * @brief Instance structure for the floating-point Linear Interpolate function. - */ - typedef struct - { - uint32_t nValues; /**< nValues */ - float32_t x1; /**< x1 */ - float32_t xSpacing; /**< xSpacing */ - float32_t *pYData; /**< pointer to the table of Y values */ - } arm_linear_interp_instance_f32; - - /** - * @brief Instance structure for the floating-point bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - float32_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_f32; - - /** - * @brief Instance structure for the Q31 bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - q31_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_q31; - - /** - * @brief Instance structure for the Q15 bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - q15_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_q15; - - /** - * @brief Instance structure for the Q15 bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - q7_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_q7; - - - /** - * @brief Q7 vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_q7( - q7_t * pSrcA, - q7_t * pSrcB, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Floating-point vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix2_instance_q15; - -/* Deprecated */ - arm_status arm_cfft_radix2_init_q15( - arm_cfft_radix2_instance_q15 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix2_q15( - const arm_cfft_radix2_instance_q15 * S, - q15_t * pSrc); - - - /** - * @brief Instance structure for the Q15 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q15_t *pTwiddle; /**< points to the twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix4_instance_q15; - -/* Deprecated */ - arm_status arm_cfft_radix4_init_q15( - arm_cfft_radix4_instance_q15 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix4_q15( - const arm_cfft_radix4_instance_q15 * S, - q15_t * pSrc); - - /** - * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q31_t *pTwiddle; /**< points to the Twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix2_instance_q31; - -/* Deprecated */ - arm_status arm_cfft_radix2_init_q31( - arm_cfft_radix2_instance_q31 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix2_q31( - const arm_cfft_radix2_instance_q31 * S, - q31_t * pSrc); - - /** - * @brief Instance structure for the Q31 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q31_t *pTwiddle; /**< points to the twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix4_instance_q31; - -/* Deprecated */ - void arm_cfft_radix4_q31( - const arm_cfft_radix4_instance_q31 * S, - q31_t * pSrc); - -/* Deprecated */ - arm_status arm_cfft_radix4_init_q31( - arm_cfft_radix4_instance_q31 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the floating-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - float32_t *pTwiddle; /**< points to the Twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - float32_t onebyfftLen; /**< value of 1/fftLen. */ - } arm_cfft_radix2_instance_f32; - -/* Deprecated */ - arm_status arm_cfft_radix2_init_f32( - arm_cfft_radix2_instance_f32 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix2_f32( - const arm_cfft_radix2_instance_f32 * S, - float32_t * pSrc); - - /** - * @brief Instance structure for the floating-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - float32_t *pTwiddle; /**< points to the Twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - float32_t onebyfftLen; /**< value of 1/fftLen. */ - } arm_cfft_radix4_instance_f32; - -/* Deprecated */ - arm_status arm_cfft_radix4_init_f32( - arm_cfft_radix4_instance_f32 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix4_f32( - const arm_cfft_radix4_instance_f32 * S, - float32_t * pSrc); - - /** - * @brief Instance structure for the fixed-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ - const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t bitRevLength; /**< bit reversal table length. */ - } arm_cfft_instance_q15; - -void arm_cfft_q15( - const arm_cfft_instance_q15 * S, - q15_t * p1, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the fixed-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ - const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t bitRevLength; /**< bit reversal table length. */ - } arm_cfft_instance_q31; - -void arm_cfft_q31( - const arm_cfft_instance_q31 * S, - q31_t * p1, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the floating-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ - const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t bitRevLength; /**< bit reversal table length. */ - } arm_cfft_instance_f32; - - void arm_cfft_f32( - const arm_cfft_instance_f32 * S, - float32_t * p1, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the Q15 RFFT/RIFFT function. - */ - typedef struct - { - uint32_t fftLenReal; /**< length of the real FFT. */ - uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ - uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ - uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ - q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ - const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ - } arm_rfft_instance_q15; - - arm_status arm_rfft_init_q15( - arm_rfft_instance_q15 * S, - uint32_t fftLenReal, - uint32_t ifftFlagR, - uint32_t bitReverseFlag); - - void arm_rfft_q15( - const arm_rfft_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst); - - /** - * @brief Instance structure for the Q31 RFFT/RIFFT function. - */ - typedef struct - { - uint32_t fftLenReal; /**< length of the real FFT. */ - uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ - uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ - uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ - q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ - const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ - } arm_rfft_instance_q31; - - arm_status arm_rfft_init_q31( - arm_rfft_instance_q31 * S, - uint32_t fftLenReal, - uint32_t ifftFlagR, - uint32_t bitReverseFlag); - - void arm_rfft_q31( - const arm_rfft_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst); - - /** - * @brief Instance structure for the floating-point RFFT/RIFFT function. - */ - typedef struct - { - uint32_t fftLenReal; /**< length of the real FFT. */ - uint16_t fftLenBy2; /**< length of the complex FFT. */ - uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ - uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ - uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ - float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ - arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ - } arm_rfft_instance_f32; - - arm_status arm_rfft_init_f32( - arm_rfft_instance_f32 * S, - arm_cfft_radix4_instance_f32 * S_CFFT, - uint32_t fftLenReal, - uint32_t ifftFlagR, - uint32_t bitReverseFlag); - - void arm_rfft_f32( - const arm_rfft_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst); - - /** - * @brief Instance structure for the floating-point RFFT/RIFFT function. - */ -typedef struct - { - arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ - uint16_t fftLenRFFT; /**< length of the real sequence */ - float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ - } arm_rfft_fast_instance_f32 ; - -arm_status arm_rfft_fast_init_f32 ( - arm_rfft_fast_instance_f32 * S, - uint16_t fftLen); - -void arm_rfft_fast_f32( - arm_rfft_fast_instance_f32 * S, - float32_t * p, float32_t * pOut, - uint8_t ifftFlag); - - /** - * @brief Instance structure for the floating-point DCT4/IDCT4 function. - */ - typedef struct - { - uint16_t N; /**< length of the DCT4. */ - uint16_t Nby2; /**< half of the length of the DCT4. */ - float32_t normalize; /**< normalizing factor. */ - float32_t *pTwiddle; /**< points to the twiddle factor table. */ - float32_t *pCosFactor; /**< points to the cosFactor table. */ - arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ - arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ - } arm_dct4_instance_f32; - - - /** - * @brief Initialization function for the floating-point DCT4/IDCT4. - * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure. - * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure. - * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure. - * @param[in] N length of the DCT4. - * @param[in] Nby2 half of the length of the DCT4. - * @param[in] normalize normalizing factor. - * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if fftLenReal is not a supported transform length. - */ - arm_status arm_dct4_init_f32( - arm_dct4_instance_f32 * S, - arm_rfft_instance_f32 * S_RFFT, - arm_cfft_radix4_instance_f32 * S_CFFT, - uint16_t N, - uint16_t Nby2, - float32_t normalize); - - - /** - * @brief Processing function for the floating-point DCT4/IDCT4. - * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure. - * @param[in] pState points to state buffer. - * @param[in,out] pInlineBuffer points to the in-place input and output buffer. - */ - void arm_dct4_f32( - const arm_dct4_instance_f32 * S, - float32_t * pState, - float32_t * pInlineBuffer); - - - /** - * @brief Instance structure for the Q31 DCT4/IDCT4 function. - */ - typedef struct - { - uint16_t N; /**< length of the DCT4. */ - uint16_t Nby2; /**< half of the length of the DCT4. */ - q31_t normalize; /**< normalizing factor. */ - q31_t *pTwiddle; /**< points to the twiddle factor table. */ - q31_t *pCosFactor; /**< points to the cosFactor table. */ - arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ - arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ - } arm_dct4_instance_q31; - - - /** - * @brief Initialization function for the Q31 DCT4/IDCT4. - * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure. - * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure - * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure - * @param[in] N length of the DCT4. - * @param[in] Nby2 half of the length of the DCT4. - * @param[in] normalize normalizing factor. - * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. - */ - arm_status arm_dct4_init_q31( - arm_dct4_instance_q31 * S, - arm_rfft_instance_q31 * S_RFFT, - arm_cfft_radix4_instance_q31 * S_CFFT, - uint16_t N, - uint16_t Nby2, - q31_t normalize); - - - /** - * @brief Processing function for the Q31 DCT4/IDCT4. - * @param[in] S points to an instance of the Q31 DCT4 structure. - * @param[in] pState points to state buffer. - * @param[in,out] pInlineBuffer points to the in-place input and output buffer. - */ - void arm_dct4_q31( - const arm_dct4_instance_q31 * S, - q31_t * pState, - q31_t * pInlineBuffer); - - - /** - * @brief Instance structure for the Q15 DCT4/IDCT4 function. - */ - typedef struct - { - uint16_t N; /**< length of the DCT4. */ - uint16_t Nby2; /**< half of the length of the DCT4. */ - q15_t normalize; /**< normalizing factor. */ - q15_t *pTwiddle; /**< points to the twiddle factor table. */ - q15_t *pCosFactor; /**< points to the cosFactor table. */ - arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ - arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ - } arm_dct4_instance_q15; - - - /** - * @brief Initialization function for the Q15 DCT4/IDCT4. - * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure. - * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure. - * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure. - * @param[in] N length of the DCT4. - * @param[in] Nby2 half of the length of the DCT4. - * @param[in] normalize normalizing factor. - * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. - */ - arm_status arm_dct4_init_q15( - arm_dct4_instance_q15 * S, - arm_rfft_instance_q15 * S_RFFT, - arm_cfft_radix4_instance_q15 * S_CFFT, - uint16_t N, - uint16_t Nby2, - q15_t normalize); - - - /** - * @brief Processing function for the Q15 DCT4/IDCT4. - * @param[in] S points to an instance of the Q15 DCT4 structure. - * @param[in] pState points to state buffer. - * @param[in,out] pInlineBuffer points to the in-place input and output buffer. - */ - void arm_dct4_q15( - const arm_dct4_instance_q15 * S, - q15_t * pState, - q15_t * pInlineBuffer); - - - /** - * @brief Floating-point vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q7 vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_q7( - q7_t * pSrcA, - q7_t * pSrcB, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Floating-point vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q7 vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_q7( - q7_t * pSrcA, - q7_t * pSrcB, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a floating-point vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scale scale factor to be applied - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_f32( - float32_t * pSrc, - float32_t scale, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a Q7 vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scaleFract fractional portion of the scale value - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_q7( - q7_t * pSrc, - q7_t scaleFract, - int8_t shift, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a Q15 vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scaleFract fractional portion of the scale value - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_q15( - q15_t * pSrc, - q15_t scaleFract, - int8_t shift, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a Q31 vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scaleFract fractional portion of the scale value - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_q31( - q31_t * pSrc, - q31_t scaleFract, - int8_t shift, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q7 vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_q7( - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Floating-point vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Dot product of floating-point vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_f32( - float32_t * pSrcA, - float32_t * pSrcB, - uint32_t blockSize, - float32_t * result); - - - /** - * @brief Dot product of Q7 vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_q7( - q7_t * pSrcA, - q7_t * pSrcB, - uint32_t blockSize, - q31_t * result); - - - /** - * @brief Dot product of Q15 vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_q15( - q15_t * pSrcA, - q15_t * pSrcB, - uint32_t blockSize, - q63_t * result); - - - /** - * @brief Dot product of Q31 vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_q31( - q31_t * pSrcA, - q31_t * pSrcB, - uint32_t blockSize, - q63_t * result); - - - /** - * @brief Shifts the elements of a Q7 vector a specified number of bits. - * @param[in] pSrc points to the input vector - * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_shift_q7( - q7_t * pSrc, - int8_t shiftBits, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Shifts the elements of a Q15 vector a specified number of bits. - * @param[in] pSrc points to the input vector - * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_shift_q15( - q15_t * pSrc, - int8_t shiftBits, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Shifts the elements of a Q31 vector a specified number of bits. - * @param[in] pSrc points to the input vector - * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_shift_q31( - q31_t * pSrc, - int8_t shiftBits, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a floating-point vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_f32( - float32_t * pSrc, - float32_t offset, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a Q7 vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_q7( - q7_t * pSrc, - q7_t offset, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a Q15 vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_q15( - q15_t * pSrc, - q15_t offset, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a Q31 vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_q31( - q31_t * pSrc, - q31_t offset, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a floating-point vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a Q7 vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_q7( - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a Q15 vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a Q31 vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a floating-point vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a Q7 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_q7( - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a Q15 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a Q31 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a floating-point vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_f32( - float32_t value, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a Q7 vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_q7( - q7_t value, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a Q15 vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_q15( - q15_t value, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a Q31 vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_q31( - q31_t value, - q31_t * pDst, - uint32_t blockSize); - - -/** - * @brief Convolution of floating-point sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. - */ - void arm_conv_f32( - float32_t * pSrcA, - uint32_t srcALen, - float32_t * pSrcB, - uint32_t srcBLen, - float32_t * pDst); - - - /** - * @brief Convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - */ - void arm_conv_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - -/** - * @brief Convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. - */ - void arm_conv_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_fast_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - */ - void arm_conv_fast_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Convolution of Q31 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_fast_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Convolution of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). - */ - void arm_conv_opt_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Convolution of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst); - - - /** - * @brief Partial convolution of floating-point sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_f32( - float32_t * pSrcA, - uint32_t srcALen, - float32_t * pSrcB, - uint32_t srcBLen, - float32_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Partial convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_fast_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_fast_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Partial convolution of Q31 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_fast_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q7 sequences - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_opt_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - uint32_t firstIndex, - uint32_t numPoints, - q15_t * pScratch1, - q15_t * pScratch2); - - -/** - * @brief Partial convolution of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Instance structure for the Q15 FIR decimator. - */ - typedef struct - { - uint8_t M; /**< decimation factor. */ - uint16_t numTaps; /**< number of coefficients in the filter. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - } arm_fir_decimate_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR decimator. - */ - typedef struct - { - uint8_t M; /**< decimation factor. */ - uint16_t numTaps; /**< number of coefficients in the filter. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - } arm_fir_decimate_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR decimator. - */ - typedef struct - { - uint8_t M; /**< decimation factor. */ - uint16_t numTaps; /**< number of coefficients in the filter. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - } arm_fir_decimate_instance_f32; - - - /** - * @brief Processing function for the floating-point FIR decimator. - * @param[in] S points to an instance of the floating-point FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_f32( - const arm_fir_decimate_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point FIR decimator. - * @param[in,out] S points to an instance of the floating-point FIR decimator structure. - * @param[in] numTaps number of coefficients in the filter. - * @param[in] M decimation factor. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * blockSize is not a multiple of M. - */ - arm_status arm_fir_decimate_init_f32( - arm_fir_decimate_instance_f32 * S, - uint16_t numTaps, - uint8_t M, - float32_t * pCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 FIR decimator. - * @param[in] S points to an instance of the Q15 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_q15( - const arm_fir_decimate_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q15 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_fast_q15( - const arm_fir_decimate_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 FIR decimator. - * @param[in,out] S points to an instance of the Q15 FIR decimator structure. - * @param[in] numTaps number of coefficients in the filter. - * @param[in] M decimation factor. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * blockSize is not a multiple of M. - */ - arm_status arm_fir_decimate_init_q15( - arm_fir_decimate_instance_q15 * S, - uint16_t numTaps, - uint8_t M, - q15_t * pCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 FIR decimator. - * @param[in] S points to an instance of the Q31 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_q31( - const arm_fir_decimate_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - /** - * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q31 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_fast_q31( - arm_fir_decimate_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR decimator. - * @param[in,out] S points to an instance of the Q31 FIR decimator structure. - * @param[in] numTaps number of coefficients in the filter. - * @param[in] M decimation factor. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * blockSize is not a multiple of M. - */ - arm_status arm_fir_decimate_init_q31( - arm_fir_decimate_instance_q31 * S, - uint16_t numTaps, - uint8_t M, - q31_t * pCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 FIR interpolator. - */ - typedef struct - { - uint8_t L; /**< upsample factor. */ - uint16_t phaseLength; /**< length of each polyphase filter component. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ - q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ - } arm_fir_interpolate_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR interpolator. - */ - typedef struct - { - uint8_t L; /**< upsample factor. */ - uint16_t phaseLength; /**< length of each polyphase filter component. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ - q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ - } arm_fir_interpolate_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR interpolator. - */ - typedef struct - { - uint8_t L; /**< upsample factor. */ - uint16_t phaseLength; /**< length of each polyphase filter component. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ - float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ - } arm_fir_interpolate_instance_f32; - - - /** - * @brief Processing function for the Q15 FIR interpolator. - * @param[in] S points to an instance of the Q15 FIR interpolator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_interpolate_q15( - const arm_fir_interpolate_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 FIR interpolator. - * @param[in,out] S points to an instance of the Q15 FIR interpolator structure. - * @param[in] L upsample factor. - * @param[in] numTaps number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * the filter length numTaps is not a multiple of the interpolation factor L. - */ - arm_status arm_fir_interpolate_init_q15( - arm_fir_interpolate_instance_q15 * S, - uint8_t L, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 FIR interpolator. - * @param[in] S points to an instance of the Q15 FIR interpolator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_interpolate_q31( - const arm_fir_interpolate_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR interpolator. - * @param[in,out] S points to an instance of the Q31 FIR interpolator structure. - * @param[in] L upsample factor. - * @param[in] numTaps number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * the filter length numTaps is not a multiple of the interpolation factor L. - */ - arm_status arm_fir_interpolate_init_q31( - arm_fir_interpolate_instance_q31 * S, - uint8_t L, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point FIR interpolator. - * @param[in] S points to an instance of the floating-point FIR interpolator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_interpolate_f32( - const arm_fir_interpolate_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point FIR interpolator. - * @param[in,out] S points to an instance of the floating-point FIR interpolator structure. - * @param[in] L upsample factor. - * @param[in] numTaps number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * the filter length numTaps is not a multiple of the interpolation factor L. - */ - arm_status arm_fir_interpolate_init_f32( - arm_fir_interpolate_instance_f32 * S, - uint8_t L, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the high precision Q31 Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ - q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ - } arm_biquad_cas_df1_32x64_ins_q31; - - - /** - * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cas_df1_32x64_q31( - const arm_biquad_cas_df1_32x64_ins_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format - */ - void arm_biquad_cas_df1_32x64_init_q31( - arm_biquad_cas_df1_32x64_ins_q31 * S, - uint8_t numStages, - q31_t * pCoeffs, - q63_t * pState, - uint8_t postShift); - - - /** - * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ - float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_cascade_df2T_instance_f32; - - /** - * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ - float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_cascade_stereo_df2T_instance_f32; - - /** - * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ - float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_cascade_df2T_instance_f64; - - - /** - * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in] S points to an instance of the filter data structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df2T_f32( - const arm_biquad_cascade_df2T_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels - * @param[in] S points to an instance of the filter data structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_stereo_df2T_f32( - const arm_biquad_cascade_stereo_df2T_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in] S points to an instance of the filter data structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df2T_f64( - const arm_biquad_cascade_df2T_instance_f64 * S, - float64_t * pSrc, - float64_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in,out] S points to an instance of the filter data structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_df2T_init_f32( - arm_biquad_cascade_df2T_instance_f32 * S, - uint8_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in,out] S points to an instance of the filter data structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_stereo_df2T_init_f32( - arm_biquad_cascade_stereo_df2T_instance_f32 * S, - uint8_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in,out] S points to an instance of the filter data structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_df2T_init_f64( - arm_biquad_cascade_df2T_instance_f64 * S, - uint8_t numStages, - float64_t * pCoeffs, - float64_t * pState); - - - /** - * @brief Instance structure for the Q15 FIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of filter stages. */ - q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ - } arm_fir_lattice_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of filter stages. */ - q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ - } arm_fir_lattice_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of filter stages. */ - float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ - } arm_fir_lattice_instance_f32; - - - /** - * @brief Initialization function for the Q15 FIR lattice filter. - * @param[in] S points to an instance of the Q15 FIR lattice structure. - * @param[in] numStages number of filter stages. - * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. - * @param[in] pState points to the state buffer. The array is of length numStages. - */ - void arm_fir_lattice_init_q15( - arm_fir_lattice_instance_q15 * S, - uint16_t numStages, - q15_t * pCoeffs, - q15_t * pState); - - - /** - * @brief Processing function for the Q15 FIR lattice filter. - * @param[in] S points to an instance of the Q15 FIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_lattice_q15( - const arm_fir_lattice_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR lattice filter. - * @param[in] S points to an instance of the Q31 FIR lattice structure. - * @param[in] numStages number of filter stages. - * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. - * @param[in] pState points to the state buffer. The array is of length numStages. - */ - void arm_fir_lattice_init_q31( - arm_fir_lattice_instance_q31 * S, - uint16_t numStages, - q31_t * pCoeffs, - q31_t * pState); - - - /** - * @brief Processing function for the Q31 FIR lattice filter. - * @param[in] S points to an instance of the Q31 FIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_fir_lattice_q31( - const arm_fir_lattice_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - -/** - * @brief Initialization function for the floating-point FIR lattice filter. - * @param[in] S points to an instance of the floating-point FIR lattice structure. - * @param[in] numStages number of filter stages. - * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. - * @param[in] pState points to the state buffer. The array is of length numStages. - */ - void arm_fir_lattice_init_f32( - arm_fir_lattice_instance_f32 * S, - uint16_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Processing function for the floating-point FIR lattice filter. - * @param[in] S points to an instance of the floating-point FIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_fir_lattice_f32( - const arm_fir_lattice_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 IIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of stages in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ - q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ - q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ - } arm_iir_lattice_instance_q15; - - /** - * @brief Instance structure for the Q31 IIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of stages in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ - q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ - q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ - } arm_iir_lattice_instance_q31; - - /** - * @brief Instance structure for the floating-point IIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of stages in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ - float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ - float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ - } arm_iir_lattice_instance_f32; - - - /** - * @brief Processing function for the floating-point IIR lattice filter. - * @param[in] S points to an instance of the floating-point IIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_f32( - const arm_iir_lattice_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point IIR lattice filter. - * @param[in] S points to an instance of the floating-point IIR lattice structure. - * @param[in] numStages number of stages in the filter. - * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. - * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. - * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_init_f32( - arm_iir_lattice_instance_f32 * S, - uint16_t numStages, - float32_t * pkCoeffs, - float32_t * pvCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 IIR lattice filter. - * @param[in] S points to an instance of the Q31 IIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_q31( - const arm_iir_lattice_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 IIR lattice filter. - * @param[in] S points to an instance of the Q31 IIR lattice structure. - * @param[in] numStages number of stages in the filter. - * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. - * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. - * @param[in] pState points to the state buffer. The array is of length numStages+blockSize. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_init_q31( - arm_iir_lattice_instance_q31 * S, - uint16_t numStages, - q31_t * pkCoeffs, - q31_t * pvCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 IIR lattice filter. - * @param[in] S points to an instance of the Q15 IIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_q15( - const arm_iir_lattice_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - -/** - * @brief Initialization function for the Q15 IIR lattice filter. - * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure. - * @param[in] numStages number of stages in the filter. - * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages. - * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. - * @param[in] pState points to state buffer. The array is of length numStages+blockSize. - * @param[in] blockSize number of samples to process per call. - */ - void arm_iir_lattice_init_q15( - arm_iir_lattice_instance_q15 * S, - uint16_t numStages, - q15_t * pkCoeffs, - q15_t * pvCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the floating-point LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - float32_t mu; /**< step size that controls filter coefficient updates. */ - } arm_lms_instance_f32; - - - /** - * @brief Processing function for floating-point LMS filter. - * @param[in] S points to an instance of the floating-point LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_f32( - const arm_lms_instance_f32 * S, - float32_t * pSrc, - float32_t * pRef, - float32_t * pOut, - float32_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for floating-point LMS filter. - * @param[in] S points to an instance of the floating-point LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to the coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_init_f32( - arm_lms_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - float32_t mu, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q15_t mu; /**< step size that controls filter coefficient updates. */ - uint32_t postShift; /**< bit shift applied to coefficients. */ - } arm_lms_instance_q15; - - - /** - * @brief Initialization function for the Q15 LMS filter. - * @param[in] S points to an instance of the Q15 LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to the coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_init_q15( - arm_lms_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - q15_t mu, - uint32_t blockSize, - uint32_t postShift); - - - /** - * @brief Processing function for Q15 LMS filter. - * @param[in] S points to an instance of the Q15 LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_q15( - const arm_lms_instance_q15 * S, - q15_t * pSrc, - q15_t * pRef, - q15_t * pOut, - q15_t * pErr, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q31 LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q31_t mu; /**< step size that controls filter coefficient updates. */ - uint32_t postShift; /**< bit shift applied to coefficients. */ - } arm_lms_instance_q31; - - - /** - * @brief Processing function for Q31 LMS filter. - * @param[in] S points to an instance of the Q15 LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_q31( - const arm_lms_instance_q31 * S, - q31_t * pSrc, - q31_t * pRef, - q31_t * pOut, - q31_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for Q31 LMS filter. - * @param[in] S points to an instance of the Q31 LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_init_q31( - arm_lms_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - q31_t mu, - uint32_t blockSize, - uint32_t postShift); - - - /** - * @brief Instance structure for the floating-point normalized LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - float32_t mu; /**< step size that control filter coefficient updates. */ - float32_t energy; /**< saves previous frame energy. */ - float32_t x0; /**< saves previous input sample. */ - } arm_lms_norm_instance_f32; - - - /** - * @brief Processing function for floating-point normalized LMS filter. - * @param[in] S points to an instance of the floating-point normalized LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_f32( - arm_lms_norm_instance_f32 * S, - float32_t * pSrc, - float32_t * pRef, - float32_t * pOut, - float32_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for floating-point normalized LMS filter. - * @param[in] S points to an instance of the floating-point LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_init_f32( - arm_lms_norm_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - float32_t mu, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q31 normalized LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q31_t mu; /**< step size that controls filter coefficient updates. */ - uint8_t postShift; /**< bit shift applied to coefficients. */ - q31_t *recipTable; /**< points to the reciprocal initial value table. */ - q31_t energy; /**< saves previous frame energy. */ - q31_t x0; /**< saves previous input sample. */ - } arm_lms_norm_instance_q31; - - - /** - * @brief Processing function for Q31 normalized LMS filter. - * @param[in] S points to an instance of the Q31 normalized LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_q31( - arm_lms_norm_instance_q31 * S, - q31_t * pSrc, - q31_t * pRef, - q31_t * pOut, - q31_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for Q31 normalized LMS filter. - * @param[in] S points to an instance of the Q31 normalized LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_norm_init_q31( - arm_lms_norm_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - q31_t mu, - uint32_t blockSize, - uint8_t postShift); - - - /** - * @brief Instance structure for the Q15 normalized LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< Number of coefficients in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q15_t mu; /**< step size that controls filter coefficient updates. */ - uint8_t postShift; /**< bit shift applied to coefficients. */ - q15_t *recipTable; /**< Points to the reciprocal initial value table. */ - q15_t energy; /**< saves previous frame energy. */ - q15_t x0; /**< saves previous input sample. */ - } arm_lms_norm_instance_q15; - - - /** - * @brief Processing function for Q15 normalized LMS filter. - * @param[in] S points to an instance of the Q15 normalized LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_q15( - arm_lms_norm_instance_q15 * S, - q15_t * pSrc, - q15_t * pRef, - q15_t * pOut, - q15_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for Q15 normalized LMS filter. - * @param[in] S points to an instance of the Q15 normalized LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_norm_init_q15( - arm_lms_norm_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - q15_t mu, - uint32_t blockSize, - uint8_t postShift); - - - /** - * @brief Correlation of floating-point sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_f32( - float32_t * pSrcA, - uint32_t srcALen, - float32_t * pSrcB, - uint32_t srcBLen, - float32_t * pDst); - - - /** - * @brief Correlation of Q15 sequences - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - */ - void arm_correlate_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch); - - - /** - * @brief Correlation of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - - void arm_correlate_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - - void arm_correlate_fast_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - */ - void arm_correlate_fast_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch); - - - /** - * @brief Correlation of Q31 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_fast_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Correlation of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). - */ - void arm_correlate_opt_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Correlation of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst); - - - /** - * @brief Instance structure for the floating-point sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_f32; - - /** - * @brief Instance structure for the Q31 sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_q31; - - /** - * @brief Instance structure for the Q15 sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_q15; - - /** - * @brief Instance structure for the Q7 sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_q7; - - - /** - * @brief Processing function for the floating-point sparse FIR filter. - * @param[in] S points to an instance of the floating-point sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_f32( - arm_fir_sparse_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - float32_t * pScratchIn, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point sparse FIR filter. - * @param[in,out] S points to an instance of the floating-point sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_f32( - arm_fir_sparse_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 sparse FIR filter. - * @param[in] S points to an instance of the Q31 sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_q31( - arm_fir_sparse_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - q31_t * pScratchIn, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 sparse FIR filter. - * @param[in,out] S points to an instance of the Q31 sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_q31( - arm_fir_sparse_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 sparse FIR filter. - * @param[in] S points to an instance of the Q15 sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] pScratchOut points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_q15( - arm_fir_sparse_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - q15_t * pScratchIn, - q31_t * pScratchOut, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 sparse FIR filter. - * @param[in,out] S points to an instance of the Q15 sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_q15( - arm_fir_sparse_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q7 sparse FIR filter. - * @param[in] S points to an instance of the Q7 sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] pScratchOut points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_q7( - arm_fir_sparse_instance_q7 * S, - q7_t * pSrc, - q7_t * pDst, - q7_t * pScratchIn, - q31_t * pScratchOut, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q7 sparse FIR filter. - * @param[in,out] S points to an instance of the Q7 sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_q7( - arm_fir_sparse_instance_q7 * S, - uint16_t numTaps, - q7_t * pCoeffs, - q7_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Floating-point sin_cos function. - * @param[in] theta input value in degrees - * @param[out] pSinVal points to the processed sine output. - * @param[out] pCosVal points to the processed cos output. - */ - void arm_sin_cos_f32( - float32_t theta, - float32_t * pSinVal, - float32_t * pCosVal); - - - /** - * @brief Q31 sin_cos function. - * @param[in] theta scaled input value in degrees - * @param[out] pSinVal points to the processed sine output. - * @param[out] pCosVal points to the processed cosine output. - */ - void arm_sin_cos_q31( - q31_t theta, - q31_t * pSinVal, - q31_t * pCosVal); - - - /** - * @brief Floating-point complex conjugate. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_conj_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t numSamples); - - /** - * @brief Q31 complex conjugate. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_conj_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex conjugate. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_conj_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @brief Floating-point complex magnitude squared - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_squared_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex magnitude squared - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_squared_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex magnitude squared - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_squared_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @ingroup groupController - */ - - /** - * @defgroup PID PID Motor Control - * - * A Proportional Integral Derivative (PID) controller is a generic feedback control - * loop mechanism widely used in industrial control systems. - * A PID controller is the most commonly used type of feedback controller. - * - * This set of functions implements (PID) controllers - * for Q15, Q31, and floating-point data types. The functions operate on a single sample - * of data and each call to the function returns a single processed value. - * S points to an instance of the PID control data structure. in - * is the input sample value. The functions return the output value. - * - * \par Algorithm: - *
-   *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
-   *    A0 = Kp + Ki + Kd
-   *    A1 = (-Kp ) - (2 * Kd )
-   *    A2 = Kd  
- * - * \par - * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant - * - * \par - * \image html PID.gif "Proportional Integral Derivative Controller" - * - * \par - * The PID controller calculates an "error" value as the difference between - * the measured output and the reference input. - * The controller attempts to minimize the error by adjusting the process control inputs. - * The proportional value determines the reaction to the current error, - * the integral value determines the reaction based on the sum of recent errors, - * and the derivative value determines the reaction based on the rate at which the error has been changing. - * - * \par Instance Structure - * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. - * A separate instance structure must be defined for each PID Controller. - * There are separate instance structure declarations for each of the 3 supported data types. - * - * \par Reset Functions - * There is also an associated reset function for each data type which clears the state array. - * - * \par Initialization Functions - * There is also an associated initialization function for each data type. - * The initialization function performs the following operations: - * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. - * - Zeros out the values in the state buffer. - * - * \par - * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. - * - * \par Fixed-Point Behavior - * Care must be taken when using the fixed-point versions of the PID Controller functions. - * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup PID - * @{ - */ - - /** - * @brief Process function for the floating-point PID Control. - * @param[in,out] S is an instance of the floating-point PID Control structure - * @param[in] in input sample to process - * @return out processed output sample. - */ - CMSIS_INLINE __STATIC_INLINE float32_t arm_pid_f32( - arm_pid_instance_f32 * S, - float32_t in) - { - float32_t out; - - /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ - out = (S->A0 * in) + - (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); - - /* Update state */ - S->state[1] = S->state[0]; - S->state[0] = in; - S->state[2] = out; - - /* return to application */ - return (out); - - } - - /** - * @brief Process function for the Q31 PID Control. - * @param[in,out] S points to an instance of the Q31 PID Control structure - * @param[in] in input sample to process - * @return out processed output sample. - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 64-bit accumulator. - * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. - * Thus, if the accumulator result overflows it wraps around rather than clip. - * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. - * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. - */ - CMSIS_INLINE __STATIC_INLINE q31_t arm_pid_q31( - arm_pid_instance_q31 * S, - q31_t in) - { - q63_t acc; - q31_t out; - - /* acc = A0 * x[n] */ - acc = (q63_t) S->A0 * in; - - /* acc += A1 * x[n-1] */ - acc += (q63_t) S->A1 * S->state[0]; - - /* acc += A2 * x[n-2] */ - acc += (q63_t) S->A2 * S->state[1]; - - /* convert output to 1.31 format to add y[n-1] */ - out = (q31_t) (acc >> 31U); - - /* out += y[n-1] */ - out += S->state[2]; - - /* Update state */ - S->state[1] = S->state[0]; - S->state[0] = in; - S->state[2] = out; - - /* return to application */ - return (out); - } - - - /** - * @brief Process function for the Q15 PID Control. - * @param[in,out] S points to an instance of the Q15 PID Control structure - * @param[in] in input sample to process - * @return out processed output sample. - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using a 64-bit internal accumulator. - * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. - * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. - * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. - * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. - * Lastly, the accumulator is saturated to yield a result in 1.15 format. - */ - CMSIS_INLINE __STATIC_INLINE q15_t arm_pid_q15( - arm_pid_instance_q15 * S, - q15_t in) - { - q63_t acc; - q15_t out; - -#if defined (ARM_MATH_DSP) - __SIMD32_TYPE *vstate; - - /* Implementation of PID controller */ - - /* acc = A0 * x[n] */ - acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in); - - /* acc += A1 * x[n-1] + A2 * x[n-2] */ - vstate = __SIMD32_CONST(S->state); - acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)*vstate, (uint64_t)acc); -#else - /* acc = A0 * x[n] */ - acc = ((q31_t) S->A0) * in; - - /* acc += A1 * x[n-1] + A2 * x[n-2] */ - acc += (q31_t) S->A1 * S->state[0]; - acc += (q31_t) S->A2 * S->state[1]; -#endif - - /* acc += y[n-1] */ - acc += (q31_t) S->state[2] << 15; - - /* saturate the output */ - out = (q15_t) (__SSAT((acc >> 15), 16)); - - /* Update state */ - S->state[1] = S->state[0]; - S->state[0] = in; - S->state[2] = out; - - /* return to application */ - return (out); - } - - /** - * @} end of PID group - */ - - - /** - * @brief Floating-point matrix inverse. - * @param[in] src points to the instance of the input floating-point matrix structure. - * @param[out] dst points to the instance of the output floating-point matrix structure. - * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. - * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. - */ - arm_status arm_mat_inverse_f32( - const arm_matrix_instance_f32 * src, - arm_matrix_instance_f32 * dst); - - - /** - * @brief Floating-point matrix inverse. - * @param[in] src points to the instance of the input floating-point matrix structure. - * @param[out] dst points to the instance of the output floating-point matrix structure. - * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. - * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. - */ - arm_status arm_mat_inverse_f64( - const arm_matrix_instance_f64 * src, - arm_matrix_instance_f64 * dst); - - - - /** - * @ingroup groupController - */ - - /** - * @defgroup clarke Vector Clarke Transform - * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. - * Generally the Clarke transform uses three-phase currents Ia, Ib and Ic to calculate currents - * in the two-phase orthogonal stator axis Ialpha and Ibeta. - * When Ialpha is superposed with Ia as shown in the figure below - * \image html clarke.gif Stator current space vector and its components in (a,b). - * and Ia + Ib + Ic = 0, in this condition Ialpha and Ibeta - * can be calculated using only Ia and Ib. - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html clarkeFormula.gif - * where Ia and Ib are the instantaneous stator phases and - * pIalpha and pIbeta are the two coordinates of time invariant vector. - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Clarke transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup clarke - * @{ - */ - - /** - * - * @brief Floating-point Clarke transform - * @param[in] Ia input three-phase coordinate a - * @param[in] Ib input three-phase coordinate b - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - */ - CMSIS_INLINE __STATIC_INLINE void arm_clarke_f32( - float32_t Ia, - float32_t Ib, - float32_t * pIalpha, - float32_t * pIbeta) - { - /* Calculate pIalpha using the equation, pIalpha = Ia */ - *pIalpha = Ia; - - /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ - *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); - } - - - /** - * @brief Clarke transform for Q31 version - * @param[in] Ia input three-phase coordinate a - * @param[in] Ib input three-phase coordinate b - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the addition, hence there is no risk of overflow. - */ - CMSIS_INLINE __STATIC_INLINE void arm_clarke_q31( - q31_t Ia, - q31_t Ib, - q31_t * pIalpha, - q31_t * pIbeta) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - - /* Calculating pIalpha from Ia by equation pIalpha = Ia */ - *pIalpha = Ia; - - /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ - product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); - - /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ - product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); - - /* pIbeta is calculated by adding the intermediate products */ - *pIbeta = __QADD(product1, product2); - } - - /** - * @} end of clarke group - */ - - /** - * @brief Converts the elements of the Q7 vector to Q31 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_q7_to_q31( - q7_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - - /** - * @ingroup groupController - */ - - /** - * @defgroup inv_clarke Vector Inverse Clarke Transform - * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html clarkeInvFormula.gif - * where pIa and pIb are the instantaneous stator phases and - * Ialpha and Ibeta are the two coordinates of time invariant vector. - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Clarke transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup inv_clarke - * @{ - */ - - /** - * @brief Floating-point Inverse Clarke transform - * @param[in] Ialpha input two-phase orthogonal vector axis alpha - * @param[in] Ibeta input two-phase orthogonal vector axis beta - * @param[out] pIa points to output three-phase coordinate a - * @param[out] pIb points to output three-phase coordinate b - */ - CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_f32( - float32_t Ialpha, - float32_t Ibeta, - float32_t * pIa, - float32_t * pIb) - { - /* Calculating pIa from Ialpha by equation pIa = Ialpha */ - *pIa = Ialpha; - - /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ - *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta; - } - - - /** - * @brief Inverse Clarke transform for Q31 version - * @param[in] Ialpha input two-phase orthogonal vector axis alpha - * @param[in] Ibeta input two-phase orthogonal vector axis beta - * @param[out] pIa points to output three-phase coordinate a - * @param[out] pIb points to output three-phase coordinate b - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the subtraction, hence there is no risk of overflow. - */ - CMSIS_INLINE __STATIC_INLINE void arm_inv_clarke_q31( - q31_t Ialpha, - q31_t Ibeta, - q31_t * pIa, - q31_t * pIb) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - - /* Calculating pIa from Ialpha by equation pIa = Ialpha */ - *pIa = Ialpha; - - /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ - product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); - - /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ - product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); - - /* pIb is calculated by subtracting the products */ - *pIb = __QSUB(product2, product1); - } - - /** - * @} end of inv_clarke group - */ - - /** - * @brief Converts the elements of the Q7 vector to Q15 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_q7_to_q15( - q7_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - - /** - * @ingroup groupController - */ - - /** - * @defgroup park Vector Park Transform - * - * Forward Park transform converts the input two-coordinate vector to flux and torque components. - * The Park transform can be used to realize the transformation of the Ialpha and the Ibeta currents - * from the stationary to the moving reference frame and control the spatial relationship between - * the stator vector current and rotor flux vector. - * If we consider the d axis aligned with the rotor flux, the diagram below shows the - * current vector and the relationship from the two reference frames: - * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html parkFormula.gif - * where Ialpha and Ibeta are the stator vector components, - * pId and pIq are rotor vector components and cosVal and sinVal are the - * cosine and sine values of theta (rotor flux position). - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Park transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup park - * @{ - */ - - /** - * @brief Floating-point Park transform - * @param[in] Ialpha input two-phase vector coordinate alpha - * @param[in] Ibeta input two-phase vector coordinate beta - * @param[out] pId points to output rotor reference frame d - * @param[out] pIq points to output rotor reference frame q - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - * - * The function implements the forward Park transform. - * - */ - CMSIS_INLINE __STATIC_INLINE void arm_park_f32( - float32_t Ialpha, - float32_t Ibeta, - float32_t * pId, - float32_t * pIq, - float32_t sinVal, - float32_t cosVal) - { - /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ - *pId = Ialpha * cosVal + Ibeta * sinVal; - - /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ - *pIq = -Ialpha * sinVal + Ibeta * cosVal; - } - - - /** - * @brief Park transform for Q31 version - * @param[in] Ialpha input two-phase vector coordinate alpha - * @param[in] Ibeta input two-phase vector coordinate beta - * @param[out] pId points to output rotor reference frame d - * @param[out] pIq points to output rotor reference frame q - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the addition and subtraction, hence there is no risk of overflow. - */ - CMSIS_INLINE __STATIC_INLINE void arm_park_q31( - q31_t Ialpha, - q31_t Ibeta, - q31_t * pId, - q31_t * pIq, - q31_t sinVal, - q31_t cosVal) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - q31_t product3, product4; /* Temporary variables used to store intermediate results */ - - /* Intermediate product is calculated by (Ialpha * cosVal) */ - product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); - - /* Intermediate product is calculated by (Ibeta * sinVal) */ - product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); - - - /* Intermediate product is calculated by (Ialpha * sinVal) */ - product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); - - /* Intermediate product is calculated by (Ibeta * cosVal) */ - product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); - - /* Calculate pId by adding the two intermediate products 1 and 2 */ - *pId = __QADD(product1, product2); - - /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ - *pIq = __QSUB(product4, product3); - } - - /** - * @} end of park group - */ - - /** - * @brief Converts the elements of the Q7 vector to floating-point vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q7_to_float( - q7_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @ingroup groupController - */ - - /** - * @defgroup inv_park Vector Inverse Park transform - * Inverse Park transform converts the input flux and torque components to two-coordinate vector. - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html parkInvFormula.gif - * where pIalpha and pIbeta are the stator vector components, - * Id and Iq are rotor vector components and cosVal and sinVal are the - * cosine and sine values of theta (rotor flux position). - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Park transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup inv_park - * @{ - */ - - /** - * @brief Floating-point Inverse Park transform - * @param[in] Id input coordinate of rotor reference frame d - * @param[in] Iq input coordinate of rotor reference frame q - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - */ - CMSIS_INLINE __STATIC_INLINE void arm_inv_park_f32( - float32_t Id, - float32_t Iq, - float32_t * pIalpha, - float32_t * pIbeta, - float32_t sinVal, - float32_t cosVal) - { - /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ - *pIalpha = Id * cosVal - Iq * sinVal; - - /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ - *pIbeta = Id * sinVal + Iq * cosVal; - } - - - /** - * @brief Inverse Park transform for Q31 version - * @param[in] Id input coordinate of rotor reference frame d - * @param[in] Iq input coordinate of rotor reference frame q - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the addition, hence there is no risk of overflow. - */ - CMSIS_INLINE __STATIC_INLINE void arm_inv_park_q31( - q31_t Id, - q31_t Iq, - q31_t * pIalpha, - q31_t * pIbeta, - q31_t sinVal, - q31_t cosVal) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - q31_t product3, product4; /* Temporary variables used to store intermediate results */ - - /* Intermediate product is calculated by (Id * cosVal) */ - product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); - - /* Intermediate product is calculated by (Iq * sinVal) */ - product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); - - - /* Intermediate product is calculated by (Id * sinVal) */ - product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); - - /* Intermediate product is calculated by (Iq * cosVal) */ - product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); - - /* Calculate pIalpha by using the two intermediate products 1 and 2 */ - *pIalpha = __QSUB(product1, product2); - - /* Calculate pIbeta by using the two intermediate products 3 and 4 */ - *pIbeta = __QADD(product4, product3); - } - - /** - * @} end of Inverse park group - */ - - - /** - * @brief Converts the elements of the Q31 vector to floating-point vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q31_to_float( - q31_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - /** - * @ingroup groupInterpolation - */ - - /** - * @defgroup LinearInterpolate Linear Interpolation - * - * Linear interpolation is a method of curve fitting using linear polynomials. - * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line - * - * \par - * \image html LinearInterp.gif "Linear interpolation" - * - * \par - * A Linear Interpolate function calculates an output value(y), for the input(x) - * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) - * - * \par Algorithm: - *
-   *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
-   *       where x0, x1 are nearest values of input x
-   *             y0, y1 are nearest values to output y
-   * 
- * - * \par - * This set of functions implements Linear interpolation process - * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single - * sample of data and each call to the function returns a single processed value. - * S points to an instance of the Linear Interpolate function data structure. - * x is the input sample value. The functions returns the output value. - * - * \par - * if x is outside of the table boundary, Linear interpolation returns first value of the table - * if x is below input range and returns last value of table if x is above range. - */ - - /** - * @addtogroup LinearInterpolate - * @{ - */ - - /** - * @brief Process function for the floating-point Linear Interpolation Function. - * @param[in,out] S is an instance of the floating-point Linear Interpolation structure - * @param[in] x input sample to process - * @return y processed output sample. - * - */ - CMSIS_INLINE __STATIC_INLINE float32_t arm_linear_interp_f32( - arm_linear_interp_instance_f32 * S, - float32_t x) - { - float32_t y; - float32_t x0, x1; /* Nearest input values */ - float32_t y0, y1; /* Nearest output values */ - float32_t xSpacing = S->xSpacing; /* spacing between input values */ - int32_t i; /* Index variable */ - float32_t *pYData = S->pYData; /* pointer to output table */ - - /* Calculation of index */ - i = (int32_t) ((x - S->x1) / xSpacing); - - if (i < 0) - { - /* Iniatilize output for below specified range as least output value of table */ - y = pYData[0]; - } - else if ((uint32_t)i >= S->nValues) - { - /* Iniatilize output for above specified range as last output value of table */ - y = pYData[S->nValues - 1]; - } - else - { - /* Calculation of nearest input values */ - x0 = S->x1 + i * xSpacing; - x1 = S->x1 + (i + 1) * xSpacing; - - /* Read of nearest output values */ - y0 = pYData[i]; - y1 = pYData[i + 1]; - - /* Calculation of output */ - y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); - - } - - /* returns output value */ - return (y); - } - - - /** - * - * @brief Process function for the Q31 Linear Interpolation Function. - * @param[in] pYData pointer to Q31 Linear Interpolation table - * @param[in] x input sample to process - * @param[in] nValues number of table values - * @return y processed output sample. - * - * \par - * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. - * This function can support maximum of table size 2^12. - * - */ - CMSIS_INLINE __STATIC_INLINE q31_t arm_linear_interp_q31( - q31_t * pYData, - q31_t x, - uint32_t nValues) - { - q31_t y; /* output */ - q31_t y0, y1; /* Nearest output values */ - q31_t fract; /* fractional part */ - int32_t index; /* Index to read nearest output values */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - index = ((x & (q31_t)0xFFF00000) >> 20); - - if (index >= (int32_t)(nValues - 1)) - { - return (pYData[nValues - 1]); - } - else if (index < 0) - { - return (pYData[0]); - } - else - { - /* 20 bits for the fractional part */ - /* shift left by 11 to keep fract in 1.31 format */ - fract = (x & 0x000FFFFF) << 11; - - /* Read two nearest output values from the index in 1.31(q31) format */ - y0 = pYData[index]; - y1 = pYData[index + 1]; - - /* Calculation of y0 * (1-fract) and y is in 2.30 format */ - y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); - - /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ - y += ((q31_t) (((q63_t) y1 * fract) >> 32)); - - /* Convert y to 1.31 format */ - return (y << 1U); - } - } - - - /** - * - * @brief Process function for the Q15 Linear Interpolation Function. - * @param[in] pYData pointer to Q15 Linear Interpolation table - * @param[in] x input sample to process - * @param[in] nValues number of table values - * @return y processed output sample. - * - * \par - * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. - * This function can support maximum of table size 2^12. - * - */ - CMSIS_INLINE __STATIC_INLINE q15_t arm_linear_interp_q15( - q15_t * pYData, - q31_t x, - uint32_t nValues) - { - q63_t y; /* output */ - q15_t y0, y1; /* Nearest output values */ - q31_t fract; /* fractional part */ - int32_t index; /* Index to read nearest output values */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - index = ((x & (int32_t)0xFFF00000) >> 20); - - if (index >= (int32_t)(nValues - 1)) - { - return (pYData[nValues - 1]); - } - else if (index < 0) - { - return (pYData[0]); - } - else - { - /* 20 bits for the fractional part */ - /* fract is in 12.20 format */ - fract = (x & 0x000FFFFF); - - /* Read two nearest output values from the index */ - y0 = pYData[index]; - y1 = pYData[index + 1]; - - /* Calculation of y0 * (1-fract) and y is in 13.35 format */ - y = ((q63_t) y0 * (0xFFFFF - fract)); - - /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ - y += ((q63_t) y1 * (fract)); - - /* convert y to 1.15 format */ - return (q15_t) (y >> 20); - } - } - - - /** - * - * @brief Process function for the Q7 Linear Interpolation Function. - * @param[in] pYData pointer to Q7 Linear Interpolation table - * @param[in] x input sample to process - * @param[in] nValues number of table values - * @return y processed output sample. - * - * \par - * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. - * This function can support maximum of table size 2^12. - */ - CMSIS_INLINE __STATIC_INLINE q7_t arm_linear_interp_q7( - q7_t * pYData, - q31_t x, - uint32_t nValues) - { - q31_t y; /* output */ - q7_t y0, y1; /* Nearest output values */ - q31_t fract; /* fractional part */ - uint32_t index; /* Index to read nearest output values */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - if (x < 0) - { - return (pYData[0]); - } - index = (x >> 20) & 0xfff; - - if (index >= (nValues - 1)) - { - return (pYData[nValues - 1]); - } - else - { - /* 20 bits for the fractional part */ - /* fract is in 12.20 format */ - fract = (x & 0x000FFFFF); - - /* Read two nearest output values from the index and are in 1.7(q7) format */ - y0 = pYData[index]; - y1 = pYData[index + 1]; - - /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ - y = ((y0 * (0xFFFFF - fract))); - - /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ - y += (y1 * fract); - - /* convert y to 1.7(q7) format */ - return (q7_t) (y >> 20); - } - } - - /** - * @} end of LinearInterpolate group - */ - - /** - * @brief Fast approximation to the trigonometric sine function for floating-point data. - * @param[in] x input value in radians. - * @return sin(x). - */ - float32_t arm_sin_f32( - float32_t x); - - - /** - * @brief Fast approximation to the trigonometric sine function for Q31 data. - * @param[in] x Scaled input value in radians. - * @return sin(x). - */ - q31_t arm_sin_q31( - q31_t x); - - - /** - * @brief Fast approximation to the trigonometric sine function for Q15 data. - * @param[in] x Scaled input value in radians. - * @return sin(x). - */ - q15_t arm_sin_q15( - q15_t x); - - - /** - * @brief Fast approximation to the trigonometric cosine function for floating-point data. - * @param[in] x input value in radians. - * @return cos(x). - */ - float32_t arm_cos_f32( - float32_t x); - - - /** - * @brief Fast approximation to the trigonometric cosine function for Q31 data. - * @param[in] x Scaled input value in radians. - * @return cos(x). - */ - q31_t arm_cos_q31( - q31_t x); - - - /** - * @brief Fast approximation to the trigonometric cosine function for Q15 data. - * @param[in] x Scaled input value in radians. - * @return cos(x). - */ - q15_t arm_cos_q15( - q15_t x); - - - /** - * @ingroup groupFastMath - */ - - - /** - * @defgroup SQRT Square Root - * - * Computes the square root of a number. - * There are separate functions for Q15, Q31, and floating-point data types. - * The square root function is computed using the Newton-Raphson algorithm. - * This is an iterative algorithm of the form: - *
-   *      x1 = x0 - f(x0)/f'(x0)
-   * 
- * where x1 is the current estimate, - * x0 is the previous estimate, and - * f'(x0) is the derivative of f() evaluated at x0. - * For the square root function, the algorithm reduces to: - *
-   *     x0 = in/2                         [initial guess]
-   *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]
-   * 
- */ - - - /** - * @addtogroup SQRT - * @{ - */ - - /** - * @brief Floating-point square root function. - * @param[in] in input value. - * @param[out] pOut square root of input value. - * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if - * in is negative value and returns zero output for negative values. - */ - CMSIS_INLINE __STATIC_INLINE arm_status arm_sqrt_f32( - float32_t in, - float32_t * pOut) - { - if (in >= 0.0f) - { - -#if (__FPU_USED == 1) && defined ( __CC_ARM ) - *pOut = __sqrtf(in); -#elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) - *pOut = __builtin_sqrtf(in); -#elif (__FPU_USED == 1) && defined(__GNUC__) - *pOut = __builtin_sqrtf(in); -#elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000) - __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in)); -#else - *pOut = sqrtf(in); -#endif - - return (ARM_MATH_SUCCESS); - } - else - { - *pOut = 0.0f; - return (ARM_MATH_ARGUMENT_ERROR); - } - } - - - /** - * @brief Q31 square root function. - * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. - * @param[out] pOut square root of input value. - * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if - * in is negative value and returns zero output for negative values. - */ - arm_status arm_sqrt_q31( - q31_t in, - q31_t * pOut); - - - /** - * @brief Q15 square root function. - * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. - * @param[out] pOut square root of input value. - * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if - * in is negative value and returns zero output for negative values. - */ - arm_status arm_sqrt_q15( - q15_t in, - q15_t * pOut); - - /** - * @} end of SQRT group - */ - - - /** - * @brief floating-point Circular write function. - */ - CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_f32( - int32_t * circBuffer, - int32_t L, - uint16_t * writeOffset, - int32_t bufferInc, - const int32_t * src, - int32_t srcInc, - uint32_t blockSize) - { - uint32_t i = 0U; - int32_t wOffset; - - /* Copy the value of Index pointer that points - * to the current location where the input samples to be copied */ - wOffset = *writeOffset; - - /* Loop over the blockSize */ - i = blockSize; - - while (i > 0U) - { - /* copy the input sample to the circular buffer */ - circBuffer[wOffset] = *src; - - /* Update the input pointer */ - src += srcInc; - - /* Circularly update wOffset. Watch out for positive and negative value */ - wOffset += bufferInc; - if (wOffset >= L) - wOffset -= L; - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *writeOffset = (uint16_t)wOffset; - } - - - - /** - * @brief floating-point Circular Read function. - */ - CMSIS_INLINE __STATIC_INLINE void arm_circularRead_f32( - int32_t * circBuffer, - int32_t L, - int32_t * readOffset, - int32_t bufferInc, - int32_t * dst, - int32_t * dst_base, - int32_t dst_length, - int32_t dstInc, - uint32_t blockSize) - { - uint32_t i = 0U; - int32_t rOffset, dst_end; - - /* Copy the value of Index pointer that points - * to the current location from where the input samples to be read */ - rOffset = *readOffset; - dst_end = (int32_t) (dst_base + dst_length); - - /* Loop over the blockSize */ - i = blockSize; - - while (i > 0U) - { - /* copy the sample from the circular buffer to the destination buffer */ - *dst = circBuffer[rOffset]; - - /* Update the input pointer */ - dst += dstInc; - - if (dst == (int32_t *) dst_end) - { - dst = dst_base; - } - - /* Circularly update rOffset. Watch out for positive and negative value */ - rOffset += bufferInc; - - if (rOffset >= L) - { - rOffset -= L; - } - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *readOffset = rOffset; - } - - - /** - * @brief Q15 Circular write function. - */ - CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q15( - q15_t * circBuffer, - int32_t L, - uint16_t * writeOffset, - int32_t bufferInc, - const q15_t * src, - int32_t srcInc, - uint32_t blockSize) - { - uint32_t i = 0U; - int32_t wOffset; - - /* Copy the value of Index pointer that points - * to the current location where the input samples to be copied */ - wOffset = *writeOffset; - - /* Loop over the blockSize */ - i = blockSize; - - while (i > 0U) - { - /* copy the input sample to the circular buffer */ - circBuffer[wOffset] = *src; - - /* Update the input pointer */ - src += srcInc; - - /* Circularly update wOffset. Watch out for positive and negative value */ - wOffset += bufferInc; - if (wOffset >= L) - wOffset -= L; - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *writeOffset = (uint16_t)wOffset; - } - - - /** - * @brief Q15 Circular Read function. - */ - CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q15( - q15_t * circBuffer, - int32_t L, - int32_t * readOffset, - int32_t bufferInc, - q15_t * dst, - q15_t * dst_base, - int32_t dst_length, - int32_t dstInc, - uint32_t blockSize) - { - uint32_t i = 0; - int32_t rOffset, dst_end; - - /* Copy the value of Index pointer that points - * to the current location from where the input samples to be read */ - rOffset = *readOffset; - - dst_end = (int32_t) (dst_base + dst_length); - - /* Loop over the blockSize */ - i = blockSize; - - while (i > 0U) - { - /* copy the sample from the circular buffer to the destination buffer */ - *dst = circBuffer[rOffset]; - - /* Update the input pointer */ - dst += dstInc; - - if (dst == (q15_t *) dst_end) - { - dst = dst_base; - } - - /* Circularly update wOffset. Watch out for positive and negative value */ - rOffset += bufferInc; - - if (rOffset >= L) - { - rOffset -= L; - } - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *readOffset = rOffset; - } - - - /** - * @brief Q7 Circular write function. - */ - CMSIS_INLINE __STATIC_INLINE void arm_circularWrite_q7( - q7_t * circBuffer, - int32_t L, - uint16_t * writeOffset, - int32_t bufferInc, - const q7_t * src, - int32_t srcInc, - uint32_t blockSize) - { - uint32_t i = 0U; - int32_t wOffset; - - /* Copy the value of Index pointer that points - * to the current location where the input samples to be copied */ - wOffset = *writeOffset; - - /* Loop over the blockSize */ - i = blockSize; - - while (i > 0U) - { - /* copy the input sample to the circular buffer */ - circBuffer[wOffset] = *src; - - /* Update the input pointer */ - src += srcInc; - - /* Circularly update wOffset. Watch out for positive and negative value */ - wOffset += bufferInc; - if (wOffset >= L) - wOffset -= L; - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *writeOffset = (uint16_t)wOffset; - } - - - /** - * @brief Q7 Circular Read function. - */ - CMSIS_INLINE __STATIC_INLINE void arm_circularRead_q7( - q7_t * circBuffer, - int32_t L, - int32_t * readOffset, - int32_t bufferInc, - q7_t * dst, - q7_t * dst_base, - int32_t dst_length, - int32_t dstInc, - uint32_t blockSize) - { - uint32_t i = 0; - int32_t rOffset, dst_end; - - /* Copy the value of Index pointer that points - * to the current location from where the input samples to be read */ - rOffset = *readOffset; - - dst_end = (int32_t) (dst_base + dst_length); - - /* Loop over the blockSize */ - i = blockSize; - - while (i > 0U) - { - /* copy the sample from the circular buffer to the destination buffer */ - *dst = circBuffer[rOffset]; - - /* Update the input pointer */ - dst += dstInc; - - if (dst == (q7_t *) dst_end) - { - dst = dst_base; - } - - /* Circularly update rOffset. Watch out for positive and negative value */ - rOffset += bufferInc; - - if (rOffset >= L) - { - rOffset -= L; - } - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *readOffset = rOffset; - } - - - /** - * @brief Sum of the squares of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_q31( - q31_t * pSrc, - uint32_t blockSize, - q63_t * pResult); - - - /** - * @brief Sum of the squares of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Sum of the squares of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_q15( - q15_t * pSrc, - uint32_t blockSize, - q63_t * pResult); - - - /** - * @brief Sum of the squares of the elements of a Q7 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_q7( - q7_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Mean value of a Q7 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_q7( - q7_t * pSrc, - uint32_t blockSize, - q7_t * pResult); - - - /** - * @brief Mean value of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Mean value of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Mean value of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Variance of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_var_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Variance of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_var_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Variance of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_var_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Root Mean Square of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_rms_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Root Mean Square of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_rms_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Root Mean Square of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_rms_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Standard deviation of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_std_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Standard deviation of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_std_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Standard deviation of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_std_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Floating-point complex magnitude - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex magnitude - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex magnitude - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex dot product - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] numSamples number of complex samples in each vector - * @param[out] realResult real part of the result returned here - * @param[out] imagResult imaginary part of the result returned here - */ - void arm_cmplx_dot_prod_q15( - q15_t * pSrcA, - q15_t * pSrcB, - uint32_t numSamples, - q31_t * realResult, - q31_t * imagResult); - - - /** - * @brief Q31 complex dot product - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] numSamples number of complex samples in each vector - * @param[out] realResult real part of the result returned here - * @param[out] imagResult imaginary part of the result returned here - */ - void arm_cmplx_dot_prod_q31( - q31_t * pSrcA, - q31_t * pSrcB, - uint32_t numSamples, - q63_t * realResult, - q63_t * imagResult); - - - /** - * @brief Floating-point complex dot product - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] numSamples number of complex samples in each vector - * @param[out] realResult real part of the result returned here - * @param[out] imagResult imaginary part of the result returned here - */ - void arm_cmplx_dot_prod_f32( - float32_t * pSrcA, - float32_t * pSrcB, - uint32_t numSamples, - float32_t * realResult, - float32_t * imagResult); - - - /** - * @brief Q15 complex-by-real multiplication - * @param[in] pSrcCmplx points to the complex input vector - * @param[in] pSrcReal points to the real input vector - * @param[out] pCmplxDst points to the complex output vector - * @param[in] numSamples number of samples in each vector - */ - void arm_cmplx_mult_real_q15( - q15_t * pSrcCmplx, - q15_t * pSrcReal, - q15_t * pCmplxDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex-by-real multiplication - * @param[in] pSrcCmplx points to the complex input vector - * @param[in] pSrcReal points to the real input vector - * @param[out] pCmplxDst points to the complex output vector - * @param[in] numSamples number of samples in each vector - */ - void arm_cmplx_mult_real_q31( - q31_t * pSrcCmplx, - q31_t * pSrcReal, - q31_t * pCmplxDst, - uint32_t numSamples); - - - /** - * @brief Floating-point complex-by-real multiplication - * @param[in] pSrcCmplx points to the complex input vector - * @param[in] pSrcReal points to the real input vector - * @param[out] pCmplxDst points to the complex output vector - * @param[in] numSamples number of samples in each vector - */ - void arm_cmplx_mult_real_f32( - float32_t * pSrcCmplx, - float32_t * pSrcReal, - float32_t * pCmplxDst, - uint32_t numSamples); - - - /** - * @brief Minimum value of a Q7 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] result is output pointer - * @param[in] index is the array index of the minimum value in the input buffer. - */ - void arm_min_q7( - q7_t * pSrc, - uint32_t blockSize, - q7_t * result, - uint32_t * index); - - - /** - * @brief Minimum value of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output pointer - * @param[in] pIndex is the array index of the minimum value in the input buffer. - */ - void arm_min_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult, - uint32_t * pIndex); - - - /** - * @brief Minimum value of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output pointer - * @param[out] pIndex is the array index of the minimum value in the input buffer. - */ - void arm_min_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult, - uint32_t * pIndex); - - - /** - * @brief Minimum value of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output pointer - * @param[out] pIndex is the array index of the minimum value in the input buffer. - */ - void arm_min_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a Q7 vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_q7( - q7_t * pSrc, - uint32_t blockSize, - q7_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a Q15 vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a Q31 vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a floating-point vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult, - uint32_t * pIndex); - - - /** - * @brief Q15 complex-by-complex multiplication - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_mult_cmplx_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex-by-complex multiplication - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_mult_cmplx_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Floating-point complex-by-complex multiplication - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_mult_cmplx_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t numSamples); - - - /** - * @brief Converts the elements of the floating-point vector to Q31 vector. - * @param[in] pSrc points to the floating-point input vector - * @param[out] pDst points to the Q31 output vector - * @param[in] blockSize length of the input vector - */ - void arm_float_to_q31( - float32_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the floating-point vector to Q15 vector. - * @param[in] pSrc points to the floating-point input vector - * @param[out] pDst points to the Q15 output vector - * @param[in] blockSize length of the input vector - */ - void arm_float_to_q15( - float32_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the floating-point vector to Q7 vector. - * @param[in] pSrc points to the floating-point input vector - * @param[out] pDst points to the Q7 output vector - * @param[in] blockSize length of the input vector - */ - void arm_float_to_q7( - float32_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q31 vector to Q15 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q31_to_q15( - q31_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q31 vector to Q7 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q31_to_q7( - q31_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q15 vector to floating-point vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q15_to_float( - q15_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q15 vector to Q31 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q15_to_q31( - q15_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q15 vector to Q7 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q15_to_q7( - q15_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @ingroup groupInterpolation - */ - - /** - * @defgroup BilinearInterpolate Bilinear Interpolation - * - * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. - * The underlying function f(x, y) is sampled on a regular grid and the interpolation process - * determines values between the grid points. - * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. - * Bilinear interpolation is often used in image processing to rescale images. - * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. - * - * Algorithm - * \par - * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. - * For floating-point, the instance structure is defined as: - *
-   *   typedef struct
-   *   {
-   *     uint16_t numRows;
-   *     uint16_t numCols;
-   *     float32_t *pData;
-   * } arm_bilinear_interp_instance_f32;
-   * 
- * - * \par - * where numRows specifies the number of rows in the table; - * numCols specifies the number of columns in the table; - * and pData points to an array of size numRows*numCols values. - * The data table pTable is organized in row order and the supplied data values fall on integer indexes. - * That is, table element (x,y) is located at pTable[x + y*numCols] where x and y are integers. - * - * \par - * Let (x, y) specify the desired interpolation point. Then define: - *
-   *     XF = floor(x)
-   *     YF = floor(y)
-   * 
- * \par - * The interpolated output point is computed as: - *
-   *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
-   *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))
-   *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)
-   *           + f(XF+1, YF+1) * (x-XF)*(y-YF)
-   * 
- * Note that the coordinates (x, y) contain integer and fractional components. - * The integer components specify which portion of the table to use while the - * fractional components control the interpolation processor. - * - * \par - * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. - */ - - /** - * @addtogroup BilinearInterpolate - * @{ - */ - - - /** - * - * @brief Floating-point bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate. - * @param[in] Y interpolation coordinate. - * @return out interpolated value. - */ - CMSIS_INLINE __STATIC_INLINE float32_t arm_bilinear_interp_f32( - const arm_bilinear_interp_instance_f32 * S, - float32_t X, - float32_t Y) - { - float32_t out; - float32_t f00, f01, f10, f11; - float32_t *pData = S->pData; - int32_t xIndex, yIndex, index; - float32_t xdiff, ydiff; - float32_t b1, b2, b3, b4; - - xIndex = (int32_t) X; - yIndex = (int32_t) Y; - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if (xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1)) - { - return (0); - } - - /* Calculation of index for two nearest points in X-direction */ - index = (xIndex - 1) + (yIndex - 1) * S->numCols; - - - /* Read two nearest points in X-direction */ - f00 = pData[index]; - f01 = pData[index + 1]; - - /* Calculation of index for two nearest points in Y-direction */ - index = (xIndex - 1) + (yIndex) * S->numCols; - - - /* Read two nearest points in Y-direction */ - f10 = pData[index]; - f11 = pData[index + 1]; - - /* Calculation of intermediate values */ - b1 = f00; - b2 = f01 - f00; - b3 = f10 - f00; - b4 = f00 - f01 - f10 + f11; - - /* Calculation of fractional part in X */ - xdiff = X - xIndex; - - /* Calculation of fractional part in Y */ - ydiff = Y - yIndex; - - /* Calculation of bi-linear interpolated output */ - out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; - - /* return to application */ - return (out); - } - - - /** - * - * @brief Q31 bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate in 12.20 format. - * @param[in] Y interpolation coordinate in 12.20 format. - * @return out interpolated value. - */ - CMSIS_INLINE __STATIC_INLINE q31_t arm_bilinear_interp_q31( - arm_bilinear_interp_instance_q31 * S, - q31_t X, - q31_t Y) - { - q31_t out; /* Temporary output */ - q31_t acc = 0; /* output */ - q31_t xfract, yfract; /* X, Y fractional parts */ - q31_t x1, x2, y1, y2; /* Nearest output values */ - int32_t rI, cI; /* Row and column indices */ - q31_t *pYData = S->pData; /* pointer to output table values */ - uint32_t nCols = S->numCols; /* num of rows */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - rI = ((X & (q31_t)0xFFF00000) >> 20); - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - cI = ((Y & (q31_t)0xFFF00000) >> 20); - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) - { - return (0); - } - - /* 20 bits for the fractional part */ - /* shift left xfract by 11 to keep 1.31 format */ - xfract = (X & 0x000FFFFF) << 11U; - - /* Read two nearest output values from the index */ - x1 = pYData[(rI) + (int32_t)nCols * (cI) ]; - x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1]; - - /* 20 bits for the fractional part */ - /* shift left yfract by 11 to keep 1.31 format */ - yfract = (Y & 0x000FFFFF) << 11U; - - /* Read two nearest output values from the index */ - y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ]; - y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1]; - - /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ - out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); - acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); - - /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ - out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); - acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); - - /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ - out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); - acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); - - /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ - out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); - acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); - - /* Convert acc to 1.31(q31) format */ - return ((q31_t)(acc << 2)); - } - - - /** - * @brief Q15 bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate in 12.20 format. - * @param[in] Y interpolation coordinate in 12.20 format. - * @return out interpolated value. - */ - CMSIS_INLINE __STATIC_INLINE q15_t arm_bilinear_interp_q15( - arm_bilinear_interp_instance_q15 * S, - q31_t X, - q31_t Y) - { - q63_t acc = 0; /* output */ - q31_t out; /* Temporary output */ - q15_t x1, x2, y1, y2; /* Nearest output values */ - q31_t xfract, yfract; /* X, Y fractional parts */ - int32_t rI, cI; /* Row and column indices */ - q15_t *pYData = S->pData; /* pointer to output table values */ - uint32_t nCols = S->numCols; /* num of rows */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - rI = ((X & (q31_t)0xFFF00000) >> 20); - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - cI = ((Y & (q31_t)0xFFF00000) >> 20); - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) - { - return (0); - } - - /* 20 bits for the fractional part */ - /* xfract should be in 12.20 format */ - xfract = (X & 0x000FFFFF); - - /* Read two nearest output values from the index */ - x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; - x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; - - /* 20 bits for the fractional part */ - /* yfract should be in 12.20 format */ - yfract = (Y & 0x000FFFFF); - - /* Read two nearest output values from the index */ - y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; - y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; - - /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ - - /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ - /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ - out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4U); - acc = ((q63_t) out * (0xFFFFF - yfract)); - - /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ - out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4U); - acc += ((q63_t) out * (xfract)); - - /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ - out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4U); - acc += ((q63_t) out * (yfract)); - - /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ - out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U); - acc += ((q63_t) out * (yfract)); - - /* acc is in 13.51 format and down shift acc by 36 times */ - /* Convert out to 1.15 format */ - return ((q15_t)(acc >> 36)); - } - - - /** - * @brief Q7 bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate in 12.20 format. - * @param[in] Y interpolation coordinate in 12.20 format. - * @return out interpolated value. - */ - CMSIS_INLINE __STATIC_INLINE q7_t arm_bilinear_interp_q7( - arm_bilinear_interp_instance_q7 * S, - q31_t X, - q31_t Y) - { - q63_t acc = 0; /* output */ - q31_t out; /* Temporary output */ - q31_t xfract, yfract; /* X, Y fractional parts */ - q7_t x1, x2, y1, y2; /* Nearest output values */ - int32_t rI, cI; /* Row and column indices */ - q7_t *pYData = S->pData; /* pointer to output table values */ - uint32_t nCols = S->numCols; /* num of rows */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - rI = ((X & (q31_t)0xFFF00000) >> 20); - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - cI = ((Y & (q31_t)0xFFF00000) >> 20); - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if (rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) - { - return (0); - } - - /* 20 bits for the fractional part */ - /* xfract should be in 12.20 format */ - xfract = (X & (q31_t)0x000FFFFF); - - /* Read two nearest output values from the index */ - x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; - x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; - - /* 20 bits for the fractional part */ - /* yfract should be in 12.20 format */ - yfract = (Y & (q31_t)0x000FFFFF); - - /* Read two nearest output values from the index */ - y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; - y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; - - /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ - out = ((x1 * (0xFFFFF - xfract))); - acc = (((q63_t) out * (0xFFFFF - yfract))); - - /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ - out = ((x2 * (0xFFFFF - yfract))); - acc += (((q63_t) out * (xfract))); - - /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ - out = ((y1 * (0xFFFFF - xfract))); - acc += (((q63_t) out * (yfract))); - - /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ - out = ((y2 * (yfract))); - acc += (((q63_t) out * (xfract))); - - /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ - return ((q7_t)(acc >> 40)); - } - - /** - * @} end of BilinearInterpolate group - */ - - -/* SMMLAR */ -#define multAcc_32x32_keep32_R(a, x, y) \ - a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) - -/* SMMLSR */ -#define multSub_32x32_keep32_R(a, x, y) \ - a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) - -/* SMMULR */ -#define mult_32x32_keep32_R(a, x, y) \ - a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) - -/* SMMLA */ -#define multAcc_32x32_keep32(a, x, y) \ - a += (q31_t) (((q63_t) x * y) >> 32) - -/* SMMLS */ -#define multSub_32x32_keep32(a, x, y) \ - a -= (q31_t) (((q63_t) x * y) >> 32) - -/* SMMUL */ -#define mult_32x32_keep32(a, x, y) \ - a = (q31_t) (((q63_t) x * y ) >> 32) - - -#if defined ( __CC_ARM ) - /* Enter low optimization region - place directly above function definition */ - #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7) - #define LOW_OPTIMIZATION_ENTER \ - _Pragma ("push") \ - _Pragma ("O1") - #else - #define LOW_OPTIMIZATION_ENTER - #endif - - /* Exit low optimization region - place directly after end of function definition */ - #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 ) - #define LOW_OPTIMIZATION_EXIT \ - _Pragma ("pop") - #else - #define LOW_OPTIMIZATION_EXIT - #endif - - /* Enter low optimization region - place directly above function definition */ - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - - /* Exit low optimization region - place directly after end of function definition */ - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) - #define LOW_OPTIMIZATION_ENTER - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined ( __GNUC__ ) - #define LOW_OPTIMIZATION_ENTER \ - __attribute__(( optimize("-O1") )) - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined ( __ICCARM__ ) - /* Enter low optimization region - place directly above function definition */ - #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 ) - #define LOW_OPTIMIZATION_ENTER \ - _Pragma ("optimize=low") - #else - #define LOW_OPTIMIZATION_ENTER - #endif - - /* Exit low optimization region - place directly after end of function definition */ - #define LOW_OPTIMIZATION_EXIT - - /* Enter low optimization region - place directly above function definition */ - #if defined ( ARM_MATH_CM4 ) || defined ( ARM_MATH_CM7 ) - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ - _Pragma ("optimize=low") - #else - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #endif - - /* Exit low optimization region - place directly after end of function definition */ - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined ( __TI_ARM__ ) - #define LOW_OPTIMIZATION_ENTER - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined ( __CSMC__ ) - #define LOW_OPTIMIZATION_ENTER - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined ( __TASKING__ ) - #define LOW_OPTIMIZATION_ENTER - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#endif - - -#ifdef __cplusplus -} -#endif - -/* Compiler specific diagnostic adjustment */ -#if defined ( __CC_ARM ) - -#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) - -#elif defined ( __GNUC__ ) -#pragma GCC diagnostic pop - -#elif defined ( __ICCARM__ ) - -#elif defined ( __TI_ARM__ ) - -#elif defined ( __CSMC__ ) - -#elif defined ( __TASKING__ ) - -#else - #error Unknown compiler -#endif - -#endif /* _ARM_MATH_H */ - -/** - * - * End of file. - */ diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armcc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armcc.h deleted file mode 100644 index 093d35b9e5..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armcc.h +++ /dev/null @@ -1,870 +0,0 @@ -/**************************************************************************//** - * @file cmsis_armcc.h - * @brief CMSIS compiler ARMCC (Arm Compiler 5) header file - * @version V5.0.4 - * @date 10. January 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_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 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 - -/* ########################### 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)) ) */ - - -#if ((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 -} - -#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ - - - -/*@} 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/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armclang.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armclang.h deleted file mode 100644 index 5c4c20e877..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_armclang.h +++ /dev/null @@ -1,1877 +0,0 @@ -/**************************************************************************//** - * @file cmsis_armclang.h - * @brief CMSIS compiler armclang (Arm Compiler 6) header file - * @version V5.0.4 - * @date 10. January 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. - */ - -/*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 /* 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 - - -/* ########################### 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) -{ - register 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) -{ - register 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) -{ - register 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) -{ - register 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) -{ - register 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 - register 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 - register 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 - register 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 - register 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)) ) */ - - -#if ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ - (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 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 - -#endif /* ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ - (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ - - - -/*@} 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 - */ -#define __CLZ (uint8_t)__builtin_clz - - -#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); -} - -#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 */ - - -#endif /* __CMSIS_ARMCLANG_H */ diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_compiler.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_compiler.h deleted file mode 100644 index 94212eb87a..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_compiler.h +++ /dev/null @@ -1,266 +0,0 @@ -/**************************************************************************//** - * @file cmsis_compiler.h - * @brief CMSIS compiler generic header file - * @version V5.0.4 - * @date 10. January 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 - -/* - * Arm Compiler 4/5 - */ -#if defined ( __CC_ARM ) - #include "cmsis_armcc.h" - - -/* - * Arm Compiler 6 (armclang) - */ -#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #include "cmsis_armclang.h" - - -/* - * GNU Compiler - */ -#elif defined ( __GNUC__ ) - #include "cmsis_gcc.h" - - -/* - * IAR Compiler - */ -#elif defined ( __ICCARM__ ) - #include - - -/* - * TI Arm Compiler - */ -#elif defined ( __TI_ARM__ ) - #include - - #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 - #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. - #define __RESTRICT - #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 - - -/* - * COSMIC Compiler - */ -#elif defined ( __CSMC__ ) - #include - - #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 - - -#else - #error Unknown compiler. -#endif - - -#endif /* __CMSIS_COMPILER_H */ - diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_gcc.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_gcc.h deleted file mode 100644 index 5d0f07e8ac..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_gcc.h +++ /dev/null @@ -1,2088 +0,0 @@ -/**************************************************************************//** - * @file cmsis_gcc.h - * @brief CMSIS compiler GCC header file - * @version V5.0.3 - * @date 16. January 2018 - ******************************************************************************/ -/* - * Copyright (c) 2009-2017 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 - - -/* ########################### 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) -{ - register 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) -{ - register 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) -{ - register 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) -{ - register 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) -{ - register 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 - register 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 - register 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 - register 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 - register 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)) ) */ - - -#if ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ - (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 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) || (__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) || (__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 -} - -#endif /* ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ - (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ - - - -/*@} 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 - */ -#define __CLZ (uint8_t)__builtin_clz - - -#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/essemi/es32f0271/libraries/CMSIS/Include/cmsis_iccarm.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_iccarm.h deleted file mode 100644 index edcaee3d4a..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_iccarm.h +++ /dev/null @@ -1,913 +0,0 @@ -/**************************************************************************//** - * @file cmsis_iccarm.h - * @brief CMSIS compiler ICCARM (IAR Compiler for Arm) header file - * @version V5.0.5 - * @date 10. January 2018 - ******************************************************************************/ - -//------------------------------------------------------------------------------ -// -// Copyright (c) 2017-2018 IAR Systems -// -// 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 __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 - #define __RESTRICT restrict -#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 __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))) - #define __TZ_get_PSPLIM_NS() (__arm_rsr("PSPLIM_NS")) - #define __TZ_set_PSPLIM_NS(VALUE) (__arm_wsr("PSPLIM_NS", (VALUE))) - #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 - - #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; - __asm volatile("MRS %0,PSPLIM_NS" : "=r" (res)); - return res; - } - __IAR_FT void __TZ_set_PSPLIM_NS(uint32_t value) - { - __asm volatile("MSR PSPLIM_NS,%0" :: "r" (value)); - } - - __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/essemi/es32f0271/libraries/CMSIS/Include/cmsis_version.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_version.h deleted file mode 100644 index 660f612aa3..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/cmsis_version.h +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************//** - * @file cmsis_version.h - * @brief CMSIS Core(M) Version definitions - * @version V5.0.2 - * @date 19. April 2017 - ******************************************************************************/ -/* - * Copyright (c) 2009-2017 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 ( 1U) /*!< [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/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mbl.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mbl.h deleted file mode 100644 index 47a39893ac..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mbl.h +++ /dev/null @@ -1,1896 +0,0 @@ -/**************************************************************************//** - * @file core_armv8mbl.h - * @brief CMSIS Armv8-M Baseline Core Peripheral Access Layer Header File - * @version V5.0.4 - * @date 10. January 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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_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 -{ - __IOM 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 */ - __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 */ - 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 Armv8-M Baseline */ -/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Armv8-M Baseline */ - #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 - - -/* 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) - { - 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[_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 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; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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 __Vendor_SysTickConfig is set to 1, then the - function TZ_SysTick_Config_NS is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mml.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mml.h deleted file mode 100644 index 0951a1f781..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_armv8mml.h +++ /dev/null @@ -1,2960 +0,0 @@ -/**************************************************************************//** - * @file core_armv8mml.h - * @brief CMSIS Armv8-M Mainline Core Peripheral Access Layer Header File - * @version V5.0.4 - * @date 10. January 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 */ - 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_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 -{ - __IOM 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 */ - __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_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; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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 __Vendor_SysTickConfig is set to 1, then the - function TZ_SysTick_Config_NS is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_cm0.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0.h deleted file mode 100644 index a3f1b9ac33..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0.h +++ /dev/null @@ -1,888 +0,0 @@ -/**************************************************************************//** - * @file core_cm0.h - * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File - * @version V5.0.3 - * @date 10. January 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_CM0_H_GENERIC -#define __CORE_CM0_H_GENERIC - -#include - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 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_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 not available for Cortex-M0 */ -/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0 */ - #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 - - -/* 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) - { - NVIC->ISER[0U] = (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[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. - 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; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_cm0plus.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0plus.h deleted file mode 100644 index f8f30c3496..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm0plus.h +++ /dev/null @@ -1,1023 +0,0 @@ -/**************************************************************************//** - * @file core_cm0plus.h - * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File - * @version V5.0.4 - * @date 10. January 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_CM0PLUS_H_GENERIC -#define __CORE_CM0PLUS_H_GENERIC - -#include - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 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 */ -#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 not available for Cortex-M0+ */ -/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0+ */ - #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 - - -/* 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) - { - NVIC->ISER[0U] = (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[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. - 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; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_cm23.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm23.h deleted file mode 100644 index 7d1d478af2..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm23.h +++ /dev/null @@ -1,1899 +0,0 @@ -/**************************************************************************//** - * @file core_cm23.h - * @brief CMSIS Cortex-M23 Core Peripheral Access Layer Header File - * @version V5.0.4 - * @date 10. January 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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_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 -{ - __IOM 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 */ - __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 /*!< @Deprecated TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */ - -#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_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 */ - 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 - - -/* 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) - { - 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[_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 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; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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 __Vendor_SysTickConfig is set to 1, then the - function TZ_SysTick_Config_NS is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_cm3.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm3.h deleted file mode 100644 index a2c0d08057..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm3.h +++ /dev/null @@ -1,1933 +0,0 @@ -/**************************************************************************//** - * @file core_cm3.h - * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File - * @version V5.0.5 - * @date 08. January 2018 - ******************************************************************************/ -/* - * Copyright (c) 2009-2017 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 RSERVED1[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 */ - -#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[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[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 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 */ - __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 -{ - __IOM 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 */ - __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 /*!< @Deprecated TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */ - -#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_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 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 - - - -/** - \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) - { - 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); - } -} - - -/** - \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; - vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_cm33.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm33.h deleted file mode 100644 index b1efbcae7c..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm33.h +++ /dev/null @@ -1,2963 +0,0 @@ -/**************************************************************************//** - * @file core_cm33.h - * @brief CMSIS Cortex-M33 Core Peripheral Access Layer Header File - * @version V5.0.5 - * @date 08. January 2018 - ******************************************************************************/ -/* - * Copyright (c) 2009-2017 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP) - #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 - - IO Type Qualifiers 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 */ - 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_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 (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 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 -{ - __IOM 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 */ - __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 /*!< @Deprecated TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */ - -#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_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_BASE_Pos 5U /*!< MPU RBAR: ADDR Position */ -#define MPU_RBAR_BASE_Msk (0x7FFFFFFUL << MPU_RBAR_BASE_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_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 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) - { - 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; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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 __Vendor_SysTickConfig is set to 1, then the - function TZ_SysTick_Config_NS is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_cm4.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm4.h deleted file mode 100644 index a11a3817a2..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm4.h +++ /dev/null @@ -1,2118 +0,0 @@ -/**************************************************************************//** - * @file core_cm4.h - * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File - * @version V5.0.5 - * @date 08. January 2018 - ******************************************************************************/ -/* - * Copyright (c) 2009-2017 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 RSERVED1[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[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[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 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 */ - __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 -{ - __IOM 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 */ - __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 /*!< @Deprecated TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */ - -#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_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 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 */ -} 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 */ - -/*@} 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 - - - -/** - \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) - { - 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); - } -} - - -/** - \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; - vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_cm7.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm7.h deleted file mode 100644 index 1fe53bf012..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_cm7.h +++ /dev/null @@ -1,2660 +0,0 @@ -/**************************************************************************//** - * @file core_cm7.h - * @brief CMSIS Cortex-M7 Core Peripheral Access Layer Header File - * @version V5.0.5 - * @date 08. January 2018 - ******************************************************************************/ -/* - * Copyright (c) 2009-2017 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 RSERVED1[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_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[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[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 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 */ - __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 -{ - __IOM 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 */ - __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 /*!< @Deprecated TPI ACPR: PRESCALER Position */ -#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< @Deprecated TPI ACPR: PRESCALER Mask */ - -#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_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 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 */ - -/*@} 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 - - - -/** - \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) - { - 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); - } -} - - -/** - \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; - vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; -} - - -/** - \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. - */ -__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 ) - - -/** - \brief Enable I-Cache - \details Turns on I-Cache - */ -__STATIC_INLINE void SCB_EnableICache (void) -{ - #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) - __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_INLINE 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_INLINE void SCB_InvalidateICache (void) -{ - #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U) - __DSB(); - __ISB(); - SCB->ICIALLU = 0UL; - __DSB(); - __ISB(); - #endif -} - - -/** - \brief Enable D-Cache - \details Turns on D-Cache - */ -__STATIC_INLINE void SCB_EnableDCache (void) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* 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_INLINE void SCB_DisableDCache (void) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - register uint32_t ccsidr; - register uint32_t sets; - register uint32_t ways; - - SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* 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_INLINE void SCB_InvalidateDCache (void) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* 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_INLINE void SCB_CleanDCache (void) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* 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_INLINE void SCB_CleanInvalidateDCache (void) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - uint32_t ccsidr; - uint32_t sets; - uint32_t ways; - - SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/ /* 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 - \param[in] addr address (aligned to 32-byte boundary) - \param[in] dsize size of memory block (in number of bytes) -*/ -__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - int32_t op_size = dsize; - uint32_t op_addr = (uint32_t)addr; - int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ - - __DSB(); - - while (op_size > 0) { - SCB->DCIMVAC = op_addr; - op_addr += (uint32_t)linesize; - op_size -= linesize; - } - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief D-Cache Clean by address - \details Cleans D-Cache for the given address - \param[in] addr address (aligned to 32-byte boundary) - \param[in] dsize size of memory block (in number of bytes) -*/ -__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - int32_t op_size = dsize; - uint32_t op_addr = (uint32_t) addr; - int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ - - __DSB(); - - while (op_size > 0) { - SCB->DCCMVAC = op_addr; - op_addr += (uint32_t)linesize; - op_size -= linesize; - } - - __DSB(); - __ISB(); - #endif -} - - -/** - \brief D-Cache Clean and Invalidate by address - \details Cleans and invalidates D_Cache for the given address - \param[in] addr address (aligned to 32-byte boundary) - \param[in] dsize size of memory block (in number of bytes) -*/ -__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize) -{ - #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - int32_t op_size = dsize; - uint32_t op_addr = (uint32_t) addr; - int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */ - - __DSB(); - - while (op_size > 0) { - SCB->DCCIMVAC = op_addr; - op_addr += (uint32_t)linesize; - op_size -= linesize; - } - - __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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_sc000.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_sc000.h deleted file mode 100644 index 9aab5e5b3e..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_sc000.h +++ /dev/null @@ -1,1016 +0,0 @@ -/**************************************************************************//** - * @file core_sc000.h - * @brief CMSIS SC000 Core Peripheral Access Layer Header File - * @version V5.0.3 - * @date 10. January 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 - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 - - -/* 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) - { - NVIC->ISER[0U] = (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[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; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/core_sc300.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_sc300.h deleted file mode 100644 index a569ef2ace..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/core_sc300.h +++ /dev/null @@ -1,1903 +0,0 @@ -/**************************************************************************//** - * @file core_sc300.h - * @brief CMSIS SC300 Core Peripheral Access Layer Header File - * @version V5.0.3 - * @date 10. January 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_SC300_H_GENERIC -#define __CORE_SC300_H_GENERIC - -#include - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- 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_PCS_VFP - #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 - - IO Type Qualifiers 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 RSERVED1[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 */ - uint32_t RESERVED1[1U]; -} 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[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 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 */ - __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 -{ - __IOM 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 */ - __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 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 - - - -/** - \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); - } -} - - -/** - \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; - vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; -} - - -/** - \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. - */ -__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0271/libraries/CMSIS/Include/mpu_armv7.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/mpu_armv7.h deleted file mode 100644 index aa180c9e59..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/mpu_armv7.h +++ /dev/null @@ -1,197 +0,0 @@ -/****************************************************************************** - * @file mpu_armv7.h - * @brief CMSIS MPU API for Armv7-M MPU - * @version V5.0.4 - * @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 ARM_MPU_ARMV7_H -#define ARM_MPU_ARMV7_H - -#define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) -#define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) -#define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) -#define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U) -#define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U) -#define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U) -#define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) -#define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) -#define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) -#define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) -#define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) -#define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) -#define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U) -#define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U) -#define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U) -#define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U) -#define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U) -#define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U) -#define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U) -#define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U) -#define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U) -#define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U) -#define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) -#define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) -#define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) -#define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) -#define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) -#define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) - -#define ARM_MPU_AP_NONE 0U -#define ARM_MPU_AP_PRIV 1U -#define ARM_MPU_AP_URO 2U -#define ARM_MPU_AP_FULL 3U -#define ARM_MPU_AP_PRO 5U -#define ARM_MPU_AP_RO 6U - -/** 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 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) \ - ((((DisableExec ) << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \ - (((AccessPermission) << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \ - (((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) | \ - (((SubRegionDisable) << MPU_RASR_SRD_Pos) & MPU_RASR_SRD_Msk) | \ - (((Size ) << MPU_RASR_SIZE_Pos) & MPU_RASR_SIZE_Msk) | \ - (MPU_RASR_ENABLE_Msk)) - - -/** -* 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) -{ - __DSB(); - __ISB(); - MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; -#ifdef SCB_SHCSR_MEMFAULTENA_Msk - SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; -#endif -} - -/** Disable the MPU. -*/ -__STATIC_INLINE void ARM_MPU_Disable(void) -{ - __DSB(); - __ISB(); -#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 orderedCpy(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) { - orderedCpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize); - table += MPU_TYPE_RALIASES; - cnt -= MPU_TYPE_RALIASES; - } - orderedCpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize); -} - -#endif diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/Include/mpu_armv8.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/mpu_armv8.h deleted file mode 100644 index 0ccfc74fe5..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/mpu_armv8.h +++ /dev/null @@ -1,333 +0,0 @@ -/****************************************************************************** - * @file mpu_armv8.h - * @brief CMSIS MPU API for Armv8-M MPU - * @version V5.0.4 - * @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 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_Pos) | \ - ((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)) - -/** -* 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) -{ - __DSB(); - __ISB(); - MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; -#ifdef SCB_SHCSR_MEMFAULTENA_Msk - SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; -#endif -} - -/** Disable the MPU. -*/ -__STATIC_INLINE void ARM_MPU_Disable(void) -{ - __DSB(); - __ISB(); -#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) -{ - __DSB(); - __ISB(); - MPU_NS->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; -#ifdef SCB_SHCSR_MEMFAULTENA_Msk - SCB_NS->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; -#endif -} - -/** Disable the Non-secure MPU. -*/ -__STATIC_INLINE void ARM_MPU_Disable_NS(void) -{ - __DSB(); - __ISB(); -#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 orderedCpy(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; - orderedCpy(&(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; - orderedCpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), c*rowWordSize); - table += c; - cnt -= c; - rnrOffset = 0U; - rnrBase += MPU_TYPE_RALIASES; - mpu->RNR = rnrBase; - } - - orderedCpy(&(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/essemi/es32f0271/libraries/CMSIS/Include/tz_context.h b/bsp/essemi/es32f0271/libraries/CMSIS/Include/tz_context.h deleted file mode 100644 index 0d09749f3a..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/Include/tz_context.h +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************************** - * @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 - -#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/essemi/es32f0271/libraries/CMSIS/RTOS/Template/cmsis_os.h b/bsp/essemi/es32f0271/libraries/CMSIS/RTOS/Template/cmsis_os.h deleted file mode 100644 index 02930af3e6..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/RTOS/Template/cmsis_os.h +++ /dev/null @@ -1,707 +0,0 @@ -/* ---------------------------------------------------------------------- - * $Date: 5. February 2013 - * $Revision: V1.02 - * - * Project: CMSIS-RTOS API - * Title: cmsis_os.h template header file - * - * Version 0.02 - * Initial Proposal Phase - * Version 0.03 - * osKernelStart added, optional feature: main started as thread - * osSemaphores have standard behavior - * osTimerCreate does not start the timer, added osTimerStart - * osThreadPass is renamed to osThreadYield - * Version 1.01 - * Support for C++ interface - * - const attribute removed from the osXxxxDef_t typedef's - * - const attribute added to the osXxxxDef macros - * Added: osTimerDelete, osMutexDelete, osSemaphoreDelete - * Added: osKernelInitialize - * Version 1.02 - * Control functions for short timeouts in microsecond resolution: - * Added: osKernelSysTick, osKernelSysTickFrequency, osKernelSysTickMicroSec - * Removed: osSignalGet - *---------------------------------------------------------------------------- - * - * Copyright (c) 2013 ARM LIMITED - * 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 ARM 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 COPYRIGHT HOLDERS AND 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. - *---------------------------------------------------------------------------*/ - - -#ifndef _CMSIS_OS_H -#define _CMSIS_OS_H - -/// \note MUST REMAIN UNCHANGED: \b osCMSIS identifies the CMSIS-RTOS API version. -#define osCMSIS 0x10002 ///< API version (main [31:16] .sub [15:0]) - -/// \note CAN BE CHANGED: \b osCMSIS_KERNEL identifies the underlying RTOS kernel and version number. -#define osCMSIS_KERNEL 0x10000 ///< RTOS identification and version (main [31:16] .sub [15:0]) - -/// \note MUST REMAIN UNCHANGED: \b osKernelSystemId shall be consistent in every CMSIS-RTOS. -#define osKernelSystemId "KERNEL V1.00" ///< RTOS identification string - -/// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS. -#define osFeature_MainThread 1 ///< main thread 1=main can be thread, 0=not available -#define osFeature_Pool 1 ///< Memory Pools: 1=available, 0=not available -#define osFeature_MailQ 1 ///< Mail Queues: 1=available, 0=not available -#define osFeature_MessageQ 1 ///< Message Queues: 1=available, 0=not available -#define osFeature_Signals 8 ///< maximum number of Signal Flags available per thread -#define osFeature_Semaphore 30 ///< maximum count for \ref osSemaphoreCreate function -#define osFeature_Wait 1 ///< osWait function: 1=available, 0=not available -#define osFeature_SysTick 1 ///< osKernelSysTick functions: 1=available, 0=not available - -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - - -// ==== Enumeration, structures, defines ==== - -/// Priority used for thread control. -/// \note MUST REMAIN UNCHANGED: \b osPriority shall be consistent in every CMSIS-RTOS. -typedef enum { - osPriorityIdle = -3, ///< priority: idle (lowest) - osPriorityLow = -2, ///< priority: low - osPriorityBelowNormal = -1, ///< priority: below normal - osPriorityNormal = 0, ///< priority: normal (default) - osPriorityAboveNormal = +1, ///< priority: above normal - osPriorityHigh = +2, ///< priority: high - osPriorityRealtime = +3, ///< priority: realtime (highest) - osPriorityError = 0x84 ///< system cannot determine priority or thread has illegal priority -} osPriority; - -/// Timeout value. -/// \note MUST REMAIN UNCHANGED: \b osWaitForever shall be consistent in every CMSIS-RTOS. -#define osWaitForever 0xFFFFFFFF ///< wait forever timeout value - -/// Status code values returned by CMSIS-RTOS functions. -/// \note MUST REMAIN UNCHANGED: \b osStatus shall be consistent in every CMSIS-RTOS. -typedef enum { - osOK = 0, ///< function completed; no error or event occurred. - osEventSignal = 0x08, ///< function completed; signal event occurred. - osEventMessage = 0x10, ///< function completed; message event occurred. - osEventMail = 0x20, ///< function completed; mail event occurred. - osEventTimeout = 0x40, ///< function completed; timeout occurred. - osErrorParameter = 0x80, ///< parameter error: a mandatory parameter was missing or specified an incorrect object. - osErrorResource = 0x81, ///< resource not available: a specified resource was not available. - osErrorTimeoutResource = 0xC1, ///< resource not available within given time: a specified resource was not available within the timeout period. - osErrorISR = 0x82, ///< not allowed in ISR context: the function cannot be called from interrupt service routines. - osErrorISRRecursive = 0x83, ///< function called multiple times from ISR with same object. - osErrorPriority = 0x84, ///< system cannot determine priority or thread has illegal priority. - osErrorNoMemory = 0x85, ///< system is out of memory: it was impossible to allocate or reserve memory for the operation. - osErrorValue = 0x86, ///< value of a parameter is out of range. - osErrorOS = 0xFF, ///< unspecified RTOS error: run-time error but no other error message fits. - os_status_reserved = 0x7FFFFFFF ///< prevent from enum down-size compiler optimization. -} osStatus; - - -/// Timer type value for the timer definition. -/// \note MUST REMAIN UNCHANGED: \b os_timer_type shall be consistent in every CMSIS-RTOS. -typedef enum { - osTimerOnce = 0, ///< one-shot timer - osTimerPeriodic = 1 ///< repeating timer -} os_timer_type; - -/// Entry point of a thread. -/// \note MUST REMAIN UNCHANGED: \b os_pthread shall be consistent in every CMSIS-RTOS. -typedef void (*os_pthread) (void const *argument); - -/// Entry point of a timer call back function. -/// \note MUST REMAIN UNCHANGED: \b os_ptimer shall be consistent in every CMSIS-RTOS. -typedef void (*os_ptimer) (void const *argument); - -// >>> the following data type definitions may shall adapted towards a specific RTOS - -/// Thread ID identifies the thread (pointer to a thread control block). -/// \note CAN BE CHANGED: \b os_thread_cb is implementation specific in every CMSIS-RTOS. -typedef struct os_thread_cb *osThreadId; - -/// Timer ID identifies the timer (pointer to a timer control block). -/// \note CAN BE CHANGED: \b os_timer_cb is implementation specific in every CMSIS-RTOS. -typedef struct os_timer_cb *osTimerId; - -/// Mutex ID identifies the mutex (pointer to a mutex control block). -/// \note CAN BE CHANGED: \b os_mutex_cb is implementation specific in every CMSIS-RTOS. -typedef struct os_mutex_cb *osMutexId; - -/// Semaphore ID identifies the semaphore (pointer to a semaphore control block). -/// \note CAN BE CHANGED: \b os_semaphore_cb is implementation specific in every CMSIS-RTOS. -typedef struct os_semaphore_cb *osSemaphoreId; - -/// Pool ID identifies the memory pool (pointer to a memory pool control block). -/// \note CAN BE CHANGED: \b os_pool_cb is implementation specific in every CMSIS-RTOS. -typedef struct os_pool_cb *osPoolId; - -/// Message ID identifies the message queue (pointer to a message queue control block). -/// \note CAN BE CHANGED: \b os_messageQ_cb is implementation specific in every CMSIS-RTOS. -typedef struct os_messageQ_cb *osMessageQId; - -/// Mail ID identifies the mail queue (pointer to a mail queue control block). -/// \note CAN BE CHANGED: \b os_mailQ_cb is implementation specific in every CMSIS-RTOS. -typedef struct os_mailQ_cb *osMailQId; - - -/// Thread Definition structure contains startup information of a thread. -/// \note CAN BE CHANGED: \b os_thread_def is implementation specific in every CMSIS-RTOS. -typedef struct os_thread_def { - os_pthread pthread; ///< start address of thread function - osPriority tpriority; ///< initial thread priority - uint32_t instances; ///< maximum number of instances of that thread function - uint32_t stacksize; ///< stack size requirements in bytes; 0 is default stack size -} osThreadDef_t; - -/// Timer Definition structure contains timer parameters. -/// \note CAN BE CHANGED: \b os_timer_def is implementation specific in every CMSIS-RTOS. -typedef struct os_timer_def { - os_ptimer ptimer; ///< start address of a timer function -} osTimerDef_t; - -/// Mutex Definition structure contains setup information for a mutex. -/// \note CAN BE CHANGED: \b os_mutex_def is implementation specific in every CMSIS-RTOS. -typedef struct os_mutex_def { - uint32_t dummy; ///< dummy value. -} osMutexDef_t; - -/// Semaphore Definition structure contains setup information for a semaphore. -/// \note CAN BE CHANGED: \b os_semaphore_def is implementation specific in every CMSIS-RTOS. -typedef struct os_semaphore_def { - uint32_t dummy; ///< dummy value. -} osSemaphoreDef_t; - -/// Definition structure for memory block allocation. -/// \note CAN BE CHANGED: \b os_pool_def is implementation specific in every CMSIS-RTOS. -typedef struct os_pool_def { - uint32_t pool_sz; ///< number of items (elements) in the pool - uint32_t item_sz; ///< size of an item - void *pool; ///< pointer to memory for pool -} osPoolDef_t; - -/// Definition structure for message queue. -/// \note CAN BE CHANGED: \b os_messageQ_def is implementation specific in every CMSIS-RTOS. -typedef struct os_messageQ_def { - uint32_t queue_sz; ///< number of elements in the queue - uint32_t item_sz; ///< size of an item - void *pool; ///< memory array for messages -} osMessageQDef_t; - -/// Definition structure for mail queue. -/// \note CAN BE CHANGED: \b os_mailQ_def is implementation specific in every CMSIS-RTOS. -typedef struct os_mailQ_def { - uint32_t queue_sz; ///< number of elements in the queue - uint32_t item_sz; ///< size of an item - void *pool; ///< memory array for mail -} osMailQDef_t; - -/// Event structure contains detailed information about an event. -/// \note MUST REMAIN UNCHANGED: \b os_event shall be consistent in every CMSIS-RTOS. -/// However the struct may be extended at the end. -typedef struct { - osStatus status; ///< status code: event or error information - union { - uint32_t v; ///< message as 32-bit value - void *p; ///< message or mail as void pointer - int32_t signals; ///< signal flags - } value; ///< event value - union { - osMailQId mail_id; ///< mail id obtained by \ref osMailCreate - osMessageQId message_id; ///< message id obtained by \ref osMessageCreate - } def; ///< event definition -} osEvent; - - -// ==== Kernel Control Functions ==== - -/// Initialize the RTOS Kernel for creating objects. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS. -osStatus osKernelInitialize (void); - -/// Start the RTOS Kernel. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osKernelStart shall be consistent in every CMSIS-RTOS. -osStatus osKernelStart (void); - -/// Check if the RTOS kernel is already started. -/// \note MUST REMAIN UNCHANGED: \b osKernelRunning shall be consistent in every CMSIS-RTOS. -/// \return 0 RTOS is not started, 1 RTOS is started. -int32_t osKernelRunning(void); - -#if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available - -/// Get the RTOS kernel system timer counter -/// \note MUST REMAIN UNCHANGED: \b osKernelSysTick shall be consistent in every CMSIS-RTOS. -/// \return RTOS kernel system timer as 32-bit value -uint32_t osKernelSysTick (void); - -/// The RTOS kernel system timer frequency in Hz -/// \note Reflects the system timer setting and is typically defined in a configuration file. -#define osKernelSysTickFrequency 100000000 - -/// Convert a microseconds value to a RTOS kernel system timer value. -/// \param microsec time value in microseconds. -/// \return time value normalized to the \ref osKernelSysTickFrequency -#define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000) - -#endif // System Timer available - -// ==== Thread Management ==== - -/// Create a Thread Definition with function, priority, and stack requirements. -/// \param name name of the thread function. -/// \param priority initial priority of the thread function. -/// \param instances number of possible thread instances. -/// \param stacksz stack size (in bytes) requirements for the thread function. -/// \note CAN BE CHANGED: The parameters to \b osThreadDef shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#if defined (osObjectsExternal) // object is external -#define osThreadDef(name, priority, instances, stacksz) \ -extern const osThreadDef_t os_thread_def_##name -#else // define the object -#define osThreadDef(name, priority, instances, stacksz) \ -const osThreadDef_t os_thread_def_##name = \ -{ (name), (priority), (instances), (stacksz) } -#endif - -/// Access a Thread definition. -/// \param name name of the thread definition object. -/// \note CAN BE CHANGED: The parameter to \b osThread shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#define osThread(name) \ -&os_thread_def_##name - -/// Create a thread and add it to Active Threads and set it to state READY. -/// \param[in] thread_def thread definition referenced with \ref osThread. -/// \param[in] argument pointer that is passed to the thread function as start argument. -/// \return thread ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS. -osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument); - -/// Return the thread ID of the current running thread. -/// \return thread ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osThreadGetId shall be consistent in every CMSIS-RTOS. -osThreadId osThreadGetId (void); - -/// Terminate execution of a thread and remove it from Active Threads. -/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS. -osStatus osThreadTerminate (osThreadId thread_id); - -/// Pass control to next thread that is in state \b READY. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osThreadYield shall be consistent in every CMSIS-RTOS. -osStatus osThreadYield (void); - -/// Change priority of an active thread. -/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. -/// \param[in] priority new priority value for the thread function. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS. -osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority); - -/// Get current priority of an active thread. -/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. -/// \return current priority value of the thread function. -/// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS. -osPriority osThreadGetPriority (osThreadId thread_id); - - -// ==== Generic Wait Functions ==== - -/// Wait for Timeout (Time Delay). -/// \param[in] millisec time delay value -/// \return status code that indicates the execution status of the function. -osStatus osDelay (uint32_t millisec); - -#if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available - -/// Wait for Signal, Message, Mail, or Timeout. -/// \param[in] millisec timeout value or 0 in case of no time-out -/// \return event that contains signal, message, or mail information or error code. -/// \note MUST REMAIN UNCHANGED: \b osWait shall be consistent in every CMSIS-RTOS. -osEvent osWait (uint32_t millisec); - -#endif // Generic Wait available - - -// ==== Timer Management Functions ==== -/// Define a Timer object. -/// \param name name of the timer object. -/// \param function name of the timer call back function. -/// \note CAN BE CHANGED: The parameter to \b osTimerDef shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#if defined (osObjectsExternal) // object is external -#define osTimerDef(name, function) \ -extern const osTimerDef_t os_timer_def_##name -#else // define the object -#define osTimerDef(name, function) \ -const osTimerDef_t os_timer_def_##name = \ -{ (function) } -#endif - -/// Access a Timer definition. -/// \param name name of the timer object. -/// \note CAN BE CHANGED: The parameter to \b osTimer shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#define osTimer(name) \ -&os_timer_def_##name - -/// Create a timer. -/// \param[in] timer_def timer object referenced with \ref osTimer. -/// \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior. -/// \param[in] argument argument to the timer call back function. -/// \return timer ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS. -osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument); - -/// Start or restart a timer. -/// \param[in] timer_id timer ID obtained by \ref osTimerCreate. -/// \param[in] millisec time delay value of the timer. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osTimerStart shall be consistent in every CMSIS-RTOS. -osStatus osTimerStart (osTimerId timer_id, uint32_t millisec); - -/// Stop the timer. -/// \param[in] timer_id timer ID obtained by \ref osTimerCreate. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osTimerStop shall be consistent in every CMSIS-RTOS. -osStatus osTimerStop (osTimerId timer_id); - -/// Delete a timer that was created by \ref osTimerCreate. -/// \param[in] timer_id timer ID obtained by \ref osTimerCreate. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osTimerDelete shall be consistent in every CMSIS-RTOS. -osStatus osTimerDelete (osTimerId timer_id); - - -// ==== Signal Management ==== - -/// Set the specified Signal Flags of an active thread. -/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. -/// \param[in] signals specifies the signal flags of the thread that should be set. -/// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters. -/// \note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS. -int32_t osSignalSet (osThreadId thread_id, int32_t signals); - -/// Clear the specified Signal Flags of an active thread. -/// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. -/// \param[in] signals specifies the signal flags of the thread that shall be cleared. -/// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters or call from ISR. -/// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS. -int32_t osSignalClear (osThreadId thread_id, int32_t signals); - -/// Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread. -/// \param[in] signals wait until all specified signal flags set or 0 for any single signal flag. -/// \param[in] millisec timeout value or 0 in case of no time-out. -/// \return event flag information or error code. -/// \note MUST REMAIN UNCHANGED: \b osSignalWait shall be consistent in every CMSIS-RTOS. -osEvent osSignalWait (int32_t signals, uint32_t millisec); - - -// ==== Mutex Management ==== - -/// Define a Mutex. -/// \param name name of the mutex object. -/// \note CAN BE CHANGED: The parameter to \b osMutexDef shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#if defined (osObjectsExternal) // object is external -#define osMutexDef(name) \ -extern const osMutexDef_t os_mutex_def_##name -#else // define the object -#define osMutexDef(name) \ -const osMutexDef_t os_mutex_def_##name = { 0 } -#endif - -/// Access a Mutex definition. -/// \param name name of the mutex object. -/// \note CAN BE CHANGED: The parameter to \b osMutex shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#define osMutex(name) \ -&os_mutex_def_##name - -/// Create and Initialize a Mutex object. -/// \param[in] mutex_def mutex definition referenced with \ref osMutex. -/// \return mutex ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osMutexCreate shall be consistent in every CMSIS-RTOS. -osMutexId osMutexCreate (const osMutexDef_t *mutex_def); - -/// Wait until a Mutex becomes available. -/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate. -/// \param[in] millisec timeout value or 0 in case of no time-out. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osMutexWait shall be consistent in every CMSIS-RTOS. -osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec); - -/// Release a Mutex that was obtained by \ref osMutexWait. -/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osMutexRelease shall be consistent in every CMSIS-RTOS. -osStatus osMutexRelease (osMutexId mutex_id); - -/// Delete a Mutex that was created by \ref osMutexCreate. -/// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS. -osStatus osMutexDelete (osMutexId mutex_id); - - -// ==== Semaphore Management Functions ==== - -#if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available - -/// Define a Semaphore object. -/// \param name name of the semaphore object. -/// \note CAN BE CHANGED: The parameter to \b osSemaphoreDef shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#if defined (osObjectsExternal) // object is external -#define osSemaphoreDef(name) \ -extern const osSemaphoreDef_t os_semaphore_def_##name -#else // define the object -#define osSemaphoreDef(name) \ -const osSemaphoreDef_t os_semaphore_def_##name = { 0 } -#endif - -/// Access a Semaphore definition. -/// \param name name of the semaphore object. -/// \note CAN BE CHANGED: The parameter to \b osSemaphore shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#define osSemaphore(name) \ -&os_semaphore_def_##name - -/// Create and Initialize a Semaphore object used for managing resources. -/// \param[in] semaphore_def semaphore definition referenced with \ref osSemaphore. -/// \param[in] count number of available resources. -/// \return semaphore ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osSemaphoreCreate shall be consistent in every CMSIS-RTOS. -osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count); - -/// Wait until a Semaphore token becomes available. -/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate. -/// \param[in] millisec timeout value or 0 in case of no time-out. -/// \return number of available tokens, or -1 in case of incorrect parameters. -/// \note MUST REMAIN UNCHANGED: \b osSemaphoreWait shall be consistent in every CMSIS-RTOS. -int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec); - -/// Release a Semaphore token. -/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osSemaphoreRelease shall be consistent in every CMSIS-RTOS. -osStatus osSemaphoreRelease (osSemaphoreId semaphore_id); - -/// Delete a Semaphore that was created by \ref osSemaphoreCreate. -/// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osSemaphoreDelete shall be consistent in every CMSIS-RTOS. -osStatus osSemaphoreDelete (osSemaphoreId semaphore_id); - -#endif // Semaphore available - - -// ==== Memory Pool Management Functions ==== - -#if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available - -/// \brief Define a Memory Pool. -/// \param name name of the memory pool. -/// \param no maximum number of blocks (objects) in the memory pool. -/// \param type data type of a single block (object). -/// \note CAN BE CHANGED: The parameter to \b osPoolDef shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#if defined (osObjectsExternal) // object is external -#define osPoolDef(name, no, type) \ -extern const osPoolDef_t os_pool_def_##name -#else // define the object -#define osPoolDef(name, no, type) \ -const osPoolDef_t os_pool_def_##name = \ -{ (no), sizeof(type), NULL } -#endif - -/// \brief Access a Memory Pool definition. -/// \param name name of the memory pool -/// \note CAN BE CHANGED: The parameter to \b osPool shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#define osPool(name) \ -&os_pool_def_##name - -/// Create and Initialize a memory pool. -/// \param[in] pool_def memory pool definition referenced with \ref osPool. -/// \return memory pool ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osPoolCreate shall be consistent in every CMSIS-RTOS. -osPoolId osPoolCreate (const osPoolDef_t *pool_def); - -/// Allocate a memory block from a memory pool. -/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate. -/// \return address of the allocated memory block or NULL in case of no memory available. -/// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS. -void *osPoolAlloc (osPoolId pool_id); - -/// Allocate a memory block from a memory pool and set memory block to zero. -/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate. -/// \return address of the allocated memory block or NULL in case of no memory available. -/// \note MUST REMAIN UNCHANGED: \b osPoolCAlloc shall be consistent in every CMSIS-RTOS. -void *osPoolCAlloc (osPoolId pool_id); - -/// Return an allocated memory block back to a specific memory pool. -/// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate. -/// \param[in] block address of the allocated memory block that is returned to the memory pool. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS. -osStatus osPoolFree (osPoolId pool_id, void *block); - -#endif // Memory Pool Management available - - -// ==== Message Queue Management Functions ==== - -#if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available - -/// \brief Create a Message Queue Definition. -/// \param name name of the queue. -/// \param queue_sz maximum number of messages in the queue. -/// \param type data type of a single message element (for debugger). -/// \note CAN BE CHANGED: The parameter to \b osMessageQDef shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#if defined (osObjectsExternal) // object is external -#define osMessageQDef(name, queue_sz, type) \ -extern const osMessageQDef_t os_messageQ_def_##name -#else // define the object -#define osMessageQDef(name, queue_sz, type) \ -const osMessageQDef_t os_messageQ_def_##name = \ -{ (queue_sz), sizeof (type) } -#endif - -/// \brief Access a Message Queue Definition. -/// \param name name of the queue -/// \note CAN BE CHANGED: The parameter to \b osMessageQ shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#define osMessageQ(name) \ -&os_messageQ_def_##name - -/// Create and Initialize a Message Queue. -/// \param[in] queue_def queue definition referenced with \ref osMessageQ. -/// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL. -/// \return message queue ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osMessageCreate shall be consistent in every CMSIS-RTOS. -osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id); - -/// Put a Message to a Queue. -/// \param[in] queue_id message queue ID obtained with \ref osMessageCreate. -/// \param[in] info message information. -/// \param[in] millisec timeout value or 0 in case of no time-out. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osMessagePut shall be consistent in every CMSIS-RTOS. -osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec); - -/// Get a Message or Wait for a Message from a Queue. -/// \param[in] queue_id message queue ID obtained with \ref osMessageCreate. -/// \param[in] millisec timeout value or 0 in case of no time-out. -/// \return event information that includes status code. -/// \note MUST REMAIN UNCHANGED: \b osMessageGet shall be consistent in every CMSIS-RTOS. -osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec); - -#endif // Message Queues available - - -// ==== Mail Queue Management Functions ==== - -#if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available - -/// \brief Create a Mail Queue Definition. -/// \param name name of the queue -/// \param queue_sz maximum number of messages in queue -/// \param type data type of a single message element -/// \note CAN BE CHANGED: The parameter to \b osMailQDef shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#if defined (osObjectsExternal) // object is external -#define osMailQDef(name, queue_sz, type) \ -extern const osMailQDef_t os_mailQ_def_##name -#else // define the object -#define osMailQDef(name, queue_sz, type) \ -const osMailQDef_t os_mailQ_def_##name = \ -{ (queue_sz), sizeof (type) } -#endif - -/// \brief Access a Mail Queue Definition. -/// \param name name of the queue -/// \note CAN BE CHANGED: The parameter to \b osMailQ shall be consistent but the -/// macro body is implementation specific in every CMSIS-RTOS. -#define osMailQ(name) \ -&os_mailQ_def_##name - -/// Create and Initialize mail queue. -/// \param[in] queue_def reference to the mail queue definition obtain with \ref osMailQ -/// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL. -/// \return mail queue ID for reference by other functions or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osMailCreate shall be consistent in every CMSIS-RTOS. -osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id); - -/// Allocate a memory block from a mail. -/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate. -/// \param[in] millisec timeout value or 0 in case of no time-out -/// \return pointer to memory block that can be filled with mail or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osMailAlloc shall be consistent in every CMSIS-RTOS. -void *osMailAlloc (osMailQId queue_id, uint32_t millisec); - -/// Allocate a memory block from a mail and set memory block to zero. -/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate. -/// \param[in] millisec timeout value or 0 in case of no time-out -/// \return pointer to memory block that can be filled with mail or NULL in case of error. -/// \note MUST REMAIN UNCHANGED: \b osMailCAlloc shall be consistent in every CMSIS-RTOS. -void *osMailCAlloc (osMailQId queue_id, uint32_t millisec); - -/// Put a mail to a queue. -/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate. -/// \param[in] mail memory block previously allocated with \ref osMailAlloc or \ref osMailCAlloc. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osMailPut shall be consistent in every CMSIS-RTOS. -osStatus osMailPut (osMailQId queue_id, void *mail); - -/// Get a mail from a queue. -/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate. -/// \param[in] millisec timeout value or 0 in case of no time-out -/// \return event that contains mail information or error code. -/// \note MUST REMAIN UNCHANGED: \b osMailGet shall be consistent in every CMSIS-RTOS. -osEvent osMailGet (osMailQId queue_id, uint32_t millisec); - -/// Free a memory block from a mail. -/// \param[in] queue_id mail queue ID obtained with \ref osMailCreate. -/// \param[in] mail pointer to the memory block that was obtained with \ref osMailGet. -/// \return status code that indicates the execution status of the function. -/// \note MUST REMAIN UNCHANGED: \b osMailFree shall be consistent in every CMSIS-RTOS. -osStatus osMailFree (osMailQId queue_id, void *mail); - -#endif // Mail Queues available - - -#ifdef __cplusplus -} -#endif - -#endif // _CMSIS_OS_H diff --git a/bsp/essemi/es32f0271/libraries/CMSIS/index.html b/bsp/essemi/es32f0271/libraries/CMSIS/index.html deleted file mode 100644 index c6da0802b4..0000000000 --- a/bsp/essemi/es32f0271/libraries/CMSIS/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -Redirect to the CMSIS main page after 0 seconds - - - - - - -If the automatic redirection is failing, click open CMSIS Documentation. - - - diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_ad16c4t.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_ad16c4t.h deleted file mode 100644 index 672719a20b..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_ad16c4t.h +++ /dev/null @@ -1,4484 +0,0 @@ -/** - ************************************************************************************** - * @file md_AD16C4T.h - * @brief ES32F0271 Header file of MD AD16C4T module. - * - * @version V0.01 - * @date 3/12/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. AMD rights reserved. - * - ************************************************************************************** - */ - /* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_AD16C4T_H__ -#define __MD_AD16C4T_H__ - -#ifdef __cplusplus -extern "C"{ -#endif - -/* Includes -------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_ad16c4t.h" - - -/** @addtogroup Micro_Driver - * @{ - */ -#if defined (AD16C4T1) - -/** @defgroup AD16C4T AD16C4T - * @brief AD16C4T module driver - * @{ - */ - - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private Macros ----------------------------------------------------------*/ - - - -/* Public Constants -----------------------------------------------------------*/ - -/** @defgroup MD_AD16C4T_Public_Constants Public Constants - * @brief AD16C4T module driver - * @{ - */ -/* AD16C4T_CON1 macros define*/ -#define MD_AD16C4T_DEBUGSELECT_INPUT (0 << AD16C4T_CON1_DBGSEL_POS) /*!< Channel input*/ -#define MD_AD16C4T_DEBUGSELECT_OUTPUT (1 << AD16C4T_CON1_DBGSEL_POS) /*!< Channel output*/ - -#define MD_AD16C4T_COMPAREINPUT_DISABLE (0 << AD16C4T_CON1_CMPSEL_POSS) /*!< Compare input is disabled*/ -#define MD_AD16C4T_COMPAREINPUT_0 (1 << AD16C4T_CON1_CMPSEL_POSS) /*!< Compare input(CMP_IN)=Compare output 0*/ -#define MD_AD16C4T_COMPAREINPUT_1 (2 << AD16C4T_CON1_CMPSEL_POSS) /*!< Compare input(CMP_IN)=Compare output 1*/ -#define MD_AD16C4T_COMPAREINPUT_2 (3 << AD16C4T_CON1_CMPSEL_POSS) /*!< Compare input(CMP_IN)=Compare output 2*/ -#define MD_AD16C4T_COMPAREINPUT_3 (4 << AD16C4T_CON1_CMPSEL_POSS) /*!< Compare input(CMP_IN)=Compare output 3*/ - -#define MD_AD16C4T_COMPAREPOLARITY_LOW (0 << AD16C4T_CON1_CMPSELP_POS) /*!< Compare input is active low*/ -#define MD_AD16C4T_COMPAREPOLARITY_HIGH (1 << AD16C4T_CON1_CMPSELP_POS) /*!< Compare input is active high*/ - -#define MD_AD16C4T_CLOCKDIVSION_DIV1 (0 << AD16C4T_CON1_DFCKSEL_POSS) /*!< tDTS=tCK_INT*/ -#define MD_AD16C4T_CLOCKDIVSION_DIV2 (1 << AD16C4T_CON1_DFCKSEL_POSS) /*!< tDTS=2*tCK_INT*/ -#define MD_AD16C4T_CLOCKDIVSION_DIV4 (2 << AD16C4T_CON1_DFCKSEL_POSS) /*!< tDTS=4*tCK_INT*/ - -#define MD_AD16C4T_CENTERALIGNED_DISABLE (0 << AD16C4T_CON1_CMSEL_POSS) /*!< Edge-aligned mode*/ -#define MD_AD16C4T_CENTERALIGNED_DOWN (1 << AD16C4T_CON1_CMSEL_POSS) /*!< Center-aligned mode 1*/ -#define MD_AD16C4T_CENTERALIGNED_UP (2 << AD16C4T_CON1_CMSEL_POSS) /*!< Center-aligned mode 2*/ -#define MD_AD16C4T_CENTERALIGNED_BOTH (3 << AD16C4T_CON1_CMSEL_POSS) /*!< Center-aligned mode 3*/ - -#define MD_AD16C4T_UPCOUNTER (0 << AD16C4T_CON1_DIRSEL_POS) /*!< Counter used as upcounter*/ -#define MD_AD16C4T_DOWNCOUNTER (1 << AD16C4T_CON1_DIRSEL_POS) /*!< Counter used as downcounter*/ - -#define MD_AD16C4T_ONEPULSEMODE_DISABLE (0 << AD16C4T_CON1_SPMEN_POS) /*!< Counter is not stopped at update event*/ -#define MD_AD16C4T_ONEPULSEMODE_ENABLE (1 << AD16C4T_CON1_SPMEN_POS) /*!< Counter stops counting at the next update event*/ - -#define MD_AD16C4T_UPDATESOURCE_NORMAL (0 << AD16C4T_CON1_UERSEL_POS) /*!< Counter overflow/underflow, Setting the UG bit, Update generation through the slave mode controller generate an update interrupt*/ -#define MD_AD16C4T_UPDATESOURCE_COUNTER (1 << AD16C4T_CON1_UERSEL_POS) /*!< Only counter overflow/underflow generates an update interrupt or DMA request if Enabled*/ - -/* AD16C4T_CON2 macros define*/ -#define MD_AD16C4T_IDLEOUTPUT_LOW 0 /*!< OC1=0 (after a dead-time if OC1N is implemented) when MOE=0*/ -#define MD_AD16C4T_IDLEOUTPUT_HIGH 1 /*!< OC1=1 (after a dead-time if OC1N is implemented) when MOE=0*/ - -#define MD_AD16C4T_TI1INPUT_CH1 (0 << AD16C4T_CON2_I1SEL_POS) /*!< The TIMx_CH1 pin is connected to TI1 input*/ -#define MD_AD16C4T_TI1INPUT_XOR (1 << AD16C4T_CON2_I1SEL_POS) /*!< The TIMx_CH1, CH2 and CH3 pins are connected to the TI1 input (XOR combination)*/ - -#define MD_AD16C4T_MASTERMODE_RESET (0 << AD16C4T_CON2_MMSEL_POSS) /*!< Reset mode*/ -#define MD_AD16C4T_MASTERMODE_ENABLE (1 << AD16C4T_CON2_MMSEL_POSS) /*!< Enable mode*/ -#define MD_AD16C4T_MASTERMODE_UPDATE (2 << AD16C4T_CON2_MMSEL_POSS) /*!< Update mode*/ -#define MD_AD16C4T_MASTERMODE_COMPAREPULSE (3 << AD16C4T_CON2_MMSEL_POSS) /*!< Compare Pulse mode*/ -#define MD_AD16C4T_MASTERMODE_COMPARE1 (4 << AD16C4T_CON2_MMSEL_POSS) /*!< Compare 1 mode*/ -#define MD_AD16C4T_MASTERMODE_COMPARE2 (5 << AD16C4T_CON2_MMSEL_POSS) /*!< Compare 2 mode*/ -#define MD_AD16C4T_MASTERMODE_COMPARE3 (6 << AD16C4T_CON2_MMSEL_POSS) /*!< Compare 3 mode*/ -#define MD_AD16C4T_MASTERMODE_COMPARE4 (7 << AD16C4T_CON2_MMSEL_POSS) /*!< Compare 4 mode*/ - -#define MD_AD16C4T_DMASELECTION_COMPARE (0 << AD16C4T_CON2_CCDMASEL_POS) /*!< CCx DMA request sent when CCx event occurs*/ -#define MD_AD16C4T_DMASELECTION_UPDATE (1 << AD16C4T_CON2_CCDMASEL_POS) /*!< CCx DMA requests sent when update event occurs*/ - -#define MD_AD16C4T_UPDATESELECTION_COMG (0 << AD16C4T_CON2_CCUSEL_POS) /*!< When capture/compare control bits are preloaded (CCPC=1), they are updated by setting the COMG bit only*/ -#define MD_AD16C4T_UPDATESELECTION_BOTH (1 << AD16C4T_CON2_CCUSEL_POS) /*!< When capture/compare control bits are preloaded (CCPC=1), they are updated by setting the COMG bit or when an rising edge occurs on TRGI*/ - -#define MD_AD16C4T_CCPRELOAD_DISABLE (0 << AD16C4T_CON2_CCPCEN_POS) /*!< CCxE, CCxNE and OCxM bits are not preloaded*/ -#define MD_AD16C4T_CCPRELOAD_ENABLE (1 << AD16C4T_CON2_CCPCEN_POS) /*!< CCxE, CCxNE and OCxM bits are preloaded*/ - -/* AD16C4T_SMCON macros define*/ -#define MD_AD16C4T_ETRPOLARITY_NONINVERTED (0 << AD16C4T_SMCON_ETPOL_POS) /*!< ETR is non-inverted*/ -#define MD_AD16C4T_ETRPOLARITY_INVERTED (1 << AD16C4T_SMCON_ETPOL_POS) /*!< ETR is inverted*/ - -#define MD_AD16C4T_ETRFILTER_FDIV1 (0 << AD16C4T_SMCON_ETFLT_POSS) /*!< No filter*/ -#define MD_AD16C4T_ETRFILTER_FDIV1N2 (1 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fCK_INT, N = 2*/ -#define MD_AD16C4T_ETRFILTER_FDIV1N4 (2 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fCK_INT, N = 4*/ -#define MD_AD16C4T_ETRFILTER_FDIV1N8 (3 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fCK_INT, N = 8*/ -#define MD_AD16C4T_ETRFILTER_FDIV2N6 (4 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 2, N = 6*/ -#define MD_AD16C4T_ETRFILTER_FDIV2N8 (5 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 2, N = 8*/ -#define MD_AD16C4T_ETRFILTER_FDIV4N6 (6 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 4, N = 6*/ -#define MD_AD16C4T_ETRFILTER_FDIV4N8 (7 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 4, N = 8*/ -#define MD_AD16C4T_ETRFILTER_FDIV8N6 (8 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 8, N = 6*/ -#define MD_AD16C4T_ETRFILTER_FDIV8N8 (9 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 8, N = 8*/ -#define MD_AD16C4T_ETRFILTER_FDIV16N5 (10 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 16, N = 5*/ -#define MD_AD16C4T_ETRFILTER_FDIV16N6 (11 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 16, N = 6*/ -#define MD_AD16C4T_ETRFILTER_FDIV16N8 (12 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 16, N = 8*/ -#define MD_AD16C4T_ETRFILTER_FDIV32N5 (13 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 32, N = 5*/ -#define MD_AD16C4T_ETRFILTER_FDIV32N6 (14 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 32, N = 6*/ -#define MD_AD16C4T_ETRFILTER_FDIV32N8 (15 << AD16C4T_SMCON_ETFLT_POSS) /*!< fSAMPLING = fDTS / 32, N = 8*/ - -#define MD_AD16C4T_MASTERSLAVE_NODELAY (0 << AD16C4T_SMCON_MSCFG_POS) /*!< No action*/ -#define MD_AD16C4T_MASTERSLAVE_DELAY (1 << AD16C4T_SMCON_MSCFG_POS) /*!< The effect of an event on the trigger input (TRGI) is delayed to allow a perfect*/ - -#define MD_AD16C4T_TRIGGERSELECT_ITR0 (0 << AD16C4T_SMCON_TSSEL_POSS) /*!< Internal Trigger 0*/ -#define MD_AD16C4T_TRIGGERSELECT_ITR1 (1 << AD16C4T_SMCON_TSSEL_POSS) /*!< Internal Trigger 1*/ -#define MD_AD16C4T_TRIGGERSELECT_ITR2 (2 << AD16C4T_SMCON_TSSEL_POSS) /*!< Internal Trigger 2*/ -#define MD_AD16C4T_TRIGGERSELECT_ITR3 (3 << AD16C4T_SMCON_TSSEL_POSS) /*!< Internal Trigger 3*/ -#define MD_AD16C4T_TRIGGERSELECT_TI1FED (4 << AD16C4T_SMCON_TSSEL_POSS) /*!< TI1 Edge Detector*/ -#define MD_AD16C4T_TRIGGERSELECT_TI1FP1 (5 << AD16C4T_SMCON_TSSEL_POSS) /*!< Filtered Timer Input 1*/ -#define MD_AD16C4T_TRIGGERSELECT_TI2FP2 (6 << AD16C4T_SMCON_TSSEL_POSS) /*!< Filtered Timer Input 2*/ -#define MD_AD16C4T_TRIGGERSELECT_ETRF (7 << AD16C4T_SMCON_TSSEL_POSS) /*!< External Trigger input*/ - -#define MD_AD16C4T_OCREFCLEAR_CMP (0 << AD16C4T_SMCON_CHCSEL_POS) /*!< OCREF_CLR is connected to the CMP_IN input*/ -#define MD_AD16C4T_OCREFCLEAR_ETRF (1 << AD16C4T_SMCON_CHCSEL_POS) /*!< OCREF_CLR is connected to ETRF*/ - -#define MD_AD16C4T_SLAVEMODE_DISABLE (0 << AD16C4T_SMCON_SMODS_POSS) /*!< Slave mode disabled*/ -#define MD_AD16C4T_SLAVEMODE_ENCODER1 (1 << AD16C4T_SMCON_SMODS_POSS) /*!< Encoder mode 1*/ -#define MD_AD16C4T_SLAVEMODE_ENCODER2 (2 << AD16C4T_SMCON_SMODS_POSS) /*!< Encoder mode 2*/ -#define MD_AD16C4T_SLAVEMODE_ENCODER3 (3 << AD16C4T_SMCON_SMODS_POSS) /*!< Encoder mode 3*/ -#define MD_AD16C4T_SLAVEMODE_RESET (4 << AD16C4T_SMCON_SMODS_POSS) /*!< Reset Mode*/ -#define MD_AD16C4T_SLAVEMODE_GATED (5 << AD16C4T_SMCON_SMODS_POSS) /*!< Gated Mode*/ -#define MD_AD16C4T_SLAVEMODE_TRIGGER (6 << AD16C4T_SMCON_SMODS_POSS) /*!< Trigger Mode*/ -#define MD_AD16C4T_SLAVEMODE_EXTERNALCLOCK (7 << AD16C4T_SMCON_SMODS_POSS) /*!< External Clock Mode 1*/ - -/* AD16C4T_IER IDR IVS RIF IFM ICR macros define*/ -#define MD_AD16C4T_INTERRUPTFALG_CC4OI (1 << AD16C4T_IER_CH4OVI_POS) /*!< Capture/Compare 4 overcapture interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_CC3OI (1 << AD16C4T_IER_CH3OVI_POS) /*!< Capture/Compare 3 overcapture interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_CC2OI (1 << AD16C4T_IER_CH2OVI_POS) /*!< Capture/Compare 2 overcapture interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_CC1OI (1 << AD16C4T_IER_CH1OVI_POS) /*!< Capture/Compare 1 overcapture interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_BI (1 << AD16C4T_IER_BRKI_POS) /*!< Break interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_TI (1 << AD16C4T_IER_TRGI_POS) /*!< Trigger interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_COMI (1 << AD16C4T_IER_COMI_POS) /*!< COM interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_CC4I (1 << AD16C4T_IER_CH4I_POS) /*!< Capture/Compare 4 interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_CC3I (1 << AD16C4T_IER_CH3I_POS) /*!< Capture/Compare 3 interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_CC2I (1 << AD16C4T_IER_CH2I_POS) /*!< Capture/Compare 2 interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_CC1I (1 << AD16C4T_IER_CH1I_POS) /*!< Capture/Compare 1 interrupt*/ -#define MD_AD16C4T_INTERRUPTFALG_UI (1 << AD16C4T_IER_UI_POS) /*!< Update interrupt*/ - -/* AD16C4T_SGE macros define*/ -#define MD_AD16C4T_EVENTGENERATION_BG (1 << AD16C4T_SGE_SGBRK_POS) /*!< Break generation*/ -#define MD_AD16C4T_EVENTGENERATION_TG (1 << AD16C4T_SGE_SGTRG_POS) /*!< Trigger generation*/ -#define MD_AD16C4T_EVENTGENERATION_COMG (1 << AD16C4T_SGE_SGCOM_POS) /*!< Capture/Compare control update generation*/ -#define MD_AD16C4T_EVENTGENERATION_CC4G (1 << AD16C4T_SGE_SGCH4_POS) /*!< Capture/Compare 4 generation*/ -#define MD_AD16C4T_EVENTGENERATION_CC3G (1 << AD16C4T_SGE_SGCH3_POS) /*!< Capture/Compare 3 generation*/ -#define MD_AD16C4T_EVENTGENERATION_CC2G (1 << AD16C4T_SGE_SGCH2_POS) /*!< Capture/Compare 2 generation*/ -#define MD_AD16C4T_EVENTGENERATION_CC1G (1 << AD16C4T_SGE_SGCH1_POS) /*!< Capture/Compare 1 generation*/ -#define MD_AD16C4T_EVENTGENERATION_UG (1 << AD16C4T_SGE_SGU_POS) /*!< Update generation*/ - -/* AD16C4T_CHMR1 CHMR2 output macros define*/ -#define MD_AD16C4T_OUTPUTMODE_DISABLE 0 /*!< Frozen*/ -#define MD_AD16C4T_OUTPUTMODE_HIGHONMSTCH 1 /*!< Set channel 1 to active level on match*/ -#define MD_AD16C4T_OUTPUTMODE_LOWONMSTCH 2 /*!< Set channel 1 to inactive level on match*/ -#define MD_AD16C4T_OUTPUTMODE_TOGGLE 3 /*!< Toggle*/ -#define MD_AD16C4T_OUTPUTMODE_FORCELOW 4 /*!< Force inactive level*/ -#define MD_AD16C4T_OUTPUTMODE_FORCEHIGH 5 /*!< Force active level*/ -#define MD_AD16C4T_OUTPUTMODE_PWMMODE1 6 /*!< PWM mode 1*/ -#define MD_AD16C4T_OUTPUTMODE_PWMMODE2 7 /*!< PWM mode 2*/ - -#define MD_AD16C4T_CHMODE_OUTPUT 0 /*!< CCx channel is configured as output*/ -#define MD_AD16C4T_CHMODE_INPUT_DIRECT 1 /*!< CCx channel is configured as input, ICx is mapped direct*/ -#define MD_AD16C4T_CHMODE_INPUT_INDIRECT 2 /*!< CCx channel is configured as input, ICx is mapped indirect*/ -#define MD_AD16C4T_CHMODE_INPUT_TRC 3 /*!< CCx channel is configured as input, ICx is mapped TRC*/ - -/* AD16C4T_CHMR1 CHMR2 input macros define*/ -#define MD_AD16C4T_INPUTFILTER_FDIV1 0 /*!< No filter*/ -#define MD_AD16C4T_INPUTFILTER_FDIV1N2 1 /*!< fSAMPLING = fCK_INT, N = 2*/ -#define MD_AD16C4T_INPUTFILTER_FDIV1N4 2 /*!< fSAMPLING = fCK_INT, N = 4*/ -#define MD_AD16C4T_INPUTFILTER_FDIV1N8 3 /*!< fSAMPLING = fCK_INT, N = 8*/ -#define MD_AD16C4T_INPUTFILTER_FDIV2N6 4 /*!< fSAMPLING = fDTS / 2, N = 6*/ -#define MD_AD16C4T_INPUTFILTER_FDIV2N8 5 /*!< fSAMPLING = fDTS / 2, N = 8*/ -#define MD_AD16C4T_INPUTFILTER_FDIV4N6 6 /*!< fSAMPLING = fDTS / 4, N = 6*/ -#define MD_AD16C4T_INPUTFILTER_FDIV4N8 7 /*!< fSAMPLING = fDTS / 4, N = 8*/ -#define MD_AD16C4T_INPUTFILTER_FDIV8N6 8 /*!< fSAMPLING = fDTS / 8, N = 6*/ -#define MD_AD16C4T_INPUTFILTER_FDIV8N8 9 /*!< fSAMPLING = fDTS / 8, N = 8*/ -#define MD_AD16C4T_INPUTFILTER_FDIV16N5 10 /*!< fSAMPLING = fDTS / 16, N = 5*/ -#define MD_AD16C4T_INPUTFILTER_FDIV16N6 11 /*!< fSAMPLING = fDTS / 16, N = 6*/ -#define MD_AD16C4T_INPUTFILTER_FDIV16N8 12 /*!< fSAMPLING = fDTS / 16, N = 8*/ -#define MD_AD16C4T_INPUTFILTER_FDIV32N5 13 /*!< fSAMPLING = fDTS / 32, N = 5*/ -#define MD_AD16C4T_INPUTFILTER_FDIV32N6 14 /*!< fSAMPLING = fDTS / 32, N = 6*/ -#define MD_AD16C4T_INPUTFILTER_FDIV32N8 15 /*!< fSAMPLING = fDTS / 32, N = 8*/ - -#define MD_AD16C4T_INPUTPRESCALE_DIV1 0 /*!< no prescaler*/ -#define MD_AD16C4T_INPUTPRESCALE_DIV2 1 /*!< capture is done once every 2 events*/ -#define MD_AD16C4T_INPUTPRESCALE_DIV4 2 /*!< capture is done once every 4 events*/ -#define MD_AD16C4T_INPUTPRESCALE_DIV8 3 /*!< capture is done once every 8 events*/ - -/* AD16C4T_CCEP input macros define*/ -#define MD_AD16C4T_OUTPUTPOLARITY_HIGH 0 /*!< active high*/ -#define MD_AD16C4T_OUTPUTPOLARITY_LOW 1 /*!< active low*/ - -/* AD16C4T_BDCFG input macros define*/ -#define MD_AD16C4T_BREAKPOLARITY_LOW (0 << AD16C4T_BDCFG_BRKP_POS) /*!< Break input BRK is active low*/ -#define MD_AD16C4T_BREAKPOLARITY_HIGH (1 << AD16C4T_BDCFG_BRKP_POS) /*!< Break input BRK is active high */ - -#define MD_AD16C4T_OFFSTATERUN_DISABLE (0 << AD16C4T_BDCFG_OFFSSR_POS) /*!< This bit is used when MOE=1, when inactive, OC/OCN outputs are disabled*/ -#define MD_AD16C4T_OFFSTATERUN_ENABLE (1 << AD16C4T_BDCFG_OFFSSR_POS) /*!< This bit is used when MOE=1, when inactive, OC/OCN outputs are enabled*/ - -#define MD_AD16C4T_OFFSTATEIDLE_DISABLE (0 << AD16C4T_BDCFG_OFFSSI_POS) /*!< This bit is used when MOE=0, when inactive, OC/OCN outputs are disabled*/ -#define MD_AD16C4T_OFFSTATEIDLE_ENABLE (1 << AD16C4T_BDCFG_OFFSSI_POS) /*!< This bit is used when MOE=0, when inactive, OC/OCN outputs are forced*/ - -#define MD_AD16C4T_LOCKLEVEL_0 (0 << AD16C4T_BDCFG_LOCKLVL_POSS) /*!< LOCK OFF*/ -#define MD_AD16C4T_LOCKLEVEL_1 (1 << AD16C4T_BDCFG_LOCKLVL_POSS) /*!< LOCK Level 1*/ -#define MD_AD16C4T_LOCKLEVEL_2 (2 << AD16C4T_BDCFG_LOCKLVL_POSS) /*!< LOCK Level 2*/ -#define MD_AD16C4T_LOCKLEVEL_3 (3 << AD16C4T_BDCFG_LOCKLVL_POSS) /*!< LOCK Level 3*/ - -/** - * @} MD_AD16C4T_Public_Constants - */ - -/* Public Macro ------------------------------------------------------------*/ -/** @defgroup MD_AD16C4T_Public_Macro Public Macro - * @brief AD16C4T module driver - * @{ - */ - -/** - * @brief Timer CON1 setup. - * @param timx AD16C4T instance - * @param value (DBGSEL | CMPSEL | CMPSELP | DFCKSEL | ARPEN | CMSEL | DIRSEL | SPMEN | UERSEL | DISUE | CNTEN) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CON1, value); -} - -/** - * @brief GET Timer CON1 register value. - * @param timx AD16C4T instance - * @retval Timer CON1 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CON1)); -} - -/** - * @brief Timer debug mode select. - * @param timx AD16C4T instance - * @param DebugSelect Debug mode output select - @arg @ref MD_AD16C4T_DEBUGSELECT_INPUT - @arg @ref MD_AD16C4T_DEBUGSELECT_OUTPUT - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1_dbgsel(AD16C4T_TypeDef *timx, uint32_t DebugSelect) -{ - MODIFY_REG(timx->CON1, AD16C4T_CON1_DBGSEL_MSK, DebugSelect); -} - -/** - * @brief Get timer debug mode select. - * @param timx AD16C4T instance - * @retval Timer debug mode select. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1_dbgsel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_DBGSEL_MSK) >> AD16C4T_CON1_DBGSEL_POS); -} - -/** - * @brief Timer compare input selection. - * @param timx AD16C4T instance - * @param CompareSelection Compare input selection - @arg @ref MD_AD16C4T_COMPAREINPUT_DISABLE - @arg @ref MD_AD16C4T_COMPAREINPUT_0 - @arg @ref MD_AD16C4T_COMPAREINPUT_1 - @arg @ref MD_AD16C4T_COMPAREINPUT_2 - @arg @ref MD_AD16C4T_COMPAREINPUT_3 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1_cmpsel(AD16C4T_TypeDef *timx, uint32_t CompareSelection) -{ - MODIFY_REG(timx->CON1, AD16C4T_CON1_CMPSEL_MSK, CompareSelection); -} - -/** - * @brief Get timer compare input selection. - * @param timx AD16C4T instance - * @retval Timer compare input selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1_cmpsel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_CMPSEL_MSK) >> AD16C4T_CON1_CMPSEL_POSS); -} - -/** - * @brief Timer compare input selection polarity setup. - * @param timx AD16C4T instance - * @param ComparePolarity compare input selection polarity - @arg @ref MD_AD16C4T_COMPAREPOLARITY_LOW - @arg @ref MD_AD16C4T_COMPAREPOLARITY_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1_cmpselp(AD16C4T_TypeDef *timx, uint32_t ComparePolarity) -{ - MODIFY_REG(timx->CON1, AD16C4T_CON1_CMPSELP_MSK, ComparePolarity); -} - -/** - * @brief Get timer compare input selection polarity. - * @param timx AD16C4T instance - * @retval Timer compare input selection polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1_cmpselp(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_CMPSELP_MSK) >> AD16C4T_CON1_CMPSELP_POS); -} - -/** - * @brief Timer clock division setup. - * @param timx AD16C4T instance - * @param ClockDivision Clock division - @arg @ref MD_AD16C4T_CLOCKDIVSION_DIV1 - @arg @ref MD_AD16C4T_CLOCKDIVSION_DIV2 - @arg @ref MD_AD16C4T_CLOCKDIVSION_DIV4 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1_dfcksel(AD16C4T_TypeDef *timx, uint32_t ClockDivision) -{ - MODIFY_REG(timx->CON1, AD16C4T_CON1_DFCKSEL_MSK, ClockDivision); -} - -/** - * @brief Get timer Clock division. - * @param timx AD16C4T instance - * @retval Timer Clock division. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1_dfcksel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_DFCKSEL_MSK) >> AD16C4T_CON1_DFCKSEL_POSS); -} - -/** - * @brief Timer auto-reload preload enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_con1_arpen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CON1, AD16C4T_CON1_ARPEN_MSK); -} - -/** - * @brief Timer auto-reload preload disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_con1_arpen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CON1, AD16C4T_CON1_ARPEN_MSK); -} - -/** - * @brief Indicates whether the timer auto-reload preload is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_con1_arpen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_ARPEN_MSK) == (AD16C4T_CON1_ARPEN_MSK)); -} - -/** - * @brief Timer center-aligned mode selection setup. - * @param timx AD16C4T instance - * @param CenterAlignedMode center-aligned mode selection - @arg @ref MD_AD16C4T_CENTERALIGNED_DISABLE - @arg @ref MD_AD16C4T_CENTERALIGNED_DOWN - @arg @ref MD_AD16C4T_CENTERALIGNED_UP - @arg @ref MD_AD16C4T_CENTERALIGNED_BOTH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1_cmsel(AD16C4T_TypeDef *timx, uint32_t CenterAlignedMode) -{ - MODIFY_REG(timx->CON1, AD16C4T_CON1_CMSEL_MSK, CenterAlignedMode); -} - -/** - * @brief Get timer center-aligned mode selection. - * @param timx AD16C4T instance - * @retval Timer center-aligned mode selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1_cmsel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_CMSEL_MSK) >> AD16C4T_CON1_CMSEL_POSS); -} - -/** - * @brief Timer counting direction setup. - * @param timx AD16C4T instance - * @param direction Counting direction - @arg @ref MD_AD16C4T_UPCOUNTER - @arg @ref MD_AD16C4T_DOWNCOUNTER - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1_dirsel(AD16C4T_TypeDef *timx, uint32_t direction) -{ - MODIFY_REG(timx->CON1, AD16C4T_CON1_DIRSEL_MSK, direction); -} - -/** - * @brief Get timer counting direction. - * @param timx AD16C4T instance - * @retval Timer counting direction. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1_dirsel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_DIRSEL_MSK) >> AD16C4T_CON1_DIRSEL_POS); -} - -/** - * @brief Timer one pulse mode enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_con1_spmen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CON1, AD16C4T_CON1_SPMEN_MSK); -} - -/** - * @brief Timer one pulse mode disable. - * @param timx AD16C4T instance - * @retval None. - */ - -__STATIC_INLINE void md_ad16c4t_disable_con1_spmen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CON1, AD16C4T_CON1_SPMEN_MSK); -} - -/** - * @brief Indicates whether the timer one pulse mode is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_con1_spmen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_SPMEN_MSK) == (AD16C4T_CON1_SPMEN_MSK)); -} - -/** - * @brief Timer update request source setup. - * @param timx AD16C4T instance - * @param UpdateSource Update request source select - @arg @ref MD_AD16C4T_UPDATESOURCE_NORMAL - @arg @ref MD_AD16C4T_UPDATESOURCE_COUNTER - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con1_uersel(AD16C4T_TypeDef *timx, uint32_t UpdateSource) -{ - MODIFY_REG(timx->CON1, AD16C4T_CON1_UERSEL_MSK, UpdateSource); -} - -/** - * @brief Get timer update request source. - * @param timx AD16C4T instance - * @retval Timer update request source. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con1_uersel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_UERSEL_MSK) >> AD16C4T_CON1_UERSEL_POS); -} - -/** - * @brief Timer update event enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_con1_disue(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CON1, AD16C4T_CON1_DISUE_MSK); -} - -/** - * @brief Timer update event disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disble_con1_disue(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CON1, AD16C4T_CON1_DISUE_MSK); -} - -/** - * @brief Indicates whether the timer update event is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_con1_disue(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_DISUE_MSK) == (AD16C4T_CON1_DISUE_MSK)); -} - -/** - * @brief Timer counter enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_con1_cnten(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CON1, AD16C4T_CON1_CNTEN_MSK); -} - - -/** - * @brief Timer counter disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_con1_cnten(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CON1, AD16C4T_CON1_CNTEN_MSK); -} - -/** - * @brief Indicates whether the timer counter is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_con1_cnten(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON1, AD16C4T_CON1_CNTEN_MSK) == (AD16C4T_CON1_CNTEN_MSK)); -} - -/** - * @brief Timer CON2 setup. - * @param timx AD16C4T instance - * @param value (OISS4 | OISS3N | OISS3 | OISS2N | OISS2 | OISS1N | OISS1 | I1SEL | MMSEL | CCDMASEL | CCUSEL | CCPCEN) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CON2, value); -} - -/** - * @brief GET Timer CON2 register value. - * @param timx AD16C4T instance - * @retval Timer CON2 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CON2)); -} - -/** - * @brief Timer output idle state 4 setup. - * @param timx AD16C4T instance - * @param IdleOutput Output idle state - @arg @ref MD_AD16C4T_IDLEOUTPUT_LOW - @arg @ref MD_AD16C4T_IDLEOUTPUT_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_oiss4(AD16C4T_TypeDef *timx, uint32_t IdleOutput) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_OISS4_MSK, (IdleOutput << AD16C4T_CON2_OISS4_POS)); -} - -/** - * @brief Get timer output idle state 4. - * @param timx AD16C4T instance - * @retval Timer output idle state 4. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_oiss4(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_OISS4_MSK) >> AD16C4T_CON2_OISS4_POS); -} - -/** - * @brief Timer output idle state 3N setup. - * @param timx AD16C4T instance - * @param IdleOutput Output idle state - @arg @ref MD_AD16C4T_IDLEOUTPUT_LOW - @arg @ref MD_AD16C4T_IDLEOUTPUT_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_oiss3n(AD16C4T_TypeDef *timx, uint32_t IdleOutput) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_OISS3N_MSK, (IdleOutput << AD16C4T_CON2_OISS3N_POS)); -} - -/** - * @brief Get timer output idle state 3N. - * @param timx AD16C4T instance - * @retval Timer output idle state 3N. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_oiss3n(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_OISS3N_MSK) >> AD16C4T_CON2_OISS3N_POS); -} - -/** - * @brief Timer output idle state 3 setup. - * @param timx AD16C4T instance - * @param IdleOutput Output idle state - @arg @ref MD_AD16C4T_IDLEOUTPUT_LOW - @arg @ref MD_AD16C4T_IDLEOUTPUT_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_oiss3(AD16C4T_TypeDef *timx, uint32_t IdleOutput) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_OISS3_MSK, (IdleOutput << AD16C4T_CON2_OISS3_POS)); -} - -/** - * @brief Get timer output idle state 3. - * @param timx AD16C4T instance - * @retval Timer output idle state 3. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_oiss3(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_OISS3_MSK) >> AD16C4T_CON2_OISS3_POS); -} - -/** - * @brief Timer output idle state 2N setup. - * @param timx AD16C4T instance - * @param IdleOutput Output idle state - @arg @ref MD_AD16C4T_IDLEOUTPUT_LOW - @arg @ref MD_AD16C4T_IDLEOUTPUT_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_oiss2n(AD16C4T_TypeDef *timx, uint32_t IdleOutput) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_OISS2N_MSK, (IdleOutput << AD16C4T_CON2_OISS2N_POS)); -} - -/** - * @brief Get timer output idle state 2N. - * @param timx AD16C4T instance - * @retval Timer output idle state 2N. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_oiss2n(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_OISS2N_MSK) >> AD16C4T_CON2_OISS2N_POS); -} - -/** - * @brief Timer output idle state 2 setup. - * @param timx AD16C4T instance - * @param IdleOutput Output idle state - @arg @ref MD_AD16C4T_IDLEOUTPUT_LOW - @arg @ref MD_AD16C4T_IDLEOUTPUT_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_oiss2(AD16C4T_TypeDef *timx, uint32_t IdleOutput) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_OISS2_MSK, (IdleOutput << AD16C4T_CON2_OISS2_POS)); -} - -/** - * @brief Get timer output idle state 2. - * @param timx AD16C4T instance - * @retval Timer output idle state 2. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_oiss2(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_OISS2_MSK) >> AD16C4T_CON2_OISS2_POS); -} - -/** - * @brief Timer output idle state 1N setup. - * @param timx AD16C4T instance - * @param IdleOutput Output idle state - @arg @ref MD_AD16C4T_IDLEOUTPUT_LOW - @arg @ref MD_AD16C4T_IDLEOUTPUT_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_oiss1n(AD16C4T_TypeDef *timx, uint32_t IdleOutput) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_OISS1N_MSK, (IdleOutput << AD16C4T_CON2_OISS1N_POS)); -} - -/** - * @brief Get timer output idle state 1N. - * @param timx AD16C4T instance - * @retval Timer output idle state 1N. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_oiss1n(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_OISS1N_MSK) >> AD16C4T_CON2_OISS1N_POS); -} - -/** - * @brief Timer output idle state 1 setup. - * @param timx AD16C4T instance - * @param IdleOutput Output idle state - @arg @ref MD_AD16C4T_IDLEOUTPUT_LOW - @arg @ref MD_AD16C4T_IDLEOUTPUT_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_oiss1(AD16C4T_TypeDef *timx, uint32_t IdleOutput) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_OISS1_MSK, (IdleOutput << AD16C4T_CON2_OISS1_POS)); -} - -/** - * @brief Get timer output idle state 1. - * @param timx AD16C4T instance - * @retval Timer output idle state 1. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_oiss1(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_OISS1_MSK) >> AD16C4T_CON2_OISS1_POS); -} - -/** - * @brief Timer TI1 selection setup. - * @param timx AD16C4T instance - * @param TI1Input TI1 input select - @arg @ref MD_AD16C4T_TI1INPUT_CH1 - @arg @ref MD_AD16C4T_TI1INPUT_XOR - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_i1sel(AD16C4T_TypeDef *timx, uint32_t TI1Input) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_I1SEL_MSK, TI1Input); -} - -/** - * @brief Get timer TI1 selection. - * @param timx AD16C4T instance - * @retval Timer TI1 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_i1sel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_I1SEL_MSK) >> AD16C4T_CON2_I1SEL_POS); -} - -/** - * @brief Timer master mode selection setup. - * @param timx AD16C4T instance - * @param MasterMode Master mode selection - @arg @ref MD_AD16C4T_MASTERMODE_RESET - @arg @ref MD_AD16C4T_MASTERMODE_ENABLE - @arg @ref MD_AD16C4T_MASTERMODE_UPDATE - @arg @ref MD_AD16C4T_MASTERMODE_COMPAREPULSE - @arg @ref MD_AD16C4T_MASTERMODE_COMPARE1 - @arg @ref MD_AD16C4T_MASTERMODE_COMPARE2 - @arg @ref MD_AD16C4T_MASTERMODE_COMPARE3 - @arg @ref MD_AD16C4T_MASTERMODE_COMPARE4 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_mmsel(AD16C4T_TypeDef *timx, uint32_t MasterMode) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_MMSEL_MSK, MasterMode); -} - -/** - * @brief Get timer master mode selection. - * @param timx AD16C4T instance - * @retval Timer master mode selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_mmsel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_MMSEL_MSK) >> AD16C4T_CON2_MMSEL_POSS); -} - -/** - * @brief Timer capture/compare DMA selection setup. - * @param timx AD16C4T instance - * @param DMASelection Capture/compare DMA selection - @arg @ref MD_AD16C4T_DMASELECTION_COMPARE - @arg @ref MD_AD16C4T_DMASELECTION_UPDATE - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_ccdmasel(AD16C4T_TypeDef *timx, uint32_t DMASelection) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_CCDMASEL_MSK, DMASelection); -} - -/** - * @brief Get timer capture/compare DMA selection. - * @param timx AD16C4T instance - * @retval Timer capture/compare DMA selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_ccdmasel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_CCDMASEL_MSK) >> AD16C4T_CON2_CCDMASEL_POS); -} - -/** - * @brief Timer capture/compare control update selection setup. - * @param timx AD16C4T instance - * @param UpdateSelection Capture/compare control update selection - @arg @ref MD_AD16C4T_UPDATESELECTION_COMG - @arg @ref MD_AD16C4T_UPDATESELECTION_BOTH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_con2_ccusel(AD16C4T_TypeDef *timx, uint32_t UpdateSelection) -{ - MODIFY_REG(timx->CON2, AD16C4T_CON2_CCUSEL_MSK, UpdateSelection); -} - -/** - * @brief Get timer capture/compare control update selection. - * @param timx AD16C4T instance - * @retval Timer capture/compare control update selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_con2_ccusel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_CCUSEL_MSK) >> AD16C4T_CON2_CCUSEL_POS); -} - -/** - * @brief Timer capture/compare preloaded control enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_con2_ccpcen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CON2, AD16C4T_CON2_CCPCEN_MSK); -} - -/** - * @brief Timer capture/compare preloaded control disable. - * @param timx AD16C4T instance - * @retval None. - */ - -__STATIC_INLINE void md_ad16c4t_disable_con2_ccpcen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CON2, AD16C4T_CON2_CCPCEN_MSK); -} - -/** - * @brief Indicates whether the timer capture/compare preloaded control is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_con2_ccpcen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CON2, AD16C4T_CON2_CCPCEN_MSK) == (AD16C4T_CON2_CCPCEN_MSK)); -} - -/** - * @brief Timer SMCON setup. - * @param timx AD16C4T instance - * @param value (ETPOL | ECM2EN | ETFLT | MSCFG | TSSEL | CHCSEL | SMODS) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_smcon(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->SMCON, value); -} - -/** - * @brief GET Timer SMCON register value. - * @param timx AD16C4T instance - * @retval Timer SMCON register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_smcon(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->SMCON)); -} - -/** - * @brief Timer external trigger polarity setup. - * @param timx AD16C4T instance - * @param ETRPolarity External trigger polarity - @arg @ref MD_AD16C4T_ETRPOLARITY_NONINVERTED - @arg @ref MD_AD16C4T_ETRPOLARITY_INVERTED - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_smcon_etpol(AD16C4T_TypeDef *timx, uint32_t ETRPolarity) -{ - MODIFY_REG(timx->SMCON, AD16C4T_SMCON_ETPOL_MSK, ETRPolarity); -} - -/** - * @brief Get timer external trigger polarity. - * @param timx AD16C4T instance - * @retval Timer external trigger polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_smcon_etpol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->SMCON, AD16C4T_SMCON_ETPOL_MSK) >> AD16C4T_SMCON_ETPOL_POS); -} - -/** - * @brief Timer external clock enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_smcon_ecm2en(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SMCON, AD16C4T_SMCON_ECM2EN_MSK); -} - - -/** - * @brief Timer external clock disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_smcon_ecm2en(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->SMCON, AD16C4T_SMCON_ECM2EN_MSK); -} - -/** - * @brief Indicates whether the timer external clock is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_smcon_ecm2en(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->SMCON, AD16C4T_SMCON_ECM2EN_MSK) == (AD16C4T_SMCON_ECM2EN_MSK)); -} - -/** - * @brief Timer external trigger filter setup. - * @param timx AD16C4T instance - * @param ETRFilter External trigger filter - @arg @ref MD_AD16C4T_ETRFILTER_FDIV1 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV1N2 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV1N4 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV1N8 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV2N6 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV2N8 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV4N6 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV4N8 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV8N6 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV8N8 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV16N5 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV16N6 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV16N8 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV32N5 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV32N6 - @arg @ref MD_AD16C4T_ETRFILTER_FDIV32N8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_smcon_etflt(AD16C4T_TypeDef *timx, uint32_t ETRFilter) -{ - MODIFY_REG(timx->SMCON, AD16C4T_SMCON_ETFLT_MSK, ETRFilter); -} - -/** - * @brief Get timer external trigger filter. - * @param timx AD16C4T instance - * @retval Timer external trigger filter. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_smcon_etflt(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->SMCON, AD16C4T_SMCON_ETFLT_MSK) >> AD16C4T_SMCON_ETFLT_POSS); -} - -/** - * @brief Timer master/slave mode setup. - * @param timx AD16C4T instance - * @param MSMode master/slave mode - @arg @ref MD_AD16C4T_MASTERSLAVE_NODELAY - @arg @ref MD_AD16C4T_MASTERSLAVE_DELAY - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_smcon_mscfg(AD16C4T_TypeDef *timx, uint32_t MSMode) -{ - MODIFY_REG(timx->SMCON, AD16C4T_SMCON_MSCFG_MSK, MSMode); -} - -/** - * @brief Get timer master/slave mode. - * @param timx AD16C4T instance - * @retval Timer master/slave mode. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_smcon_mscfg(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->SMCON, AD16C4T_SMCON_MSCFG_MSK) >> AD16C4T_SMCON_MSCFG_POS); -} - -/** - * @brief Timer trigger selection setup. - * @param timx AD16C4T instance - * @param TriggerSelect Trigger selection - @arg @ref MD_AD16C4T_TRIGGERSELECT_ITR0 - @arg @ref MD_AD16C4T_TRIGGERSELECT_ITR1 - @arg @ref MD_AD16C4T_TRIGGERSELECT_ITR2 - @arg @ref MD_AD16C4T_TRIGGERSELECT_ITR3 - @arg @ref MD_AD16C4T_TRIGGERSELECT_TI1FED - @arg @ref MD_AD16C4T_TRIGGERSELECT_TI1FP1 - @arg @ref MD_AD16C4T_TRIGGERSELECT_TI2FP2 - @arg @ref MD_AD16C4T_TRIGGERSELECT_ETRF - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_smcon_tssel(AD16C4T_TypeDef *timx, uint32_t TriggerSelect) -{ - MODIFY_REG(timx->SMCON, AD16C4T_SMCON_TSSEL_MSK, TriggerSelect); -} - -/** - * @brief Get timer trigger selection. - * @param timx AD16C4T instance - * @retval Timer trigger selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_smcon_tssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->SMCON, AD16C4T_SMCON_TSSEL_MSK) >> AD16C4T_SMCON_TSSEL_POSS); -} - -/** - * @brief Timer OCREF clear selection setup. - * @param timx AD16C4T instance - * @param OCREFSelect OCREF clear selection - @arg @ref MD_AD16C4T_OCREFCLEAR_CMP - @arg @ref MD_AD16C4T_OCREFCLEAR_ETRF - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_smcon_chcsel(AD16C4T_TypeDef *timx, uint32_t OCREFSelect) -{ - MODIFY_REG(timx->SMCON, AD16C4T_SMCON_CHCSEL_MSK, OCREFSelect); -} - -/** - * @brief Get timer OCREF clear selection. - * @param timx AD16C4T instance - * @retval Timer OCREF clear selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_smcon_chcsel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->SMCON, AD16C4T_SMCON_CHCSEL_MSK) >> AD16C4T_SMCON_CHCSEL_POS); -} - -/** - * @brief Timer slave mode selection setup. - * @param timx AD16C4T instance - * @param SlaveMode Slave mode selection - @arg @ref MD_AD16C4T_SLAVEMODE_DISABLE - @arg @ref MD_AD16C4T_SLAVEMODE_ENCODER1 - @arg @ref MD_AD16C4T_SLAVEMODE_ENCODER2 - @arg @ref MD_AD16C4T_SLAVEMODE_ENCODER3 - @arg @ref MD_AD16C4T_SLAVEMODE_RESET - @arg @ref MD_AD16C4T_SLAVEMODE_GATED - @arg @ref MD_AD16C4T_SLAVEMODE_TRIGGER - @arg @ref MD_AD16C4T_SLAVEMODE_EXTERNALCLOCK - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_smcon_smods(AD16C4T_TypeDef *timx, uint32_t SlaveMode) -{ - MODIFY_REG(timx->SMCON, AD16C4T_SMCON_SMODS_MSK, SlaveMode); -} - -/** - * @brief Get timer slave mode selection. - * @param timx AD16C4T instance - * @retval Timer slave mode selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_smcon_smods(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->SMCON, AD16C4T_SMCON_SMODS_MSK) >> AD16C4T_SMCON_SMODS_POSS); -} - -/** - * @brief Timer IER setup. - * @param timx AD16C4T instance - * @param value (CH4OVI | CH3OVI | CH2OVI | CH1OVI | BRKI | TRGI | COMI | CH4I | CH3I | CH2I | CH1I | UI) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ier(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->IER, value); -} - -/** - * @brief Timer cpture/compare 4 overcapture interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch4ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH4OVI_MSK); -} - -/** - * @brief Timer cpture/compare 3 overcapture interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch3ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH3OVI_MSK); -} - -/** - * @brief Timer cpture/compare 2 overcapture interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch2ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH2OVI_MSK); -} - -/** - * @brief Timer cpture/compare 1 overcapture interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch1ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH1OVI_MSK); -} - -/** - * @brief Timer break interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_brki(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_BRKI_MSK); -} - -/** - * @brief Timer trigger interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_trgi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_TRGI_MSK); -} - -/** - * @brief Timer COM interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_comi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_COMI_MSK); -} - -/** - * @brief Timer capture/compare 4 interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch4i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH4I_MSK); -} - -/** - * @brief Timer capture/compare 3 interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch3i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH3I_MSK); -} - -/** - * @brief Timer capture/compare 2 interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch2i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH2I_MSK); -} - -/** - * @brief Timer capture/compare 1 interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ch1i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_CH1I_MSK); -} - -/** - * @brief Timer update interrupt enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ier_ui(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IER, AD16C4T_IER_UI_MSK); -} - -/** - * @brief Timer IDR setup. - * @param timx AD16C4T instance - * @param value (CH4OVI | CH3OVI | CH2OVI | CH1OVI | BRKI | TRGI | COMI | CH4I | CH3I | CH2I | CH1I | UI) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_idr(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->IDR, value); -} - -/** - * @brief Timer cpture/compare 4 overcapture interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch4ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH4OVI_MSK); -} - -/** - * @brief Timer cpture/compare 3 overcapture interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch3ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH3OVI_MSK); -} - -/** - * @brief Timer cpture/compare 2 overcapture interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch2ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH2OVI_MSK); -} - -/** - * @brief Timer cpture/compare 1 overcapture interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch1ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH1OVI_MSK); -} - -/** - * @brief Timer break interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_brki(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_BRKI_MSK); -} - -/** - * @brief Timer trigger interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_trgi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_TRGI_MSK); -} - -/** - * @brief Timer COM interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_comi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_COMI_MSK); -} - -/** - * @brief Timer capture/compare 4 interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch4i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH4I_MSK); -} - -/** - * @brief Timer capture/compare 3 interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch3i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH3I_MSK); -} - -/** - * @brief Timer capture/compare 2 interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch2i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH2I_MSK); -} - -/** - * @brief Timer capture/compare 1 interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ch1i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_CH1I_MSK); -} - -/** - * @brief Timer update interrupt disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_idr_ui(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->IDR, AD16C4T_IDR_UI_MSK); -} - -/** - * @brief Get timer IVS setup. - * @param timx AD16C4T instance - * @retval Timer IVS setup. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ivs(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->IVS)); -} - -/** - * @brief Indicates whether the timer capture/compare 4 overcapture interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch4ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH4OVI_MSK) == (AD16C4T_IVS_CH4OVI_MSK)); -} - -/** - * @brief Indicates whether the timer capture/compare 3 overcapture interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch3ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH3OVI_MSK) == (AD16C4T_IVS_CH3OVI_MSK)); -} - -/** - * @brief Indicates whether the timer cpture/compare 2 overcapture interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch2ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH2OVI_MSK) == (AD16C4T_IVS_CH2OVI_MSK)); -} - -/** - * @brief Indicates whether the timer capture/compare 1 overcapture interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch1ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH1OVI_MSK) == (AD16C4T_IVS_CH1OVI_MSK)); -} - -/** - * @brief Indicates whether the timer break interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_brki(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_BRKI_MSK) == (AD16C4T_IVS_BRKI_MSK)); -} - -/** - * @brief Indicates whether the timer trigger interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_trgi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_TRGI_MSK) == (AD16C4T_IVS_TRGI_MSK)); -} - -/** - * @brief Indicates whether the timer COM interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_comi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_COMI_MSK) == (AD16C4T_IVS_COMI_MSK)); -} - -/** - * @brief Indicates whether the timer Capture/Compare 4 interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch4i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH4I_MSK) == (AD16C4T_IVS_CH4I_MSK)); -} - -/** - * @brief Indicates whether the timer Capture/Compare 3 interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch3i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH3I_MSK) == (AD16C4T_IVS_CH3I_MSK)); -} - -/** - * @brief Indicates whether the timer Capture/Compare 2 interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch2i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH2I_MSK) == (AD16C4T_IVS_CH2I_MSK)); -} - -/** - * @brief Indicates whether the timer Capture/Compare 1 interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ch1i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_CH1I_MSK) == (AD16C4T_IVS_CH1I_MSK)); -} - -/** - * @brief Indicates whether the timer update interrupt is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ivs_ui(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IVS, AD16C4T_IVS_UI_MSK) == (AD16C4T_IVS_UI_MSK)); -} - -/** - * @brief Get timer RIF flag. - * @param timx AD16C4T instance - * @retval Timer RIF flag. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_rif(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->RIF)); -} - -/** - * @brief Get timer capture/compare 4 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch4ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH4OVI_MSK) == (AD16C4T_RIF_CH4OVI_MSK)); -} - -/** - * @brief Get timer capture/compare 3 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch3ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH3OVI_MSK) == (AD16C4T_RIF_CH3OVI_MSK)); -} - -/** - * @brief Get timer capture/compare 2 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch2ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH2OVI_MSK) == (AD16C4T_RIF_CH2OVI_MSK)); -} - -/** - * @brief Get timer capture/compare 1 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch1ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH1OVI_MSK) == (AD16C4T_RIF_CH1OVI_MSK)); -} - -/** - * @brief Get timer break interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_brki(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_BRKI_MSK) == (AD16C4T_RIF_BRKI_MSK)); -} - -/** - * @brief Get timer trigger interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_trgi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_TRGI_MSK) == (AD16C4T_RIF_TRGI_MSK)); -} - -/** - * @brief Get timer COM interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_comi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_COMI_MSK) == (AD16C4T_RIF_COMI_MSK)); -} - -/** - * @brief Get timer capture/compare 4 interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch4i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH4I_MSK) == (AD16C4T_RIF_CH4I_MSK)); -} - -/** - * @brief Get timer capture/compare 3 interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch3i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH3I_MSK) == (AD16C4T_RIF_CH3I_MSK)); -} - -/** - * @brief Get timer capture/compare 2 interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch2i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH2I_MSK) == (AD16C4T_RIF_CH2I_MSK)); -} - -/** - * @brief Get timer capture/compare 1 interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ch1i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_CH1I_MSK) == (AD16C4T_RIF_CH1I_MSK)); -} - -/** - * @brief Get timer update interrupt flag. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_rif_ui(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->RIF, AD16C4T_RIF_UI_MSK) == (AD16C4T_RIF_UI_MSK)); -} - -/** - * @brief Get timer IFM flag. - * @param timx AD16C4T instance - * @retval Timer IFM flag. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ifm(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->IFM)); -} - -/** - * @brief Get timer capture/compare 4 overcapture interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch4ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH4OVI_MSK) == (AD16C4T_IFM_CH4OVI_MSK)); -} - -/** - * @brief Get timer capture/compare 3 overcapture interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch3ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH3OVI_MSK) == (AD16C4T_IFM_CH3OVI_MSK)); -} - -/** - * @brief Get timer capture/compare 2 overcapture interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch2ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH2OVI_MSK) == (AD16C4T_IFM_CH2OVI_MSK)); -} - -/** - * @brief Get timer capture/compare 1 overcapture interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch1ovi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH1OVI_MSK) == (AD16C4T_IFM_CH1OVI_MSK)); -} - -/** - * @brief Get timer break interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_brki(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_BRKI_MSK) == (AD16C4T_IFM_BRKI_MSK)); -} - -/** - * @brief Get timer trigger interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_trgi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_TRGI_MSK) == (AD16C4T_IFM_TRGI_MSK)); -} - -/** - * @brief Get timer COM interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_comi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_COMI_MSK) == (AD16C4T_IFM_COMI_MSK)); -} - -/** - * @brief Get timer capture/compare 4 interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch4i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH4I_MSK) == (AD16C4T_IFM_CH4I_MSK)); -} - -/** - * @brief Get timer capture/compare 3 interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch3i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH3I_MSK) == (AD16C4T_IFM_CH3I_MSK)); -} - -/** - * @brief Get timer capture/compare 2 interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch2i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH2I_MSK) == (AD16C4T_IFM_CH2I_MSK)); -} - -/** - * @brief Get timer capture/compare 1 interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ch1i(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_CH1I_MSK) == (AD16C4T_IFM_CH1I_MSK)); -} - -/** - * @brief Get timer update interrupt flag masked. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_ad16c4t_is_active_flag_ifm_ui(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->IFM, AD16C4T_IFM_UI_MSK) == (AD16C4T_IFM_UI_MSK)); -} - -/** - * @brief Timer ICR setup. - * @param timx AD16C4T instance - * @param value (CC4OI | CC3OI | CC2OI | CC1OI | BI | TI | COMI | CC4I | CC3I | CC2I | CC1I | UI) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_icr(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->ICR, value); -} - -/** - * @brief Clear timer cpture/compare 4 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch4ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH4OVI_MSK); -} - -/** - * @brief Clear timer cpture/compare 3 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch3ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH3OVI_MSK); -} - -/** - * @brief Clear timer cpture/compare 2 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch2ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH2OVI_MSK); -} - -/** - * @brief Clear timer cpture/compare 1 overcapture interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch1ovi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH1OVI_MSK); -} - -/** - * @brief Clear timer break interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_brki(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_BRKI_MSK); -} - -/** - * @brief Clear timer trigger interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_trgi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_TRGI_MSK); -} - -/** - * @brief Clear timer COM interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_comi(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_COMI_MSK); -} - -/** - * @brief Clear timer capture/compare 4 interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch4i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH4I_MSK); -} - -/** - * @brief Clear timer capture/compare 3 interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch3i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH3I_MSK); -} - -/** - * @brief Clear timer capture/compare 2 interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch2i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH2I_MSK); -} - -/** - * @brief Clear timer capture/compare 1 interrupt flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ch1i(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_CH1I_MSK); -} - -/** - * @brief Clear timer upadte flag. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_clear_flag_icr_ui(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->ICR, AD16C4T_ICR_UI_MSK); -} - -/** - * @brief Timer SGE setup. - * @param timx AD16C4T instance - * @param value (SGBRK | SGTRG | SGCOM | SGCH4 | SGCH3 | SGCH2 | SGCH1 | SGU) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->SGE, value); -} - -/** - * @brief Timer break generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgbrk(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGBRK_MSK); -} - -/** - * @brief Timer trigger generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgtrg(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGTRG_MSK); -} - -/** - * @brief Timer COM generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgcom(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGCOM_MSK); -} - -/** - * @brief Timer Capture/Compare 4 generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgch4(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGCH4_MSK); -} - -/** - * @brief Timer Capture/Compare 3 generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgch3(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGCH3_MSK); -} - -/** - * @brief Timer Capture/Compare 2 generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgch2(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGCH2_MSK); -} - -/** - * @brief Timer Capture/Compare 1 generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgch1(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGCH1_MSK); -} - -/** - * @brief Timer update generation. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_sge_sgu(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->SGE, AD16C4T_SGE_SGU_MSK); -} - -/** - * @brief Timer CHMR1 setup. - * @param timx AD16C4T instance - * @param value output (CH2OCLREN | CH2MOD | CH2PEN | CH2FEN | CC2SSEL | CH1OCLREN | CH1MOD | CH1PEN | CH1FEN | CC1SSEL) - * input (I2FLT | I2PRES | CC2SSEL | I1FLT | I1PRES | CC1SSEL) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CHMR1, value); -} - -/** - * @brief GET Timer CHMR1 register value. - * @param timx AD16C4T instance - * @retval Timer CHMR1 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CHMR1)); -} - -/** - * @brief Timer output compare 2 clear enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr1_output_ch2oclren(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2OCLREN_MSK); -} - -/** - * @brief Timer output compare 2 clear disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr1_output_ch2oclren(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2OCLREN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 2 clear is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr1_output_ch2oclren(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2OCLREN_MSK) == (AD16C4T_CHMR1_OUTPUT_CH2OCLREN_MSK)); -} - -/** - * @brief Timer output compare 2 mode setup. - * @param timx AD16C4T instance - * @param OutputMode Output compare mode - @arg @ref MD_AD16C4T_OUTPUTMODE_DISABLE - @arg @ref MD_AD16C4T_OUTPUTMODE_HIGHONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_LOWONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_TOGGLE - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCELOW - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCEHIGH - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE1 - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE2 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_output_ch2mod(AD16C4T_TypeDef *timx, uint32_t OutputMode) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK, (OutputMode << AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS)); -} - -/** - * @brief Get timer output compare 2 mode. - * @param timx AD16C4T instance - * @retval Timer output compare 2 mode. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_output_ch2mod(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2MOD_MSK) >> AD16C4T_CHMR1_OUTPUT_CH2MOD_POSS); -} - -/** - * @brief Timer output compare 2 preload enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr1_output_ch2pen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2PEN_MSK); -} - -/** - * @brief Timer output compare 2 preload disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr1_output_ch2pen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2PEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 2 preload is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr1_output_ch2pen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2PEN_MSK) == (AD16C4T_CHMR1_OUTPUT_CH2PEN_MSK)); -} - -/** - * @brief Timer output compare 2 fast enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr1_output_ch2fen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2FEN_MSK); -} - -/** - * @brief Timer output compare 2 fast disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr1_output_ch2fen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2FEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 2 fast is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr1_output_ch2fen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH2FEN_MSK) == (AD16C4T_CHMR1_OUTPUT_CH2FEN_MSK)); -} - -/** - * @brief Timer cpture/compare 2 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_output_cc2ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CC2SSEL_MSK, (ChannelMode << AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 2 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 2 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_output_cc2ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CC2SSEL_MSK) >> AD16C4T_CHMR1_OUTPUT_CC2SSEL_POSS); -} - -/** - * @brief Timer output compare 1 clear enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr1_output_ch1oclren(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1OCLREN_MSK); -} - -/** - * @brief Timer output compare 1 clear disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr1_output_ch1oclren(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1OCLREN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 1 clear is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr1_output_ch1oclren(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1OCLREN_MSK) == (AD16C4T_CHMR1_OUTPUT_CH1OCLREN_MSK)); -} - -/** - * @brief Timer output compare 1 mode setup. - * @param timx AD16C4T instance - * @param OutputMode Output compare mode - @arg @ref MD_AD16C4T_OUTPUTMODE_DISABLE - @arg @ref MD_AD16C4T_OUTPUTMODE_HIGHONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_LOWONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_TOGGLE - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCELOW - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCEHIGH - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE1 - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE2 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_output_ch1mod(AD16C4T_TypeDef *timx, uint32_t OutputMode) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK, (OutputMode << AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS)); -} - -/** - * @brief Get timer output compare 1 mode. - * @param timx AD16C4T instance - * @retval Timer output compare 1 mode. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_output_ch1mod(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1MOD_MSK) >> AD16C4T_CHMR1_OUTPUT_CH1MOD_POSS); -} - -/** - * @brief Timer output compare 1 preload enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr1_output_ch1pen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1PEN_MSK); -} - -/** - * @brief Timer output compare 1 preload disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr1_output_ch1pen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1PEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 1 preload is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr1_output_ch1pen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1PEN_MSK) == (AD16C4T_CHMR1_OUTPUT_CH1PEN_MSK)); -} - -/** - * @brief Timer output compare 1 fast enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr1_output_ch1fen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1FEN_MSK); -} - -/** - * @brief Timer output compare 1 fast disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr1_output_ch1fen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1FEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 1 fast is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr1_output_ch1fen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CH1FEN_MSK) == (AD16C4T_CHMR1_OUTPUT_CH1FEN_MSK)); -} - -/** - * @brief Timer cpture/compare 1 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_output_cc1ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CC1SSEL_MSK, (ChannelMode << AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 1 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 1 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_output_cc1ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_OUTPUT_CC1SSEL_MSK) >> AD16C4T_CHMR1_OUTPUT_CC1SSEL_POSS); -} - -/** - * @brief Timer input capture 2 filter setup. - * @param timx AD16C4T instance - * @param InputFliter Input capture filter - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N2 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N4 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_input_i2flt(AD16C4T_TypeDef *timx, uint32_t InputFliter) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_INPUT_I2FLT_MSK, (InputFliter << AD16C4T_CHMR1_INPUT_I2FLT_POSS)); -} - -/** - * @brief Get timer input capture 2 filter. - * @param timx AD16C4T instance - * @retval Timer input capture 2 filter. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_input_i2flt(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_INPUT_I2FLT_MSK) >> AD16C4T_CHMR1_INPUT_I2FLT_POSS); -} - -/** - * @brief Timer input capture 2 prescaler setup. - * @param timx AD16C4T instance - * @param InputPrescale Input capture prescaler - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV1 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV2 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV4 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_input_i2pres(AD16C4T_TypeDef *timx, uint32_t InputPrescale) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_INPUT_I2PRES_MSK, (InputPrescale << AD16C4T_CHMR1_INPUT_I2PRES_POSS)); -} - -/** - * @brief Get timer input capture 2 prescaler. - * @param timx AD16C4T instance - * @retval Timer input capture 2 prescaler. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_input_i2pres(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_INPUT_I2PRES_MSK) >> AD16C4T_CHMR1_INPUT_I2PRES_POSS); -} - -/** - * @brief Timer cpture/compare 2 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_input_cc2ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_INPUT_CC2SSEL_MSK, (ChannelMode << AD16C4T_CHMR1_INPUT_CC2SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 2 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 2 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_input_cc2ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_INPUT_CC2SSEL_MSK) >> AD16C4T_CHMR1_INPUT_CC2SSEL_POSS); -} - -/** - * @brief Timer input capture 1 filter setup. - * @param timx AD16C4T instance - * @param InputFliter Input capture filter - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N2 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N4 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_input_i1flt(AD16C4T_TypeDef *timx, uint32_t InputFliter) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_INPUT_I1FLT_MSK, (InputFliter << AD16C4T_CHMR1_INPUT_I1FLT_POSS)); -} - -/** - * @brief Get timer input capture 1 filter. - * @param timx AD16C4T instance - * @retval Timer input capture 1 filter. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_input_i1flt(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_INPUT_I1FLT_MSK) >> AD16C4T_CHMR1_INPUT_I1FLT_POSS); -} - -/** - * @brief Timer input capture 1 prescaler setup. - * @param timx AD16C4T instance - * @param InputPrescale Input capture prescaler - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV1 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV2 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV4 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_input_i1pres(AD16C4T_TypeDef *timx, uint32_t InputPrescale) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_INPUT_I1PRES_MSK, (InputPrescale << AD16C4T_CHMR1_INPUT_I1PRES_POSS)); -} - -/** - * @brief Get timer input capture 1 prescaler. - * @param timx AD16C4T instance - * @retval Timer input capture 1 prescaler. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_input_i1pres(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_INPUT_I1PRES_MSK) >> AD16C4T_CHMR1_INPUT_I1PRES_POSS); -} - -/** - * @brief Timer cpture/compare 1 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr1_input_cc1ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR1, AD16C4T_CHMR1_INPUT_CC1SSEL_MSK, (ChannelMode << AD16C4T_CHMR1_INPUT_CC1SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 1 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 1 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr1_input_cc1ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR1, AD16C4T_CHMR1_INPUT_CC1SSEL_MSK) >> AD16C4T_CHMR1_INPUT_CC1SSEL_POSS); -} - -/** - * @brief Timer CHMR2 setup. - - * @param timx AD16C4T instance - * @param value output (CH4OCLREN | CH4MOD | CH4PEN | CH4FEN | CC4SSEL | CH3OCLREN | CH3MOD | CH3PEN | CH3FEN | CC3SSEL) - * input (I4FLT | I4PRES | CC4SSEL | I3FLT | I3PRES | CC3SSEL) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CHMR2, value); -} - -/** - * @brief GET Timer CHMR2 register value. - * @param timx AD16C4T instance - * @retval Timer CHMR2 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CHMR2)); -} - -/** - * @brief Timer output compare 4 clear enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr2_output_ch4oclren(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4OCLREN_MSK); -} - -/** - * @brief Timer output compare 4 clear disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr2_output_ch4oclren(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4OCLREN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 4 clear is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr2_output_ch4oclren(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4OCLREN_MSK) == (AD16C4T_CHMR2_OUTPUT_CH4OCLREN_MSK)); -} - -/** - * @brief Timer output compare 4 mode setup. - * @param timx AD16C4T instance - * @param OutputMode Output compare mode - @arg @ref MD_AD16C4T_OUTPUTMODE_DISABLE - @arg @ref MD_AD16C4T_OUTPUTMODE_HIGHONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_LOWONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_TOGGLE - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCELOW - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCEHIGH - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE1 - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE2 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_output_ch4mod(AD16C4T_TypeDef *timx, uint32_t OutputMode) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4MOD_MSK, (OutputMode << AD16C4T_CHMR2_OUTPUT_CH4MOD_POSS)); -} - -/** - * @brief Get timer output compare 4 mode. - * @param timx AD16C4T instance - * @retval Timer output compare 4 mode. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_output_ch4mod(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4MOD_MSK) >> AD16C4T_CHMR2_OUTPUT_CH4MOD_POSS); -} - -/** - * @brief Timer output compare 4 preload enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr2_output_ch4pen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4PEN_MSK); -} - -/** - * @brief Timer output compare 4 preload disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr2_output_ch4pen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4PEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 4 preload is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr2_output_ch4pen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4PEN_MSK) == (AD16C4T_CHMR2_OUTPUT_CH4PEN_MSK)); -} - -/** - * @brief Timer output compare 4 fast enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr2_output_ch4fen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4FEN_MSK); -} - -/** - * @brief Timer output compare 4 fast disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr2_output_ch4fen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4FEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 4 fast is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr2_output_ch4fen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH4FEN_MSK) == (AD16C4T_CHMR2_OUTPUT_CH4FEN_MSK)); -} - -/** - * @brief Timer cpture/compare 4 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_output_cc4ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CC4SSEL_MSK, (ChannelMode << AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 4 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 4 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_output_cc4ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CC4SSEL_MSK) >> AD16C4T_CHMR2_OUTPUT_CC4SSEL_POSS); -} - -/** - * @brief Timer output compare 3 clear enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr2_output_ch3oclren(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3OCLREN_MSK); -} - -/** - * @brief Timer output compare 3 clear disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr2_output_ch3oclren(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3OCLREN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 3 clear is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr2_output_ch3oclren(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3OCLREN_MSK) == (AD16C4T_CHMR2_OUTPUT_CH3OCLREN_MSK)); -} - -/** - * @brief Timer output compare 3 mode setup. - * @param timx AD16C4T instance - * @param OutputMode Output compare mode - @arg @ref MD_AD16C4T_OUTPUTMODE_DISABLE - @arg @ref MD_AD16C4T_OUTPUTMODE_HIGHONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_LOWONMSTCH - @arg @ref MD_AD16C4T_OUTPUTMODE_TOGGLE - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCELOW - @arg @ref MD_AD16C4T_OUTPUTMODE_FORCEHIGH - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE1 - @arg @ref MD_AD16C4T_OUTPUTMODE_PWMMODE2 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_output_ch3mod(AD16C4T_TypeDef *timx, uint32_t OutputMode) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3MOD_MSK, (OutputMode << AD16C4T_CHMR2_OUTPUT_CH3MOD_POSS)); -} - -/** - * @brief Get timer output compare 3 mode. - * @param timx AD16C4T instance - * @retval Timer output compare 3 mode. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_output_ch3mod(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3MOD_MSK) >> AD16C4T_CHMR2_OUTPUT_CH3MOD_POSS); -} - -/** - * @brief Timer output compare 3 preload enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr2_output_ch3pen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3PEN_MSK); -} - -/** - * @brief Timer output compare 3 preload disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr2_output_ch3pen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3PEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 3 preload is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr2_output_ch3pen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3PEN_MSK) == (AD16C4T_CHMR2_OUTPUT_CH3PEN_MSK)); -} - -/** - * @brief Timer output compare 3 fast enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_chmr2_output_ch3fen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3FEN_MSK); -} - -/** - * @brief Timer output compare 3 fast disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_chmr2_output_ch3fen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3FEN_MSK); -} - -/** - * @brief Indicates whether the timer output compare 3 fast is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_chmr2_output_ch3fen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CH3FEN_MSK) == (AD16C4T_CHMR2_OUTPUT_CH3FEN_MSK)); -} - -/** - * @brief Timer cpture/compare 3 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_output_cc3ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CC3SSEL_MSK, (ChannelMode << AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 3 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 3 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_output_cc3ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_OUTPUT_CC3SSEL_MSK) >> AD16C4T_CHMR2_OUTPUT_CC3SSEL_POSS); -} - -/** - * @brief Timer input capture 4 filter setup. - * @param timx AD16C4T instance - * @param InputFliter Input capture filter - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N2 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N4 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_input_i4flt(AD16C4T_TypeDef *timx, uint32_t InputFliter) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_INPUT_I4FLT_MSK, (InputFliter << AD16C4T_CHMR2_INPUT_I4FLT_POSS)); -} - -/** - * @brief Get timer input capture 4 filter. - * @param timx AD16C4T instance - * @retval Timer input capture 4 filter. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_input_i4flt(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_INPUT_I4FLT_MSK) >> AD16C4T_CHMR2_INPUT_I4FLT_POSS); -} - -/** - * @brief Timer input capture 4 prescaler setup. - * @param timx AD16C4T instance - * @param InputPrescale Input capture prescaler - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV1 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV2 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV4 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_input_i4pres(AD16C4T_TypeDef *timx, uint32_t InputPrescale) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_INPUT_I4PRES_MSK, (InputPrescale << AD16C4T_CHMR2_INPUT_I4PRES_POSS)); -} - -/** - * @brief Get timer input capture 4 prescaler. - * @param timx AD16C4T instance - * @retval Timer input capture 4 prescaler. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_input_i4pres(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_INPUT_I4PRES_MSK) >> AD16C4T_CHMR2_INPUT_I4PRES_POSS); -} - -/** - * @brief Timer cpture/compare 4 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_input_cc4ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_INPUT_CC4SSEL_MSK, (ChannelMode << AD16C4T_CHMR2_INPUT_CC4SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 4 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 4 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_input_cc4ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_INPUT_CC4SSEL_MSK) >> AD16C4T_CHMR2_INPUT_CC4SSEL_POSS); -} - -/** - * @brief Timer input capture 3 filter setup. - * @param timx AD16C4T instance - * @param InputFliter Input capture filter - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N2 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N4 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV1N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV2N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV4N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV8N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV16N8 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N5 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N6 - @arg @ref MD_AD16C4T_INPUTFILTER_FDIV32N8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_input_i3flt(AD16C4T_TypeDef *timx, uint32_t InputFliter) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_INPUT_I3FLT_MSK, (InputFliter << AD16C4T_CHMR2_INPUT_I3FLT_POSS)); -} - -/** - * @brief Get timer input capture 3 filter. - * @param timx AD16C4T instance - * @retval Timer input capture 3 filter. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_input_i3flt(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_INPUT_I3FLT_MSK) >> AD16C4T_CHMR2_INPUT_I3FLT_POSS); -} - -/** - * @brief Timer input capture 3 prescaler setup. - * @param timx AD16C4T instance - * @param InputPrescale Input capture prescaler - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV1 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV2 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV4 - @arg @ref MD_AD16C4T_INPUTPRESCALE_DIV8 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_input_i3pres(AD16C4T_TypeDef *timx, uint32_t InputPrescale) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_INPUT_I3PRES_MSK, (InputPrescale << AD16C4T_CHMR2_INPUT_I3PRES_POSS)); -} - -/** - * @brief Get timer input capture 3 prescaler. - * @param timx AD16C4T instance - * @retval Timer input capture 3 prescaler. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_input_i3pres(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_INPUT_I3PRES_MSK) >> AD16C4T_CHMR2_INPUT_I3PRES_POSS); -} - -/** - * @brief Timer cpture/compare 3 selection setup. - * @param timx AD16C4T instance - * @param ChannelMode Channel mode selection - @arg @ref MD_AD16C4T_CHMODE_OUTPUT - @arg @ref MD_AD16C4T_CHMODE_INPUT_DIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_INDIRECT - @arg @ref MD_AD16C4T_CHMODE_INPUT_TRC - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_chmr2_input_cc3ssel(AD16C4T_TypeDef *timx, uint32_t ChannelMode) -{ - MODIFY_REG(timx->CHMR2, AD16C4T_CHMR2_INPUT_CC3SSEL_MSK, (ChannelMode << AD16C4T_CHMR2_INPUT_CC3SSEL_POSS)); -} - -/** - * @brief Get timer cpture/compare 3 selection. - * @param timx AD16C4T instance - * @retval Timer cpture/compare 3 selection. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_chmr2_input_cc3ssel(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CHMR2, AD16C4T_CHMR2_INPUT_CC3SSEL_MSK) >> AD16C4T_CHMR2_INPUT_CC3SSEL_POSS); -} - -/** - * @brief Timer CCEP setup. - * @param timx AD16C4T instance - * @param value (CC4NPOL | CC4POL | CC4EN | CC3NPOL | CC3NEN | CC3POL | CC3EN | CC2NPOL | - * CC2NEN | CC2POL | CC2EN | CC1NPOL | CC1NEN | CC1POL | CC1EN ) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CCEP, value); -} - -/** - * @brief GET Timer CCEP register value. - * @param timx AD16C4T instance - * @retval Timer CCEP register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CCEP)); -} - -/** - * @brief Timer capture/compare 4 complementary output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc4npol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC4NPOL_MSK, (OutputPolarity << AD16C4T_CCEP_CC4NPOL_POS)); -} - -/** - * @brief Get timer capture/compare 4 complementary output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 4 complementary output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc4npol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC4NPOL_MSK) >> AD16C4T_CCEP_CC4NPOL_POS); -} - -/** - * @brief Timer capture/compare 4 output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc4pol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC4POL_MSK, (OutputPolarity << AD16C4T_CCEP_CC4POL_POS)); -} - -/** - * @brief Get timer capture/compare 4 output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 4 output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc4pol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC4POL_MSK) >> AD16C4T_CCEP_CC4POL_POS); -} - -/** - * @brief Timer Capture/Compare 4 output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ccep_cc4en(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CCEP, AD16C4T_CCEP_CC4EN_MSK); -} - -/** - * @brief Timer Capture/Compare 4 output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_ccep_cc4en(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CCEP, AD16C4T_CCEP_CC4EN_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 4 output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ccep_cc4en(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC4EN_MSK) == (AD16C4T_CCEP_CC4EN_MSK)); -} - -/** - * @brief Timer capture/compare 3 complementary output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc3npol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC3NPOL_MSK, (OutputPolarity << AD16C4T_CCEP_CC3NPOL_POS)); -} - -/** - * @brief Get timer capture/compare 3 complementary output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 3 complementary output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc3npol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC3NPOL_MSK) >> AD16C4T_CCEP_CC3NPOL_POS); -} - -/** - * @brief Timer Capture/Compare 3 complementary output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ccep_cc3nen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CCEP, AD16C4T_CCEP_CC3NEN_MSK); -} - -/** - * @brief Timer Capture/Compare 3 complementary output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_ccep_cc3nen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CCEP, AD16C4T_CCEP_CC3NEN_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 3 complementary output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ccep_cc3nen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC3NEN_MSK) == (AD16C4T_CCEP_CC3NEN_MSK)); -} - -/** - * @brief Timer capture/compare 3 output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc3pol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC3POL_MSK, (OutputPolarity << AD16C4T_CCEP_CC3POL_POS)); -} - -/** - * @brief Get timer capture/compare 3 output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 3 output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc3pol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC3POL_MSK) >> AD16C4T_CCEP_CC3POL_POS); -} - -/** - * @brief Timer Capture/Compare 3 output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ccep_cc3en(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CCEP, AD16C4T_CCEP_CC3EN_MSK); -} - -/** - * @brief Timer Capture/Compare 3 output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_ccep_cc3en(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CCEP, AD16C4T_CCEP_CC3EN_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 3 output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ccep_cc3en(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC3EN_MSK) == (AD16C4T_CCEP_CC3EN_MSK)); -} - -/** - * @brief Timer capture/compare 2 complementary output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc2npol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC2NPOL_MSK, (OutputPolarity << AD16C4T_CCEP_CC2NPOL_POS)); -} - -/** - * @brief Get timer capture/compare 2 complementary output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 2 complementary output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc2npol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC2NPOL_MSK) >> AD16C4T_CCEP_CC2NPOL_POS); -} - -/** - * @brief Timer Capture/Compare 2 complementary output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ccep_cc2nen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CCEP, AD16C4T_CCEP_CC2NEN_MSK); -} - -/** - * @brief Timer Capture/Compare 2 complementary output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_ccep_cc2nen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CCEP, AD16C4T_CCEP_CC2NEN_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 2 complementary output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ccep_cc2nen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC2NEN_MSK) == (AD16C4T_CCEP_CC2NEN_MSK)); -} - -/** - * @brief Timer capture/compare 2 output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc2pol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC2POL_MSK, (OutputPolarity << AD16C4T_CCEP_CC2POL_POS)); -} - -/** - * @brief Get timer capture/compare 2 output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 2 output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc2pol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC2POL_MSK) >> AD16C4T_CCEP_CC2POL_POS); -} - -/** - * @brief Timer Capture/Compare 2 output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ccep_cc2en(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CCEP, AD16C4T_CCEP_CC2EN_MSK); -} - -/** - * @brief Timer Capture/Compare 2 output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_ccep_cc2en(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CCEP, AD16C4T_CCEP_CC2EN_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 2 output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ccep_cc2en(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC2EN_MSK) == (AD16C4T_CCEP_CC2EN_MSK)); -} - -/** - * @brief Timer capture/compare 1 complementary output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc1npol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC1NPOL_MSK, (OutputPolarity << AD16C4T_CCEP_CC1NPOL_POS)); -} - -/** - * @brief Get timer capture/compare 1 complementary output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 1 complementary output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc1npol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC1NPOL_MSK) >> AD16C4T_CCEP_CC1NPOL_POS); -} - -/** - * @brief Timer Capture/Compare 1 complementary output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ccep_cc1nen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CCEP, AD16C4T_CCEP_CC1NEN_MSK); -} - -/** - * @brief Timer Capture/Compare 1 complementary output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_ccep_cc1nen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CCEP, AD16C4T_CCEP_CC1NEN_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 1 complementary output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ccep_cc1nen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC1NEN_MSK) == (AD16C4T_CCEP_CC1NEN_MSK)); -} - -/** - * @brief Timer capture/compare 1 output polarity setup. - * @param timx AD16C4T instance - * @param OutputPolarity Output polarity - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_HIGH - @arg @ref MD_AD16C4T_OUTPUTPOLARITY_LOW - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccep_cc1pol(AD16C4T_TypeDef *timx, uint32_t OutputPolarity) -{ - MODIFY_REG(timx->CCEP, AD16C4T_CCEP_CC1POL_MSK, (OutputPolarity << AD16C4T_CCEP_CC1POL_POS)); -} - -/** - * @brief Get timer capture/compare 1 output polarity. - * @param timx AD16C4T instance - * @retval Timer capture/compare 1 output polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccep_cc1pol(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC1POL_MSK) >> AD16C4T_CCEP_CC1POL_POS); -} - -/** - * @brief Timer Capture/Compare 1 output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_ccep_cc1en(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->CCEP, AD16C4T_CCEP_CC1EN_MSK); -} - -/** - * @brief Timer Capture/Compare 1 output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_ccep_cc1en(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->CCEP, AD16C4T_CCEP_CC1EN_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 1 output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_ccep_cc1en(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCEP, AD16C4T_CCEP_CC1EN_MSK) == (AD16C4T_CCEP_CC1EN_MSK)); -} - -/** - * @brief Timer COUNT setup. - * @param timx AD16C4T instance - * @param value COUNT - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_count(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->COUNT, value); -} - -/** - * @brief GET Timer COUNT register value. - * @param timx AD16C4T instance - * @retval Timer COUNT register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_count(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->COUNT)); -} - -/** - * @brief Timer counter value setup. - * @param timx AD16C4T instance - * @param counter Counter value (between Min_Data=0 and Max_Data=0xFFFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_count_cntv(AD16C4T_TypeDef *timx, uint32_t counter) -{ - MODIFY_REG(timx->COUNT, AD16C4T_COUNT_CNTV_MSK, counter); -} - -/** - * @brief Get timer counter value. - * @param timx AD16C4T instance - * @retval Timer counter value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_cnt_cntv(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->COUNT, AD16C4T_COUNT_CNTV_MSK) >> AD16C4T_COUNT_CNTV_POSS); -} - -/** - * @brief Timer PRES setup. - * @param timx AD16C4T instance - * @param value PRES - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_pres(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->PRES, value); -} - -/** - * @brief GET Timer PRES register value. - * @param timx AD16C4T instance - * @retval Timer PRES register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_pres(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->PRES)); -} - -/** - * @brief Timer prescaler value setup. - * @param timx AD16C4T instance - * @param prescaler Prescaler value (between Min_Data=0 and Max_Data=0xFFFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_pres_pscv(AD16C4T_TypeDef *timx, uint32_t prescaler) -{ - MODIFY_REG(timx->PRES, AD16C4T_PRES_PSCV_MSK, prescaler); -} - -/** - * @brief Get timer prescaler value. - * @param timx AD16C4T instance - * @retval Timer prescaler value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_pres_pscv(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->PRES, AD16C4T_PRES_PSCV_MSK) >> AD16C4T_PRES_PSCV_POSS); -} - -/** - * @brief Timer AR setup. - * @param timx AD16C4T instance - * @param value AR - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ar(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->AR, value); -} - -/** - * @brief GET Timer AR register value. - * @param timx AD16C4T instance - * @retval Timer AR register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ar(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->AR)); -} - -/** - * @brief Timer auto-reload value setup. - * @param timx AD16C4T instance - * @param reload Auto-reload value (between Min_Data=0 and Max_Data=0xFFFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ar_arv(AD16C4T_TypeDef *timx, uint32_t reload) -{ - MODIFY_REG(timx->AR, AD16C4T_AR_ARV_MSK, reload); -} - -/** - * @brief Get timer auto-reload value. - * @param timx AD16C4T instance - * @retval Timer auto-reload value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ar_arv(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->AR, AD16C4T_AR_ARV_MSK) >> AD16C4T_AR_ARV_POSS); -} - -/** - * @brief Timer REPAR setup. - * @param timx AD16C4T instance - * @param value REPAR - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_rcr(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->REPAR, value); -} - -/** - * @brief GET Timer REPAR register value. - * @param timx AD16C4T instance - * @retval Timer REPAR register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_repar(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->REPAR)); -} - -/** - * @brief Timer repetition counter value setup. - * @param timx AD16C4T instance - * @param repetition Repetition counter value (between Min_Data=0 and Max_Data=0xFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_repar_repv(AD16C4T_TypeDef *timx, uint32_t repetition) -{ - MODIFY_REG(timx->REPAR, AD16C4T_REPAR_REPV_MSK, repetition); -} - -/** - * @brief Get timer repetition counter value. - * @param timx AD16C4T instance - * @retval Timer repetition counter value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_repar_repv(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->REPAR, AD16C4T_REPAR_REPV_MSK) >> AD16C4T_REPAR_REPV_POSS); -} - -/** - * @brief Timer CCVAL1 setup. - * @param timx AD16C4T instance - * @param value CCVAL1 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval1(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CCVAL1, value); -} - -/** - * @brief GET Timer CCVAL1 register value. - * @param timx AD16C4T instance - * @retval Timer CCVAL1 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval1(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CCVAL1)); -} - -/** - * @brief Timer capture/compare value 1 setup. - * @param timx AD16C4T instance - * @param CapCompValue Capture/Compare value 1 (between Min_Data=0 and Max_Data=0xFFFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval1_ccrv1(AD16C4T_TypeDef *timx, uint32_t CapCompValue) -{ - MODIFY_REG(timx->CCVAL1, AD16C4T_CCVAL1_CCRV1_MSK, CapCompValue); -} - -/** - * @brief Get timer capture/compare value 1. - * @param timx AD16C4T instance - * @retval Timer capture/compare value 1. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval1_ccrv1(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCVAL1, AD16C4T_CCVAL1_CCRV1_MSK) >> AD16C4T_CCVAL1_CCRV1_POSS); -} - -/** - * @brief Timer CCVAL2 setup. - * @param timx AD16C4T instance - * @param value CCVAL2 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval2(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CCVAL2, value); -} - -/** - * @brief GET Timer CCVAL2 register value. - * @param timx AD16C4T instance - * @retval Timer CCVAL2 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval2(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CCVAL2)); -} - -/** - * @brief Timer capture/compare value 2 setup. - * @param timx AD16C4T instance - * @param CapCompValue Capture/Compare value 2 (between Min_Data=0 and Max_Data=0xFFFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval2_ccrv2(AD16C4T_TypeDef *timx, uint32_t CapCompValue) -{ - MODIFY_REG(timx->CCVAL2, AD16C4T_CCVAL2_CCRV2_MSK, CapCompValue); -} - -/** - * @brief Get timer capture/compare value 2. - * @param timx AD16C4T instance - * @retval Timer capture/compare value 2. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval2_ccrv2(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCVAL2, AD16C4T_CCVAL2_CCRV2_MSK) >> AD16C4T_CCVAL2_CCRV2_POSS); -} - -/** - * @brief Timer CCVAL3 setup. - * @param timx AD16C4T instance - * @param value CCVAL3 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval3(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CCVAL3, value); -} - -/** - * @brief GET Timer CCVAL3 register value. - * @param timx AD16C4T instance - * @retval Timer CCVAL3 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval3(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CCVAL3)); -} - -/** - * @brief Timer capture/compare value 3 setup. - * @param timx AD16C4T instance - * @param CapCompValue Capture/Compare value 3 (between Min_Data=0 and Max_Data=0xFFFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval3_ccrv3(AD16C4T_TypeDef *timx, uint32_t CapCompValue) -{ - MODIFY_REG(timx->CCVAL3, AD16C4T_CCVAL3_CCRV3_MSK, CapCompValue); -} - -/** - * @brief Get timer capture/compare value 3. - * @param timx AD16C4T instance - * @retval Timer capture/compare value 3. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval3_ccrv3(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCVAL3, AD16C4T_CCVAL3_CCRV3_MSK) >> AD16C4T_CCVAL3_CCRV3_POSS); -} - -/** - * @brief Timer CCVAL4 setup. - * @param timx AD16C4T instance - * @param value CCVAL4 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval4(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->CCVAL4, value); -} - -/** - * @brief GET Timer CCVAL4 register value. - * @param timx AD16C4T instance - * @retval Timer CCVAL4 register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval4(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->CCVAL4)); -} - -/** - * @brief Timer capture/compare value 4 setup. - * @param timx AD16C4T instance - * @param CapCompValue Capture/Compare value 4 (between Min_Data=0 and Max_Data=0xFFFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_ccval4_ccrv4(AD16C4T_TypeDef *timx, uint32_t CapCompValue) -{ - MODIFY_REG(timx->CCVAL4, AD16C4T_CCVAL4_CCRV4_MSK, CapCompValue); -} - -/** - * @brief Get timer capture/compare value 4. - * @param timx AD16C4T instance - * @retval Timer capture/compare value 4. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_ccval4_ccrv4(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->CCVAL4, AD16C4T_CCVAL4_CCRV4_MSK) >> AD16C4T_CCVAL4_CCRV4_POSS); -} - -/** - * @brief Timer BDCFG setup. - * @param timx AD16C4T instance - * @param value (GOEN | AOEN | BRKP | BRKEN | OFFSSR | OFFSSI | LOCKLVL | DT) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_bdcfg(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->BDCFG, value); -} - -/** - * @brief GET Timer BDCFG register value. - * @param timx AD16C4T instance - * @retval Timer BDCFG register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_bdcfg(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->BDCFG)); -} - -/** - * @brief Timer main output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_bdcfg_goen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->BDCFG, AD16C4T_BDCFG_GOEN_MSK); -} - -/** - * @brief Timer main output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_bdcfg_goen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->BDCFG, AD16C4T_BDCFG_GOEN_MSK); -} - -/** - * @brief Indicates whether the timer main output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_bdcfg_goen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_GOEN_MSK) == (AD16C4T_BDCFG_GOEN_MSK)); -} - -/** - * @brief Timer automatic output enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_bdcfg_aoen(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->BDCFG, AD16C4T_BDCFG_AOEN_MSK); -} - -/** - * @brief Timer automatic output disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_bdcfg_aoen(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->BDCFG, AD16C4T_BDCFG_AOEN_MSK); -} - -/** - * @brief Indicates whether the timer automatic output is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_bdcfg_aoen(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_AOEN_MSK) == (AD16C4T_BDCFG_AOEN_MSK)); -} - -/** - * @brief Timer break polarity setup. - * @param timx AD16C4T instance - * @param BreakPolarity Break polarity - * @arg @ref MD_AD16C4T_BREAKPOLARITY_LOW - * @arg @ref MD_AD16C4T_BREAKPOLARITY_HIGH - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_bdcfg_brkp(AD16C4T_TypeDef *timx, uint32_t BreakPolarity) -{ - MODIFY_REG(timx->BDCFG, AD16C4T_BDCFG_BRKP_MSK, BreakPolarity); -} - -/** - * @brief Get timer break polarity. - * @param timx AD16C4T instance - * @retval Timer break polarity. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_bdcfg_brkp(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_BRKP_MSK) >> AD16C4T_BDCFG_BRKP_POS); -} - -/** - * @brief Timer break enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_bdcfg_brken(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->BDCFG, AD16C4T_BDCFG_BRKEN_MSK); -} - -/** - * @brief Timer break disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_bdcfg_brken(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->BDCFG, AD16C4T_BDCFG_BRKEN_MSK); -} - -/** - * @brief Indicates whether the timer break is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_bdcfg_brken(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_BRKEN_MSK) == (AD16C4T_BDCFG_BRKEN_MSK)); -} - -/** - * @brief Timer off-state selection for run mode setup. - * @param timx AD16C4T instance - * @param OffStateRun Off-state selection for run mode - * @arg @ref MD_AD16C4T_OFFSTATERUN_DISABLE - * @arg @ref MD_AD16C4T_OFFSTATERUN_ENABLE - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_bdcfg_offssr(AD16C4T_TypeDef *timx, uint32_t OffStateRun) -{ - MODIFY_REG(timx->BDCFG, AD16C4T_BDCFG_OFFSSR_MSK, OffStateRun); -} - -/** - * @brief Get timer off-state selection for run mode. - * @param timx AD16C4T instance - * @retval Timer off-state selection for run mode. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_bdcfg_offssr(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_OFFSSR_MSK) >> AD16C4T_BDCFG_OFFSSR_POS); -} - -/** - * @brief Timer off-state selection for idle mode setup. - * @param timx AD16C4T instance - * @param OffStateIdle Off-state selection for idle mode - * @arg @ref MD_AD16C4T_OFFSTATEIDLE_DISABLE - * @arg @ref MD_AD16C4T_OFFSTATEIDLE_ENABLE - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_bdcfg_offssi(AD16C4T_TypeDef *timx, uint32_t OffStateIdle) -{ - MODIFY_REG(timx->BDCFG, AD16C4T_BDCFG_OFFSSI_MSK, OffStateIdle); -} - -/** - * @brief Get timer off-state selection for idle mode. - * @param timx AD16C4T instance - * @retval Timer off-state selection for idle mode. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_bdcfg_offssi(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_OFFSSI_MSK) >> AD16C4T_BDCFG_OFFSSI_POS); -} - -/** - * @brief Timer lock configuration setup. - * @param timx AD16C4T instance - * @param LockLevel Lock configuration - * @arg @ref MD_AD16C4T_LOCKLEVEL_0 - * @arg @ref MD_AD16C4T_LOCKLEVEL_1 - * @arg @ref MD_AD16C4T_LOCKLEVEL_2 - * @arg @ref MD_AD16C4T_LOCKLEVEL_3 - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_bdcfg_locklvl(AD16C4T_TypeDef *timx, uint32_t LockLevel) -{ - MODIFY_REG(timx->BDCFG, AD16C4T_BDCFG_LOCKLVL_MSK, LockLevel); -} - -/** - * @brief Get timer lock configuration. - * @param timx AD16C4T instance - * @retval Timer lock configuration. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_bdcfg_locklvl(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_LOCKLVL_MSK) >> AD16C4T_BDCFG_LOCKLVL_POSS); -} - -/** - * @brief Timer dead-time generator setup. - * @param timx AD16C4T instance - * @param DeadTime Dead-time generator (between Min_Data=0 and Max_Data=0xFF) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_bdcfg_dt(AD16C4T_TypeDef *timx, uint32_t DeadTime) -{ - MODIFY_REG(timx->BDCFG, AD16C4T_BDCFG_DT_MSK, DeadTime); -} - -/** - * @brief Get timer dead-time generator. - * @param timx AD16C4T instance - * @retval Timer dead-time generator. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_bdcfg_dt(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->BDCFG, AD16C4T_BDCFG_DT_MSK) >> AD16C4T_BDCFG_DT_POSS); -} - -/** - * @brief Timer DMAEN setup. - * @param timx AD16C4T instance - * @param value (TRGIDE | COMDE | CH4DE | CH3DE | CH2DE | CH1DE | UDE) - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_set_dmaen(AD16C4T_TypeDef *timx, uint32_t value) -{ - WRITE_REG(timx->DMAEN, value); -} - -/** - * @brief GET Timer DMAEN register value. - * @param timx AD16C4T instance - * @retval Timer DMAEN register value. - */ - -__STATIC_INLINE uint32_t md_ad16c4t_get_dmaen(AD16C4T_TypeDef *timx) -{ - return (READ_REG(timx->DMAEN)); -} - -/** - * @brief Timer trigger DMA request enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_dmaen_trgide(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->DMAEN, AD16C4T_DMAEN_TRGIDE_MSK); -} - -/** - * @brief Timer trigger DMA request disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_dmaen_trgide(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->DMAEN, AD16C4T_DMAEN_TRGIDE_MSK); -} - -/** - * @brief Indicates whether the timer trigger DMA request is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_dmaen_trgide(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->DMAEN, AD16C4T_DMAEN_TRGIDE_MSK) == (AD16C4T_DMAEN_TRGIDE_MSK)); -} - -/** - * @brief Timer COM DMA request enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_dmaen_comde(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->DMAEN, AD16C4T_DMAEN_COMDE_MSK); -} - -/** - * @brief Timer COM DMA request disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_dmaen_comde(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->DMAEN, AD16C4T_DMAEN_COMDE_MSK); -} - -/** - * @brief Indicates whether the timer trigger COM request is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_dmaen_comde(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->DMAEN, AD16C4T_DMAEN_COMDE_MSK) == (AD16C4T_DMAEN_COMDE_MSK)); -} - -/** - * @brief Timer Capture/Compare 4 DMA request enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_dmaen_ch4de(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->DMAEN, AD16C4T_DMAEN_CH4DE_MSK); -} - -/** - * @brief Timer Capture/Compare 4 DMA request disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_dmaen_ch4de(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->DMAEN, AD16C4T_DMAEN_CH4DE_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 4 DMA request is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_dmaen_ch4de(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->DMAEN, AD16C4T_DMAEN_CH4DE_MSK) == (AD16C4T_DMAEN_CH4DE_MSK)); -} - -/** - * @brief Timer Capture/Compare 3 DMA request enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_dmaen_ch3de(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->DMAEN, AD16C4T_DMAEN_CH3DE_MSK); -} - -/** - * @brief Timer Capture/Compare 3 DMA request disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_dmaen_ch3de(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->DMAEN, AD16C4T_DMAEN_CH3DE_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 3 DMA request is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_dmaen_ch3de(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->DMAEN, AD16C4T_DMAEN_CH3DE_MSK) == (AD16C4T_DMAEN_CH3DE_MSK)); -} - -/** - * @brief Timer Capture/Compare 2 DMA request enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_dmaen_ch2de(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->DMAEN, AD16C4T_DMAEN_CH2DE_MSK); -} - -/** - * @brief Timer Capture/Compare 2 DMA request disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_dmaen_ch2de(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->DMAEN, AD16C4T_DMAEN_CH2DE_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 2 DMA request is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_dmaen_ch2de(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->DMAEN, AD16C4T_DMAEN_CH2DE_MSK) == (AD16C4T_DMAEN_CH2DE_MSK)); -} - -/** - * @brief Timer Capture/Compare 1 DMA request enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_dmaen_ch1de(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->DMAEN, AD16C4T_DMAEN_CH1DE_MSK); -} - -/** - * @brief Timer Capture/Compare 1 DMA request disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_dmaen_ch1de(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->DMAEN, AD16C4T_DMAEN_CH1DE_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare 1 DMA request is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_dmaen_ch1de(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->DMAEN, AD16C4T_DMAEN_CH1DE_MSK) == (AD16C4T_DMAEN_CH1DE_MSK)); -} - -/** - * @brief Timer update DMA request enable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_enable_dmaen_ude(AD16C4T_TypeDef *timx) -{ - SET_BIT(timx->DMAEN, AD16C4T_DMAEN_UDE_MSK); -} - -/** - * @brief Timer update DMA request disable. - * @param timx AD16C4T instance - * @retval None - */ - -__STATIC_INLINE void md_ad16c4t_disable_dmaen_ude(AD16C4T_TypeDef *timx) -{ - CLEAR_BIT(timx->DMAEN, AD16C4T_DMAEN_UDE_MSK); -} - -/** - * @brief Indicates whether the timer Capture/Compare update DMA request is enabled. - * @param timx AD16C4T instance - * @retval State of bit (1 or 0). - */ - -__STATIC_INLINE uint32_t md_ad16c4t_is_enabled_dmaen_ude(AD16C4T_TypeDef *timx) -{ - return (READ_BIT(timx->DMAEN, AD16C4T_DMAEN_UDE_MSK) == (AD16C4T_DMAEN_UDE_MSK)); -} -/** - * @} MD_AD16C4T_Public_Macro - */ - -/* Public functions -----------------------------------------------------------*/ - - - -/** - * @} AD16C4T - */ - - -#endif - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_adc.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_adc.h deleted file mode 100644 index 3c3bdbc5f8..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_adc.h +++ /dev/null @@ -1,6109 +0,0 @@ -/** - ****************************************************************************** - * @file md_ADC.h - * @brief ES32F0271 ADC Header File. - * - * @version V1.00.01 - * @date 04/12/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_ADC_H__ -#define __MD_ADC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_adc.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined ADC - -/** @defgroup ADC ADC - * @brief ADC micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/* Public types ---------------------------------------------------------------*/ -/* Public constants -----------------------------------------------------------*/ -/* Public functions -----------------------------------------------------------*/ - -/** @defgroup MD_ADC_Public_Constants ADC Public Constants - * @{ - */ - -/** - * @brief ADC Init structure. - */ -typedef struct -{ - uint8_t VRLS; - uint8_t SSx; - uint32_t Sel; - uint32_t Type; - uint32_t Cntini; - uint32_t Cnt; - uint8_t End; - uint8_t Ckdiv; -} md_adc_inittypedef; -/** @defgroup MD_ADC_CFG ADC_CFG Register - * @{ - */ -#define MD_ADC_CFG_TESTEN (0xEDU) /** @brief data ADC Test Enable */ - -#define MD_ADC_CFG_MODE_NORMAL (0x00000000U<CFG, ADC_CFG_TESTEN_MSK, MD_ADC_CFG_TESTEN<CFG, ADC_CFG_MODE_MSK, Mode<CFG, ADC_CFG_MODE_MSK))>>ADC_CFG_MODE_POS); -} - -/** - * @brief Set ADC Wait Counter Value. - * @note Set the wait cycle between each ADC sample. - * @param ADCx ADC Instance - * @param CNT Value between Min_Value=0x00 and Max_Value=0xFF - * @retval None - */ -__STATIC_INLINE void md_adc_set_srate_cnt(ADC_TypeDef *ADCx, uint32_t cnt) -{ - MODIFY_REG(ADCx->SRATE, ADC_SRATE_CNT_MSK, cnt<SRATE, ADC_SRATE_CNT_MSK))>>ADC_SRATE_CNT_POSS); -} - -/** - * @brief Set ADC Wait Counter Initial Value. - * @note Set the Initial Value of ADC wait counter. - * @param ADCx ADC Instance - * @param CNTINI - * @arg @ref CNTINI Value between Min_Value=0x00 and Max_Value=0xFF - * @retval None - */ -__STATIC_INLINE void md_adc_set_srate_cntini(ADC_TypeDef *adcx, uint32_t cntini) -{ - MODIFY_REG(adcx->SRATE, ADC_SRATE_CNTINI_MSK, cntini<SRATE, ADC_SRATE_CNTINI_MSK))>>ADC_SRATE_CNTINI_POSS); -} - -/** - * @brief Set ADC Converter Clock Division. - * @note Get the division ratio of ADC converter clock. 0 to 15 division ratio - * where 0 indicates no division is implemented. To modify CLKDIV, user - * should first set CLKEN to 0 and re-enable this bit after modification - * on CLKDIV. - * @param ADCx ADC Instance - * @param ADC Converter Clock Division - * @arg @ref MD_ADC_SRATE_CKDIV1 - * @arg @ref MD_ADC_SRATE_CKDIV2 - * @arg @ref MD_ADC_SRATE_CKDIV4 - * @arg @ref MD_ADC_SRATE_CKDIV6 - * @arg @ref MD_ADC_SRATE_CKDIV8 - * @arg @ref MD_ADC_SRATE_CKDIV10 - * @arg @ref MD_ADC_SRATE_CKDIV12 - * @arg @ref MD_ADC_SRATE_CKDIV14 - * @arg @ref MD_ADC_SRATE_CKDIV16 - * @arg @ref MD_ADC_SRATE_CKDIV18 - * @arg @ref MD_ADC_SRATE_CKDIV20 - * @arg @ref MD_ADC_SRATE_CKDIV22 - * @arg @ref MD_ADC_SRATE_CKDIV24 - * @arg @ref MD_ADC_SRATE_CKDIV26 - * @arg @ref MD_ADC_SRATE_CKDIV28 - * @arg @ref MD_ADC_SRATE_CKDIV30 - * @retval None - */ -__STATIC_INLINE void md_adc_set_srate_clkdiv(ADC_TypeDef *ADCx, uint32_t clkdiv) -{ - MODIFY_REG(ADCx->SRATE, ADC_SRATE_CKDIV_MSK, clkdiv<SRATE, ADC_SRATE_CKDIV_MSK))>>ADC_SRATE_CKDIV_POSS); -} - -/** - * @brief ADC clock enable. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_clken(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_SRATE_CKEN_MSK); -} - -/** - * @brief ADC clock sisable. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_clken(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_SRATE_CKEN_MSK); -} - -/** - * @brief Check if ADC clock is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_clken(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_SRATE_CKEN_MSK) == (ADC_SRATE_CKEN_MSK)); -} - -/** - * @brief Channel 15 Invert Control enable. - * @note This is used to invert the data of channel 15. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch15inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH15INV_MSK); -} - -/** - * @brief Channel 15 Invert Control disable. - * @note This is used to invert the data of channel 15. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch15inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH15INV_MSK); -} - -/** - * @brief Check if Channel 15 Invert Control is enabled. - * @note This is used to invert the data of channel 15. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch15inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH15INV_MSK) == (ADC_CHINV_CH15INV_MSK)); -} - -/** - * @brief Channel 14 Invert Control enable. - * @note This is used to invert the data of channel 14. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch14inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH14INV_MSK); -} - -/** - * @brief Channel 14 Invert Control disable. - * @note This is used to invert the data of channel 14. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch14inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH14INV_MSK); -} - -/** - * @brief Check if Channel 14 Invert Control is enabled. - * @note This is used to invert the data of channel 14. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch14inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH14INV_MSK) == (ADC_CHINV_CH14INV_MSK)); -} - -/** - * @brief Channel 13 Invert Control enable. - * @note This is used to invert the data of channel 13. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch13inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH13INV_MSK); -} - -/** - * @brief Channel 13 Invert Control disable. - * @note This is used to invert the data of channel 13. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch13inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH13INV_MSK); -} - -/** - * @brief Check if Channel 13 Invert Control is enabled. - * @note This is used to invert the data of channel 13. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch13inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH13INV_MSK) == (ADC_CHINV_CH13INV_MSK)); -} - -/** - * @brief Channel 12 Invert Control enable. - * @note This is used to invert the data of channel 12. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch12inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH12INV_MSK); -} - -/** - * @brief Channel 12 Invert Control disable. - * @note This is used to invert the data of channel 12. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch12inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH12INV_MSK); -} - -/** - * @brief Check if Channel 12 Invert Control is enabled. - * @note This is used to invert the data of channel 12. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch12inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH12INV_MSK) == (ADC_CHINV_CH12INV_MSK)); -} - -/** - * @brief Channel 11 Invert Control enable. - * @note This is used to invert the data of channel 11. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch11inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH15INV_MSK); -} - -/** - * @brief Channel 11 Invert Control disable. - * @note This is used to invert the data of channel 11. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch11inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH11INV_MSK); -} - -/** - * @brief Check if Channel 11 Invert Control is enabled. - * @note This is used to invert the data of channel 11. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch11inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH11INV_MSK) == (ADC_CHINV_CH11INV_MSK)); -} - -/** - * @brief Channel 10 Invert Control enable. - * @note This is used to invert the data of channel 10. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch10inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH10INV_MSK); -} - -/** - * @brief Channel 10 Invert Control disable. - * @note This is used to invert the data of channel 10. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch10inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH10INV_MSK); -} - -/** - * @brief Check if Channel 10 Invert Control is enabled. - * @note This is used to invert the data of channel 10. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch10inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH10INV_MSK) == (ADC_CHINV_CH10INV_MSK)); -} - -/** - * @brief Channel 9 Invert Control enable. - * @note This is used to invert the data of channel 9. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch9inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH9INV_MSK); -} - -/** - * @brief Channel 9 Invert Control disable. - * @note This is used to invert the data of channel 9. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch9inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH9INV_MSK); -} - -/** - * @brief Check if Channel 9 Invert Control is enabled. - * @note This is used to invert the data of channel 9. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch9inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH9INV_MSK) == (ADC_CHINV_CH9INV_MSK)); -} - -/** - * @brief Channel 8 Invert Control enable. - * @note This is used to invert the data of channel 8. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch8inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH8INV_MSK); -} - -/** - * @brief Channel 8 Invert Control disable. - * @note This is used to invert the data of channel 8. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch8inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH8INV_MSK); -} - -/** - * @brief Check if Channel 8 Invert Control is enabled. - * @note This is used to invert the data of channel 8. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch8inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH8INV_MSK) == (ADC_CHINV_CH8INV_MSK)); -} - -/** - * @brief Channel 7 Invert Control enable. - * @note This is used to invert the data of channel 7. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch7inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH7INV_MSK); -} - -/** - * @brief Channel 7 Invert Control disable. - * @note Disable invert data channel 7. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch7inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH7INV_MSK); -} - -/** - * @brief Check if Channel 7 Invert Control is enabled. - * @note Check invert state of data channel 7. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch7inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH7INV_MSK) == (ADC_CHINV_CH7INV_MSK)); -} - -/** - * @brief Channel 6 Invert Control enable. - * @note This is used to invert the data of channel 6. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch6inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH6INV_MSK); -} - -/** - * @brief Channel 6 Invert Control disable. - * @note Disable invert data channel 6. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch6inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH6INV_MSK); -} - -/** - * @brief Check if Channel 6 Invert Control is enabled. - * @note Check invert state of data channel 6. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch6inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH6INV_MSK) == (ADC_CHINV_CH6INV_MSK)); -} - -/** - * @brief Channel 5 Invert Control enable. - * @note This is used to invert the data of channel 5. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch5inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH5INV_MSK); -} - -/** - * @brief Channel 5 Invert Control disable. - * @note Disable invert data channel 5. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch5inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH5INV_MSK); -} - -/** - * @brief Check if Channel 5 Invert Control is enabled. - * @note Check invert state of data channel 5. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch5inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH5INV_MSK) == (ADC_CHINV_CH5INV_MSK)); -} - -/** - * @brief Channel 4 Invert Control enable. - * @note This is used to invert the data of channel 4. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch4inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH4INV_MSK); -} - -/** - * @brief Channel 4 Invert Control disable. - * @note Disable invert data channel 4. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch4inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH4INV_MSK); -} - -/** - * @brief Check if Channel 4 Invert Control is enabled. - * @note Check invert state of data channel 4. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch4inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH4INV_MSK) == (ADC_CHINV_CH4INV_MSK)); -} - -/** - * @brief Channel 3 Invert Control enable. - * @note This is used to invert the data of channel 3. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch3inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH3INV_MSK); -} - -/** - * @brief Channel 3 Invert Control disable. - * @note Disable invert data channel 3. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch3inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH3INV_MSK); -} - -/** - * @brief Check if Channel 3 Invert Control is enabled. - * @note Check invert state of data of channel 3. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch3inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH3INV_MSK) == (ADC_CHINV_CH3INV_MSK)); -} - -/** - * @brief Channel 2 Invert Control enable. - * @note This is used to invert the data of channel 2. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch2inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH2INV_MSK); -} - -/** - * @brief Channel 2 Invert Control disable. - * @note Disable invert data channel 2. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch2inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH2INV_MSK); -} - -/** - * @brief Check if Channel 2 Invert Control is enabled. - * @note Check invert state of data of channel 2. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch2inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH2INV_MSK) == (ADC_CHINV_CH2INV_MSK)); -} - -/** - * @brief Channel 1 Invert Control enable. - * @note This is used to invert the data of channel 1. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch1inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH1INV_MSK); -} - -/** - * @brief Channel 1 Invert Control disable. - * @note Disable invert data channel 1. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch1inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH1INV_MSK); -} - -/** - * @brief Check if Channel 1 Invert Control is enabled. - * @note Check invert of data of channel 1. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch1inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH1INV_MSK) == (ADC_CHINV_CH1INV_MSK)); -} - -/** - * @brief Channel 0 Invert Control enable. - * @note This is used to invert the data of channel 0. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_srate_ch0inv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SRATE, ADC_CHINV_CH0INV_MSK); -} - -/** - * @brief Channel 0 Invert Control disable. - * @note Disable invert data channel 0. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_srate_ch0inv(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SRATE, ADC_CHINV_CH0INV_MSK); -} - -/** - * @brief Check if Channel 0 Invert Control is enabled. - * @note Check invert state of data of channel 0. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_srate_ch0inv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SRATE, ADC_CHINV_CH0INV_MSK) == (ADC_CHINV_CH0INV_MSK)); -} - -/** - * @brief Set ADC SRATE register. - * @note This is used to set SRATE register. - * @param ADCx ADC Instance - * @param SRATE - * @retval NONE. - */ -__STATIC_INLINE void md_adc_set_srate(ADC_TypeDef *adcx, uint32_t srate) -{ - WRITE_REG(adcx->SRATE, srate); -} - -/** - * @brief Get ADC SRATE register. - * @note This is used to read SRATE register. - * @param ADCx ADC Instance - * @param SRATE - * @retval SRATE Register Value. - */ -__STATIC_INLINE uint32_t md_adc_get_srate(ADC_TypeDef *adcx) -{ - return READ_REG(adcx->SRATE); -} - -/** - * @brief Set ADC Channel 7 PGA Gain. - * @note This is used to select channel 7 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch7pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH7PGA_MSK, Gain<GAINL, ADC_GAINL_CH7PGA_MSK)>>ADC_GAINL_CH7PGA_POSS); -} - -/** - * @brief Set ADC Channel 6 PGA Gain. - * @note This is used to select channel 6 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch6pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH6PGA_MSK, Gain<GAINL, ADC_GAINL_CH6PGA_MSK)>>ADC_GAINL_CH6PGA_POSS); -} - -/** - * @brief Set ADC Channel 5 PGA Gain. - * @note This is used to select channel 5 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch5pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH5PGA_MSK, Gain<GAINL, ADC_GAINL_CH5PGA_MSK)>>ADC_GAINL_CH5PGA_POSS); -} - -/** - * @brief Set ADC Channel 4 PGA Gain. - * @note This is used to select channel 4 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch4pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH4PGA_MSK, Gain<GAINL, ADC_GAINL_CH4PGA_MSK)>>ADC_GAINL_CH4PGA_POSS); -} - -/** - * @brief Set ADC Channel 3 PGA Gain. - * @note This is used to select channel 3 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch3pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH3PGA_MSK, Gain<GAINL, ADC_GAINL_CH3PGA_MSK)>>ADC_GAINL_CH3PGA_POSS); -} - -/** - * @brief Set ADC Channel 2 PGA Gain. - * @note This is used to select channel 2 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch2pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH2PGA_MSK, Gain<GAINL, ADC_GAINL_CH2PGA_MSK)>>ADC_GAINL_CH2PGA_POSS); -} - -/** - * @brief Set ADC Channel 1 PGA Gain. - * @note This is used to select channel 1 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch1pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH1PGA_MSK, Gain<GAINL, ADC_GAINL_CH1PGA_MSK)>>ADC_GAINL_CH1PGA_POSS); -} - -/** - * @brief Set ADC Channel 0 PGA Gain. - * @note This is used to select channel 0 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl_ch0pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINL, ADC_GAINL_CH0PGA_MSK, Gain<GAINL, ADC_GAINL_CH0PGA_MSK)>>ADC_GAINL_CH0PGA_POSS); -} - -/** - * @brief Set ADC Channels 0~7 PGA Gain. - * @note This is used to select channels 0-7 PGA gain. - * @param ADCx ADC Instance - * @param GainL Register Values for CH0~CH7. - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainl(ADC_TypeDef *ADCx, uint32_t GainL) -{ - WRITE_REG(ADCx->GAINL, GainL); -} - -/** - * @brief Get ADC Channels 0~7 PGA Gain. - * @note This is used to read channels 0-7 PGA gain. - * @param ADCx ADC Instance - * @retval GainL Register Values for CH0~CH7. - */ -__STATIC_INLINE uint32_t md_adc_get_gainl(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->GAINL); -} - -/** - * @brief Set ADC Channel 15 PGA Gain. - * @note This is used to select channel 15 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch15pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH15PGA_MSK, Gain<GAINH, ADC_GAINH_CH15PGA_MSK)>>ADC_GAINH_CH15PGA_POSS); -} - -/** - * @brief Set ADC Channel 14 PGA Gain. - * @note This is used to select channel 14 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch14pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH14PGA_MSK, Gain<GAINH, ADC_GAINH_CH14PGA_MSK)>>ADC_GAINH_CH14PGA_POSS); -} - -/** - * @brief Set ADC Channel 13 PGA Gain. - * @note This is used to select channel 13 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch13pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH13PGA_MSK, Gain<GAINH, ADC_GAINH_CH13PGA_MSK)>>ADC_GAINH_CH13PGA_POSS); -} - -/** - * @brief Set ADC Channel 12 PGA Gain. - * @note This is used to select channel 12 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch12pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH12PGA_MSK, Gain<GAINH, ADC_GAINH_CH12PGA_MSK)>>ADC_GAINH_CH12PGA_POSS); -} - -/** - * @brief Set ADC Channel 11 PGA Gain. - * @note This is used to select channel 11 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch11pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH11PGA_MSK, Gain<GAINH, ADC_GAINH_CH11PGA_MSK)>>ADC_GAINH_CH11PGA_POSS); -} - -/** - * @brief Set ADC Channel 10 PGA Gain. - * @note This is used to select channel 10 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch10pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH10PGA_MSK, Gain<GAINH, ADC_GAINH_CH10PGA_MSK)>>ADC_GAINH_CH10PGA_POSS); -} - -/** - * @brief Set ADC Channel 9 PGA Gain. - * @note This is used to select channel 9 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch9pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH9PGA_MSK, Gain<GAINH, ADC_GAINH_CH9PGA_MSK)>>ADC_GAINH_CH9PGA_POSS); -} - -/** - * @brief Set ADC Channel 8 PGA Gain. - * @note This is used to select channel 8 PGA gain. - * @param ADCx ADC Instance - * @param ADC PGA Gain - * @param Gain parameter can be one of the following values: - * @arg @ref MD_ADC_PGA_GAIN_X1 - * @arg @ref MD_ADC_PGA_GAIN_X2 - * @arg @ref MD_ADC_PGA_GAIN_X3 - * @arg @ref MD_ADC_PGA_GAIN_X4 - * @arg @ref MD_ADC_PGA_GAIN_X5 - * @arg @ref MD_ADC_PGA_GAIN_X6 - * @arg @ref MD_ADC_PGA_GAIN_X7 - * @arg @ref MD_ADC_PGA_GAIN_X8 - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh_ch8pga(ADC_TypeDef *ADCx, uint32_t Gain) -{ - MODIFY_REG(ADCx->GAINH, ADC_GAINH_CH8PGA_MSK, Gain<GAINH, ADC_GAINH_CH8PGA_MSK)>>ADC_GAINH_CH8PGA_POSS); -} - -/** - * @brief Set ADC Channels 8~15 PGA Gain. - * @note This register is used to select channels 8-15 PGA gain. - * @param GainH Register Values for CH8~CH15. - * @retval None - */ -__STATIC_INLINE void md_adc_set_gainh(ADC_TypeDef *ADCx, uint32_t GainH) -{ - WRITE_REG(ADCx->GAINH, GainH); -} - -/** - * @brief Get ADC Channels 8~15 PGA Gain. - * @note This register is used to read channels 8-15 PGA gain. - * @param ADCx ADC Instance - * @retval GainH Register Values for CH8~CH15. - */ -__STATIC_INLINE uint32_t md_adc_get_gainh(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->GAINH); -} - -/** - * @brief Refresh ADC FIFOs SS0~SS3. - * @note This register allowed users to reset ADC FIFO when starting a - * new Sample Sequencer. - * @param ADCx ADC Instance - * @param Value if bit (1 or 0) - * @retval None - */ -__STATIC_INLINE void md_adc_set_frf_ffrst(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->FRF, ADC_FRF_FFRST_MSK); -} - -/** - * @brief Get ADC FIFO Refresh Status. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_frf_ffrst(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->FRF, ADC_FRF_FFRST_MSK)>>ADC_FRF_FFRST_POS); -} - -/** - * @brief Refresh ADC SS3 FIFO. - * @note This register is used to refresh the FIFO of sequencer 3 at any - * time. This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_set_frf_ss3rf(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->FRF, ADC_FRF_SS3RF_MSK); -} - -/** - * @brief Refresh ADC SS32 FIFO. - * @note This register is used to refresh the FIFO of sequencer 2 at any - * time. This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_set_frf_ss2rf(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->FRF, ADC_FRF_SS2RF_MSK); -} - -/** - * @brief Refresh ADC SS1 FIFO. - * @note This register is used to refresh the FIFO of sequencer 1 at any - * time. This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_set_frf_ss1rf(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->FRF, ADC_FRF_SS1RF_MSK); -} - -/** - * @brief Refresh ADC SS0 FIFO. - * @note This register is used to refresh the FIFO of sequencer 0 at any - * time. This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_set_frf_ss0rf(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->FRF, ADC_FRF_SS0RF_MSK); -} - -/** - * @brief Refresh ADC FIFO Register. - * @note This is used to set RFR register. - * @param ADCx ADC Instance - * @param Register Value - * @retval None - */ -__STATIC_INLINE void md_adc_set_frf(ADC_TypeDef *ADCx, uint32_t Value) -{ - WRITE_REG(ADCx->FRF, Value); -} - -/** - * @brief Get ADC FIFO Refresh Register. - * @note This is used to get RFR register. - * @param ADCx ADC Instance - * @retval Register Value - */ -__STATIC_INLINE uint32_t md_adc_get_frf(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->FRF); -} - -/** - * @brief Check if all ADC Sequencer is idle. - * @note Check if SS0~SS3 is idle. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_idle(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SSEN, ADC_SSEN_IDLE_MSK) == (ADC_SSEN_IDLE_MSK)); -} - -/** - * @brief ADC Sample Sequencer 3 (SS3) Enable. - * @note User can set this bit to enable sample sequencer 3 (SS3). - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ssen_ss3en(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SSEN, ADC_SSEN_SS3EN_MSK); -} - -/** - * @brief ADC Sample Sequencer 3 (SS3) Disable. - * @note Disable sample sequencer 3 (SS3). - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ssen_ss3en(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SSEN, ADC_SSEN_SS3EN_MSK); -} - -/** - * @brief Check if ADC Sample Sequencer 3 (SS3) is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ssen_ss3en(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SSEN, ADC_SSEN_SS3EN_MSK) == (ADC_SSEN_SS3EN_MSK)); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Enable. - * @note User can set this bit to enable sample sequencer 2 (SS2). - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ssen_ss2en(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SSEN, ADC_SSEN_SS2EN_MSK); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Disable. - * @note Disable sample sequencer 2 (SS2). - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ssen_ss2en(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SSEN, ADC_SSEN_SS2EN_MSK); -} - -/** - * @brief Check if ADC Sample Sequencer 2 (SS2) is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ssen_ss2en(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SSEN, ADC_SSEN_SS2EN_MSK) == (ADC_SSEN_SS2EN_MSK)); -} - -/** - * @brief ADC Sample Sequencer 1 (SS1) Enable. - * @note User can set this bit to enable sample sequencer 1 (SS1). - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ssen_ss1en(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SSEN, ADC_SSEN_SS1EN_MSK); -} - -/** - * @brief ADC Sample Sequencer 1 (SS1) Disable. - * @note Disable sample sequencer 1 (SS1). - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ssen_ss1en(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SSEN, ADC_SSEN_SS1EN_MSK); -} - -/** - * @brief Check if ADC Sample Sequencer 1 (SS1) is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ssen_ss1en(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SSEN, ADC_SSEN_SS1EN_MSK) == (ADC_SSEN_SS1EN_MSK)); -} - -/** - * @brief ADC Sample Sequencer 0 (SS0) Enable. - * @note User can set this bit to enable sequencer 0 (SS0). - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ssen_ss0en(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SSEN, ADC_SSEN_SS0EN_MSK); -} - -/** - * @brief AADC Sample Sequencer 0 (SS0) Disable. - * @note Disable sample sequencer 0 (SS0). - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ssen_ss0en(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SSEN, ADC_SSEN_SS0EN_MSK); -} - -/** - * @brief Check if ADC Sample Sequencer 0 (SS0) is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ssen_ss0en(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SSEN, ADC_SSEN_SS0EN_MSK) == (ADC_SSEN_SS0EN_MSK)); -} - -/** - * @brief ADC Sample Sequencer 3 (SS3) Initiate. - * @note Triggers smapling on SS3 if the sequencer is enabled in the ADC_SSEN_SS3EN. - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_set_swtri_ss3(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SWTRI, ADC_SWTRI_SS3_MSK); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Initiate. - * @note Triggers smapling on SS2 if the sequencer is enabled in the ADC_SSEN_SS2EN. - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_set_swtri_ss2(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SWTRI, ADC_SWTRI_SS2_MSK); -} - -/** - * @brief ADC Sample Sequencer 1 (SS1) Initiate. - * @note Triggers smapling on SS1 if the sequencer is enabled in the ADC_SSEN_SS1EN. - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_set_swtri_ss1(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SWTRI, ADC_SWTRI_SS1_MSK); -} - -/** - * @brief ADC Sample Sequencer 0 (SS0) Initiate. - * @note Triggers smapling on SS0 if the sequencer is enabled in the ADC_SSEN_SS0EN. - * This bit will cleared by itself. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_set_swtri_ss0(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SWTRI, ADC_SWTRI_SS0_MSK); -} - -/** - * @brief ADC Timeout Interrupt Enable. - * @note User can set this bit to enable timeout Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ier_toie(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IER, ADC_IER_TOIE_MSK); -} - -/** - * @brief ADC Sample Sequencer 3 (SS3) Interrupt Enable. - * @note User can set this bit to enable sequencer 3 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ier_ss3ie(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IER, ADC_IER_SS3IE_MSK); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Interrupt Enable. - * @note User can set this bit to enable sequencer 2 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ier_ss2ie(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IER, ADC_IER_SS2IE_MSK); -} - -/** - * @brief ADC Sample Sequencer 1 (SS1) Interrupt Enable. - * @note User can set this bit to enable sequencer 1 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ier_ss1ie(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IER, ADC_IER_SS1IE_MSK); -} - -/** - * @brief ADC Sample Sequencer 0 (SS0) Interrupt Enable. - * @note User can set this bit to enable sequencer 0 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ier_ss0ie(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IER, ADC_IER_SS0IE_MSK); -} - -/** - * @brief ADC Timeout Interrupt Disable. - * @note User can set this bit to disable timeout Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_idr_toid(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IDR, ADC_IDR_TOID_MSK); -} - -/** - * @brief ADC Sample Sequencer 3 (SS3) Interrupt Disable. - * @note User can set this bit to disable sequencer 3 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_idr_ss3id(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IDR, ADC_IDR_SS3ID_MSK); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Interrupt Disable. - * @note User can set this bit to disable sequencer 2 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_idr_ss2id(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IDR, ADC_IDR_SS2ID_MSK); -} - -/** - * @brief ADC Sample Sequencer 1 (SS1) Interrupt Disable. - * @note User can set this bit to disable sequencer 1 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_idr_ss1id(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IDR, ADC_IDR_SS1ID_MSK); -} - -/** - * @brief ADC Sample Sequencer 0 (SS0) Interrupt Disable. - * @note User can set this bit to disable sequencer 0 Interrupt function. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_idr_ss0id(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->IDR, ADC_IDR_SS0ID_MSK); -} - -/** - * @brief Check if ADC Timeout Interrupt is Enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ivs_toivs(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IVS, ADC_IVS_TOIVS_MSK) == (ADC_IVS_TOIVS_MSK)); -} - -/** - * @brief Check if ADC Sample Sequencer 3 (SS3) Interrupt is Enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ivs_ss3ivs(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IVS, ADC_IVS_SS3IVS_MSK) == (ADC_IVS_SS3IVS_MSK)); -} - -/** - * @brief Check if ADC Sample Sequencer 2 (SS2) Interrupt is Enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ivs_ss2ivs(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IVS, ADC_IVS_SS2IVS_MSK) == (ADC_IVS_SS2IVS_MSK)); -} - -/** - * @brief Check if ADC Sample Sequencer 1 (SS1) Interrupt is Enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ivs_ss1ivs(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IVS, ADC_IVS_SS1IVS_MSK) == (ADC_IVS_SS1IVS_MSK)); -} - -/** - * @brief Check if ADC Sample Sequencer 0 (SS0) Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ivs_ss0ivs(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IVS, ADC_IVS_SS0IVS_MSK) == (ADC_IVS_SS0IVS_MSK)); -} - -/** - * @brief Check Timeout Raw Interrupt Flag Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_rif_torif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->RIF, ADC_RIF_TORIF_MSK) == (ADC_RIF_TORIF_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 3 (SS3) Raw Interrupt Flag Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_rif_ss3rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->RIF, ADC_RIF_SS3RIF_MSK) == (ADC_RIF_SS3RIF_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 2 (SS2) Raw Interrupt Flag Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_rif_ss2rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->RIF, ADC_RIF_SS2RIF_MSK) == (ADC_RIF_SS2RIF_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 1 (SS1) Raw Interrupt Flag Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_rif_ss1rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->RIF, ADC_RIF_SS1RIF_MSK) == (ADC_RIF_SS1RIF_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 0 (SS0) Raw Interrupt Flag Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_rif_ss0rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->RIF, ADC_RIF_SS0RIF_MSK) == (ADC_RIF_SS0RIF_MSK)); -} - -/** - * @brief Check Timeout Interrupt Flag Masked Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ifm_torif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IFM, ADC_IFM_TOIFM_MSK) == (ADC_IFM_TOIFM_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 3 (SS3) Interrupt Flag Masked Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ifm_ss3rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IFM, ADC_IFM_SS3IFM_MSK) == (ADC_IFM_SS3IFM_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 2 (SS2) Interrupt Flag Masked Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ifm_ss2rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IFM, ADC_IFM_SS2IFM_MSK) == (ADC_IFM_SS2IFM_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 1 (SS1) Interrupt Flag Masked Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ifm_ss1rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IFM, ADC_IFM_SS1IFM_MSK) == (ADC_IFM_SS1IFM_MSK)); -} - -/** - * @brief Check ADC Sample Sequencer 0 (SS0) Interrupt Flag Masked Status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ifm_ss0rif(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->IFM, ADC_IFM_SS0IFM_MSK) == (ADC_IFM_SS0IFM_MSK)); -} - -/** - * @brief ADC Timeout Interrupt Clear. - * @note User can set this bit to clear timeout interrupt status. - * @param ADCx ADC Instance - * @retval None. - */ -__STATIC_INLINE void md_uart_clear_flag_icr_toicr(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->ICR, ADC_ICR_TOICR_MSK); -} - -/** - * @brief ADC Sample Sequencer 3 (SS3) Interrupt Clear. - * @note User can set this bit to clear SS3 interrupt status. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_clear_flag_icr_ss3icr(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->ICR, ADC_ICR_SS3ICR_MSK); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Interrupt Clear. - * @note User can set this bit to clear SS2 interrupt status. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_clear_flag_icr_ss2icr(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->ICR, ADC_ICR_SS2ICR_MSK); -} - -/** - * @brief ADC Sample Sequencer 1 (SS1) Interrupt Clear. - * @note User can set this bit to clear SS1 interrupt status. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_clear_flag_icr_ss1icr(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->ICR, ADC_ICR_SS1ICR_MSK); -} - -/** - * @brief ADC Sample Sequencer 0 (SS0) Interrupt Clear. - * @note User can set this bit to clear SS0 interrupt status. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_clear_flag_icr_ss0icr(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->ICR, ADC_ICR_SS0ICR_MSK); -} - -/** - * @brief ADC SS3 DMA Function Enable. - * @note User can set this register to enable DMA function. - * For S3, if set when FIFO is not empty, DMA Single REQ will rise. - * @param UARTx UART Instance - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_dma_ss3dmaen(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->DMA, ADC_DMA_SS3_DMAEN_MSK); -} - -/** - * @brief ADC SS3 DMA Function Disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_dma_ss3dmaen(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->DMA, ADC_DMA_SS3_DMAEN_MSK); -} - -/** - * @brief Check if ADC SS3 DMA is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_dma_ss3dmaen(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_BIT(ADCx->DMA, ADC_DMA_SS3_DMAEN_MSK) == (ADC_DMA_SS3_DMAEN_MSK)); -} - -/** - * @brief ADC SS2 DMA Function Enable. - * @note User can set this register to enable DMA function. - * For S2, if set when FIFO is not empty, DMA Single REQ will rise. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_dma_ss2dmaen(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->DMA, ADC_DMA_SS2_DMAEN_MSK); -} - -/** - * @brief ADC SS2 DMA Function Disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_dma_ss2dmaen(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->DMA, ADC_DMA_SS2_DMAEN_MSK); -} - -/** - * @brief Check if ADC SS2 DMA is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_dma_ss2dmaen(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_BIT(ADCx->DMA, ADC_DMA_SS2_DMAEN_MSK) == (ADC_DMA_SS2_DMAEN_MSK)); -} - -/** - * @brief ADC SS1 DMA Function Enable. - * @note User can set this register to enable DMA function. - * For S1, if set when FIFO is not empty, DMA Single REQ will rise. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_dma_ss1dmaen(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->DMA, ADC_DMA_SS1_DMAEN_MSK); -} - -/** - * @brief ADC SS1 DMA Function Disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_dma_ss1dmaen(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->DMA, ADC_DMA_SS1_DMAEN_MSK); -} - -/** - * @brief Check if ADC SS1 DMA is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_dma_ss1dmaen(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_BIT(ADCx->DMA, ADC_DMA_SS1_DMAEN_MSK) == (ADC_DMA_SS1_DMAEN_MSK)); -} - -/** - * @brief ADC SS0 DMA Function Enable. - * @note User can set this register to enable DMA function. - * For S0, if set when FIFO is not empty, DMA Single REQ will rise. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_dma_ss0dmaen(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->DMA, ADC_DMA_SS0_DMAEN_MSK); -} - -/** - * @brief ADC SS0 DMA Function Disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_dma_ss0dmaen(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->DMA, ADC_DMA_SS0_DMAEN_MSK); -} - -/** - * @brief Check if ADC SS3 DMA is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_dma_ss0dmaen(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_BIT(ADCx->DMA, ADC_DMA_SS0_DMAEN_MSK) == (ADC_DMA_SS0_DMAEN_MSK)); -} - -/** - * @brief Set SS0 Trigger Select. - * @note This field selects the trigger source for Sample Sequencer 0. - * @param ADCx ADC Instance. - * @param Sample sequencer trigger sources. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_SEL_SW - * @arg @ref MD_ADC_SS_CON_SEL_BS16T1 - * @arg @ref MD_ADC_SS_CON_SEL_ALWAYS - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T4 - * @arg @ref MD_ADC_SS_CON_SEL_AD16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GPIO - * @arg @ref MD_ADC_SS_CON_SEL_CMP0 - * @arg @ref MD_ADC_SS_CON_SEL_CMP1 - * @arg @ref MD_ADC_SS_CON_SEL_CMP2 - * @arg @ref MD_ADC_SS_CON_SEL_CMP3 - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss0_con_sel(ADC_TypeDef *ADCx, uint32_t TrigSource) -{ - MODIFY_REG(ADCx->SS0_CON, ADC_SS0_CON_SEL_MSK, TrigSource<SS0_CON, ADC_SS0_CON_SEL_MSK)>>ADC_SS0_CON_SEL_POSS); -} - -/** - * @brief Set ADC Sample Sequencer 0 (SS0) Trigger Type select. - * @note User can set this bit to select the type of trigger. - * @param Sample sequencer trigger types. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_TYP_EDGE - * @arg @ref MD_ADC_SS_COM_TYP_LEVEL - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss0_con_type(ADC_TypeDef *ADCx, uint32_t TrigType) -{ - MODIFY_REG(ADCx->SS0_CON, ADC_SS0_CON_TYP_MSK, TrigType<SS0_CON, ADC_SS0_CON_TYP_MSK)>>ADC_SS0_CON_TYP_POS); -} - -/** - * @brief Set ADC Sample Sequencer 0 (SS0) Priority. - * @note This field contains a binary-encoded value specifying the - * priority encoding of SS0. The prioriteies assigned to the - * sequencers must be uniquely mapped. - * @param ADCx ADC Instance. - * @param Sample sequencer trigger priorities. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS0_CON_PRI_HIGHEST - * @arg @ref MD_ADC_SS0_CON_PRI_SECOND - * @arg @ref MD_ADC_SS0_CON_PRI_THIRD - * @arg @ref MD_ADC_SS0_CON_PRI_LOWEST - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss0_con_pri(ADC_TypeDef *ADCx, uint32_t priority) -{ - MODIFY_REG(ADCx->SS0_CON, ADC_SS0_CON_PRI_MSK, priority<SS0_CON, ADC_SS0_CON_PRI_MSK)>>ADC_SS0_CON_PRI_POSS); -} - -/** - * @brief Enable One Shot Trigger Mode. - * @note When set HIGH, each trigger will only sample once and use one slot in FIFO. - * @param ADCx ADC Instance. - * @retval None - */ -__STATIC_INLINE void md_adc_enable_ss0_con_one(ADC_TypeDef *adcx) -{ - SET_BIT(adcx->SS0_CON, ADC_SS0_CON_ONE_MSK); -} - -/** - * @brief Disable One Shot Trigger Mode. - * @param ADCx ADC Instance. - * @retval None - */ -__STATIC_INLINE void md_adc_disable_ss0_con_one(ADC_TypeDef *adcx) -{ - CLEAR_BIT(adcx->SS0_CON, ADC_SS0_CON_ONE_MSK); -} - -/** - * @brief Set 8th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux7(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX7_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX7_MSK)>>ADC_SS0_MUX0_MUX7_POSS); -} - -/** - * @brief Set 7th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux6(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX6_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX6_MSK)>>ADC_SS0_MUX0_MUX6_POSS); -} - -/** - * @brief Set 6th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux5(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX5_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX5_MSK)>>ADC_SS0_MUX0_MUX5_POSS); -} - -/** - * @brief Set 5th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux4(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX4_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX4_MSK)>>ADC_SS0_MUX0_MUX4_POSS); -} - -/** - * @brief Set 4th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux3(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX3_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX3_MSK)>>ADC_SS0_MUX0_MUX3_POSS); -} - -/** - * @brief Set 3rd Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux2(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX2_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX2_MSK)>>ADC_SS0_MUX0_MUX2_POSS); -} - -/** - * @brief Set 2nd Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux1(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX1_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX1_MSK)>>ADC_SS0_MUX0_MUX1_POSS); -} - -/** - * @brief Set 1st Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux0_mux0(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX0, ADC_SS0_MUX0_MUX0_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX0_MUX0_MSK)>>ADC_SS0_MUX0_MUX0_POSS); -} - -/** - * @brief Set ADC channels MUX 0~7. - * @note Set ADC SS0_MUX0 register. - * @note Mapping ADINx to ADC channels 0~7. - - * @param ADC Channel - * @param MUX Register - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss0_mux0(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - WRITE_REG(ADCx->SS0_MUX0, RegValue); -} - -/** - * @brief Get ADC channels MUX 0~7. - * @note Get ADC SS0_MUX0 register. - * @param ADCx ADC Instance - * @retval SS0_MUX0 Register Value - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_mux0(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS0_MUX0); -} - -/** - * @brief Set 16th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux15(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX15_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX15_MSK)>>ADC_SS0_MUX1_MUX15_POSS); -} - -/** - * @brief Set 15th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux14(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX14_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX14_MSK)>>ADC_SS0_MUX1_MUX14_POSS); -} - -/** - * @brief Set 14th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux13(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX13_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX13_MSK)>>ADC_SS0_MUX1_MUX13_POSS); -} - -/** - * @brief Set 13th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux12(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX12_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX12_MSK)>>ADC_SS0_MUX1_MUX12_POSS); -} - -/** - * @brief Set 12th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux11(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX11_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX11_MSK)>>ADC_SS0_MUX1_MUX11_POSS); -} - -/** - * @brief Set 11th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux10(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX10_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX10_MSK)>>ADC_SS0_MUX1_MUX10_POSS); -} - -/** - * @brief Set 10th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux9(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX9_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX9_MSK)>>ADC_SS0_MUX1_MUX9_POSS); -} - -/** - * @brief Set 9th Sample Input Select. - * @note User can set this register to select which channel will be - * sampled. For example, a value of n indicates the input is - * channel n. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss0_mux1_mux8(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS0_MUX1, ADC_SS0_MUX1_MUX8_MSK, AdinPin<SS0_MUX0, ADC_SS0_MUX1_MUX8_MSK)>>ADC_SS0_MUX1_MUX8_POSS); -} - -/** - * @brief Set ADC channels MUX 8~15. - * @note Set SS0_MUX1 register for channels 8~15. - * @param ADCx ADC Instance. - * @param SS0 MUX1 Register. - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss0_mux1(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - WRITE_REG(ADCx->SS0_MUX1, RegValue); -} - -/** - * @brief Get ADC channels MUX 8~15. - * @note Get SS0_MUX1 register for channels 8~15. - * @param ADCx ADC Instance. - * @retval SS0 MUX1 Register. - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_mux1(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS0_MUX1); -} - -/** - * @brief 16th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie15(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE15_MSK); -} - -/** - * @brief 16th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie15(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE15_MSK); -} - -/** - * @brief Check if 16th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie15(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE15_MSK) == (ADC_SS0_END_IE15_MSK)); -} - -/** - * @brief 15th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie14(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE14_MSK); -} - -/** - * @brief 15th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie14(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE14_MSK); -} - -/** - * @brief Check if 15th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie14(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE14_MSK) == (ADC_SS0_END_IE14_MSK)); -} - -/** - * @brief 14th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie13(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE13_MSK); -} - -/** - * @brief 14th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie13(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE13_MSK); -} - -/** - * @brief Check if 14th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie13(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE13_MSK) == (ADC_SS0_END_IE13_MSK)); -} - -/** - * @brief 13th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie12(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE12_MSK); -} - -/** - * @brief 13th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie12(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE12_MSK); -} - -/** - * @brief Check if 13th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie12(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE12_MSK) == (ADC_SS0_END_IE12_MSK)); -} - -/** - * @brief 12th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie11(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE11_MSK); -} - -/** - * @brief 12th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie11(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE11_MSK); -} - -/** - * @brief Check 12th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie11(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE11_MSK) == (ADC_SS0_END_IE11_MSK)); -} - -/** - * @brief 11th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie10(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE10_MSK); -} - -/** - * @brief 11th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie10(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE10_MSK); -} - -/** - * @brief Check if 11th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie10(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE10_MSK) == (ADC_SS0_END_IE10_MSK)); -} - -/** - * @brief 10th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie9(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE9_MSK); -} - -/** - * @brief 10th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie9(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE9_MSK); -} - -/** - * @brief Check if 10th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie9(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE9_MSK) == (ADC_SS0_END_IE9_MSK)); -} - -/** - * @brief 9th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie8(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE8_MSK); -} - -/** - * @brief 9th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie8(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE8_MSK); -} - -/** - * @brief Check if 9th Sample Interrupt is Enable. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie8(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE8_MSK) == (ADC_SS0_END_IE8_MSK)); -} - -/** - * @brief 8th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie7(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE7_MSK); -} - -/** - * @brief 8th Sample Interrupt Disable - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie7(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE7_MSK); -} - -/** - * @brief Check if 8th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie7(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE7_MSK) == (ADC_SS0_END_IE7_MSK)); -} - -/** - * @brief 7th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie6(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE6_MSK); -} - -/** - * @brief 7th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie6(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE6_MSK); -} - -/** - * @brief Check if 7th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie6(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE6_MSK) == (ADC_SS0_END_IE6_MSK)); -} - - -/** - * @brief 6th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie5(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE5_MSK); -} - -/** - * @brief 6th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie5(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE5_MSK); -} - -/** - * @brief Check if 6th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie5(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE5_MSK) == (ADC_SS0_END_IE5_MSK)); -} - -/** - * @brief 5th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie4(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE4_MSK); -} - -/** - * @brief 5th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie4(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE4_MSK); -} - -/** - * @brief Check if 5th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie4(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE4_MSK) == (ADC_SS0_END_IE4_MSK)); -} - -/** - * @brief 4th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie3(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE3_MSK); -} - -/** - * @brief 4th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie3(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE3_MSK); -} - -/** - * @brief Check if 4th Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie3(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE3_MSK) == (ADC_SS0_END_IE3_MSK)); -} - -/** - * @brief 3rd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie2(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE2_MSK); -} - -/** - * @brief 3rd Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie2(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE2_MSK); -} - -/** - * @brief Check if 3rd Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie2(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE2_MSK) == (ADC_SS0_END_IE2_MSK)); -} - -/** - * @brief 2nd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie1(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE1_MSK); -} - -/** - * @brief 2nd Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie1(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE1_MSK); -} - -/** - * @brief Check if 2nd Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie1(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE1_MSK) == (ADC_SS0_END_IE1_MSK)); -} - -/** - * @brief 1st Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss0_end_ie0(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_END_IE0_MSK); -} - -/** - * @brief 1st Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss0_end_ie0(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS0_END, ADC_SS0_END_IE0_MSK); -} - -/** - * @brief Check if 1st Sample Interrupt is Enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss0_end_ie0(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_END, ADC_SS0_END_IE0_MSK) == (ADC_SS0_END_IE0_MSK)); -} - -/** - * @brief Set ADC SS0 sample counts. - * @note User can set this register to select how many times will ADC samples data. - * @param ADCx ADC Instance. - * @param End Value Min_Value=0x00 Max_Value=0x0F. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss0_end_end(ADC_TypeDef *ADCx, uint32_t EndValue) -{ - MODIFY_REG(ADCx->SS0_END, ADC_SS0_END_END_MSK, EndValue<SS0_END, ADC_SS0_END_END_MSK)>>ADC_SS0_END_END_POSS); -} - -/** - * @brief Set ADC Sample Sequence 0 End Control Register. - * @note Set ADC_SS0_END register - * @param ADCx ADC Instance - * @param ADC_SS0_END Register Value - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss0_end(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - MODIFY_REG(ADCx->SS0_END, ADC_SS0_END_END_MSK, RegValue); -} - -/** - * @brief Get ADC Sample Sequence 0 End Control Register. - * @param ADCx ADC Instance - * @retval ADC_SS0_END Register Value - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_end(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS0_END); -} - -/** - * @brief Set ADC Sample Sequencer 0 (SS0) FIFO Overflow status - * @note When the FIFO is full and a write was requested. - * When an overflow is detected, the most recent write is dropped. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss0_fstat_ov(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_FSTAT_OV_MSK); -} - -/** - * @brief Get ADC Sample Sequencer 0 (SS0) FIFO Overflow status - * @param ADCx ADC Instance - * @retval 1 or 0 - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_OV_MSK)>>ADC_SS0_FSTAT_OV_POS); -} - -/** - * @brief Check if ADC SS0 FSTAT OV is actived. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss0_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_OV_MSK) == (ADC_SS0_FSTAT_OV_MSK)); -} - -/** - * @brief Get ADC SS0 FSTAT FULL - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_FULL_MSK)>>ADC_SS0_FSTAT_FULL_POS); -} - -/** - * @brief Check if ADC SS0 FSTAT FULL is actived. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss0_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_FULL_MSK) == (ADC_SS0_FSTAT_FULL_MSK)); -} - -/** - * @brief Set ADC SS0 FSTAT UV. - * @note When the FIFO is empty and a read was requested. - * The problematic read does not move the FIFO pointers, and 0s are returned. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss0_fstat_uv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS0_END, ADC_SS0_FSTAT_UV_MSK); -} - -/** - * @brief Get ADC SS0 FSTAT UV - * @param ADCx ADC Instance - * @retval 1 or 0 - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_UV_MSK)>>ADC_SS0_FSTAT_UV_POS); -} - -/** - * @brief Check if ADC SS0 FSTAT UV is actived. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss0_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_UV_MSK) == (ADC_SS0_FSTAT_UV_MSK)); -} - -/** - * @brief Get ADC SS0 FSTAT EMPTY - * @param ADCx ADC Instance - * @retval 1 or 0 - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_EMPTY_MSK)>>ADC_SS0_FSTAT_EMPTY_POS); -} - -/** - * @brief Check if ADC SS0 FSTAT EMPTY is actived. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss0_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_EMPTY_MSK) == (ADC_SS0_FSTAT_EMPTY_MSK)); -} - -/** - * @brief Get ADC SS0 FSTAT HPTR - * @note The field contains the current head pointer index, which is the - * next entry to be written to FIFO. - * @param ADCx ADC Instance - * @retval 1 or 0 - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_fstat_hptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_HPTR_MSK)>>ADC_SS0_FSTAT_HPTR_POSS); -} - -/** - * @brief Get ADC SS0 FSTAT TPTR - * @note The field contains the current tail pointer index, which is the - * next entry to be read from FIFO. - * @param ADCx ADC Instance - * @retval 1 or 0 - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_fstat_tptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS0_FSTAT, ADC_SS0_FSTAT_TPTR_MSK)>>ADC_SS0_FSTAT_TPTR_POSS); -} - -/** - * @brief Get ADC sample sequencer 0(SS0) result FIFO data. - * @note User can read conversion result data by reading this register. - * @param ADCx ADC Instance - * @retval ADC Sampled Data - */ -__STATIC_INLINE uint32_t md_adc_get_ss0_data(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_REG(ADC->SS0_DATA)); -} - -/** - * @brief Set SS1 Trigger Select. - * @note This field selects the trigger source for Sample Sequencer 1. - * @param ADCx ADC Instance - * @param Sample sequencer trigger sources. - * This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_SEL_SW - * @arg @ref MD_ADC_SS_CON_SEL_BS16T1 - * @arg @ref MD_ADC_SS_CON_SEL_ALWAYS - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T4 - * @arg @ref MD_ADC_SS_CON_SEL_AD16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GPIO - * @arg @ref MD_ADC_SS_CON_SEL_CMP0 - * @arg @ref MD_ADC_SS_CON_SEL_CMP1 - * @arg @ref MD_ADC_SS_CON_SEL_CMP2 - * @arg @ref MD_ADC_SS_CON_SEL_CMP3 - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss1_con_sel(ADC_TypeDef *ADCx, uint32_t TrigSource) -{ - MODIFY_REG(ADCx->SS1_CON, ADC_SS1_CON_SEL_MSK, TrigSource<SS1_CON, ADC_SS1_CON_SEL_MSK)>>ADC_SS1_CON_SEL_POSS); -} - -/** - * @brief ADC Sample Sequencer 1 (SS1) Trigger Type select. - * @note User can set this bit to select the type of trigger. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_TYP_EDGE - * @arg @ref MD_ADC_SS_COM_TYP_LEVEL - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss1_con_type(ADC_TypeDef *ADCx, uint32_t TrigType) -{ - MODIFY_REG(ADCx->SS1_CON, ADC_SS1_CON_TYP_MSK, TrigType<SS1_CON, ADC_SS1_CON_TYP_MSK)>>ADC_SS1_CON_TYP_POS); -} - -/** - * @brief Set ADC Sample Sequencer 1 (SS1) Priority. - * @note This field contains a binary-encoded value specifying the - * priority encoding of SS1. The prioriteies assigned to the - * sequencers must be uniquely mapped. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS0_CON_PRI_HIGHEST - * @arg @ref MD_ADC_SS0_CON_PRI_SECOND - * @arg @ref MD_ADC_SS0_CON_PRI_THIRD - * @arg @ref MD_ADC_SS0_CON_PRI_LOWEST - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss1_con_pri(ADC_TypeDef *adcx, uint32_t priority) -{ - MODIFY_REG(adcx->SS1_CON, ADC_SS1_CON_PRI_MSK, priority<SS1_CON, ADC_SS1_CON_PRI_MSK)>>ADC_SS1_CON_PRI_POSS); -} - -/** - * @brief One Shot Trigger Mode enable. - * @note When set HIGH, each trigger will only sample once and use one - * slot in FIFO. - * @param ADCx ADC Instance. - * @retval None - */ -__STATIC_INLINE void md_adc_enable_ss1_con_one(ADC_TypeDef *adcx) -{ - SET_BIT(adcx->SS1_CON, ADC_SS1_CON_ONE_MSK); -} - -/** - * @brief One Shot Trigger Mode disable. - * @param ADCx ADC Instance. - * @retval None - */ -__STATIC_INLINE void md_adc_disable_ss1_con_one(ADC_TypeDef *adcx) -{ - CLEAR_BIT(adcx->SS1_CON, ADC_SS1_CON_ONE_MSK); -} - -/** - * @brief Set ADC SS1 MUX7 ADINx Input Pin. - * @note 8th Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux7(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX7_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX7_MSK)>>ADC_SS1_MUX0_MUX7_POSS); -} - -/** - * @brief Set ADC SS1 MUX6 Input ADIN Pin. - * @note 7th Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux6(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX6_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX6_MSK)>>ADC_SS1_MUX0_MUX6_POSS); -} - -/** - * @brief Set ADC SS1 MUX0 MUX5 Input ADIN Pin. - * @note 6th Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux5(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX5_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX5_MSK)>>ADC_SS1_MUX0_MUX5_POSS); -} - -/** - * @brief Set ADC SS1 MUX0 MUX4 Input ADIN Pin. - * @note 5th Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux4(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX4_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX4_MSK)>>ADC_SS1_MUX0_MUX4_POSS); -} - -/** - * @brief Set ADC SS1 MUX0 MUX3 Input ADIN Pin. - * @note 4th Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux3(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX3_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX3_MSK)>>ADC_SS1_MUX0_MUX3_POSS); -} - -/** - * @brief Set ADC SS1 MUX0 MUX2 Input ADIN Pin. - * @note 3rd Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux2(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX2_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX2_MSK)>>ADC_SS1_MUX0_MUX2_POSS); -} - -/** - * @brief Set ADC SS1 MUX0 MUX1 Input ADIN Pin. - * @note 2nd Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux1(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX1_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX1_MSK)>>ADC_SS1_MUX0_MUX1_POSS); -} - -/** - * @brief Set ADC SS1 MUX0 MUX0 Input ADIN Pin. - * @note 1st Sample Input Select. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss1_mux0_mux0(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS1_MUX0, ADC_SS1_MUX0_MUX0_MSK, AdinPin<SS1_MUX0, ADC_SS1_MUX0_MUX0_MSK)>>ADC_SS1_MUX0_MUX0_POSS); -} - -/** - * @brief Set ADC_SS1_MUX0 register. - * @note Set ADC_SS1_MUX0 channels 0~7. - * @param ADCx ADC Instance. - * @param ADC_SS1_MUX0 register value. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss1_mux0(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - WRITE_REG(ADCx->SS1_MUX0, RegValue); -} - -/** - * @brief Get ADC_SS1_MUX0 register. - * @param ADCx ADC Instance. - * @retval ADC_SS1_MUX0 register value. - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_mux0(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS1_MUX0); -} - -/** - * @brief 8th Sample Interrupt Enable. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_enable_ss1_end_ie7(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE7_MSK); -} - -/** - * @brief 8th Sample Interrupt Disable. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie7(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE7_MSK); -} - -/** - * @brief Check if 8th Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie7(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE7_MSK) == (ADC_SS1_END_IE7_MSK)); -} - -/** - * @brief 7th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss1_end_ie6(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE6_MSK); -} - -/** - * @brief 7th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie6(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE6_MSK); -} - -/** - * @brief Check if 7th Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie6(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE6_MSK) == (ADC_SS1_END_IE6_MSK)); -} - - -/** - * @brief 6th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss10_end_ie5(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE5_MSK); -} - -/** - * @brief 8th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie5(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE5_MSK); -} - -/** - * @brief Check if 6th Sample Interrupt is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie5(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE5_MSK) == (ADC_SS1_END_IE5_MSK)); -} - -/** - * @brief 5th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss1_end_ie4(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE4_MSK); -} - -/** - * @brief 5th Sample Interrupt Disable. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie4(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE4_MSK); -} - -/** - * @brief Check if 5th Sample Interrupt is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie4(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE4_MSK) == (ADC_SS1_END_IE4_MSK)); -} - -/** - * @brief 4th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss1_end_ie3(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE3_MSK); -} - -/** - * @brief 8th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie3(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE3_MSK); -} - -/** - * @brief Check if 4th Sample Interrupt is enabled. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie3(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE3_MSK) == (ADC_SS1_END_IE3_MSK)); -} - -/** - * @brief 3rd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss1_end_ie2(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE2_MSK); -} - -/** - * @brief 3rd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie2(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE2_MSK); -} - -/** - * @brief Check if 3rd Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie2(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE2_MSK) == (ADC_SS1_END_IE2_MSK)); -} - -/** - * @brief 2nd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss1_end_ie1(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE1_MSK); -} - -/** - * @brief 2nd Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie1(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE1_MSK); -} - -/** - * @brief Check if 2nd Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie1(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE1_MSK) == (ADC_SS1_END_IE1_MSK)); -} - -/** - * @brief 1st Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss1_end_ie0(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_END_IE0_MSK); -} - -/** - * @brief 1st Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss1_end_ie0(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS1_END, ADC_SS1_END_IE0_MSK); -} - -/** - * @brief Check if 1st Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss1_end_ie0(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS1_END_IE0_MSK) == (ADC_SS1_END_IE0_MSK)); -} - -/** - * @brief Set end sample counts. - * @note User can set this register to select how many times will ADC - * samples data. - * @param ADCx ADC Instance. - * @param End Value Min_Value=0x00 Max_Value=0x07. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss1_end_end(ADC_TypeDef *ADCx, uint32_t EndValue) -{ - MODIFY_REG(ADCx->SS1_END, ADC_SS1_END_END_MSK, EndValue<SS1_END, ADC_SS1_END_END_MSK)>>ADC_SS1_END_END_POSS); -} - -/** - * @brief Set ADC_SS1_END Control Register - * @param ADCx ADC Instance. - * @param ADC_SS1_END register value. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss1_end(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - MODIFY_REG(ADCx->SS1_END, ADC_SS1_END_END_MSK, RegValue); -} - -/** - * @brief Get ADC_SS1_End Control Register - * @param ADCx ADC Instance. - * @retval ADC_SS1_END register value. - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_end(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS1_END); -} - -/** - * @brief Set ADC Sample Sequencer 1 (SS1) FIFO Overflow status. - * @note When the FIFO is full and a write was requested, the - * most recent write is dropped. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss1_fstat_ov(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_FSTAT_OV_MSK); -} - -/** - * @brief Get ADC Sample Sequencer 1 (SS1) FIFO Overflow status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_OV_MSK)>>ADC_SS1_FSTAT_OV_POS); -} - -/** - * @brief Check if ADC Sample Sequencer 1 (SS1) FIFO Overflow is actived. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss1_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_OV_MSK) == (ADC_SS1_FSTAT_OV_MSK)); -} - -/** - * @brief Get ADC SS1 FIFO Full status - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_FULL_MSK)>>ADC_SS1_FSTAT_FULL_POS); -} - -/** - * @brief Check if ADC SS1 FIFO Full is actived. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss1_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_FULL_MSK) == (ADC_SS1_FSTAT_FULL_MSK)); -} - -/** - * @brief Set ADC Sample Sequencer 1 (SS1) FIFO Underflow status. - * @note When the FIFO is empty and a read was requested. - * The problematic read does not move the FIFO pointers, and 0s are returned. - * @param ADCx ADC Instance - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss1_fstat_uv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS1_FSTAT_UV_MSK); -} - -/** - * @brief Get ADC Sample Sequencer 1 (SS1) FIFO Underflow status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_UV_MSK)>>ADC_SS1_FSTAT_UV_POS); -} - -/** - * @brief Check if ADC Sample Sequencer 1 (SS1) FIFO Underflow status is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss1_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_UV_MSK) == (ADC_SS1_FSTAT_UV_MSK)); -} - -/** - * @brief Get ADC SS1 FIFO Empty status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_EMPTY_MSK)>>ADC_SS1_FSTAT_EMPTY_POS); -} - -/** - * @brief Check if ADC SS1 FIFO Empty is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss1_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_EMPTY_MSK) == (ADC_SS1_FSTAT_EMPTY_MSK)); -} - -/** - * @brief Get ADC SS1 FIFO Head Pointer. - * @note The field contains the current head pointer index, which is the - * next entry to be written to FIFO. - * @param ADCx ADC Instance. - * @retval Value between Min_Data=0x00 and Max_Data=0x0F - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_fstat_hptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_HPTR_MSK)>>ADC_SS1_FSTAT_HPTR_POSS); -} - -/** - * @brief Get ADC SS1 FIFO Tail Pointer. - * @note The field contains the current tail pointer index, which is the - * next entry to be read from FIFO. - * @param ADCx ADC Instance. - * @retval Value between Min_Data=0x00 and Max_Data=0x0F - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_fstat_tptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_FSTAT, ADC_SS1_FSTAT_TPTR_MSK)>>ADC_SS1_FSTAT_TPTR_POSS); -} - -/** - * @brief Get ADC sample sequencer 1(SS1) Conversion Result Data. - * @note User can read conversion result data by reading this register. - * @param ADCx ADC Instance. - * @retval ADC Sampled Data. - */ -__STATIC_INLINE uint32_t md_adc_get_ss1_data(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_REG(ADC->SS1_DATA)); -} - -/** - * @brief Set ADC SS2 Trigger Select. - * @note This field selects the trigger source for Sample Sequencer 1. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_SEL_SW - * @arg @ref MD_ADC_SS_CON_SEL_BS16T1 - * @arg @ref MD_ADC_SS_CON_SEL_ALWAYS - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T4 - * @arg @ref MD_ADC_SS_CON_SEL_AD16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GPIO - * @arg @ref MD_ADC_SS_CON_SEL_CMP0 - * @arg @ref MD_ADC_SS_CON_SEL_CMP1 - * @arg @ref MD_ADC_SS_CON_SEL_CMP2 - * @arg @ref MD_ADC_SS_CON_SEL_CMP3 - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss2_con_sel(ADC_TypeDef *ADCx, uint32_t TrigSource) -{ - MODIFY_REG(ADCx->SS2_CON, ADC_SS2_CON_SEL_MSK, TrigSource<SS2_CON, ADC_SS2_CON_SEL_MSK)>>ADC_SS2_CON_SEL_POSS); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Trigger Type select. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_TYP_EDGE - * @arg @ref MD_ADC_SS_COM_TYP_LEVEL - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss2_con_type(ADC_TypeDef *ADCx, uint32_t TrigType) -{ - MODIFY_REG(ADCx->SS2_CON, ADC_SS2_CON_TYP_MSK, TrigType<SS2_CON, ADC_SS2_CON_TYP_MSK)>>ADC_SS2_CON_TYP_POS); -} - -/** - * @brief Set ADC Sample Sequencer 2(SS2) Priority. - * @note This field contains a binary-encoded value specifying the - * priority encoding of SS2. The prioriteies assigned to the - * sequencers must be uniquely mapped. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_PRI_HIGHEST - * @arg @ref MD_ADC_SS_CON_PRI_SECOND - * @arg @ref MD_ADC_SS_CON_PRI_THIRD - * @arg @ref MD_ADC_SS_CON_PRI_LOWEST - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss2_con_pri(ADC_TypeDef *adcx, uint32_t priority) -{ - MODIFY_REG(adcx->SS2_CON, ADC_SS2_CON_PRI_MSK, priority<SS2_CON, ADC_SS2_CON_PRI_MSK)>>ADC_SS2_CON_PRI_POSS); -} - -/** - * @brief Enable One Shot Trigger Mode. - * @note When set HIGH, each trigger will only sample once and use one - * slot in FIFO. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss2_con_one(ADC_TypeDef *adcx) -{ - SET_BIT(adcx->SS2_CON, ADC_SS2_CON_ONE_MSK); -} - -/** - * @brief Disable One Shot Trigger Mode. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss2_con_one(ADC_TypeDef *adcx) -{ - CLEAR_BIT(adcx->SS2_CON, ADC_SS2_CON_ONE_MSK); -} - -/** - * @brief 4th Sample Input Select.. - * @param ADCx ADC Instance - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss2_mux0_mux3(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS2_MUX0, ADC_SS2_MUX0_MUX3_MSK, AdinPin<SS2_MUX0, ADC_SS2_MUX0_MUX3_MSK)>>ADC_SS2_MUX0_MUX3_POSS); -} - -/** - * @brief 3rd Sample Input Select. - * @param ADCx ADC Instance. - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss2_mux0_mux2(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS2_MUX0, ADC_SS2_MUX0_MUX2_MSK, AdinPin<SS2_MUX0, ADC_SS2_MUX0_MUX2_MSK)>>ADC_SS2_MUX0_MUX2_POSS); -} - -/** - * @brief 2nd Sample Input Select. - * @param ADCx ADC Instance. - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss2_mux0_mux1(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS2_MUX0, ADC_SS2_MUX0_MUX1_MSK, AdinPin<SS2_MUX0, ADC_SS2_MUX0_MUX1_MSK)>>ADC_SS2_MUX0_MUX1_POSS); -} - -/** - * @brief 1st Sample Input Select. - * @param ADCx ADC Instance. - * @param ADIN Pin: - * @arg @ref MD_ADC_SS_MUX_ADIN15 - * @arg @ref MD_ADC_SS_MUX_ADIN14 - * @arg @ref MD_ADC_SS_MUX_ADIN13 - * @arg @ref MD_ADC_SS_MUX_ADIN12 - * @arg @ref MD_ADC_SS_MUX_ADIN11 - * @arg @ref MD_ADC_SS_MUX_ADIN10 - * @arg @ref MD_ADC_SS_MUX_ADIN9 - * @arg @ref MD_ADC_SS_MUX_ADIN8 - * @arg @ref MD_ADC_SS_MUX_ADIN7 - * @arg @ref MD_ADC_SS_MUX_ADIN6 - * @arg @ref MD_ADC_SS_MUX_ADIN5 - * @arg @ref MD_ADC_SS_MUX_ADIN4 - * @arg @ref MD_ADC_SS_MUX_ADIN3 - * @arg @ref MD_ADC_SS_MUX_ADIN2 - * @arg @ref MD_ADC_SS_MUX_ADIN1 - * @arg @ref MD_ADC_SS_MUX_ADIN0 - */ -__STATIC_INLINE void md_adc_set_ss2_mux0_mux0(ADC_TypeDef *ADCx, uint32_t AdinPin) -{ - MODIFY_REG(ADCx->SS2_MUX0, ADC_SS2_MUX0_MUX0_MSK, AdinPin<SS2_MUX0, ADC_SS2_MUX0_MUX0_MSK)>>ADC_SS2_MUX0_MUX0_POSS); -} - -/** - * @brief Set ADC_SS2_MUX0 register value. - * @param ADCx ADC Instance. - * @param ADC_SS2_MUX0 Register - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss2_mux0(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - WRITE_REG(ADCx->SS2_MUX0, RegValue); -} - -/** - * @brief Get ADC_SS2_MUX0 register value. - * @param ADCx ADC Instance. - * @retval ADC_SS2_MUX0 Register - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_mux0(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS2_MUX0); -} - -/** - * @brief 4th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss2_end_ie3(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS2_END, ADC_SS2_END_IE3_MSK); -} - -/** - * @brief 4th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss2_end_ie3(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS2_END, ADC_SS2_END_IE3_MSK); -} - -/** - * @brief Check if 4th Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss2_end_ie3(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_END, ADC_SS2_END_IE3_MSK) == (ADC_SS2_END_IE3_MSK)); -} - -/** - * @brief 3rd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss2_end_ie2(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS2_END, ADC_SS2_END_IE2_MSK); -} - -/** - * @brief 3rd Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss2_end_ie2(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS2_END, ADC_SS2_END_IE2_MSK); -} - -/** - * @brief Check if 3rd Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss2_end_ie2(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_END, ADC_SS2_END_IE2_MSK) == (ADC_SS2_END_IE2_MSK)); -} - -/** - * @brief 2nd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss2_end_ie1(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS1_END, ADC_SS2_END_IE1_MSK); -} - -/** - * @brief 2nd Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss2_end_ie1(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS2_END, ADC_SS2_END_IE1_MSK); -} - -/** - * @brief Check if 2nd Sample Interrupt Enable is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss2_end_ie1(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS1_END, ADC_SS2_END_IE1_MSK) == (ADC_SS2_END_IE1_MSK)); -} - -/** - * @brief 1st Sample Interrupt Enable - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss2_end_ie0(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS2_END, ADC_SS2_END_IE0_MSK); -} - -/** - * @brief 4th Sample Interrupt Disable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss2_end_ie0(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS2_END, ADC_SS2_END_IE0_MSK); -} - -/** - * @brief Check if 1st Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss2_end_ie0(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_END, ADC_SS2_END_IE0_MSK) == (ADC_SS2_END_IE0_MSK)); -} - -/** - * @brief Set ADC SS2 END sample. - * @param ADCx ADC Instance. - * @param End Value Min_Value=0x00 Max_Value=0x03 - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss2_end_end(ADC_TypeDef *ADCx, uint32_t EndValue) -{ - MODIFY_REG(ADCx->SS2_END, ADC_SS2_END_END_MSK, EndValue<SS2_END, ADC_SS2_END_END_MSK)>>ADC_SS2_END_END_POSS); -} - -/** - * @brief Set ADC_SS2_End Control Register. - * @param ADCx ADC Instance. - * @param ADC_SS2_End Register Value. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss2_end(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - MODIFY_REG(ADCx->SS2_END, ADC_SS2_END_END_MSK, RegValue); -} - -/** - * @brief Get ADC_SS2_End Control Register. - * @param ADCx ADC Instance. - * @retval ADC_SS2_End Register Value. - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_end(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS2_END); -} - -/** - * @brief Set ADC Sample Sequencer 2(SS2) FIFO Overflow status. - * @note When the FIFO is full and a write was requested, the - * most recent write is dropped. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss2_fstat_ov(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS2_END, ADC_SS2_FSTAT_OV_MSK); -} - -/** - * @brief Get ADC Sample Sequencer 2(SS2) FIFO Overflow status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_OV_MSK)>>ADC_SS2_FSTAT_OV_POS); -} - -/** - * @brief Check if ADC Sample Sequencer 2(SS2) FIFO Overflow status is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss2_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_OV_MSK) == (ADC_SS2_FSTAT_OV_MSK)); -} - -/** - * @brief Get ADC SS2 FIFO Full status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_FULL_MSK)>>ADC_SS2_FSTAT_FULL_POS); -} - -/** - * @brief Check if ADC SS2 FIFO Full is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss2_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_FULL_MSK) == (ADC_SS2_FSTAT_FULL_MSK)); -} - -/** - * @brief Set ADC Sample Sequencer 2(SS2) FIFO Underflow status. - * @note When the FIFO is empty and a read was requested. - * The problematic read does not move the FIFO pointers, and 0s are returned. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss2_fstat_uv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS2_END, ADC_SS2_FSTAT_UV_MSK); -} - -/** - * @brief Get ADC Sample Sequencer 2(SS2) FIFO Underflow status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_UV_MSK)>>ADC_SS2_FSTAT_UV_POS); -} - -/** - * @brief Check if ADC Sample Sequencer 2(SS2) FIFO Underflow status is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss2_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_UV_MSK) == (ADC_SS2_FSTAT_UV_MSK)); -} - -/** - * @brief Get ADC SS2 FIFO Empty status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_EMPTY_MSK)>>ADC_SS2_FSTAT_EMPTY_POS); -} - -/** - * @brief Check if ADC SS2 FIFO Empty is actived. - * @param ADCx ADC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss2_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_EMPTY_MSK) == (ADC_SS2_FSTAT_EMPTY_MSK)); -} - -/** - * @brief Get ADC SS2 FIFO Head Pointer. - * @param ADCx ADC Instance. - * @retval Return value between Min_Data=0x00 and Max_Data=0x0F. - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_fstat_hptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_HPTR_MSK)>>ADC_SS2_FSTAT_HPTR_POSS); -} - -/** - * @brief Get ADC SS2 FSTAT TPTR - * @param ADCx ADC Instance - * @retval Return value between Min_Data=0x00 and Max_Data=0x0F. - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_fstat_tptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS2_FSTAT, ADC_SS2_FSTAT_TPTR_MSK)>>ADC_SS2_FSTAT_TPTR_POSS); -} - -/** - * @brief Get ADC sample sequencer 2(SS2) Conversion Result Data. - * @note User can read conversion result data by reading this register. - * @param ADCx ADC Instance. - * @retval ADC Sampled Data. - */ -__STATIC_INLINE uint32_t md_adc_get_ss2_data(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_REG(ADC->SS2_DATA)); -} - -/** - * @brief Set SS3 Trigger Select. - * @note This field selects the trigger source for Sample Sequencer 3. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_SEL_SW - * @arg @ref MD_ADC_SS_CON_SEL_BS16T1 - * @arg @ref MD_ADC_SS_CON_SEL_ALWAYS - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C4T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T2 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T3 - * @arg @ref MD_ADC_SS_CON_SEL_GP32C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GP16C2T4 - * @arg @ref MD_ADC_SS_CON_SEL_AD16C4T1 - * @arg @ref MD_ADC_SS_CON_SEL_GPIO - * @arg @ref MD_ADC_SS_CON_SEL_CMP0 - * @arg @ref MD_ADC_SS_CON_SEL_CMP1 - * @arg @ref MD_ADC_SS_CON_SEL_CMP2 - * @arg @ref MD_ADC_SS_CON_SEL_CMP3 - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss3_con_sel(ADC_TypeDef *ADCx, uint32_t TrigSource) -{ - MODIFY_REG(ADCx->SS3_CON, ADC_SS3_CON_SEL_MSK, TrigSource<SS3_CON, ADC_SS3_CON_SEL_MSK)>>ADC_SS3_CON_SEL_POSS); -} - -/** - * @brief ADC Sample Sequencer 2 (SS2) Trigger Type select. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_TYP_EDGE - * @arg @ref MD_ADC_SS_COM_TYP_LEVEL - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss3_con_type(ADC_TypeDef *ADCx, uint32_t TrigType) -{ - MODIFY_REG(ADCx->SS3_CON, ADC_SS3_CON_TYP_MSK, TrigType<SS3_CON, ADC_SS3_CON_TYP_MSK)>>ADC_SS3_CON_TYP_POS); -} - -/** - * @brief Set ADC Sample Sequencer 3(SS3) Priority. - * @note This field contains a binary-encoded value specifying the - * priority encoding of SS2. The prioriteies assigned to the - * sequencers must be uniquely mapped. - * @param ADCx ADC Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_ADC_SS_CON_PRI_HIGHEST - * @arg @ref MD_ADC_SS_CON_PRI_SECOND - * @arg @ref MD_ADC_SS_CON_PRI_THIRD - * @arg @ref MD_ADC_SS_CON_PRI_LOWEST - * @retval None - */ -__STATIC_INLINE void md_adc_set_ss3_con_pri(ADC_TypeDef *adcx, uint32_t priority) -{ - MODIFY_REG(adcx->SS3_CON, ADC_SS3_CON_PRI_MSK, priority<SS3_CON, ADC_SS3_CON_PRI_MSK)>>ADC_SS3_CON_PRI_POSS); -} - -/** - * @brief Enable ADC sample sequencer 3(SS3) one shot mode. - * @note When set HIGH, each trigger will only sample once and use one - * slot in FIFO. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss3_con_one(ADC_TypeDef *adcx) -{ - SET_BIT(adcx->SS3_CON, ADC_SS3_CON_ONE_MSK); -} - -/** - * @brief Disable ADC sample sequencer 3(SS3) one shot mode. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss3_con_one(ADC_TypeDef *adcx) -{ - CLEAR_BIT(adcx->SS3_CON, ADC_SS3_CON_ONE_MSK); -} - -/** - * @brief Enable ADC SS3 1th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_enable_ss3_end_ie0(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS3_END, ADC_SS3_END_IE0_MSK); -} - -/** - * @brief Disable ADC SS3 1th Sample Interrupt Enable. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_disable_ss3_end_ie0(ADC_TypeDef *ADCx) -{ - CLEAR_BIT(ADCx->SS3_END, ADC_SS3_END_IE0_MSK); -} - -/** - * @brief Check if ADC SS3 1th Sample Interrupt is enabled. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_enabled_ss3_end_ie0(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_END, ADC_SS3_END_IE0_MSK) == (ADC_SS3_END_IE0_MSK)); -} - -/** - * @brief Set ADC SS3 END sample. - * @param ADCx ADC Instance. - * @param End Value Min_Value=0x00 Max_Value=0x01. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss3_end_end(ADC_TypeDef *ADCx, uint32_t EndValue) -{ - MODIFY_REG(ADCx->SS3_END, ADC_SS3_END_END_MSK, EndValue<SS3_END, ADC_SS3_END_END_MSK)>>ADC_SS3_END_END_POS); -} - -/** - * @brief Set ADC_SS3_End Control Register. - * @param ADCx ADC Instance. - * @param ADC_SS3_END Register Value. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss3_end(ADC_TypeDef *ADCx, uint32_t RegValue) -{ - MODIFY_REG(ADCx->SS2_END, ADC_SS3_END_END_MSK, RegValue); -} - -/** - * @brief Get ADC_SS3_End Control Register - * @param ADCx ADC Instance. - * @retval ADC_SS3_End Register Value. - */ -__STATIC_INLINE uint32_t md_adc_get_ss3_end(ADC_TypeDef *ADCx) -{ - return READ_REG(ADCx->SS3_END); -} - -/** - * @brief Set ADC Sample Sequencer 3 (SS3) FIFO Overflow status. - * @note When the FIFO is full and a write was requested, the - * most recent write is dropped. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss3_fstat_ov(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS3_END, ADC_SS3_FSTAT_OV_MSK); -} - -/** - * @brief Get ADC Sample Sequencer 3 (SS3) FIFO Overflow status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss3_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_OV_MSK)>>ADC_SS3_FSTAT_OV_POS); -} - -/** - * @brief Check if ADC Sample Sequencer 3 (SS3) FIFO Overflow status is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss3_fstat_ov(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_OV_MSK) == (ADC_SS3_FSTAT_OV_MSK)); -} - -/** - * @brief Get ADC SS3 FIFO Full status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss3_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_FULL_MSK)>>ADC_SS3_FSTAT_FULL_POS); -} - -/** - * @brief Check if ADC SS3 FIFO Full status is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss3_fstat_full(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_FULL_MSK) == (ADC_SS3_FSTAT_FULL_MSK)); -} - -/** - * @brief Set ADC Sample Sequencer 3 (SS3) FIFO Underflow status. - * @note When the FIFO is empty and a read was requested. - * The problematic read does not move the FIFO pointers, and 0s are returned. - * @param ADCx ADC Instance. - * @retval None. - */ -__STATIC_INLINE void md_adc_set_ss3_fstat_uv(ADC_TypeDef *ADCx) -{ - SET_BIT(ADCx->SS3_END, ADC_SS3_FSTAT_UV_MSK); -} - -/** - * @brief Get ADC Sample Sequencer 3 (SS3) FIFO Underflow status. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss3_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_UV_MSK)>>ADC_SS3_FSTAT_UV_POS); -} - -/** - * @brief Check if ADC Sample Sequencer 3 (SS3) FIFO Underflow status is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss3_fstat_uv(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_UV_MSK) == (ADC_SS3_FSTAT_UV_MSK)); -} - -/** - * @brief Get ADC SS3 FIFO Empty. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_get_ss3_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_EMPTY_MSK)>>ADC_SS3_FSTAT_EMPTY_POS); -} - -/** - * @brief Check if ADC SS3 FIFO Empty is actived. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_adc_is_active_flag_ss3_fstat_empty(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_EMPTY_MSK) == (ADC_SS3_FSTAT_EMPTY_MSK)); -} - -/** - * @brief Get ADC SS3 FIFO Head Pointer. - * @param ADCx ADC Instance. - * @retval Value between Min_Data=0x00 and Max_Data=0x01. - */ -__STATIC_INLINE uint32_t md_adc_get_ss23_fstat_hptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_HPTR_MSK)>>ADC_SS3_FSTAT_HPTR_POSS); -} - -/** - * @brief Get ADC SS3 FIFO Tail Pointer. - * @param ADCx ADC Instance. - * @retval Value between Min_Data=0x00 and Max_Data=0x01. - */ -__STATIC_INLINE uint32_t md_adc_get_ss3_fstat_tptr(ADC_TypeDef *ADCx) -{ - return (READ_BIT(ADCx->SS3_FSTAT, ADC_SS3_FSTAT_TPTR_MSK)>>ADC_SS3_FSTAT_TPTR_POSS); -} - -/** - * @brief Get ADC sample sequencer 3(SS3) Conversion Result Data. - * @note User can read conversion result data by reading this register. - * @param ADCx ADC Instance. - * @retval ADC Sampled Data. - */ -__STATIC_INLINE uint32_t md_adc_get_ss3_data(ADC_TypeDef *ADCx) -{ - return (uint32_t)(READ_REG(ADC->SS3_DATA)); -} - -/** @defgroup MD_ADC_PM_WRITE_READ Common Write and read registers Macros - * @} - */ -#endif - -void md_adc_init(ADC_TypeDef *ADCx, md_adc_inittypedef *ADC_InitStruct,uint8_t *); -void md_adc_calibration_data(double, double ,double * ,double *); -void md_adc_get_data(uint8_t, double, double, uint16_t *); -/** - * @} MD_ADC_Public_Macros - */ - -/** @} ADC - */ - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_aes.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_aes.h deleted file mode 100644 index e4e16693d5..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_aes.h +++ /dev/null @@ -1,941 +0,0 @@ -/** - ****************************************************************************** - * @file md_aes.h - * @brief M601 AES Head File. - * - * @version V0.01 - * @date 28/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_AES_H__ -#define __MD_AES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (AES) - -/** @defgroup AES AES - * @brief AES micro driver - * @{ - */ - -/* Private Types --------------------------------------------------------------*/ -/* Private Variables ----------------------------------------------------------*/ -/* Private Macros -------------------------------------------------------------*/ -/* Public Types ---------------------------------------------------------------*/ -/** @defgroup MD_AES_INIT AES public init structure - * @brief - * @{ - */ -typedef struct -{ - volatile uint8_t aes_con_bl; - volatile uint8_t aes_con_mode; - volatile uint32_t aes_key[4]; - volatile uint32_t aes_iv[4]; - volatile uint32_t aes_din[4]; - volatile uint32_t aes_dout[4]; -} md_aes_init_typedef; -/** - * @} MD_AES_INIT - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_AES_Public_Constants AES Public Constants - * @brief - * @{ - */ - -/** @defgroup MD_AES_CON_registers AES Control Registers - * @brief - * @{ - */ -#define MD_AES_CON_READY_BUSY 0 /*!< This allow user to read AES Encryption/Decryption Ready Status. */ -#define MD_AES_CON_READY_READY 1 /*!< This allow user to read AES Encryption/Decryption Ready Status. */ -#define MD_AES_CON_OT_DMA_ST_PASS 1 /*!< This allow user to read AES DMA Output Status. */ -#define MD_AES_CON_OT_DMA_ST_FAIL 0 /*!< This allow user to read AES DMA Output Status. */ -#define MD_AES_CON_IT_DMA_ST_PASS 1 /*!< This allow user to read AES DMA Input Status. */ -#define MD_AES_CON_IT_DMA_ST_FAIL 0 /*!< This allow user to read AES DMA Input Status. */ -#define MD_AES_CON_OT_DEPTH_0 0 /*!< This allow user to read AES DIO data depth status (X=0). */ -#define MD_AES_CON_OT_DEPTH_1 1 /*!< This allow user to read AES DIO data depth status (X=1). */ -#define MD_AES_CON_OT_DEPTH_2 2 /*!< This allow user to read AES DIO data depth status (X=2). */ -#define MD_AES_CON_OT_DEPTH_3 3 /*!< This allow user to read AES DIO data depth status (X=3). */ -#define MD_AES_CON_IT_DEPTH_0 0 /*!< This allow user to read AES DIO data depth status (X=0). */ -#define MD_AES_CON_IT_DEPTH_1 1 /*!< This allow user to read AES DIO data depth status (X=1). */ -#define MD_AES_CON_IT_DEPTH_2 2 /*!< This allow user to read AES DIO data depth status (X=2). */ -#define MD_AES_CON_IT_DEPTH_3 3 /*!< This allow user to read AES DIO data depth status (X=3). */ -#define MD_AES_CON_RE_INIT_SET 1 /*!< This allow user to set AES Re-initial. */ -#define MD_AES_CON_RE_INIT_UNSET 0 /*!< This allow user to set AES Re-initial. */ -#define MD_AES_CON_DMA_EN_INPUT_ENABLE (1 << 0) /*!< This allow user to set AES DMA Function Enable. 0:AES input DMA disable */ -#define MD_AES_CON_DMA_EN_INPUT_DISABLE (0 << 0) /*!< This allow user to set AES DMA Function Enable. 1:AES input DMA enable */ -#define MD_AES_CON_DMA_EN_OUTPUT_ENABLE (1 << 1 /*!< This allow user to set AES DMA Function Enable. 0:AES output DMA disable */ -#define MD_AES_CON_DMA_EN_OUTPUT_DISABLE (0 << 1) /*!< This allow user to set AES DMA Function Enable. 1:AES outut DMA enable */ -#define MD_AES_CON_BL_CBC 0 /*!< This allow user to set Block Cipher Encryption / Decryption Mode. 000:CBC */ -#define MD_AES_CON_BL_CFB 1 /*!< This allow user to set Block Cipher Encryption / Decryption Mode. 001:CFB */ -#define MD_AES_CON_BL_OFB 2 /*!< This allow user to set Block Cipher Encryption / Decryption Mode. 010:OFB */ -#define MD_AES_CON_BL_CTR 3 /*!< This allow user to set Block Cipher Encryption / Decryption Mode. 011:CTR */ -#define MD_AES_CON_BL_ECB 4 /*!< This allow user to set Block Cipher Encryption / Decryption Mode. 100:ECB */ -#define MD_AES_CON_BL_GCM 5 /*!< This allow user to set Block Cipher Encryption / Decryption Mode. 101:GCM */ -#define MD_AES_CON_REV_NORMAL 0 /*!< This allow user to set AES Input Reverse. 0:Normal Mode */ -#define MD_AES_CON_REV_REVERSE 1 /*!< This allow user to set AES Input Reverse. 1:KEY, IV, DI, DO Byte Reverse Mode */ -#define MD_AES_CON_MODE_ENCRYPT 0 /*!< This allow user to set AES Mode Control. 0:Encryption Mode */ -#define MD_AES_CON_MODE_DECRYPT 1 /*!< This allow user to set AES Mode Control. 1:Decryption Mode */ -#define MD_AES_CON_START 1 /*!< This allow user to set AES Start. AES function will start after this bit is set to 1. */ -/** - * @} MD_AES_CON_registers - */ - -/** @defgroup MD_AES_IER_registers AES Interrupt Enable Registers - * @brief - * @{ - */ -#define MD_AES_IER_DECIE 1 /*!< This allow user to set AES Decryption Interrupt Enable. */ -#define MD_AES_IER_ENCIE 1 /*!< This allow user to set AES Encryption Interrupt Enable. */ -/** - * @} MD_AES_IER_registers - */ - -/** @defgroup MD_AES_IDR_registers AES Interrupt Disable Registers - * @brief - * @{ - */ -#define MD_AES_IDR_DECID 1 /*!< This allow user to set AES Decryption Interrupt Disable. */ -#define MD_AES_IDR_ENCID 1 /*!< This allow user to set AES Encryption Interrupt Disable. */ -/** - * @} MD_AES_IDR_registers - */ - -/** @defgroup MD_AES_IVS_registers AES Interrupt Valid Status Registers - * @brief - * @{ - */ -#define MD_AES_IVS_DECIVS_DISABLE 0 /*!< This allow user to set AES Decryption Interrupt Valid Status. 0:AES Decryption interrupt is disabled. */ -#define MD_AES_IVS_DECIVS_ENABLE 1 /*!< This allow user to set AES Decryption Interrupt Valid Status. 1:AES Decryption interrupt is enabled. */ -#define MD_AES_IVS_ENCIVS_DISABLE 0 /*!< This allow user to set AES Encryption Interrupt Valid Status. 0:AES Encryption interrupt is disabled. */ -#define MD_AES_IVS_ENCIVS_ENABLE 1 /*!< This allow user to set AES Encryption Interrupt Valid Status. 1:AES Encryption interrupt is enabled. */ -/** - * @} MD_AES_IVS_registers - */ - -/** @defgroup MD_AES_RIF_registers AES Raw Interrupt Flag Registers - * @brief - * @{ - */ -#define MD_AES_RIF_DECRIF_NO_INTERRUPT 0 /*!< This allow user to set AES Decryption Raw Interrupt Flag Status. 0: No interrupt. */ -#define MD_AES_RIF_DECRIF_INTERRUPT 1 /*!< This allow user to set AES Decryption Raw Interrupt Flag Status. 1: AES Decryption interrupt is asserting. */ -#define MD_AES_RIF_ENCRIF_NO_INTERRUPT 0 /*!< This allow user to set AES Encryption Raw Interrupt Flag Status. 0: No interrupt. */ -#define MD_AES_RIF_ENCRIF_INTERRUPT 1 /*!< This allow user to set AES Encryption Raw Interrupt Flag Status. 1: AES Encryption interrupt is asserting. */ -/** - * @} MD_AES_RIF_registers - */ - -/** @defgroup MD_AES_IFM_registers AES Interrupt Flag Mask Registers - * @brief - * @{ - */ -#define MD_AES_IFM_DECRIF_MASK 0 /*!< This allow user to set AES Decryption Interrupt Flag Masked Status. 0: No interrupt or the interrupt has been masked. */ -#define MD_AES_IFM_DECRIF_SIGNAL 1 /*!< This allow user to set AES Decryption Interrupt Flag Masked Status. 1: AES Decryption interrupt has been signalled. */ -#define MD_AES_IFM_ENCRIF_MASK 0 /*!< This allow user to set AES Encryption Interrupt Flag Masked Status. 0: No interrupt or the interrupt has been masked. */ -#define MD_AES_IFM_ENCRIF_SIGNAL 1 /*!< This allow user to set AES Encryption Interrupt Flag Masked Status. 1: AES Encryption interrupt has been signalled. */ -/** - * @} MD_AES_IFM_registers - */ - -/** @defgroup MD_AES_ICR_registers AES Interrupt Clear Registers - * @brief - * @{ - */ -#define MD_AES_ICR_DECICR 1 /*!< This allow user to set AES Decryption Interrupt Clear. User can set this bit to clear AES Decryption interrupt status. */ -#define MD_AES_ICR_ENCICR 1 /*!< This allow user to set AES Decryption Interrupt Clear. User can set this bit to clear AES Encryption interrupt status. */ -/** - * @} MD_AES_ICR_registers - */ - -/** - * @} MD_AES_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_AES_Public_Macros AES Public Macros - * @brief - * @{ - */ - -/** - * @brief AES Control Register - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_READY_BUSY 0 - * @arg @ref MD_AES_CON_READY_READY 1 - * @arg @ref MD_AES_CON_OT_DMA_ST_PASS 1 - * @arg @ref MD_AES_CON_OT_DMA_ST_FAIL 0 - * @arg @ref MD_AES_CON_IT_DMA_ST_PASS 1 - * @arg @ref MD_AES_CON_IT_DMA_ST_FAIL 0 - * @arg @ref MD_AES_CON_OT_DEPTH_0 0 - * @arg @ref MD_AES_CON_OT_DEPTH_1 1 - * @arg @ref MD_AES_CON_OT_DEPTH_2 2 - * @arg @ref MD_AES_CON_OT_DEPTH_3 3 - * @arg @ref MD_AES_CON_IT_DEPTH_0 0 - * @arg @ref MD_AES_CON_IT_DEPTH_1 1 - * @arg @ref MD_AES_CON_IT_DEPTH_2 2 - * @arg @ref MD_AES_CON_IT_DEPTH_3 3 - * @arg @ref MD_AES_CON_RE_INIT_SET 1 - * @arg @ref MD_AES_CON_RE_INIT_UNSET 0 - * @arg @ref MD_AES_CON_DMA_EN_INPUT_ENABLE (1 << 0) - * @arg @ref MD_AES_CON_DMA_EN_INPUT_DISABLE (0 << 0) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_ENABLE (1 << 1) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_DISABLE (0 << 1) - * @arg @ref MD_AES_CON_BL_CBC 0 - * @arg @ref MD_AES_CON_BL_CFB 1 - * @arg @ref MD_AES_CON_BL_OFB 2 - * @arg @ref MD_AES_CON_BL_CTR 3 - * @arg @ref MD_AES_CON_BL_ECB 4 - * @arg @ref MD_AES_CON_BL_GCM 5 - * @arg @ref MD_AES_CON_REV_NORMAL 0 - * @arg @ref MD_AES_CON_REV_REVERSE 1 - * @arg @ref MD_AES_CON_MODE_ENCRYPT 0 - * @arg @ref MD_AES_CON_MODE_DECRYPT 1 - * @arg @ref MD_AES_CON_START 1 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_con(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->CON, value); -} - -/** - * @brief AES Control Register - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_READY_BUSY 0 - * @arg @ref MD_AES_CON_READY_READY 1 - * @arg @ref MD_AES_CON_OT_DMA_ST_PASS 1 - * @arg @ref MD_AES_CON_OT_DMA_ST_FAIL 0 - * @arg @ref MD_AES_CON_IT_DMA_ST_PASS 1 - * @arg @ref MD_AES_CON_IT_DMA_ST_FAIL 0 - * @arg @ref MD_AES_CON_OT_DEPTH_0 0 - * @arg @ref MD_AES_CON_OT_DEPTH_1 1 - * @arg @ref MD_AES_CON_OT_DEPTH_2 2 - * @arg @ref MD_AES_CON_OT_DEPTH_3 3 - * @arg @ref MD_AES_CON_IT_DEPTH_0 0 - * @arg @ref MD_AES_CON_IT_DEPTH_1 1 - * @arg @ref MD_AES_CON_IT_DEPTH_2 2 - * @arg @ref MD_AES_CON_IT_DEPTH_3 3 - * @arg @ref MD_AES_CON_RE_INIT_SET 1 - * @arg @ref MD_AES_CON_RE_INIT_UNSET 0 - * @arg @ref MD_AES_CON_DMA_EN_INPUT_ENABLE (1 << 0) - * @arg @ref MD_AES_CON_DMA_EN_INPUT_DISABLE (0 << 0) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_ENABLE (1 << 1) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_DISABLE (0 << 1) - * @arg @ref MD_AES_CON_BL_CBC 0 - * @arg @ref MD_AES_CON_BL_CFB 1 - * @arg @ref MD_AES_CON_BL_OFB 2 - * @arg @ref MD_AES_CON_BL_CTR 3 - * @arg @ref MD_AES_CON_BL_ECB 4 - * @arg @ref MD_AES_CON_BL_GCM 5 - * @arg @ref MD_AES_CON_REV_NORMAL 0 - * @arg @ref MD_AES_CON_REV_REVERSE 1 - * @arg @ref MD_AES_CON_MODE_ENCRYPT 0 - * @arg @ref MD_AES_CON_MODE_DECRYPT 1 - * @arg @ref MD_AES_CON_START 1 - */ -__STATIC_INLINE uint32_t md_aes_get_con(AES_TypeDef *aes) -{ - return (READ_REG(aes->CON)); -} - -/** - * @brief AES Encryption / Decryption Ready Status - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_READY_BUSY 0 - * @arg @ref MD_AES_CON_READY_READY 1 - */ -__STATIC_INLINE uint32_t md_aes_get_con_ready(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_READY_MSK) >> AES_CON_READY_POS) & 0x1); -} - -/** - * @brief AES DMA Output Status - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_OT_DMA_ST_PASS 0 - * @arg @ref MD_AES_CON_OT_DMA_ST_FAIL 1 - */ -__STATIC_INLINE uint32_t md_aes_get_con_ot_dma_st(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_OT_DMA_ST_MSK) >> AES_CON_OT_DMA_ST_POS) & 0x1); -} - -/** - * @brief AES DMA Intput Status - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_IT_DMA_ST_PASS 0 - * @arg @ref MD_AES_CON_IT_DMA_ST_FAIL 1 - */ -__STATIC_INLINE uint32_t md_aes_get_con_it_dma_st(AES_TypeDef *aes, uint32_t value) -{ - return ((READ_BIT(aes->CON, AES_CON_IT_DMA_ST_MSK) >> AES_CON_IT_DMA_ST_POS) & 0x1); -} - -/** - * @brief AES DIO data depth status (X=0,1,2,3) - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_OT_DEPTH_0 0 - * @arg @ref MD_AES_CON_OT_DEPTH_1 1 - * @arg @ref MD_AES_CON_OT_DEPTH_2 2 - * @arg @ref MD_AES_CON_OT_DEPTH_3 3 - */ -__STATIC_INLINE uint32_t md_aes_get_con_ot_depth(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_OT_DEPTH_MSK) >> AES_CON_OT_DEPTH_POSS) & 0x3); -} - -/** - * @brief AES DIO data depth status (X=0,1,2,3) - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_IT_DEPTH_0 0 - * @arg @ref MD_AES_CON_IT_DEPTH_1 1 - * @arg @ref MD_AES_CON_IT_DEPTH_2 2 - * @arg @ref MD_AES_CON_IT_DEPTH_3 3 - */ -__STATIC_INLINE uint32_t md_aes_get_con_it_depth(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_IT_DEPTH_MSK) >> AES_CON_IT_DEPTH_POSS) & 0x3); -} - -/** - * @brief AES Re-initial - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_RE_INIT_SET 1 - * @arg @ref MD_AES_CON_RE_INIT_UNSET 0 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_con_re_init(AES_TypeDef *aes, uint32_t value) -{ - MODIFY_REG(aes->CON, AES_CON_RE_INIT_MSK, (value << AES_CON_RE_INIT_POS)); -} - -/** - * @brief AES Re-initial - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_RE_INIT_SET 1 - * @arg @ref MD_AES_CON_RE_INIT_UNSET 0 - */ -__STATIC_INLINE uint32_t md_aes_get_con_re_init(AES_TypeDef *aes) -{ - - return ((READ_BIT(aes->CON, AES_CON_RE_INIT_MSK) >> AES_CON_RE_INIT_POS) & 0x1); -} - -/** - * @brief AES DMA Function Enable - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_DMA_EN_INPUT_ENABLE (1 << 0) - * @arg @ref MD_AES_CON_DMA_EN_INPUT_DISABLE (0 << 0) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_ENABLE (1 << 1) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_DISABLE (0 << 1) - * @retval None. - */ -__STATIC_INLINE void md_aes_set_con_dma_en(AES_TypeDef *aes, uint32_t value) -{ - MODIFY_REG(aes->CON, AES_CON_DMA_EN_MSK, (value << AES_CON_DMA_EN_POSS)); -} - -/** - * @brief AES DMA Function Enable - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_DMA_EN_INPUT_ENABLE (1 << 0) - * @arg @ref MD_AES_CON_DMA_EN_INPUT_DISABLE (0 << 0) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_ENABLE (1 << 1) - * @arg @ref MD_AES_CON_DMA_EN_OUTPUT_DISABLE (0 << 1) - */ -__STATIC_INLINE uint32_t md_aes_get_con_dma_en(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_DMA_EN_MSK) >> AES_CON_DMA_EN_POSS) & 0x3); -} - -/** - * @brief Block Cipher Encryption / Decryption Mode - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_BL_CBC 0 - * @arg @ref MD_AES_CON_BL_CFB 1 - * @arg @ref MD_AES_CON_BL_OFB 2 - * @arg @ref MD_AES_CON_BL_CTR 3 - * @arg @ref MD_AES_CON_BL_ECB 4 - * @arg @ref MD_AES_CON_BL_GCM 5 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_con_bl(AES_TypeDef *aes, uint32_t value) -{ - MODIFY_REG(aes->CON, AES_CON_BL_MSK, (value << AES_CON_BL_POSS)); -} - -/** - * @brief Block Cipher Encryption / Decryption Mode - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_BL_CBC 0 - * @arg @ref MD_AES_CON_BL_CFB 1 - * @arg @ref MD_AES_CON_BL_OFB 2 - * @arg @ref MD_AES_CON_BL_CTR 3 - * @arg @ref MD_AES_CON_BL_ECB 4 - * @arg @ref MD_AES_CON_BL_GCM 5 - */ -__STATIC_INLINE uint32_t md_aes_get_con_bl(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_BL_MSK) >> AES_CON_BL_POSS) & 0x7); -} - -/** - * @brief AES Input Reverse - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_REV_NORMAL 0 - * @arg @ref MD_AES_CON_REV_REVERSE 1 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_con_rev(AES_TypeDef *aes, uint32_t value) -{ - MODIFY_REG(aes->CON, AES_CON_REV_MSK, (value << AES_CON_REV_POS)); -} - -/** - * @brief AES Input Reverse - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_REV_NORMAL 0 - * @arg @ref MD_AES_CON_REV_REVERSE 1 - */ -__STATIC_INLINE uint32_t md_aes_get_con_rev(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_REV_MSK) >> AES_CON_REV_POS) & 0x1); -} - -/** - * @brief AES Mode Control - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_MODE_ENCRYPT 0 - * @arg @ref MD_AES_CON_MODE_DECRYPT 1 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_con_mode(AES_TypeDef *aes, uint32_t value) -{ - MODIFY_REG(aes->CON, AES_CON_MODE_MSK, (value << AES_CON_MODE_POS)); -} - -/** - * @brief AES Mode Control - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_MODE_ENCRYPT 0 - * @arg @ref MD_AES_CON_MODE_DECRYPT 1 - */ -__STATIC_INLINE uint32_t md_aes_get_con_mode(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_MODE_MSK) >> AES_CON_MODE_POS) & 0x1); -} - -/** - * @brief AES Start - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_START 1 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_con_start(AES_TypeDef *aes, uint32_t value) -{ - MODIFY_REG(aes->CON, AES_CON_START_MSK, (value << AES_CON_START_POS)); -} - -/** - * @brief AES Start - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_CON_START 1 - */ -__STATIC_INLINE uint32_t md_aes_get_con_start(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->CON, AES_CON_START_MSK) >> AES_CON_START_POS) & 0x1); -} - -/** - * @brief AES Interrupt Enable Register - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_IER_DECIE 1 - * @arg @ref MD_AES_IER_ENCIE 1 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_ier(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->IER, value); -} - -/** - * @brief AES Decryption Interrupt Enable - * @param AES Instance - * @retval None. - */ -__STATIC_INLINE void md_aes_enable_ier_decie(AES_TypeDef *aes) -{ - MODIFY_REG(aes->IER, AES_IER_DECIE_MSK, (1 << AES_IER_DECIE_POS)); -} - -/** - * @brief AES Encryption Interrupt Enable - * @param AES Instance - * @retval None. - */ -__STATIC_INLINE void md_aes_enable_ier_encie(AES_TypeDef *aes) -{ - MODIFY_REG(aes->IER, AES_IER_ENCIE_MSK, (1 << AES_IER_ENCIE_POS)); -} - -/** - * @brief AES Interrupt Disable Register - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_AES_IDR_DECID 1 - * @arg @ref MD_AES_IDR_ENCID 1 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_idr(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->IDR, value); -} - -/** - * @brief AES Decryption Interrupt Disable - * @param AES Instance - * @retval None. - */ -__STATIC_INLINE void md_aes_disable_idr_decid(AES_TypeDef *aes) -{ - MODIFY_REG(aes->IDR, AES_IDR_DECID_MSK, (1 << AES_IDR_DECID_POS)); -} - -/** - * @brief AES Encryption Interrupt Disable - * @param AES Instance - * @retval None. - */ -__STATIC_INLINE void md_aes_disable_idr_encid(AES_TypeDef *aes) -{ - MODIFY_REG(aes->IDR, AES_IDR_DECID_MSK, (1 << AES_IDR_DECID_POS)); -} - -/** - * @brief AES Interrupt Valid Status Register - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @ref MD_AES_IVS_DECIVS_DISABLE 0 - * @arg @ref MD_AES_IVS_DECIVS_ENABLE 1 - * @arg @ref MD_AES_IVS_ENCIVS_DISABLE 0 - * @arg @ref MD_AES_IVS_ENCIVS_ENABLE 1 - */ -__STATIC_INLINE uint32_t md_aes_get_ivs(AES_TypeDef *aes) -{ - return (READ_REG(aes->IVS)); -} - -/** - * @brief AES Decryption Interrupt Valid Status - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg value true, false - */ -__STATIC_INLINE bool md_aes_is_enabled_ivs_decivs(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->IVS, AES_IVS_DECIVS_MSK) >> AES_IVS_DECIVS_POS) & 0x1) ? true : false; -} - -/** - * @brief AES Encryption Interrupt Valid Status - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg value true, false - */ -__STATIC_INLINE bool md_aes_is_enabled_ivs_encivs(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->IVS, AES_IVS_ENCIVS_MSK) >> AES_IVS_ENCIVS_POS) & 0x1) ? true : false; -} - -/** - * @brief AES Raw Interrupt Flag Status - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @reg MD_AES_RIF_DECRIF_NO_INTERRUPT 0 - * @arg @reg MD_AES_RIF_DECRIF_INTERRUPT 1 - */ -__STATIC_INLINE uint32_t md_aes_get_rif(AES_TypeDef *aes) -{ - return (READ_REG(aes->RIF)); -} - -/** - * @brief AES Encryption Raw Interrupt Flag Status - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg value true, false - */ -__STATIC_INLINE bool md_aes_is_active_rif_decrif(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->RIF, AES_RIF_DECRIF_MSK) >> AES_RIF_DECRIF_POS) & 0x1) ? true : false; -} - -/** - * @brief AES Encryption Raw Interrupt Flag Status - * @param Mode This parameter can be one of the following values: - * @arg value true, false - * @retval None. - */ -__STATIC_INLINE bool md_aes_is_active_rif_encrif(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->RIF, AES_RIF_ENCRIF_MSK) >> AES_RIF_ENCRIF_POS) & 0x1) ? true : false; -} - -/** - * @brief AES Interrupt Flag Mask Status Register - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg @reg MD_AES_IFM_DECRIF_MASK 0 - * @arg @reg MD_AES_IFM_DECRIF_SIGNAL 1 - * @arg @reg MD_AES_IFM_ENCRIF_MASK 0 - * @arg @reg MD_AES_IFM_ENCRIF_SIGNAL 1 - */ -__STATIC_INLINE uint32_t md_aes_get_ifm(AES_TypeDef *aes) -{ - return (READ_REG(aes->IFM)); -} - -/** - * @brief AES Interrupt Flag Mask Status Register - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg value true, false - */ -__STATIC_INLINE bool md_aes_is_active_ifm_decifm(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->IFM, AES_IFM_DECIFM_MSK) >> AES_IFM_DECIFM_POS) & 0x1) ? true : false; -} - -/** - * @brief AES Interrupt Flag Mask Status Register - * @param AES Instance - * @retval value This parameter can be one of the following values: - * @arg value true, false - */ -__STATIC_INLINE bool md_aes_is_active_ifm_encifm(AES_TypeDef *aes) -{ - return ((READ_BIT(aes->IFM, AES_IFM_ENCIFM_MSK) >> AES_IFM_ENCIFM_POS) & 0x1) ? true : false; -} - -/** - * @brief AES Interrupt Clear Register - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg @reg MD_AES_ICR_DECICR 1 - * @arg @reg MD_AES_ICR_ENCICR 1 - * @retval None. - */ -__STATIC_INLINE void md_aes_set_icr(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->ICR, value); -} - -/** - * @brief AES Decryption Interrupt Clear - * @param AES Instance - * @retval None. - */ -__STATIC_INLINE void md_aes_clear_icr_decicr(AES_TypeDef *aes) -{ - MODIFY_REG(aes->ICR, AES_ICR_DECICR_MSK, (1 << AES_ICR_DECICR_POS)); -} - -/** - * @brief AES Encryption Interrupt Clear - * @param AES Instance - * @retval None. - */ -__STATIC_INLINE void md_aes_clear_icr_encicr(AES_TypeDef *aes) -{ - MODIFY_REG(aes->ICR, AES_ICR_ENCICR_MSK, (1 << AES_ICR_ENCICR_POS)); -} - -/** - * @brief AES 128-bit Input / Ouput Data Register - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_dio(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->DIO, value); -} - -/** - * @brief AES 128-bit Input / Ouput Data Register - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -//#pragma push -//#pragma O0 -__STATIC_INLINE uint32_t md_aes_get_dio(AES_TypeDef *aes) -{ - return (READ_REG(aes->DIO)); -} -//#pragma pop - -/** - * @brief AES 128-bit Keyword Register 0 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_key0(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->KEY0, value); -} - -/** - * @brief AES 128-bit Keyword Register 0 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_key0(AES_TypeDef *aes) -{ - return (READ_REG(aes->KEY0)); -} - -/** - * @brief AES 128-bit Keyword Register 1 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_key1(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->KEY1, value); -} - -/** - * @brief AES 128-bit Keyword Register 1 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_key1(AES_TypeDef *aes) -{ - return (READ_REG(aes->KEY1)); -} - -/** - * @brief AES 128-bit Keyword Register 2 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_key2(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->KEY2, value); -} - -/** - * @brief AES 128-bit Keyword Register 2 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_key2(AES_TypeDef *aes) -{ - return (READ_REG(aes->KEY2)); -} - -/** - * @brief AES 128-bit Keyword Register 3 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_key3(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->KEY3, value); -} - -/** - * @brief AES 128-bit Keyword Register 3 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_key3(AES_TypeDef *aes) -{ - return (READ_REG(aes->KEY3)); -} - -/** - * @brief AES 128-bit Initial Vector Register 0 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_iv0(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->IV0, value); -} - -/** - * @brief AES 128-bit Initial Vector Register 0 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_iv0(AES_TypeDef *aes) -{ - return (READ_REG(aes->IV0)); -} - -/** - * @brief AES 128-bit Initial Vector Register 1 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_iv1(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->IV1, value); -} - -/** - * @brief AES 128-bit Initial Vector Register 1 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_iv1(AES_TypeDef *aes) -{ - return (READ_REG(aes->IV1)); -} - -/** - * @brief AES 128-bit Initial Vector Register 2 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_iv2(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->IV2, value); -} - -/** - * @brief AES 128-bit Initial Vector Register 2 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_iv2(AES_TypeDef *aes) -{ - return (READ_REG(aes->IV2)); -} - -/** - * @brief AES 128-bit Initial Vector Register 3 - * @param AES Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_aes_set_iv3(AES_TypeDef *aes, uint32_t value) -{ - WRITE_REG(aes->IV3, value); -} - -/** - * @brief AES 128-bit Initial Vector Register 3 - * @param AES Instance - * @retval value - * @arg Minimum 0x0000000 - * @arg Maximum 0xFFFFFFF - */ -__STATIC_INLINE uint32_t md_aes_get_iv3(AES_TypeDef *aes) -{ - return (READ_REG(aes->IV3)); -} - -/** - * @} MD_AES_Public_Macros - */ - -/** - * @} AES - */ - -#endif - -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_cmp.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_cmp.h deleted file mode 100644 index b2b6d2b2e0..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_cmp.h +++ /dev/null @@ -1,573 +0,0 @@ -/** - ****************************************************************************** - * @file md_CMP.h - * @brief ES32F0271 CMP Head File. - * - * @version V1.00.01 - * @date 11/23/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - - /* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_CMP_H__ -#define __MD_CMP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_cmp.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (CMP) -/** @defgroup CMP CMP - * @brief CMP micro driver - * @{ - */ - - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/* Public types ---------------------------------------------------------------*/ -/* Public constants -----------------------------------------------------------*/ - -/** @defgroup MD_CMP_Public_Constants CMP Public Constants - * @{ - */ - -/** @defgroup MD_CMP_PC_CARS CMP Reference voltage - * @{ - */ -#define MD_CMP_CARS_1_25V (0x00000000UL) /*!< @brief Select CARS for 0.25*5V */ -#define MD_CMP_CARS_2_50V (0x00000001UL) /*!< @brief Select CARS for 0.5*5V */ -#define MD_CMP_CARS_3_75V (0x00000002UL) /*!< @brief Select CARS for 0.75*5V */ -#define MD_CMP_CARS_5_00V (0x00000003UL) /*!< @brief Select CARS for 5V */ - -/** - * @} MD_CMP_PC_CARS - */ - - -/** - * @} MD_CMP_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_CMP_Public_Macros CMP Public Macros - * @{ - */ - -/** @defgroup MD_CMP_PF_CON CMP Control Register - * @{ - */ -/** - * @brief Set CMP control register (CMP_CON) - * @param cmp CMP Instance - * @param value The value write in CMP_CON - * @retval None - */ -__STATIC_INLINE void md_cmp_set_con(CMP_TypeDef *cmp, uint32_t value) -{ - WRITE_REG(cmp->CON, value); -} - -/** - * @brief Get CMP control register (CMP_CON) - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_get_con(CMP_TypeDef *cmp) -{ - return (uint32_t)(READ_REG(cmp->CON)); -} - -/** - * @brief Enable Comparator 1 enable set - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_con_cmpon1(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CON, CMP_CON_CMPON1_MSK); -} -/** - * @brief Disable Comparator 1 enable set - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_con_cmpon1(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CON, CMP_CON_CMPON1_MSK); -} - -/** - * @brief Check if Comparator 1 enable set is enable - * @param cmp CMP Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_con_cmpon1(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CON, CMP_CON_CMPON1_MSK)); -} - -/** - * @brief Enable Comparator 2 enable set - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_con_cmpon2(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CON, CMP_CON_CMPON2_MSK); -} -/** - * @brief Disable Comparator 2 enable set - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_con_cmpon2(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CON, CMP_CON_CMPON2_MSK); -} - -/** - * @brief Check if Comparator 2 enable set is enable - * @param cmp CMP Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_con_caon2(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CON, CMP_CON_CMPON2_MSK)); -} - -/** - * @} MD_CMP_PF_CON - */ - - -/** @defgroup MD_CMP_PF_Configuration CMP Configuration Manangement - * @{ - */ - - -/** - * @brief Set CMP control register 1(CMP_CFG1) - * @param cmp CMP Instance - * @param value The value write in CMP_CFG1 - * @retval None - */ -__STATIC_INLINE void md_cmp_set_cfg1(CMP_TypeDef *cmp, uint32_t value) -{ - WRITE_REG(cmp->CFG1, value); -} -/** - * @brief Get CMP control register 1(CMP_CFG1) - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_get_cfg1(CMP_TypeDef *cmp) -{ - return (uint32_t)(READ_REG(cmp->CFG1)); -} - - -/** - * @brief Set Comparator 1 reference voltage selection. - * @param cmp CMP Instance - * @param RefVol This parameter can be one of the following values: - * @arg MD_CMP_CARS_1_25V - * @arg MD_CMP_CARS_2_50V - * @arg MD_CMP_CARS_3_75V - * @arg MD_CMP_CARS_5_00V - * @retval None - */ -__STATIC_INLINE void md_cmp_set_cfg1_rs(CMP_TypeDef *cmp, uint32_t RefVol) -{ - MODIFY_REG(cmp->CFG1, CMP_CFG1_RS_MSK, RefVol<CFG1, CMP_CFG1_RS_MSK) >> CMP_CFG1_RS_POSS); -} - - -/** - * @brief Enable Comparator 1 Filter circuit - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg1_fen(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG1, CMP_CFG1_FEN_MSK); -} -/** - * @brief Disable Comparator 1 Filter circuit - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg1_fen(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG1, CMP_CFG1_FEN_MSK); -} - -/** - * @brief Check if Comparator 1 Filter circuit is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg1_fen(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG1, CMP_CFG1_FEN_MSK) == (CMP_CFG1_FEN_MSK)); -} - - -/** - * @brief Enable comparator 1 reverse circuit enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg1_psen(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG1, CMP_CFG1_PSEN_MSK); -} -/** - * @brief Disable comparator 1 reverse circuit enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg1_psen(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG1, CMP_CFG1_PSEN_MSK); -} - -/** - * @brief Check if comparator 1 reverse circuit enable is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg1_capsen(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG1, CMP_CFG1_PSEN_MSK) == (CMP_CFG1_PSEN_MSK) ); -} - - -/** - * @brief Enable Comparator 1 Negative input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg1_insel(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG1, CMP_CFG1_INSEL_MSK); -} -/** - * @brief Disable Comparator 1 Negative input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg1_insel(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG1, CMP_CFG1_INSEL_MSK); -} - -/** - * @brief Check if comparator 1 Negative input select is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg1_insel(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG1, CMP_CFG1_INSEL_MSK) == (CMP_CFG1_INSEL_MSK)); -} - - -/** - * @brief Enable comparator 1 Positive input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg1_ipsel(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG1, CMP_CFG1_IPSEL_MSK); -} -/** - * @brief Disable comparator 1 Positive input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg1_ipsel(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG1, CMP_CFG1_IPSEL_MSK); -} - -/** - * @brief Check if comparator 1 Positive input select is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg1_ipsel(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG1, CMP_CFG1_IPSEL_MSK) == (CMP_CFG1_IPSEL_MSK)); -} - - -/** - * @brief Set CMP control register 2(CMP_CFG2) - * @param cmp CMP Instance - * @param value The value write in CMP_CFG2 - * @retval None - */ -__STATIC_INLINE void md_cmp_set_cfg2(CMP_TypeDef *cmp, uint32_t value) -{ - WRITE_REG(cmp->CFG2, value); -} -/** - * @brief Get CMP control register 2(CMP_CFG2) - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_get_cfg2(CMP_TypeDef *cmp) -{ - return (uint32_t)(READ_REG(cmp->CFG2)); -} - - -/** - * @brief Set Comparator 2 reference voltage selection. - * @param cmp CMP Instance - * @param RefVol This parameter can be one of the following values: - * @arg MD_CMP_CARS_1_25V - * @arg MD_CMP_CARS_2_50V - * @arg MD_CMP_CARS_3_75V - * @arg MD_CMP_CARS_5_00V - * @retval None - */ -__STATIC_INLINE void md_cmp_set_cfg2_rs(CMP_TypeDef *cmp, uint32_t RefVol) -{ - MODIFY_REG(cmp->CFG2, CMP_CFG2_RS_MSK, RefVol << CMP_CFG2_RS_POSS); -} - -/** - * @brief Return Comparator 2 reference voltage - * @param cmp CMP Instance - * @retval None - * @arg MD_CMP_CARS_1_25V - * @arg MD_CMP_CARS_2_50V - * @arg MD_CMP_CARS_3_75V - * @arg MD_CMP_CARS_5_00V - */ -__STATIC_INLINE uint32_t md_cmp_get_cfg2_rs(CMP_TypeDef *cmp) -{ - return (uint32_t)(READ_BIT(cmp->CFG2, CMP_CFG2_RS_MSK) >> CMP_CFG2_RS_POSS); -} - - -/** - * @brief Enable Comparator 2 Filter circuit - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg2_fen(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG2, CMP_CFG2_FEN_MSK); -} -/** - * @brief Disable Comparator 2 Filter circuit - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg2_fen(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG2, CMP_CFG2_FEN_MSK); -} - -/** - * @brief Check if Comparator 2 Filter circuit is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg2_fen(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG2, CMP_CFG2_FEN_MSK) == (CMP_CFG2_FEN_MSK)) ; -} - - -/** - * @brief Enable comparator 2 reverse circuit enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg2_psen(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG2, CMP_CFG2_PSEN_MSK); -} -/** - * @brief Disable comparator 2 reverse circuit enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg2_psen(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG2, CMP_CFG2_PSEN_MSK); -} - -/** - * @brief Check if comparator 2 reverse circuit enable is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg2_psen(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG2, CMP_CFG2_PSEN_MSK) == (CMP_CFG2_PSEN_MSK)); -} - - -/** - * @brief Enable Comparator 2 Negative input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg2_insel(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG2, CMP_CFG2_INSEL_MSK); -} -/** - * @brief Disable Comparator 2 Negative input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg2_insel(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG2, CMP_CFG2_INSEL_MSK); -} - -/** - * @brief Check if comparator 2 Negative input select is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg2_insel(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG2, CMP_CFG2_INSEL_MSK) == (CMP_CFG2_INSEL_MSK)); -} - - -/** - * @brief Enable comparator 2 Positive input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_enable_cfg2_ipsel(CMP_TypeDef *cmp) -{ - SET_BIT(cmp->CFG2, CMP_CFG2_IPSEL_MSK); -} -/** - * @brief Disable comparator 2 Positive input select - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE void md_cmp_disable_cfg2_ipsel(CMP_TypeDef *cmp) -{ - CLEAR_BIT(cmp->CFG2, CMP_CFG2_IPSEL_MSK); -} - -/** - * @brief Check if comparator 2 Positive input select is enable - * @param cmp CMP Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_cmp_is_enable_cfg2_ipsel(CMP_TypeDef *cmp) -{ - return (READ_BIT(cmp->CFG2, CMP_CFG2_IPSEL_MSK) == (CMP_CFG2_IPSEL_MSK)); -} - - -/** - * @} MD_CMP_PF_Configuration - */ - -/** @defgroup MD_CMP_PC_RULT CMP Comparator Output Register. - * @{ - */ - -/** - * @brief Return Comparator output result(CMP_RULT) - * @param cmp CMP Instance - * @retval The state of 1 or 0 - */ -__STATIC_INLINE uint32_t md_cmp_get_rult(CMP_TypeDef *cmp) -{ - return (uint32_t)(READ_REG(cmp->RULT)); -} - -/** - * @brief Return Comparator 1 output result - * @param cmp CMP Instance - * @retval The state of 1 or 0 - */ -__STATIC_INLINE uint32_t md_cmp_get_rult_cmpo1(CMP_TypeDef *cmp) -{ - return (uint32_t)(READ_BIT(cmp->RULT, CMP_RULT_CMPO1_MSK)); -} -/** - * @brief Return Comparator 2 output result - * @param cmp CMP Instance - * @retval The state of 1 or 0 - */ -__STATIC_INLINE uint32_t md_cmp_get_rult_cmpo2(CMP_TypeDef *cmp) -{ - return (uint32_t)(READ_BIT(cmp->RULT, CMP_RULT_CMPO2_MSK)); -} - - -/** - * @} MD_CMP_PC_RULT - */ - - -/** - * @} MD_CMP_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ - -/** - * @} CMP - */ - -#endif - - -/** - * @} Micro_Driver - */ - -#endif - -#ifdef __cplusplus -} -#endif - - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_crc.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_crc.h deleted file mode 100644 index f1b65692e7..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_crc.h +++ /dev/null @@ -1,519 +0,0 @@ -/** - ****************************************************************************** - * @file md_crc.h - * @brief M601 CRC Head File. - * - * @version V0.01 - * @date 28/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_CRC_H__ -#define __MD_CRC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (CRC) - -/** @defgroup CRC CRC - * @brief CRC module driver - * @{ - */ - -/* Private Types --------------------------------------------------------------*/ -/* Private Variables ----------------------------------------------------------*/ -/* Private Macros -------------------------------------------------------------*/ -/* Public Types ---------------------------------------------------------------*/ -/** @defgroup MD_CRC_INIT CRC public init structure - * @brief - * @{ - */ -typedef struct -{ - uint32_t xorout; - uint32_t refout; - uint32_t refin; - uint32_t byte; - uint32_t mode; - uint32_t req; - uint32_t ds; - uint32_t rst; -} md_crc_init_typedef; -/** - * @} MD_CRC_INIT - */ - -/* Public Constants -----------------------------------------------------------*/ -/** @defgroup MD_CRC_Public_Constants CRC Public Constants - * @brief - * @{ - */ - -/** @defgroup MD_CRC_CON_registers CRC Control Registers - * @brief - * @{ - */ -#define MD_CRC_CON_DMA_ON 1 /*!< This allow user to enable DMA function. */ -#define MD_CRC_CON_DMA_OFF 0 /*!< This allow user to disable DMA function. */ -#define MD_CRC_CON_MSB_ON 1 /*!< User can set this bit to change the 'byte' order of input data. */ -#define MD_CRC_CON_MSB_OFF 1 /*!< User can set this bit to change the 'byte' order of input data. */ -#define MD_CRC_CON_REOUT 0 /*!< This allow user to reverse the order of CRC output data. */ -#define MD_CRC_CON_REOUT_REV 1 /*!< This allow user to reverse the order of CRC output data. */ -#define MD_CRC_CON_REIN 0 /*!< This allow user to reverse the order of CRC input data. */ -#define MD_CRC_CON_REIN_REV 1 /*!< This allow user to reverse the order of CRC input data. */ -#define MD_CRC_CON_SIZE_POLY32 0 /*!< This allow user to select polynomial size. */ -#define MD_CRC_CON_SIZE_POLY16 1 /*!< This allow user to select polynomial size. */ -#define MD_CRC_CON_SIZE_POLY8 2 /*!< This allow user to select polynomial size. */ -#define MD_CRC_CON_MODE_COMP_DISABLE 0 /*!< This allow user to check CRC result. */ -#define MD_CRC_CON_MODE_COMP_ZERO 1 /*!< This allow user to check CRC result. */ -#define MD_CRC_CON_MODE_COMP_ENABLE 2 /*!< This allow user to check CRC result. */ -#define MD_CRC_CON_RESET 1 /*!< User can set this bit to reset CRC function. */ -/** - * @} MD_CRC_CON_registers - */ - -/** @defgroup MD_CRC_STAT_registers CRC Status Registers - * @brief - * @{ - */ -#define MD_CRC_STAT_FAIL 1 /*!< This bit is set when CRC result is not correct. */ -#define MD_CRC_STAT_EMPTY 1 /*!< This bit is cleaned after an CRC calculation. */ -#define MD_CRC_STAT_BUSY 1 /*!< This bit is set when CRC module is calculating result. */ -#define MD_CRC_STAT_DONE 1 /*!< This bit is set when CRC calculation is finish. */ -/** - * @} MD_CRC_STAT_registers - */ - -/** - * @} MD_CRC_Public_Constants - */ - -/* Public Macros --------------------------------------------------------------*/ -/** @defgroup MD_CRC_Public_Macros CRC Public Macros - * @brief - * @{ - */ - -/** - * @brief This register is used to write the CRC initial data. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x00000000 - * @arg Maximum 0xFFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_crc_set_init(CRC_TypeDef *crc, uint32_t value) -{ - WRITE_REG(crc->INIT, value); -} - -/** - * @brief This register is used to read the CRC initial data. - * @param CRC Instance - * @retval value 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_init(CRC_TypeDef *crc) -{ - return (READ_REG(crc->INIT)); -} - -/** - * @brief This register is used to write the coefficient of the CRC polynomial. Default coefficient is for CRC32. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x00000000 - * @arg Maximum 0xFFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_crc_set_poly(CRC_TypeDef *crc, uint32_t value) -{ - WRITE_REG(crc->POLY, value); -} - -/** - * @brief This register is used to read the coefficient of the CRC polynomial. Default coefficient is for CRC32. - * @param CRC Instance - * @retval value 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_poly(CRC_TypeDef *crc) -{ - return (READ_REG(crc->POLY)); -} - -/** - * @brief This register is used to write the CRC input data. CRC will start to calculate result after this register is written. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x00000000 - * @arg Maximum 0xFFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_crc_set_data(CRC_TypeDef *crc, uint32_t value) -{ - WRITE_REG(crc->DATA, value); -} - -/** - * @brief This register is used to read the CRC input data. CRC will start to calculate result after this register is written. - * @param CRC Instance - * @retval value 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_data(CRC_TypeDef *crc) -{ - return (READ_REG(crc->DATA)); -} - -/** - * @brief This register is used to compare with the CRC output data. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x00000000 - * @arg Maximum 0xFFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_crc_set_comp(CRC_TypeDef *crc, uint32_t value) -{ - WRITE_REG(crc->COMP, value); -} - -/** - * @brief This register is used to compare with the CRC output data. - * @param CRC Instance - * @retval value 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_comp(CRC_TypeDef *crc) -{ - return (READ_REG(crc->COMP)); -} - -/** - * @brief This register is used to set a parameter to do exclusive OR with CRC output data. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg Minimum 0x00000000 - * @arg Maximum 0xFFFFFFFF - * @retval None. - */ -__STATIC_INLINE void md_crc_set_rema(CRC_TypeDef *crc, uint32_t value) -{ - WRITE_REG(crc->REMA, value); -} - -/** - * @brief This register is used to set a parameter to do exclusive OR with CRC output data. - * @param CRC Instance - * @retval value 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_rema(CRC_TypeDef *crc) -{ - return (READ_REG(crc->REMA)); -} - -/** - * @brief This register is used to set a parameter. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_CRC_CON_DMA_ON 1 - * @arg @ref MD_CRC_CON_DMA_OFF 0 - * @arg @ref MD_CRC_CON_MSB_ON 1 - * @arg @ref MD_CRC_CON_MSB_OFF 0 - * @arg @ref MD_CRC_CON_REOUT 0 - * @arg @ref MD_CRC_CON_REOUT_REV 1 - * @arg @ref MD_CRC_CON_REIN 0 - * @arg @ref MD_CRC_CON_REIN_REV 1 - * @arg @ref MD_CRC_CON_SIZE_POLY32 0 - * @arg @ref MD_CRC_CON_SIZE_POLY16 1 - * @arg @ref MD_CRC_CON_SIZE_POLY8 2 - * @arg @ref MD_CRC_CON_MODE_COMP_DISABLE 0 - * @arg @ref MD_CRC_CON_MODE_COMP_ZERO 1 - * @arg @ref MD_CRC_CON_MODE_COMP_ENABLE 2 - * @arg @ref MD_CRC_CON_RESET 1 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con(CRC_TypeDef *crc, uint32_t value) -{ - WRITE_REG(crc->CON, value); -} - -/** - * @brief This register is used to get a parameter. - * @param CRC Instance - * @retval value 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_con(CRC_TypeDef *crc) -{ - return (READ_REG(crc->CON)); -} - -/** - * @brief This function allow user to enable DMA function. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_CRC_CON_DMA_ON 1 - * @arg @ref MD_CRC_CON_DMA_OFF 0 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con_dma(CRC_TypeDef *crc, uint32_t value) -{ - MODIFY_REG(crc->CON, CRC_CON_DMA_MSK, value << CRC_CON_DMA_POS); -} - -/** - * @brief This function allow user to enable DMA function. - * @param CRC Instance - * @retval value 0: disable, 1: enable. - */ -__STATIC_INLINE uint32_t md_crc_get_con_dma(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->CON, CRC_CON_DMA_MSK) >> CRC_CON_DMA_POS) & 0x1); -} - -/** - * @brief User can set this bit to change the 'byte' order of input data. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_CRC_CON_MSB_ON 1 - * @arg @ref MD_CRC_CON_MSB_OFF 0 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con_msb(CRC_TypeDef *crc, uint32_t value) -{ - MODIFY_REG(crc->CON, CRC_CON_MSB_MSK, value << CRC_CON_MSB_POS); -} - -/** - * @brief User can set this bit to change the 'byte' order of input data. - * @param CRC Instance - * @retval value 0: disable, 1: enable. - */ -__STATIC_INLINE uint32_t md_crc_get_con_msb(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->CON, CRC_CON_MSB_MSK) >> CRC_CON_MSB_POS) & 0x1); -} - -/** - * @brief This function allow user to reverse the order of CRC output data. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @reg MD_CRC_CON_REOUT 0 - * @arg @reg MD_CRC_CON_REOUT_REV 1 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con_reout(CRC_TypeDef *crc, uint32_t value) -{ - MODIFY_REG(crc->CON, CRC_CON_REOUT_MSK, value << CRC_CON_REOUT_POS); -} - -/** - * @brief This function allow user to reverse the order of CRC output data. - * @param CRC Instance - * @retval value 0: Disable reverse operation, 1: Reverse output data. - */ -__STATIC_INLINE uint32_t md_crc_get_con_reout(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->CON, CRC_CON_REOUT_MSK) >> CRC_CON_REOUT_POS) & 0x1); -} - -/** - * @brief This function allow user to reverse the order of CRC input data. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @reg MD_CRC_CON_REIN 0 - * @arg @reg MD_CRC_CON_REIN_REV 1 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con_rein(CRC_TypeDef *crc, uint32_t value) -{ - MODIFY_REG(crc->CON, CRC_CON_REIN_MSK, value << CRC_CON_REIN_POS); -} - -/** - * @brief User can set this bit to change the 'byte' order of input data. - * @param CRC Instance - * @retval value 0: Disable reverse operation, 1: Bit reversal done by byte. - */ -__STATIC_INLINE uint32_t md_crc_get_con_rein(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->CON, CRC_CON_REIN_MSK) >> CRC_CON_REIN_POS) & 0x1); -} - -/** - * @brief User can set this bit to change the 'byte' order of input data. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_CRC_CON_SIZE_POLY32 0 - * @arg @ref MD_CRC_CON_SIZE_POLY16 1 - * @arg @ref MD_CRC_CON_SIZE_POLY8 2 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con_size(CRC_TypeDef *crc, uint32_t value) -{ - MODIFY_REG(crc->CON, CRC_CON_SIZE_MSK, value << CRC_CON_SIZE_POSS); -} - -/** - * @brief User can set this bit to change the 'byte' order of input data. - * @param CRC Instance - * @retval value 00: 32 bit polynomial, 01: 16 bit polynomial, 10: 8 bit polynomial. - */ -__STATIC_INLINE uint32_t md_crc_get_con_size(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->CON, CRC_CON_SIZE_MSK) >> CRC_CON_SIZE_POSS) & 0x3); -} - -/** - * @brief This function allow user to check CRC result. If CRC result is not correct, the status “FAIL” in CRC_STA will be set to 1. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_CRC_CON_MODE_COMP_DISABLE 0 - * @arg @ref MD_CRC_CON_MODE_COMP_ZERO 1 - * @arg @ref MD_CRC_CON_MODE_COMP_ENABLE 2 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con_mode(CRC_TypeDef *crc, uint32_t value) -{ - MODIFY_REG(crc->CON, CRC_CON_MODE_MSK, value << CRC_CON_MODE_POSS); -} - -/** - * @brief This function allow user to check CRC result. If CRC result is not correct, the status “FAIL” in CRC_STA will be set to 1. - * @param CRC Instance - * @retval value 00: Disable compare function, 01: Compare CRC result with 32’h0000_0000, 10: Compare CRC result with CRC_COMP. - */ -__STATIC_INLINE uint32_t md_crc_get_con_mode(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->CON, CRC_CON_MODE_MSK) >> CRC_CON_MODE_POSS) & 0x3); -} - -/** - * @brief User can set this bit to reset CRC function. This bit will be cleared by itself. - * @param CRC Instance - * @param value This parameter can be one of the following values: - * @arg @ref MD_CRC_CON_RESET 1 - * @retval None. - */ -__STATIC_INLINE void md_crc_set_con_reset(CRC_TypeDef *crc, uint32_t value) -{ - MODIFY_REG(crc->CON, CRC_CON_RESET_MSK, value << CRC_CON_RESET_POS); -} - -/** - * @brief User can set this bit to reset CRC function. This bit will be cleared by itself. - * @param CRC Instance - * @retval value 0. - */ -__STATIC_INLINE uint32_t md_crc_get_con_reset(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->CON, CRC_CON_RESET_MSK) >> CRC_CON_RESET_POS) & 0x1); -} - -/** - * @brief This register is used to show the CRC calculation result. - * @param CRC Instance - * @retval value: 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_dout(CRC_TypeDef *crc) -{ - return (READ_REG(crc->DOUT)); -} - -/** - * @brief This register is used to show the CRC calculation exculsive OR result. - * @param CRC Instance - * @retval value: 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_dout_xor(CRC_TypeDef *crc) -{ - return (READ_REG(crc->DOUT_XOR)); -} - -/** - * @brief This register is used to show the CRC calculation exculsive OR result. - * @param CRC Instance - * @retval value: 0x00000000 ~ 0xffffffff. - */ -__STATIC_INLINE uint32_t md_crc_get_stat(CRC_TypeDef *crc) -{ - return (READ_REG(crc->STAT)); -} - -/** - * @brief This bit is set when CRC result is not correct. - * @param CRC Instance - * @retval value: 1 = FAIL, 0 = PASS. - @arg @ref MD_CRC_STAT_FAIL 1 - */ -__STATIC_INLINE uint32_t md_crc_get_stat_fail(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->STAT, CRC_STAT_FAIL_MSK) >> CRC_STAT_FAIL_POS) & 0x1); -} - -/** - * @brief This bit is cleaned after an CRC calculation. - * @param CRC Instance - * @retval value: 1 = FAIL, 0 = PASS. - @arg @ref MD_CRC_STAT_EMPTY 1 - */ -__STATIC_INLINE uint32_t md_crc_get_stat_empty(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->STAT, CRC_STAT_EMPTY_MSK) >> CRC_STAT_EMPTY_POS) & 0x1); -} - -/** - * @brief This bit is set when CRC module is calculating result. - * @param CRC Instance - * @retval value: 1 = FAIL, 0 = PASS. - @arg @ref MD_CRC_STAT_BUSY 1 - */ -__STATIC_INLINE uint32_t md_crc_get_stat_busy(CRC_TypeDef *crc) -{ - return ((READ_BIT(crc->STAT, CRC_STAT_BUSY_MSK) >> CRC_STAT_BUSY_POS) & 0x1); -} - -/** - * @brief This bit is set when CRC module is calculating result. - * @param CRC Instance - * @retval value: 1 = FAIL, 0 = PASS. - @arg @ref MD_CRC_STAT_DONE 1 - */ -__STATIC_INLINE uint32_t md_crc_get_stat_done(CRC_TypeDef *crc) -{ - return (READ_BIT(crc->STAT, CRC_STAT_DONE_MSK) >> CRC_STAT_DONE_POS); -} - -/** - * @} MD_CRC_Public_Macros - */ - -/** - * @} CRC - */ - -#endif - -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_dac.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_dac.h deleted file mode 100644 index 199fc195b1..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_dac.h +++ /dev/null @@ -1,290 +0,0 @@ -/** - ****************************************************************************** - * @file md_ADC.h - * @brief ES32F0271 DAC Header File. - * - * @version V1.00.01 - * @date 01/14/2019 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_DAC_H__ -#define __MD_DAC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_dac.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined DAC - -/** @defgroup DAC DAC - * @brief DAC micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/* Public types ---------------------------------------------------------------*/ -/* Public constants -----------------------------------------------------------*/ -/* Public functions -----------------------------------------------------------*/ - -/** @defgroup MD_DAC_Public_Constants DAC Public Constants - * @{ - */ - -/** @defgroup MD_DAC_CON DAC_CON Register - * @{ - */ - -#define MD_ADC_CON_TSEL_SW (0x00000000U<CON, DAC_CON_INVREN_MSK); -} - -/** - * @brief DAC INVREN Disable. - * @param None - * @retval None - */ -__STATIC_INLINE void md_dac_disable_con_invren(DAC_TypeDef *DACx) -{ - CLEAR_BIT(DACx->CON, DAC_CON_INVREN_MSK); -} - -/** - * @brief Check if DAC INVREN is enabled. - * @param None - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dac_is_enabled_con_invren(DAC_TypeDef *DACx) -{ - return (READ_BIT(DACx->CON, DAC_CON_INVREN_MSK) == (DAC_CON_INVREN_MSK)); -} - -/** - * @brief TRIGGER enable. - * @param DACx DAC Instance - * @retval None - */ -__STATIC_INLINE void md_dac_enable_con_trien(DAC_TypeDef *DACx) -{ - SET_BIT(DACx->CON, DAC_CON_TRIEN_MSK); -} - -/** - * @brief TRIGGER Disable. - * @param DACx DAC Instance - * @retval None - */ -__STATIC_INLINE void md_dac_disable_en_trien(DAC_TypeDef *DACx) -{ - CLEAR_BIT(DACx->CON, DAC_CON_TRIEN_MSK); -} - -/** - * @brief Check if DAC TRIGGER is enabled. - * @param DACx DAC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dac_is_enabled_con_trien(DAC_TypeDef *DACx) -{ - return (READ_BIT(DACx->EN, DAC_CON_TRIEN_MSK) == (DAC_CON_TRIEN_MSK)); -} - -/** - * @brief Set DACx DIV register. - * @note This bits can only be written none zero value. - * @param DACx DAC Instance. - * @param DIV value. - * @retval None - */ -__STATIC_INLINE void md_dac_set_div(DAC_TypeDef *DACx, uint32_t div) -{ - WRITE_REG(DACx->DIV, div); -} - -/** - * @brief Set DACx DAC_CON WAVE value. - * @param DACx DAC Instance. - * @param WAVE value. - * @retval None - */ -__STATIC_INLINE void md_dac_set_con_wave(DAC_TypeDef *DACx, uint32_t wave) -{ - MODIFY_REG(DACx->CON, DAC_CON_MAMP_MSK, wave<CON, DAC_CON_MAMP_MSK, mamp<CON, DAC_CON_T_SEL_MSK, tsel<TRIG, DAC_TRIG_S_TRIG_MSK); -} - -/** - * @brief Check if Transmit FIFO full. - * @note This bit is set and cleared by hardware when the TX FIFO is no - * longer full. - * @param DACx DAC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dac_is_active_flag_stat_txfull(DAC_TypeDef *DACx) -{ - return (READ_BIT(DACx->STAT, DAC_STAT_TX_FULL_MSK) == (DAC_STAT_TX_FULL_MSK)); -} - -/** - * @brief Check if Transmit DAC is busy. - * @param DACx DAC Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dac_is_active_flag_stat_busy(DAC_TypeDef *DACx) -{ - return (READ_BIT(DACx->STAT, DAC_STAT_BUSY_MSK) == (DAC_STAT_BUSY_MSK)); -} - -/** - * @brief DAC enable. - * @param DACx DAC Instance - * @retval None - */ -__STATIC_INLINE void md_dac_enable_en_dacen(DAC_TypeDef *DACx) -{ - SET_BIT(DACx->EN, DAC_EN_DAC_EN_MSK); -} - -/** - * @brief DAC Disable. - * @param DACx DAC Instance - * @retval None - */ -__STATIC_INLINE void md_dac_disable_en_dacen(DAC_TypeDef *DACx) -{ - CLEAR_BIT(DACx->EN, DAC_EN_DAC_EN_MSK); -} - -/** - * @brief Set DACx data register. - * @param DACx DAC Instance. - * @param Tx data value. - * @retval None - */ -__STATIC_INLINE void md_dac_set_txdata(DAC_TypeDef *DACx, uint32_t data) -{ - WRITE_REG(DACx->DATA, data); -} - -#endif - -/** - * @} MD_GPIO_Public_Macros - */ - -/** @} ADC - */ - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_dma.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_dma.h deleted file mode 100644 index 521ce1e61e..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_dma.h +++ /dev/null @@ -1,5561 +0,0 @@ -/** - ****************************************************************************** - * @file md_DMA.h - * @brief ES32F0271 DMA HEAD File. - * - * @version V1.00.02 - * @date 30/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_DMA_H__ -#define __MD_DMA_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_dma.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (DMA1) - -/** @defgroup DMA DMA - * @brief DMA micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_DMA_PT_INIT DMA Public Init structures - * @{ - */ - -/** - * @brief MD DMA Init Structure definition - */ - - -/** - * @} MD_DMA_PT_INIT - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_DMA_Public_Constants DMA Public Constants - * @{ - */ - -/** @defgroup MD_DMA_DINCOS Destination Increment Offset Size - * @{ - */ -#define MD_DMA_DINCOS_LINKED_DWSEL (0x00000000UL) /** @brief The offset size for the peripheral address calculation is - linked to the DWSEL */ -#define MD_DMA_DINCOS_FIXED_TO_4 (0X00000001UL) /** @brief The offset size for the peripheral address calculation is - fixed to 4 (32-bit alignment). */ -/** - * @} MD_DMA_DINCOS - */ - -/** @defgroup MD_DMA_DBUSEL Destination Transfer Burst Selection - * @{ - */ -#define MD_DMA_DBUSEL_SINGLE (0x00000000U) -#define MD_DMA_DBUSEL_WRAP4 (0x00000002U) -#define MD_DMA_DBUSEL_INCR4 (0x00000003U) -#define MD_DMA_DBUSEL_WRAP8 (0x00000004U) -#define MD_DMA_DBUSEL_INCR8 (0x00000005U) -#define MD_DMA_DBUSEL_WRAP16 (0x00000006U) -#define MD_DMA_DBUSEL_INCR16 (0x00000007U) -/** - * @} MD_DMA_DBUSEL - */ - -/** @defgroup MD_DMA_DDWSEL Destination Transfer Data Width Selection. - * @{ - */ -#define MD_DMA_DDWSEL_ONE_BYTE (0x00000000UL) /** @brief One byte (8-bit) is transferred for every DMA operation. */ -#define MD_DMA_DDWSEL_ONE_HALF_WORD (0x00000001UL) /** @brief One half-word (16-bit) is transferred for every DMA operation. */ -#define MD_DMA_DDWSEL_ONE_WORD (0x00000002UL) /** @brief One word (32-bit) is transferred for every DMA operation. */ -/** - * @} MD_DMA_DDWSEL - */ - -/** @defgroup MD_DMA_SINCOS Source Increment Offset Size - * @{ - */ -#define MD_DMA_SINCOS_LINKED_SWSEL (0x00000000UL) /** @brief The offset size for the peripheral address calculation is - linked to the SWSEL */ -#define MD_DMA_SINCOS_FIXED_TO_4 (0X00000001UL) /** @brief The offset size for the peripheral address calculation is - fixed to 4 (32-bit alignment). */ -/** - * @} MD_DMA_SINCOS - */ - -/** @defgroup MD_DMA_SBUSEL Source Transfer Burst Selection. - * @{ - */ -#define MD_DMA_SBUSEL_SINGLE (0x00000000U) -#define MD_DMA_SBUSEL_WRAP4 (0x00000002U) -#define MD_DMA_SBUSEL_INCR4 (0x00000003U) -#define MD_DMA_SBUSEL_WRAP8 (0x00000004U) -#define MD_DMA_SBUSEL_INCR8 (0x00000005U) -#define MD_DMA_SBUSEL_WRAP16 (0x00000006U) -#define MD_DMA_SBUSEL_INCR16 (0x00000007U) -/** - * @} MD_DMA_SBUSEL - */ - -/** @defgroup MD_DMA_SDWSEL Source Transfer Data Width Selection. - * @{ - */ -#define MD_DMA_SDWSEL_ONE_BYTE (0x00000000UL) /** @brief One byte (8-bit) is transferred for every DMA operation. */ -#define MD_DMA_SDWSEL_ONE_HALF_WORD (0x00000001UL) /** @brief One half-word (16-bit) is transferred for every DMA operation. */ -#define MD_DMA_SDWSEL_ONE_WORD (0x00000002UL) /** @brief One word (32-bit) is transferred for every DMA operation. */ -/** - * @} MD_DMA_SDWSEL - */ - -/** @defgroup MD_DMA_CHPRI DMA Channel Priority. - * @{ - */ -#define MD_DMA_CHPRI_LV0 (0x00000000U) -#define MD_DMA_CHPRI_LV1 (0x00000001U) -#define MD_DMA_CHPRI_LV2 (0x00000002U) -#define MD_DMA_CHPRI_LV3 (0x00000003U) -#define MD_DMA_CHPRI_LV4 (0x00000004U) -#define MD_DMA_CHPRI_LV5 (0x00000005U) -/** - * @} MD_DMA_CHPRI - */ - -/** @defgroup MD_DMA_MODESEL DMA Mode Select. - * @{ - */ -#define MD_DMA_MODESEL_MEM_TO_MEM (0x0000000UL) /** @brief Memory to Memory mode (Memory-to-Memory). */ -#define MD_DMA_MODESEL_PER_TO_MEM (0x0000001UL) /** @brief Peripheral to Memory mode (Peripheral-to-Memory). */ -#define MD_DMA_MODESEL_MEM_TO_PER (0x0000002UL) /** @brief Memory to Peripheral mode (Memory-to-Peripheral). */ -/** - * @} MD_DMA_MODESEL - */ - -/** @defgroup MD_DMA_PFCTRL Peripheral flow controller - * @{ - */ -#define MD_DMA_PFCTRL_DMA_CTRL (0x0000000UL) /** @brief The DMA is the flow controller */ -#define MD_DMA_PFCTRL_PER_CTRL (0x0000001UL) /** @brief The peripheral is the flow controller */ -/** - * @} MD_DMA_PFCTRL - */ - -/** @defgroup MD_DMA_PHSS Peripheral Handshake Software Select - * @{ - */ -#define MD_DMA_PHSS_UART1_TX (0x0000000UL) -#define MD_DMA_PHSS_UART2_TX (0x0000001UL) -#define MD_DMA_PHSS_UART3_TX (0x0000002UL) -#define MD_DMA_PHSS_SUART1_TX (0x0000003UL) -#define MD_DMA_PHSS_SUART2_TX (0x0000004UL) -#define MD_DMA_PHSS_SPI1_TX (0x0000005UL) -#define MD_DMA_PHSS_SPI2_TX (0x0000006UL) -#define MD_DMA_PHSS_I2C1_TX (0x0000007UL) -#define MD_DMA_PHSS_I2C2_TX (0x0000008UL) -#define MD_DMA_PHSS_AES_IN (0x0000009UL) -#define MD_DMA_PHSS_DAC (0x000000AUL) -#define MD_DMA_PHSS_CRC (0x000000BUL) -#define MD_DMA_PHSS_UART1_RX (0x000000FUL) -#define MD_DMA_PHSS_UART2_RX (0x0000010UL) -#define MD_DMA_PHSS_UART3_RX (0x0000011UL) -#define MD_DMA_PHSS_SUART1_RX (0x0000012UL) -#define MD_DMA_PHSS_SUART2_RX (0x0000013UL) -#define MD_DMA_PHSS_SPI1_RTX (0x0000014UL) -#define MD_DMA_PHSS_SPI2_RX (0x0000015UL) -#define MD_DMA_PHSS_I2C1_RX (0x0000016UL) -#define MD_DMA_PHSS_I2C2_RX (0x0000017UL) -#define MD_DMA_PHSS_AES_OUT (0x0000018UL) -#define MD_DMA_PHSS_ADCSS0 (0x0000019UL) -#define MD_DMA_PHSS_ADCSS1 (0x000001AUL) -#define MD_DMA_PHSS_ADCSS2 (0x000001BUL) -#define MD_DMA_PHSS_ADCSS3 (0x000001CUL) -#define MD_DMA_PHSS_BS16T1_UP (0x0000020UL) -#define MD_DMA_PHSS_AD16C4T1_CH1 (0x0000021UL) -#define MD_DMA_PHSS_AD16C4T1_CH2 (0x0000022UL) -#define MD_DMA_PHSS_AD16C4T1_CH3 (0x0000023UL) -#define MD_DMA_PHSS_AD16C4T1_CH4 (0x0000024UL) -#define MD_DMA_PHSS_AD16C4T1_UP (0x0000025UL) -#define MD_DMA_PHSS_AD16C4T1_TRIG (0x0000026UL) -#define MD_DMA_PHSS_AD16C4T1_COM (0x0000027UL) -#define MD_DMA_PHSS_GP32C4T1_CH1 (0x0000028UL) -#define MD_DMA_PHSS_GP32C4T1_CH2 (0x0000029UL) -#define MD_DMA_PHSS_GP32C4T1_CH3 (0x000002AUL) -#define MD_DMA_PHSS_GP32C4T1_CH4 (0x000002BUL) -#define MD_DMA_PHSS_GP32C4T1_UP (0x000002CUL) -#define MD_DMA_PHSS_GP32C4T1_TRIG (0x000002DUL) -#define MD_DMA_PHSS_GP16C4T1_CH1 (0x000002EUL) -#define MD_DMA_PHSS_GP16C4T1_CH2 (0x000002FUL) -#define MD_DMA_PHSS_GP16C4T1_CH3 (0x0000030UL) -#define MD_DMA_PHSS_GP16C4T1_CH4 (0x0000031UL) -#define MD_DMA_PHSS_GP16C4T1_UP (0x0000032UL) -#define MD_DMA_PHSS_GP16C4T1_TRIG (0x0000033UL) -#define MD_DMA_PHSS_GP16C4T2_CH1 (0x0000034UL) -#define MD_DMA_PHSS_GP16C4T2_CH2 (0x0000035UL) -#define MD_DMA_PHSS_GP16C4T2_CH3 (0x0000036UL) -#define MD_DMA_PHSS_GP16C4T2_CH4 (0x0000037UL) -#define MD_DMA_PHSS_GP16C4T2_UP (0x0000038UL) -#define MD_DMA_PHSS_GP16C4T2_TRIG (0x0000039UL) -#define MD_DMA_PHSS_GP16C4T3_CH1 (0x000003AUL) -#define MD_DMA_PHSS_GP16C4T3_CH2 (0x000003BUL) -#define MD_DMA_PHSS_GP16C4T3_CH3 (0x000003CUL) -#define MD_DMA_PHSS_GP16C4T3_CH4 (0x000003DUL) -#define MD_DMA_PHSS_GP16C4T3_UP (0x000003EUL) -#define MD_DMA_PHSS_GP16C4T3_TRIG (0x000003FUL) -#define MD_DMA_PHSS_GP16C2T1_CH1 (0x0000040UL) -#define MD_DMA_PHSS_GP16C2T1_CH2 (0x0000041UL) -#define MD_DMA_PHSS_GP16C2T1_UP (0x0000042UL) -#define MD_DMA_PHSS_GP16C2T1_TRIG (0x0000043UL) -#define MD_DMA_PHSS_GP16C2T1_COM (0x0000044UL) -#define MD_DMA_PHSS_GP16C2T2_CH1 (0x0000046UL) -#define MD_DMA_PHSS_GP16C2T2_CH2 (0x0000047UL) -#define MD_DMA_PHSS_GP16C2T2_UP (0x0000048UL) -#define MD_DMA_PHSS_GP16C2T2_TRIG (0x0000049UL) -#define MD_DMA_PHSS_GP16C2T2_COM (0x000004AUL) -#define MD_DMA_PHSS_GP16C2T3_CH1 (0x000004CUL) -#define MD_DMA_PHSS_GP16C2T3_CH2 (0x000004DUL) -#define MD_DMA_PHSS_GP16C2T3_UP (0x000004EUL) -#define MD_DMA_PHSS_GP16C2T3_TRIG (0x000004FUL) -#define MD_DMA_PHSS_GP16C2T3_COM (0x0000050UL) -#define MD_DMA_PHSS_GP16C2T4_CH1 (0x0000052UL) -#define MD_DMA_PHSS_GP16C2T4_CH2 (0x0000053UL) -#define MD_DMA_PHSS_GP16C2T4_UP (0x0000054UL) -#define MD_DMA_PHSS_GP16C2T4_TRIG (0x0000055UL) -#define MD_DMA_PHSS_GP16C2T4_COM (0x0000056UL) -/** - * @} MD_DMA_PHSS - */ - -/** - * @} MD_DMA_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_DMA_Public_Macros DMA Public Macros - * @{ - */ - -/** - * @brief DMA Channel 5 TABORT Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch5tabie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH5TABIE_MSK); -} -/** - * @brief DMA Channel 5 Block Transmit Done Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch5btdie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH5BTDIE_MSK); -} -/** - * @brief DMA Channel 4 TABORT Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch4tabie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH4TABIE_MSK); -} -/** - * @brief DMA Channel 4 Block Transmit Done Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch4btdie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH4BTDIE_MSK); -} -/** - * @brief DMA Channel 3 TABORT Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch3tabie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH3TABIE_MSK); -} -/** - * @brief DMA Channel 3 Block Transmit Done Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch3btdie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH3BTDIE_MSK); -} -/** - * @brief DMA Channel 2 TABORT Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch2tabie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH2TABIE_MSK); -} -/** - * @brief DMA Channel 2 Block Transmit Done Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch2btdie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH2BTDIE_MSK); -} -/** - * @brief DMA Channel 1 TABORT Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch1tabie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH1TABIE_MSK); -} -/** - * @brief DMA Channel 1 Block Transmit Done Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch1btdie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH1BTDIE_MSK); -} -/** - * @brief DMA Channel 0 TABORT Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch0tabie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH0TABIE_MSK); -} -/** - * @brief DMA Channel 0 Block Transmit Done Interrupt Enable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_ier_ch0btdie(DMA_TypeDef *dma) -{ - SET_BIT(dma->IER, DMA_IER_CH0BTDIE_MSK); -} - -/** @defgroup MD_DMA_IER_CH5TABIE CH5TABIE - * @brief Set DMA Channel 5 TABORT Interrupt Enable bit for md_dma_set_ier() function used - * @param ch5tabie This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_dma_set_ier_ch5tabie_fun(ch5tabie) (ch5tabie<IER, (ch5tabie|ch5btdie|ch4tabie|ch4btdie|ch3tabie|ch3btdie|ch2tabie|ch2btdie|ch1tabie|ch1btdie|ch0tabie|ch0btdie)); -} - -/** - * @brief DMA Channel 5 TABORT Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch5tabid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH5TABID_MSK); -} -/** - * @brief DMA Channel 5 Block Transmit Done Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch5btdid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH5BTDID_MSK); -} -/** - * @brief DMA Channel 4 TABORT Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch4tabid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH4TABID_MSK); -} -/** - * @brief DMA Channel 4 Block Transmit Done Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch4btdid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH4BTDID_MSK); -} -/** - * @brief DMA Channel 3 TABORT Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch3tabid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH3TABID_MSK); -} -/** - * @brief DMA Channel 3 Block Transmit Done Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch3btdid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH3BTDID_MSK); -} -/** - * @brief DMA Channel 2 TABORT Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch2tabid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH2TABID_MSK); -} -/** - * @brief DMA Channel 2 Block Transmit Done Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch2btdid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH2BTDID_MSK); -} -/** - * @brief DMA Channel 1 TABORT Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch1tabid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH1TABID_MSK); -} -/** - * @brief DMA Channel 1 Block Transmit Done Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch1btdid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH1BTDID_MSK); -} -/** - * @brief DMA Channel 0 TABORT Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch0tabid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH0TABID_MSK); -} -/** - * @brief DMA Channel 0 Block Transmit Done Interrupt Disable bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_enable_idr_ch0btdid(DMA_TypeDef *dma) -{ - SET_BIT(dma->IDR, DMA_IDR_CH0BTDID_MSK); -} - - -/** - * @brief DMA Channel 5 TABORT Interrupt Valid Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch5tabivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH5TABIVS_MSK)>>DMA_IVS_CH5TABIVS_POS); -} -/** - * @brief DMA Channel 5 Block Transmit Done Interrupt Valid Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch5btdivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH5BTDIVS_MSK)>>DMA_IVS_CH5BTDIVS_POS); -} -/** - * @brief DMA Channel 4 TABORT Interrupt Valid Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch4tabivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH4TABIVS_MSK)>>DMA_IVS_CH4TABIVS_POS); -} -/** - * @brief DMA Channel 4 Block Transmit Done Interrupt Valid Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch4btdivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH4BTDIVS_MSK)>>DMA_IVS_CH4BTDIVS_POS); -} -/** - * @brief DMA Channel 3 TABORT Interrupt Valid Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch3tabivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH3TABIVS_MSK)>>DMA_IVS_CH3TABIVS_POS); -} -/** - * @brief DMA Channel 3 Block Transmit Done Interrupt Valid Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch3btdivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH3BTDIVS_MSK)>>DMA_IVS_CH3BTDIVS_POS); -} -/** - * @brief DMA Channel 2 TABORT Interrupt Valid Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch2tabivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH2TABIVS_MSK)>>DMA_IVS_CH2TABIVS_POS); -} -/** - * @brief DMA Channel 2 Block Transmit Done Interrupt Valid Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch2btdivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH2BTDIVS_MSK)>>DMA_IVS_CH2BTDIVS_POS); -} -/** - * @brief DMA Channel 1 TABORT Interrupt Valid Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch1tabivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH1TABIVS_MSK)>>DMA_IVS_CH1TABIVS_POS); -} -/** - * @brief DMA Channel 1 Block Transmit Done Interrupt Valid Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch1btdivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH1BTDIVS_MSK)>>DMA_IVS_CH1BTDIVS_POS); -} -/** - * @brief DMA Channel 0 TABORT Interrupt Valid Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch0tabivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH0TABIVS_MSK)>>DMA_IVS_CH0TABIVS_POS); -} -/** - * @brief DMA Channel 0 Block Transmit Done Interrupt Valid Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch0btdivs(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IVS, DMA_IVS_CH0BTDIVS_MSK)>>DMA_IVS_CH0BTDIVS_POS); -} -/** - * @brief Get DMA interrupt valid status register - * @param dma DMA Instance - * @retval DMA channel interrupt valid status - */ -__STATIC_INLINE uint32_t md_dma_get_ivs(DMA_TypeDef *dma) -{ - return (READ_REG(dma->IVS)); -} - -/** - * @brief DMA Channel 5 TABORT Raw Interrupt Flag Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch5tabrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH5TABRIF_MSK)>>DMA_RIF_CH5TABRIF_POS); -} -/** - * @brief DMA Channel 5 Block Transmit Done Raw Interrupt Flag Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch5btdrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH5BTDRIF_MSK)>>DMA_RIF_CH5BTDRIF_POS); -} -/** - * @brief DMA Channel 4 TABORT Raw Interrupt Flag Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch4tabrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH4TABRIF_MSK)>>DMA_RIF_CH4TABRIF_POS); -} -/** - * @brief DMA Channel 4 Block Transmit Done Raw Interrupt Flag Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch4btdrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH4BTDRIF_MSK)>>DMA_RIF_CH4BTDRIF_POS); -} -/** - * @brief DMA Channel 3 TABORT Raw Interrupt Flag Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch3tabrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH3TABRIF_MSK)>>DMA_RIF_CH3TABRIF_POS); -} -/** - * @brief DMA Channel 3 Block Transmit Done Raw Interrupt Flag Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch3btdrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH3BTDRIF_MSK)>>DMA_RIF_CH3BTDRIF_POS); -} -/** - * @brief DMA Channel 2 TABORT Raw Interrupt Flag Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch2tabrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH2TABRIF_MSK)>>DMA_RIF_CH2TABRIF_POS); -} -/** - * @brief DMA Channel 2 Block Transmit Done Raw Interrupt Flag Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch2btdrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH2BTDRIF_MSK)>>DMA_RIF_CH2BTDRIF_POS); -} -/** - * @brief DMA Channel 1 TABORT Raw Interrupt Flag Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch1tabrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH1TABRIF_MSK)>>DMA_RIF_CH1TABRIF_POS); -} -/** - * @brief DMA Channel 1 Block Transmit Done Raw Interrupt Flag Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch1btdrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH1BTDRIF_MSK)>>DMA_RIF_CH1BTDRIF_POS); -} -/** - * @brief DMA Channel 0 TABORT Raw Interrupt Flag Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch0tabrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH0TABRIF_MSK)>>DMA_RIF_CH0TABRIF_POS); -} -/** - * @brief DMA Channel 0 Block Transmit Done Raw Interrupt Flag Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ivs_ch0btdrif(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->RIF, DMA_RIF_CH0BTDRIF_MSK)>>DMA_RIF_CH0BTDRIF_POS); -} -/** - * @brief Get DMA raw interrupt flag status register - * @param dma DMA Instance - * @retval DMA channel raw interrupt flag status - */ -__STATIC_INLINE uint32_t md_dma_get_rif(DMA_TypeDef *dma) -{ - return (READ_REG(dma->RIF)); -} - -/** - * @brief DMA Channel 5 TABORT Interrupt Flag Masked Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch5tabifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH5TABIFM_MSK)>>DMA_IFM_CH5TABIFM_POS); -} -/** - * @brief DMA Channel 5 Block Transmit Done Interrupt Flag Masked Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch5btdifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH5BTDIFM_MSK)>>DMA_IFM_CH5BTDIFM_POS); -} -/** - * @brief DMA Channel 4 TABORT Interrupt Flag Masked Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch4tabifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH4TABIFM_MSK)>>DMA_IFM_CH4TABIFM_POS); -} -/** - * @brief DMA Channel 4 Block Transmit Done Interrupt Flag Masked Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch4btdifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH4BTDIFM_MSK)>>DMA_IFM_CH4BTDIFM_POS); -} -/** - * @brief DMA Channel 3 TABORT Interrupt Flag Masked Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch3tabifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH3TABIFM_MSK)>>DMA_IFM_CH3TABIFM_POS); -} -/** - * @brief DMA Channel 3 Block Transmit Done Interrupt Flag Masked Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch3btdifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH3BTDIFM_MSK)>>DMA_IFM_CH3BTDIFM_POS); -} -/** - * @brief DMA Channel 2 TABORT Interrupt Flag Masked Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch2tabifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH2TABIFM_MSK)>>DMA_IFM_CH2TABIFM_POS); -} -/** - * @brief DMA Channel 2 Block Transmit Done Interrupt Flag Masked Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch2btdifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH2BTDIFM_MSK)>>DMA_IFM_CH2BTDIFM_POS); -} -/** - * @brief DMA Channel 1 TABORT Interrupt Flag Masked Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch1tabifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH1TABIFM_MSK)>>DMA_IFM_CH1TABIFM_POS); -} -/** - * @brief DMA Channel 1 Block Transmit Done Interrupt Flag Masked Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch1btdifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH1BTDIFM_MSK)>>DMA_IFM_CH1BTDIFM_POS); -} -/** - * @brief DMA Channel 0 TABORT Interrupt Flag Masked Status bit - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch0tabifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH0TABIFM_MSK)>>DMA_IFM_CH0TABIFM_POS); -} -/** - * @brief DMA Channel 0 Block Transmit Done Interrupt Flag Masked Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_ifm_ch0btdifm(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->IFM, DMA_IFM_CH0BTDIFM_MSK)>>DMA_IFM_CH0BTDIFM_POS); -} -/** - * @brief Get DMA interrupt flag masked status register - * @param dma DMA Instance - * @retval DMA channel interrupt flag masked status - */ -__STATIC_INLINE uint32_t md_dma_get_ifm(DMA_TypeDef *dma) -{ - return (READ_REG(dma->IFM)); -} - - -/** - * @brief DMA Channel 5 TABORT Interrupt Clear bit - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch5tabicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH5TABICR_MSK); -} -/** - * @brief DMA Channel 5 Block Transmit Done Interrupt Clear bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch5btdicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH5BTDICR_MSK); -} -/** - * @brief DMA Channel 4 TABORT Interrupt Clear bit - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch4tabicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH4TABICR_MSK); -} -/** - * @brief DMA Channel 4 Block Transmit Done Interrupt Clear bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch4btdicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH4BTDICR_MSK); -} -/** - * @brief DMA Channel 3 TABORT Interrupt Clear bit - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch3tabicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH3TABICR_MSK); -} -/** - * @brief DMA Channel 3 Block Transmit Done Interrupt Clear bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch3btdicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH3BTDICR_MSK); -} -/** - * @brief DMA Channel 2 TABORT Interrupt Clear bit - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch2tabicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH2TABICR_MSK); -} -/** - * @brief DMA Channel 2 Block Transmit Done Interrupt Clear bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch2btdicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH2BTDICR_MSK); -} -/** - * @brief DMA Channel 1 TABORT Interrupt Clear bit - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch1tabicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH1TABICR_MSK); -} -/** - * @brief DMA Channel 1 Block Transmit Done Interrupt Clear bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch1btdicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH1BTDICR_MSK); -} -/** - * @brief DMA Channel 0 TABORT Interrupt Clear bit - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch0tabicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH0TABICR_MSK); -} -/** - * @brief DMA Channel 0 Block Transmit Done Interrupt Clear bit. - * @param dma DMA Instance - * @retval None - */ -__STATIC_INLINE void md_dma_clear_icr_ch0btdicr(DMA_TypeDef *dma) -{ - SET_BIT(dma->ICR, DMA_ICR_CH0BTDICR_MSK); -} - -/** @defgroup MD_DMA_ICR_CH5TABICR CH5TABICR - * @brief Set DMA Channel 5 TABORT Interrupt Clear bit for md_dma_set_icr() function used - * @param ch5tabicr This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_dma_set_icr_ch5tabicr_fun(ch5tabicr) (ch5tabicr<ICR, ( ch5tabicr|ch5btdicr|ch4tabicr|ch4btdicr|ch3tabicr|ch3btdicr|ch2tabicr|ch2btdicr| - ch1tabicr|ch1btdicr|ch0tabicr|ch0btdicr)); -} -/** - * @brief Set DMA interrupt clear register(2) - * @param dma DMA Instance - * @param icr is interrupt clear register - * @retval None - */ -__STATIC_INLINE void md_dma_set_icr_icr(DMA_TypeDef *dma, uint32_t icr) -{ - WRITE_REG(dma->ICR, icr); -} - - -/** - * @brief DMA Channel 5 PFCTRL Size not match,last data have error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch5pfser(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH5PFSER_MSK)>>DMA_EMSG_CH5PFSER_POS); -} -/** - * @brief DMA Channel 5 PFCTRL Over run Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch5pfov(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH5PFOV_MSK)>>DMA_EMSG_CH5PFOV_POS); -} -/** - * @brief DMA Channel 5 Setting Burst Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch5setbuer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH5SETBUER_MSK)>>DMA_EMSG_CH5SETBUER_POS); -} -/** - * @brief DMA Channel 5 Setting BCR Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch5setbcer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH5SETBCER_MSK)>>DMA_EMSG_CH5SETBCER_POS); -} -/** - * @brief DMA Channel 4 PFCTRL Size not match,last data have error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch4pfser(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH4PFSER_MSK)>>DMA_EMSG_CH4PFSER_POS); -} -/** - * @brief DMA Channel 4 PFCTRL Over run Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch4pfov(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH4PFOV_MSK)>>DMA_EMSG_CH4PFOV_POS); -} -/** - * @brief DMA Channel 4 Setting Burst Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch4setbuer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH4SETBUER_MSK)>>DMA_EMSG_CH4SETBUER_POS); -} -/** - * @brief DMA Channel 4 Setting BCR Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch4setbcer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH4SETBCER_MSK)>>DMA_EMSG_CH4SETBCER_POS); -} -/** - * @brief DMA Channel 3 PFCTRL Size not match,last data have error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch3pfser(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH3PFSER_MSK)>>DMA_EMSG_CH3PFSER_POS); -} -/** - * @brief DMA Channel 3 PFCTRL Over run Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch3pfov(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH3PFOV_MSK)>>DMA_EMSG_CH3PFOV_POS); -} -/** - * @brief DMA Channel 3 Setting Burst Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch3setbuer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH3SETBUER_MSK)>>DMA_EMSG_CH3SETBUER_POS); -} -/** - * @brief DMA Channel 3 Setting BCR Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch3setbcer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH3SETBCER_MSK)>>DMA_EMSG_CH3SETBCER_POS); -} -/** - * @brief DMA Channel 2 PFCTRL Size not match,last data have error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch2pfser(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH2PFSER_MSK)>>DMA_EMSG_CH2PFSER_POS); -} -/** - * @brief DMA Channel 2 PFCTRL Over run Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch2pfov(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH2PFOV_MSK)>>DMA_EMSG_CH2PFOV_POS); -} -/** - * @brief DMA Channel 2 Setting Burst Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch2setbuer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH2SETBUER_MSK)>>DMA_EMSG_CH2SETBUER_POS); -} -/** - * @brief DMA Channel 2 Setting BCR Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch2setbcer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH2SETBCER_MSK)>>DMA_EMSG_CH2SETBCER_POS); -} -/** - * @brief DMA Channel 1 PFCTRL Size not match,last data have error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch1pfser(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH1PFSER_MSK)>>DMA_EMSG_CH1PFSER_POS); -} -/** - * @brief DMA Channel 1 PFCTRL Over run Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch1pfov(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH1PFOV_MSK)>>DMA_EMSG_CH1PFOV_POS); -} -/** - * @brief DMA Channel 1 Setting Burst Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch1setbuer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH1SETBUER_MSK)>>DMA_EMSG_CH1SETBUER_POS); -} -/** - * @brief DMA Channel 1 Setting BCR Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch1setbcer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH1SETBCER_MSK)>>DMA_EMSG_CH1SETBCER_POS); -} -/** - * @brief DMA Channel 0 PFCTRL Size not match,last data have error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch0pfser(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH0PFSER_MSK)>>DMA_EMSG_CH0PFSER_POS); -} -/** - * @brief DMA Channel 0 PFCTRL Over run Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch0pfov(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH0PFOV_MSK)>>DMA_EMSG_CH0PFOV_POS); -} -/** - * @brief DMA Channel 0 Setting Burst Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch0setbuer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH0SETBUER_MSK)>>DMA_EMSG_CH0SETBUER_POS); -} -/** - * @brief DMA Channel 0 Setting BCR Error Status bit. - * @param dma DMA Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_dma_get_emsg_ch0setbcer(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->EMSG, DMA_EMSG_CH0SETBCER_MSK)>>DMA_EMSG_CH0SETBCER_POS); -} -/** - * @brief Get DMA error message register - * @param dma DMA Instance - * @retval DMA channel error message status - */ -__STATIC_INLINE uint32_t md_dma_get_emsg(DMA_TypeDef *dma) -{ - return (READ_REG(dma->EMSG)); -} - -/** - * @brief Set Destination Increment Offset Size bit. - * @note This bit has no meaning if bit DINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if DBUSEL are different from 00. - * @param dma DMA Instance - * @param dincos can be one of the following values: - * @arg @ref MD_DMA_DINCOS_LINKED_DWSEL - * @arg @ref MD_DMA_DINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_dincos(DMA_TypeDef *dma, uint32_t dincos) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_DINCOS_MSK, (dincos<CSR0, DMA_CSR0_DINCOS_MSK)>>DMA_CSR0_DINCOS_POS); -} -/** - * @brief Set Destination Transfer Burst Selection. - * @param dma DMA Instance - * @param dbusel can be one of the following values: - * @arg @ref MD_DMA_DBUSEL_SINGLE - * @arg @ref MD_DMA_DBUSEL_WRAP4 - * @arg @ref MD_DMA_DBUSEL_INCR4 - * @arg @ref MD_DMA_DBUSEL_WRAP8 - * @arg @ref MD_DMA_DBUSEL_INCR8 - * @arg @ref MD_DMA_DBUSEL_WRAP16 - * @arg @ref MD_DMA_DBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_dbusel(DMA_TypeDef *dma, uint32_t dbusel) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_DBUSEL_MSK, (dbusel<CSR0, DMA_CSR0_DBUSEL_MSK)>>DMA_CSR0_DBUSEL_POSS); -} -/** - * @brief Set Destination Transfer Data Width Selection. - * @param dma DMA Instance - * @param ddwsel can be one of the following values: - * @arg @ref MD_DMA_DDWSEL_ONE_BYTE - * @arg @ref MD_DMA_DDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_DDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_ddwsel(DMA_TypeDef *dma, uint32_t ddwsel) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_DDWSEL_MSK, (ddwsel<CSR0, DMA_CSR0_DDWSEL_MSK)>>DMA_CSR0_DDWSEL_POSS); -} -/** - * @brief Set Destination Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_dinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_DINC_MSK, (dinc<CSR0, DMA_CSR0_DINC_MSK)>>DMA_CSR0_DINC_POS); -} -/** - * @brief Set Source Increment Offset Size bit. - * @note This bit has no meaning if bit SINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if SBUSEL are different from 00. - * @param dma DMA Instance - * @param sincos can be one of the following values: - * @arg @ref MD_DMA_SINCOS_LINKED_SWSEL - * @arg @ref MD_DMA_SINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_sincos(DMA_TypeDef *dma, uint32_t sincos) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_SINCOS_MSK, (sincos<CSR0, DMA_CSR0_SINCOS_MSK)>>DMA_CSR0_SINCOS_POS); -} -/** - * @brief Set Source Transfer Burst Selection. - * @param dma DMA Instance - * @param sbusel can be one of the following values: - * @arg @ref MD_DMA_SBUSEL_SINGLE - * @arg @ref MD_DMA_SBUSEL_WRAP4 - * @arg @ref MD_DMA_SBUSEL_INCR4 - * @arg @ref MD_DMA_SBUSEL_WRAP8 - * @arg @ref MD_DMA_SBUSEL_INCR8 - * @arg @ref MD_DMA_SBUSEL_WRAP16 - * @arg @ref MD_DMA_SBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_sbusel(DMA_TypeDef *dma, uint32_t sbusel) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_SBUSEL_MSK, (sbusel<CSR0, DMA_CSR0_SBUSEL_MSK)>>DMA_CSR0_SBUSEL_POSS); -} -/** - * @brief Set Source Transfer Data Width Selection. - * @param dma DMA Instance - * @param sdwsel can be one of the following values: - * @arg @ref MD_DMA_SDWSEL_ONE_BYTE - * @arg @ref MD_DMA_SDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_SDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_sdwsel(DMA_TypeDef *dma, uint32_t sdwsel) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_SDWSEL_MSK, (sdwsel<CSR0, DMA_CSR0_SDWSEL_MSK)>>DMA_CSR0_SDWSEL_POSS); -} -/** - * @brief Set Source Transfer Increment Mode - * @param dma DMA Instance - * @param sinc can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_sinc(DMA_TypeDef *dma, uint32_t sinc) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_SINC_MSK, (sinc<CSR0, DMA_CSR0_SINC_MSK)>>DMA_CSR0_SINC_POS); -} -/** - * @brief Set Peripheral Handshake Software Select - * @param dma DMA Instance - * @param phss can be one of the following values: - * @arg @ref MD_DMA_PHSS_UART1_TX - * @arg @ref MD_DMA_PHSS_UART2_TX - * @arg @ref MD_DMA_PHSS_UART3_TX - * @arg @ref MD_DMA_PHSS_SUART1_TX - * @arg @ref MD_DMA_PHSS_SUART2_TX - * @arg @ref MD_DMA_PHSS_SPI1_TX - * @arg @ref MD_DMA_PHSS_SPI2_TX - * @arg @ref MD_DMA_PHSS_I2C1_TX - * @arg @ref MD_DMA_PHSS_I2C2_TX - * @arg @ref MD_DMA_PHSS_AES_IN - * @arg @ref MD_DMA_PHSS_DAC - * @arg @ref MD_DMA_PHSS_CRC - * @arg @ref MD_DMA_PHSS_UART1_RX - * @arg @ref MD_DMA_PHSS_UART2_RX - * @arg @ref MD_DMA_PHSS_UART3_RX - * @arg @ref MD_DMA_PHSS_SUART1_RX - * @arg @ref MD_DMA_PHSS_SUART2_RX - * @arg @ref MD_DMA_PHSS_SPI1_RTX - * @arg @ref MD_DMA_PHSS_SPI2_RX - * @arg @ref MD_DMA_PHSS_I2C1_RX - * @arg @ref MD_DMA_PHSS_I2C2_RX - * @arg @ref MD_DMA_PHSS_AES_OUT - * @arg @ref MD_DMA_PHSS_ADCSS0 - * @arg @ref MD_DMA_PHSS_ADCSS1 - * @arg @ref MD_DMA_PHSS_ADCSS2 - * @arg @ref MD_DMA_PHSS_ADCSS3 - * @arg @ref MD_DMA_PHSS_BS16T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_AD16C4T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_AD16C4T1_COM - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP32C4T1_UP - * @arg @ref MD_DMA_PHSS_GP32C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T1_UP - * @arg @ref MD_DMA_PHSS_GP16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T2_UP - * @arg @ref MD_DMA_PHSS_GP16C4T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T3_UP - * @arg @ref MD_DMA_PHSS_GP16C4T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T1_UP - * @arg @ref MD_DMA_PHSS_GP16C2T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_COM - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T2_UP - * @arg @ref MD_DMA_PHSS_GP16C2T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T2_COM - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T3_UP - * @arg @ref MD_DMA_PHSS_GP16C2T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T3_COM - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T4_UP - * @arg @ref MD_DMA_PHSS_GP16C2T4_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T4_COM - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_phss(DMA_TypeDef *dma, uint32_t phss) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_PHSS_MSK, (phss<CSR0, DMA_CSR0_PHSS_MSK)>>DMA_CSR0_PHSS_POSS); -} -/** - * @brief Set DMA Channel Priority. - * @param dma DMA Instance - * @param chpri can be one of the following values: - * @arg @ref MD_DMA_CHPRI_LV0 - * @arg @ref MD_DMA_CHPRI_LV1 - * @arg @ref MD_DMA_CHPRI_LV2 - * @arg @ref MD_DMA_CHPRI_LV3 - * @arg @ref MD_DMA_CHPRI_LV4 - * @arg @ref MD_DMA_CHPRI_LV5 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_chpri(DMA_TypeDef *dma, uint32_t chpri) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_CHPRI_MSK, (chpri<CSR0, DMA_CSR0_CHPRI_MSK)>>DMA_CSR0_CHPRI_POSS); -} -/** - * @brief Set DMA Mode Select. - * @param dma DMA Instance - * @param modesel can be one of the following values: - * @arg @ref MD_DMA_MODESEL_MEM_TO_MEM - * @arg @ref MD_DMA_MODESEL_PER_TO_MEM - * @arg @ref MD_DMA_MODESEL_MEM_TO_PER - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_modesel(DMA_TypeDef *dma, uint32_t modesel) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_MODESEL_MSK, (modesel<CSR0, DMA_CSR0_MODESEL_MSK)>>DMA_CSR0_MODESEL_POSS); -} -/** - * @brief Set Direct Mode Enable. - * @param dma DMA Instance - * @param dirmden can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_dirmden(DMA_TypeDef *dma, uint32_t dirmden) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_DIRMDEN_MSK, (dirmden<CSR0, DMA_CSR0_DIRMDEN_MSK)>>DMA_CSR0_DIRMDEN_POS); -} -/** - * @brief Set Peripheral flow controller - * @param dma DMA Instance - * @param pfctrl can be one of the following values: - * @arg @ref MD_DMA_PFCTRL_DMA_CTRL - * @arg @ref MD_DMA_PFCTRL_PER_CTRL - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_pfctrl(DMA_TypeDef *dma, uint32_t pfctrl) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_PFCTRL_MSK, (pfctrl<CSR0, DMA_CSR0_PFCTRL_MSK)>>DMA_CSR0_PFCTRL_POS); -} -/** - * @brief Set Circular mode - * @param dma DMA Instance - * @param circ can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_circ(DMA_TypeDef *dma, uint32_t circ) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_CIRC_MSK, (circ<CSR0, DMA_CSR0_CIRC_MSK)>>DMA_CSR0_CIRC_POS); -} -/** - * @brief Set DMA Channel Enable. - * @param dma DMA Instance - * @param chen can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr0_chen(DMA_TypeDef *dma, uint32_t chen) -{ - MODIFY_REG(dma->CSR0, DMA_CSR0_CHEN_MSK, (chen<CSR0, DMA_CSR0_CHEN_MSK)>>DMA_CSR0_CHEN_POS); -} - -/** @defgroup MD_DMA_CSR0_DINCOS DINCOS - * @brief Set Destination Increment Offset Size bit for md_dma_set_cs0() function used - * @param dincos This parameter can be one of the following values: - * @arg @ref MD_DMA_DINCOS_LINKED_DWSEL - * @arg @ref MD_DMA_DINCOS_FIXED_TO_4 - * @{ - */ -#define md_dma_set_csr0_dincos_fun(dincos) (dincos<CSR0, (dincos|dbusel|ddwsel|dinc|sincos|sbusel|sdwsel|sinc| - phss|chpri|modesel|dirmden|pfctrl|circ|chen)); -} - - -/** - * @brief Set DMA Transfer Source Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param sar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_sar0_sar(DMA_TypeDef *dma, uint32_t sar) -{ - MODIFY_REG(dma->SAR0, DMA_SAR0_SAR_MSK, (sar<SAR0, DMA_SAR0_SAR_MSK)>>DMA_SAR0_SAR_POSS); -} - -/** - * @brief Set DMA Transfer Destination Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param dar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_dar0_dar(DMA_TypeDef *dma, uint32_t dar) -{ - MODIFY_REG(dma->DAR0, DMA_DAR0_DAR_MSK, (dar<DAR0, DMA_DAR0_DAR_MSK)>>DMA_DAR0_DAR_POSS); -} - -/** - * @brief Get DMA Current Transfer Byte Count - * @param dma DMA Instance - * @retval The retval can be one of the following values: - * @arg Max Value 65535 - * @arg Min Value 0 - */ -__STATIC_INLINE uint32_t md_dma_get_bcr0_cbcr(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->BCR0, DMA_BCR0_CBCR_MSK)>>DMA_BCR0_CBCR_POSS); -} -/** - * @brief Set DMA Transfer Byte Count Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param bcr This field indicates a 16-bit transfer byte count of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_bcr0_bcr(DMA_TypeDef *dma, uint32_t bcr) -{ - MODIFY_REG(dma->BCR0, DMA_BCR0_BCR_MSK, (bcr<BCR0, DMA_BCR0_BCR_MSK)>>DMA_BCR0_BCR_POSS); -} - -/** - * @brief Set Destination Increment Offset Size bit. - * @note This bit has no meaning if bit DINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if DBUSEL are different from 00. - * @param dma DMA Instance - * @param dincos can be one of the following values: - * @arg @ref MD_DMA_DINCOS_LINKED_DWSEL - * @arg @ref MD_DMA_DINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_dincos(DMA_TypeDef *dma, uint32_t dincos) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_DINCOS_MSK, (dincos<CSR1, DMA_CSR1_DINCOS_MSK)>>DMA_CSR1_DINCOS_POS); -} -/** - * @brief Set Destination Transfer Burst Selection. - * @param dma DMA Instance - * @param dbusel can be one of the following values: - * @arg @ref MD_DMA_DBUSEL_SINGLE - * @arg @ref MD_DMA_DBUSEL_WRAP4 - * @arg @ref MD_DMA_DBUSEL_INCR4 - * @arg @ref MD_DMA_DBUSEL_WRAP8 - * @arg @ref MD_DMA_DBUSEL_INCR8 - * @arg @ref MD_DMA_DBUSEL_WRAP16 - * @arg @ref MD_DMA_DBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_dbusel(DMA_TypeDef *dma, uint32_t dbusel) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_DBUSEL_MSK, (dbusel<CSR1, DMA_CSR1_DBUSEL_MSK)>>DMA_CSR1_DBUSEL_POSS); -} -/** - * @brief Set Destination Transfer Data Width Selection. - * @param dma DMA Instance - * @param ddwsel can be one of the following values: - * @arg @ref MD_DMA_DDWSEL_ONE_BYTE - * @arg @ref MD_DMA_DDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_DDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_ddwsel(DMA_TypeDef *dma, uint32_t ddwsel) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_DDWSEL_MSK, (ddwsel<CSR1, DMA_CSR1_DDWSEL_MSK)>>DMA_CSR1_DDWSEL_POSS); -} -/** - * @brief Set Destination Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_dinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_DINC_MSK, (dinc<CSR1, DMA_CSR1_DINC_MSK)>>DMA_CSR1_DINC_POS); -} -/** - * @brief Set Source Increment Offset Size bit. - * @note This bit has no meaning if bit SINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if SBUSEL are different from 00. - * @param dma DMA Instance - * @param sincos can be one of the following values: - * @arg @ref MD_DMA_SINCOS_LINKED_SWSEL - * @arg @ref MD_DMA_SINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_sincos(DMA_TypeDef *dma, uint32_t sincos) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_SINCOS_MSK, (sincos<CSR1, DMA_CSR1_SINCOS_MSK)>>DMA_CSR1_SINCOS_POS); -} -/** - * @brief Set Source Transfer Burst Selection. - * @param dma DMA Instance - * @param sbusel can be one of the following values: - * @arg @ref MD_DMA_SBUSEL_SINGLE - * @arg @ref MD_DMA_SBUSEL_WRAP4 - * @arg @ref MD_DMA_SBUSEL_INCR4 - * @arg @ref MD_DMA_SBUSEL_WRAP8 - * @arg @ref MD_DMA_SBUSEL_INCR8 - * @arg @ref MD_DMA_SBUSEL_WRAP16 - * @arg @ref MD_DMA_SBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_sbusel(DMA_TypeDef *dma, uint32_t sbusel) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_SBUSEL_MSK, (sbusel<CSR1, DMA_CSR1_SBUSEL_MSK)>>DMA_CSR1_SBUSEL_POSS); -} -/** - * @brief Set Source Transfer Data Width Selection. - * @param dma DMA Instance - * @param sdwsel can be one of the following values: - * @arg @ref MD_DMA_SDWSEL_ONE_BYTE - * @arg @ref MD_DMA_SDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_SDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_sdwsel(DMA_TypeDef *dma, uint32_t sdwsel) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_SDWSEL_MSK, (sdwsel<CSR1, DMA_CSR1_SDWSEL_MSK)>>DMA_CSR1_SDWSEL_POSS); -} -/** - * @brief Set Source Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_sinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_SINC_MSK, (dinc<CSR1, DMA_CSR1_SINC_MSK)>>DMA_CSR1_SINC_POS); -} -/** - * @brief Set Peripheral Handshake Software Select - * @param dma DMA Instance - * @param phss can be one of the following values: - * @arg @ref MD_DMA_PHSS_UART1_TX - * @arg @ref MD_DMA_PHSS_UART2_TX - * @arg @ref MD_DMA_PHSS_UART3_TX - * @arg @ref MD_DMA_PHSS_SUART1_TX - * @arg @ref MD_DMA_PHSS_SUART2_TX - * @arg @ref MD_DMA_PHSS_SPI1_TX - * @arg @ref MD_DMA_PHSS_SPI2_TX - * @arg @ref MD_DMA_PHSS_I2C1_TX - * @arg @ref MD_DMA_PHSS_I2C2_TX - * @arg @ref MD_DMA_PHSS_AES_IN - * @arg @ref MD_DMA_PHSS_DAC - * @arg @ref MD_DMA_PHSS_CRC - * @arg @ref MD_DMA_PHSS_UART1_RX - * @arg @ref MD_DMA_PHSS_UART2_RX - * @arg @ref MD_DMA_PHSS_UART3_RX - * @arg @ref MD_DMA_PHSS_SUART1_RX - * @arg @ref MD_DMA_PHSS_SUART2_RX - * @arg @ref MD_DMA_PHSS_SPI1_RTX - * @arg @ref MD_DMA_PHSS_SPI2_RX - * @arg @ref MD_DMA_PHSS_I2C1_RX - * @arg @ref MD_DMA_PHSS_I2C2_RX - * @arg @ref MD_DMA_PHSS_AES_OUT - * @arg @ref MD_DMA_PHSS_ADCSS0 - * @arg @ref MD_DMA_PHSS_ADCSS1 - * @arg @ref MD_DMA_PHSS_ADCSS2 - * @arg @ref MD_DMA_PHSS_ADCSS3 - * @arg @ref MD_DMA_PHSS_BS16T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_AD16C4T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_AD16C4T1_COM - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP32C4T1_UP - * @arg @ref MD_DMA_PHSS_GP32C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T1_UP - * @arg @ref MD_DMA_PHSS_GP16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T2_UP - * @arg @ref MD_DMA_PHSS_GP16C4T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T3_UP - * @arg @ref MD_DMA_PHSS_GP16C4T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T1_UP - * @arg @ref MD_DMA_PHSS_GP16C2T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_COM - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T2_UP - * @arg @ref MD_DMA_PHSS_GP16C2T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T2_COM - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T3_UP - * @arg @ref MD_DMA_PHSS_GP16C2T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T3_COM - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T4_UP - * @arg @ref MD_DMA_PHSS_GP16C2T4_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T4_COM - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_phss(DMA_TypeDef *dma, uint32_t phss) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_PHSS_MSK, (phss<CSR1, DMA_CSR1_PHSS_MSK)>>DMA_CSR1_PHSS_POSS); -} -/** - * @brief Set DMA Channel Priority. - * @param dma DMA Instance - * @param chpri can be one of the following values: - * @arg @ref MD_DMA_CHPRI_LV0 - * @arg @ref MD_DMA_CHPRI_LV1 - * @arg @ref MD_DMA_CHPRI_LV2 - * @arg @ref MD_DMA_CHPRI_LV3 - * @arg @ref MD_DMA_CHPRI_LV4 - * @arg @ref MD_DMA_CHPRI_LV5 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_chpri(DMA_TypeDef *dma, uint32_t chpri) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_CHPRI_MSK, (chpri<CSR1, DMA_CSR1_CHPRI_MSK)>>DMA_CSR1_CHPRI_POSS); -} -/** - * @brief Set DMA Mode Select. - * @param dma DMA Instance - * @param modesel can be one of the following values: - * @arg @ref MD_DMA_MODESEL_MEM_TO_MEM - * @arg @ref MD_DMA_MODESEL_PER_TO_MEM - * @arg @ref MD_DMA_MODESEL_MEM_TO_PER - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_modesel(DMA_TypeDef *dma, uint32_t modesel) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_MODESEL_MSK, (modesel<CSR1, DMA_CSR1_MODESEL_MSK)>>DMA_CSR1_MODESEL_POSS); -} -/** - * @brief Set Direct Mode Enable. - * @param dma DMA Instance - * @param dirmden can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_dirmden(DMA_TypeDef *dma, uint32_t dirmden) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_DIRMDEN_MSK, (dirmden<CSR1, DMA_CSR1_DIRMDEN_MSK)>>DMA_CSR1_DIRMDEN_POS); -} -/** - * @brief Set Peripheral flow controller - * @param dma DMA Instance - * @param pfctrl can be one of the following values: - * @arg @ref MD_DMA_PFCTRL_DMA_CTRL - * @arg @ref MD_DMA_PFCTRL_PER_CTRL - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_pfctrl(DMA_TypeDef *dma, uint32_t pfctrl) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_PFCTRL_MSK, (pfctrl<CSR1, DMA_CSR1_PFCTRL_MSK)>>DMA_CSR1_PFCTRL_POS); -} -/** - * @brief Set Circular mode - * @param dma DMA Instance - * @param circ can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_circ(DMA_TypeDef *dma, uint32_t circ) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_CIRC_MSK, (circ<CSR1, DMA_CSR1_CIRC_MSK)>>DMA_CSR1_CIRC_POS); -} -/** - * @brief Set DMA Channel Enable. - * @param dma DMA Instance - * @param chen can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr1_chen(DMA_TypeDef *dma, uint32_t chen) -{ - MODIFY_REG(dma->CSR1, DMA_CSR1_CHEN_MSK, (chen<CSR1, DMA_CSR1_CHEN_MSK)>>DMA_CSR1_CHEN_POS); -} - -/** - * @brief Set DMA Transfer Source Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param sar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_sar1_sar(DMA_TypeDef *dma, uint32_t sar) -{ - MODIFY_REG(dma->SAR1, DMA_SAR1_SAR_MSK, (sar<SAR1, DMA_SAR1_SAR_MSK)>>DMA_SAR1_SAR_POSS); -} - -/** - * @brief Set DMA Transfer Destination Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param dar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_dar1_dar(DMA_TypeDef *dma, uint32_t dar) -{ - MODIFY_REG(dma->DAR1, DMA_DAR1_DAR_MSK, (dar<DAR1, DMA_DAR1_DAR_MSK)>>DMA_DAR1_DAR_POSS); -} - -/** - * @brief Get DMA Current Transfer Byte Count - * @param dma DMA Instance - * @retval The retval can be one of the following values: - * @arg Max Value 65535 - * @arg Min Value 0 - */ -__STATIC_INLINE uint32_t md_dma_get_bcr1_cbcr(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->BCR1, DMA_BCR1_CBCR_MSK)>>DMA_BCR1_CBCR_POSS); -} -/** - * @brief Set DMA Transfer Byte Count Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param bcr This field indicates a 16-bit transfer byte count of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_bcr1_bcr(DMA_TypeDef *dma, uint32_t bcr) -{ - MODIFY_REG(dma->BCR1, DMA_BCR1_BCR_MSK, (bcr<BCR1, DMA_BCR1_BCR_MSK)>>DMA_BCR1_BCR_POSS); -} - -/** - * @brief Set Destination Increment Offset Size bit. - * @note This bit has no meaning if bit DINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if DBUSEL are different from 00. - * @param dma DMA Instance - * @param dincos can be one of the following values: - * @arg @ref MD_DMA_DINCOS_LINKED_DWSEL - * @arg @ref MD_DMA_DINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_dincos(DMA_TypeDef *dma, uint32_t dincos) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_DINCOS_MSK, (dincos<CSR2, DMA_CSR2_DINCOS_MSK)>>DMA_CSR2_DINCOS_POS); -} -/** - * @brief Set Destination Transfer Burst Selection. - * @param dma DMA Instance - * @param dbusel can be one of the following values: - * @arg @ref MD_DMA_DBUSEL_SINGLE - * @arg @ref MD_DMA_DBUSEL_WRAP4 - * @arg @ref MD_DMA_DBUSEL_INCR4 - * @arg @ref MD_DMA_DBUSEL_WRAP8 - * @arg @ref MD_DMA_DBUSEL_INCR8 - * @arg @ref MD_DMA_DBUSEL_WRAP16 - * @arg @ref MD_DMA_DBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_dbusel(DMA_TypeDef *dma, uint32_t dbusel) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_DBUSEL_MSK, (dbusel<CSR2, DMA_CSR2_DBUSEL_MSK)>>DMA_CSR2_DBUSEL_POSS); -} -/** - * @brief Set Destination Transfer Data Width Selection. - * @param dma DMA Instance - * @param ddwsel can be one of the following values: - * @arg @ref MD_DMA_DDWSEL_ONE_BYTE - * @arg @ref MD_DMA_DDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_DDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_ddwsel(DMA_TypeDef *dma, uint32_t ddwsel) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_DDWSEL_MSK, (ddwsel<CSR2, DMA_CSR2_DDWSEL_MSK)>>DMA_CSR2_DDWSEL_POSS); -} -/** - * @brief Set Destination Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_dinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_DINC_MSK, (dinc<CSR2, DMA_CSR2_DINC_MSK)>>DMA_CSR2_DINC_POS); -} -/** - * @brief Set Source Increment Offset Size bit. - * @note This bit has no meaning if bit SINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if SBUSEL are different from 00. - * @param dma DMA Instance - * @param sincos can be one of the following values: - * @arg @ref MD_DMA_SINCOS_LINKED_SWSEL - * @arg @ref MD_DMA_SINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_sincos(DMA_TypeDef *dma, uint32_t sincos) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_SINCOS_MSK, (sincos<CSR2, DMA_CSR2_SINCOS_MSK)>>DMA_CSR2_SINCOS_POS); -} -/** - * @brief Set Source Transfer Burst Selection. - * @param dma DMA Instance - * @param sbusel can be one of the following values: - * @arg @ref MD_DMA_SBUSEL_SINGLE - * @arg @ref MD_DMA_SBUSEL_WRAP4 - * @arg @ref MD_DMA_SBUSEL_INCR4 - * @arg @ref MD_DMA_SBUSEL_WRAP8 - * @arg @ref MD_DMA_SBUSEL_INCR8 - * @arg @ref MD_DMA_SBUSEL_WRAP16 - * @arg @ref MD_DMA_SBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_sbusel(DMA_TypeDef *dma, uint32_t sbusel) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_SBUSEL_MSK, (sbusel<CSR2, DMA_CSR2_SBUSEL_MSK)>>DMA_CSR2_SBUSEL_POSS); -} -/** - * @brief Set Source Transfer Data Width Selection. - * @param dma DMA Instance - * @param sdwsel can be one of the following values: - * @arg @ref MD_DMA_SDWSEL_ONE_BYTE - * @arg @ref MD_DMA_SDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_SDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_sdwsel(DMA_TypeDef *dma, uint32_t sdwsel) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_SDWSEL_MSK, (sdwsel<CSR2, DMA_CSR2_SDWSEL_MSK)>>DMA_CSR2_SDWSEL_POSS); -} -/** - * @brief Set Source Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_sinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_SINC_MSK, (dinc<CSR2, DMA_CSR2_SINC_MSK)>>DMA_CSR2_SINC_POS); -} -/** - * @brief Set Peripheral Handshake Software Select - * @param dma DMA Instance - * @param phss can be one of the following values: - * @arg @ref MD_DMA_PHSS_UART1_TX - * @arg @ref MD_DMA_PHSS_UART2_TX - * @arg @ref MD_DMA_PHSS_UART3_TX - * @arg @ref MD_DMA_PHSS_SUART1_TX - * @arg @ref MD_DMA_PHSS_SUART2_TX - * @arg @ref MD_DMA_PHSS_SPI1_TX - * @arg @ref MD_DMA_PHSS_SPI2_TX - * @arg @ref MD_DMA_PHSS_I2C1_TX - * @arg @ref MD_DMA_PHSS_I2C2_TX - * @arg @ref MD_DMA_PHSS_AES_IN - * @arg @ref MD_DMA_PHSS_DAC - * @arg @ref MD_DMA_PHSS_CRC - * @arg @ref MD_DMA_PHSS_UART1_RX - * @arg @ref MD_DMA_PHSS_UART2_RX - * @arg @ref MD_DMA_PHSS_UART3_RX - * @arg @ref MD_DMA_PHSS_SUART1_RX - * @arg @ref MD_DMA_PHSS_SUART2_RX - * @arg @ref MD_DMA_PHSS_SPI1_RTX - * @arg @ref MD_DMA_PHSS_SPI2_RX - * @arg @ref MD_DMA_PHSS_I2C1_RX - * @arg @ref MD_DMA_PHSS_I2C2_RX - * @arg @ref MD_DMA_PHSS_AES_OUT - * @arg @ref MD_DMA_PHSS_ADCSS0 - * @arg @ref MD_DMA_PHSS_ADCSS1 - * @arg @ref MD_DMA_PHSS_ADCSS2 - * @arg @ref MD_DMA_PHSS_ADCSS3 - * @arg @ref MD_DMA_PHSS_BS16T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_AD16C4T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_AD16C4T1_COM - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP32C4T1_UP - * @arg @ref MD_DMA_PHSS_GP32C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T1_UP - * @arg @ref MD_DMA_PHSS_GP16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T2_UP - * @arg @ref MD_DMA_PHSS_GP16C4T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T3_UP - * @arg @ref MD_DMA_PHSS_GP16C4T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T1_UP - * @arg @ref MD_DMA_PHSS_GP16C2T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_COM - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T2_UP - * @arg @ref MD_DMA_PHSS_GP16C2T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T2_COM - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T3_UP - * @arg @ref MD_DMA_PHSS_GP16C2T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T3_COM - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T4_UP - * @arg @ref MD_DMA_PHSS_GP16C2T4_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T4_COM - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_phss(DMA_TypeDef *dma, uint32_t phss) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_PHSS_MSK, (phss<CSR2, DMA_CSR2_PHSS_MSK)>>DMA_CSR2_PHSS_POSS); -} -/** - * @brief Set DMA Channel Priority. - * @param dma DMA Instance - * @param chpri can be one of the following values: - * @arg @ref MD_DMA_CHPRI_LV0 - * @arg @ref MD_DMA_CHPRI_LV1 - * @arg @ref MD_DMA_CHPRI_LV2 - * @arg @ref MD_DMA_CHPRI_LV3 - * @arg @ref MD_DMA_CHPRI_LV4 - * @arg @ref MD_DMA_CHPRI_LV5 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_chpri(DMA_TypeDef *dma, uint32_t chpri) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_CHPRI_MSK, (chpri<CSR2, DMA_CSR2_CHPRI_MSK)>>DMA_CSR2_CHPRI_POSS); -} -/** - * @brief Set DMA Mode Select. - * @param dma DMA Instance - * @param modesel can be one of the following values: - * @arg @ref MD_DMA_MODESEL_MEM_TO_MEM - * @arg @ref MD_DMA_MODESEL_PER_TO_MEM - * @arg @ref MD_DMA_MODESEL_MEM_TO_PER - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_modesel(DMA_TypeDef *dma, uint32_t modesel) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_MODESEL_MSK, (modesel<CSR2, DMA_CSR2_MODESEL_MSK)>>DMA_CSR2_MODESEL_POSS); -} -/** - * @brief Set Direct Mode Enable. - * @param dma DMA Instance - * @param dirmden can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_dirmden(DMA_TypeDef *dma, uint32_t dirmden) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_DIRMDEN_MSK, (dirmden<CSR2, DMA_CSR2_DIRMDEN_MSK)>>DMA_CSR2_DIRMDEN_POS); -} -/** - * @brief Set Peripheral flow controller - * @param dma DMA Instance - * @param pfctrl can be one of the following values: - * @arg @ref MD_DMA_PFCTRL_DMA_CTRL - * @arg @ref MD_DMA_PFCTRL_PER_CTRL - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_pfctrl(DMA_TypeDef *dma, uint32_t pfctrl) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_PFCTRL_MSK, (pfctrl<CSR2, DMA_CSR2_PFCTRL_MSK)>>DMA_CSR2_PFCTRL_POS); -} -/** - * @brief Set Circular mode - * @param dma DMA Instance - * @param circ can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_circ(DMA_TypeDef *dma, uint32_t circ) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_CIRC_MSK, (circ<CSR2, DMA_CSR2_CIRC_MSK)>>DMA_CSR2_CIRC_POS); -} -/** - * @brief Set DMA Channel Enable. - * @param dma DMA Instance - * @param chen can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr2_chen(DMA_TypeDef *dma, uint32_t chen) -{ - MODIFY_REG(dma->CSR2, DMA_CSR2_CHEN_MSK, (chen<CSR2, DMA_CSR2_CHEN_MSK)>>DMA_CSR2_CHEN_POS); -} - -/** - * @brief Set DMA Transfer Source Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param sar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_sar2_sar(DMA_TypeDef *dma, uint32_t sar) -{ - MODIFY_REG(dma->SAR2, DMA_SAR2_SAR_MSK, (sar<SAR2, DMA_SAR2_SAR_MSK)>>DMA_SAR2_SAR_POSS); -} - -/** - * @brief Set DMA Transfer Destination Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param dar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_dar2_dar(DMA_TypeDef *dma, uint32_t dar) -{ - MODIFY_REG(dma->DAR2, DMA_DAR2_DAR_MSK, (dar<DAR2, DMA_DAR2_DAR_MSK)>>DMA_DAR2_DAR_POSS); -} - -/** - * @brief Get DMA Current Transfer Byte Count - * @param dma DMA Instance - * @retval The retval can be one of the following values: - * @arg Max Value 65535 - * @arg Min Value 0 - */ -__STATIC_INLINE uint32_t md_dma_get_bcr2_cbcr(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->BCR2, DMA_BCR2_CBCR_MSK)>>DMA_BCR2_CBCR_POSS); -} -/** - * @brief Set DMA Transfer Byte Count Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param bcr This field indicates a 16-bit transfer byte count of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_bcr2_bcr(DMA_TypeDef *dma, uint32_t bcr) -{ - MODIFY_REG(dma->BCR2, DMA_BCR2_BCR_MSK, (bcr<BCR2, DMA_BCR2_BCR_MSK)>>DMA_BCR2_BCR_POSS); -} - -/** - * @brief Set Destination Increment Offset Size bit. - * @note This bit has no meaning if bit DINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if DBUSEL are different from 00. - * @param dma DMA Instance - * @param dincos can be one of the following values: - * @arg @ref MD_DMA_DINCOS_LINKED_DWSEL - * @arg @ref MD_DMA_DINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_dincos(DMA_TypeDef *dma, uint32_t dincos) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_DINCOS_MSK, (dincos<CSR3, DMA_CSR3_DINCOS_MSK)>>DMA_CSR3_DINCOS_POS); -} -/** - * @brief Set Destination Transfer Burst Selection. - * @param dma DMA Instance - * @param dbusel can be one of the following values: - * @arg @ref MD_DMA_DBUSEL_SINGLE - * @arg @ref MD_DMA_DBUSEL_WRAP4 - * @arg @ref MD_DMA_DBUSEL_INCR4 - * @arg @ref MD_DMA_DBUSEL_WRAP8 - * @arg @ref MD_DMA_DBUSEL_INCR8 - * @arg @ref MD_DMA_DBUSEL_WRAP16 - * @arg @ref MD_DMA_DBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_dbusel(DMA_TypeDef *dma, uint32_t dbusel) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_DBUSEL_MSK, (dbusel<CSR3, DMA_CSR3_DBUSEL_MSK)>>DMA_CSR3_DBUSEL_POSS); -} -/** - * @brief Set Destination Transfer Data Width Selection. - * @param dma DMA Instance - * @param ddwsel can be one of the following values: - * @arg @ref MD_DMA_DDWSEL_ONE_BYTE - * @arg @ref MD_DMA_DDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_DDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_ddwsel(DMA_TypeDef *dma, uint32_t ddwsel) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_DDWSEL_MSK, (ddwsel<CSR3, DMA_CSR3_DDWSEL_MSK)>>DMA_CSR3_DDWSEL_POSS); -} -/** - * @brief Set Destination Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_dinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_DINC_MSK, (dinc<CSR3, DMA_CSR3_DINC_MSK)>>DMA_CSR3_DINC_POS); -} -/** - * @brief Set Source Increment Offset Size bit. - * @note This bit has no meaning if bit SINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if SBUSEL are different from 00. - * @param dma DMA Instance - * @param sincos can be one of the following values: - * @arg @ref MD_DMA_SINCOS_LINKED_SWSEL - * @arg @ref MD_DMA_SINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_sincos(DMA_TypeDef *dma, uint32_t sincos) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_SINCOS_MSK, (sincos<CSR3, DMA_CSR3_SINCOS_MSK)>>DMA_CSR3_SINCOS_POS); -} -/** - * @brief Set Source Transfer Burst Selection. - * @param dma DMA Instance - * @param sbusel can be one of the following values: - * @arg @ref MD_DMA_SBUSEL_SINGLE - * @arg @ref MD_DMA_SBUSEL_WRAP4 - * @arg @ref MD_DMA_SBUSEL_INCR4 - * @arg @ref MD_DMA_SBUSEL_WRAP8 - * @arg @ref MD_DMA_SBUSEL_INCR8 - * @arg @ref MD_DMA_SBUSEL_WRAP16 - * @arg @ref MD_DMA_SBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_sbusel(DMA_TypeDef *dma, uint32_t sbusel) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_SBUSEL_MSK, (sbusel<CSR3, DMA_CSR3_SBUSEL_MSK)>>DMA_CSR3_SBUSEL_POSS); -} -/** - * @brief Set Source Transfer Data Width Selection. - * @param dma DMA Instance - * @param sdwsel can be one of the following values: - * @arg @ref MD_DMA_SDWSEL_ONE_BYTE - * @arg @ref MD_DMA_SDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_SDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_sdwsel(DMA_TypeDef *dma, uint32_t sdwsel) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_SDWSEL_MSK, (sdwsel<CSR3, DMA_CSR3_SDWSEL_MSK)>>DMA_CSR3_SDWSEL_POSS); -} -/** - * @brief Set Source Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_sinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_SINC_MSK, (dinc<CSR3, DMA_CSR3_SINC_MSK)>>DMA_CSR3_SINC_POS); -} -/** - * @brief Set Peripheral Handshake Software Select - * @param dma DMA Instance - * @param phss can be one of the following values: - * @arg @ref MD_DMA_PHSS_UART1_TX - * @arg @ref MD_DMA_PHSS_UART2_TX - * @arg @ref MD_DMA_PHSS_UART3_TX - * @arg @ref MD_DMA_PHSS_SUART1_TX - * @arg @ref MD_DMA_PHSS_SUART2_TX - * @arg @ref MD_DMA_PHSS_SPI1_TX - * @arg @ref MD_DMA_PHSS_SPI2_TX - * @arg @ref MD_DMA_PHSS_I2C1_TX - * @arg @ref MD_DMA_PHSS_I2C2_TX - * @arg @ref MD_DMA_PHSS_AES_IN - * @arg @ref MD_DMA_PHSS_DAC - * @arg @ref MD_DMA_PHSS_CRC - * @arg @ref MD_DMA_PHSS_UART1_RX - * @arg @ref MD_DMA_PHSS_UART2_RX - * @arg @ref MD_DMA_PHSS_UART3_RX - * @arg @ref MD_DMA_PHSS_SUART1_RX - * @arg @ref MD_DMA_PHSS_SUART2_RX - * @arg @ref MD_DMA_PHSS_SPI1_RTX - * @arg @ref MD_DMA_PHSS_SPI2_RX - * @arg @ref MD_DMA_PHSS_I2C1_RX - * @arg @ref MD_DMA_PHSS_I2C2_RX - * @arg @ref MD_DMA_PHSS_AES_OUT - * @arg @ref MD_DMA_PHSS_ADCSS0 - * @arg @ref MD_DMA_PHSS_ADCSS1 - * @arg @ref MD_DMA_PHSS_ADCSS2 - * @arg @ref MD_DMA_PHSS_ADCSS3 - * @arg @ref MD_DMA_PHSS_BS16T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_AD16C4T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_AD16C4T1_COM - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP32C4T1_UP - * @arg @ref MD_DMA_PHSS_GP32C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T1_UP - * @arg @ref MD_DMA_PHSS_GP16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T2_UP - * @arg @ref MD_DMA_PHSS_GP16C4T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T3_UP - * @arg @ref MD_DMA_PHSS_GP16C4T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T1_UP - * @arg @ref MD_DMA_PHSS_GP16C2T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_COM - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T2_UP - * @arg @ref MD_DMA_PHSS_GP16C2T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T2_COM - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T3_UP - * @arg @ref MD_DMA_PHSS_GP16C2T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T3_COM - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T4_UP - * @arg @ref MD_DMA_PHSS_GP16C2T4_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T4_COM - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_phss(DMA_TypeDef *dma, uint32_t phss) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_PHSS_MSK, (phss<CSR3, DMA_CSR3_PHSS_MSK)>>DMA_CSR3_PHSS_POSS); -} -/** - * @brief Set DMA Channel Priority. - * @param dma DMA Instance - * @param chpri can be one of the following values: - * @arg @ref MD_DMA_CHPRI_LV0 - * @arg @ref MD_DMA_CHPRI_LV1 - * @arg @ref MD_DMA_CHPRI_LV2 - * @arg @ref MD_DMA_CHPRI_LV3 - * @arg @ref MD_DMA_CHPRI_LV4 - * @arg @ref MD_DMA_CHPRI_LV5 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_chpri(DMA_TypeDef *dma, uint32_t chpri) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_CHPRI_MSK, (chpri<CSR3, DMA_CSR3_CHPRI_MSK)>>DMA_CSR3_CHPRI_POSS); -} -/** - * @brief Set DMA Mode Select. - * @param dma DMA Instance - * @param modesel can be one of the following values: - * @arg @ref MD_DMA_MODESEL_MEM_TO_MEM - * @arg @ref MD_DMA_MODESEL_PER_TO_MEM - * @arg @ref MD_DMA_MODESEL_MEM_TO_PER - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_modesel(DMA_TypeDef *dma, uint32_t modesel) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_MODESEL_MSK, (modesel<CSR3, DMA_CSR3_MODESEL_MSK)>>DMA_CSR3_MODESEL_POSS); -} -/** - * @brief Set Direct Mode Enable. - * @param dma DMA Instance - * @param dirmden can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_dirmden(DMA_TypeDef *dma, uint32_t dirmden) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_DIRMDEN_MSK, (dirmden<CSR3, DMA_CSR3_DIRMDEN_MSK)>>DMA_CSR3_DIRMDEN_POS); -} -/** - * @brief Set Peripheral flow controller - * @param dma DMA Instance - * @param pfctrl can be one of the following values: - * @arg @ref MD_DMA_PFCTRL_DMA_CTRL - * @arg @ref MD_DMA_PFCTRL_PER_CTRL - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_pfctrl(DMA_TypeDef *dma, uint32_t pfctrl) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_PFCTRL_MSK, (pfctrl<CSR3, DMA_CSR3_PFCTRL_MSK)>>DMA_CSR3_PFCTRL_POS); -} -/** - * @brief Set Circular mode - * @param dma DMA Instance - * @param circ can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_circ(DMA_TypeDef *dma, uint32_t circ) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_CIRC_MSK, (circ<CSR3, DMA_CSR3_CIRC_MSK)>>DMA_CSR3_CIRC_POS); -} -/** - * @brief Set DMA Channel Enable. - * @param dma DMA Instance - * @param chen can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr3_chen(DMA_TypeDef *dma, uint32_t chen) -{ - MODIFY_REG(dma->CSR3, DMA_CSR3_CHEN_MSK, (chen<CSR3, DMA_CSR3_CHEN_MSK)>>DMA_CSR3_CHEN_POS); -} - -/** - * @brief Set DMA Transfer Source Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param sar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_sar3_sar(DMA_TypeDef *dma, uint32_t sar) -{ - MODIFY_REG(dma->SAR3, DMA_SAR3_SAR_MSK, (sar<SAR3, DMA_SAR3_SAR_MSK)>>DMA_SAR3_SAR_POSS); -} - -/** - * @brief Set DMA Transfer Destination Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param dar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_dar3_dar(DMA_TypeDef *dma, uint32_t dar) -{ - MODIFY_REG(dma->DAR3, DMA_DAR3_DAR_MSK, (dar<DAR3, DMA_DAR3_DAR_MSK)>>DMA_DAR3_DAR_POSS); -} - -/** - * @brief Get DMA Current Transfer Byte Count - * @param dma DMA Instance - * @retval The retval can be one of the following values: - * @arg Max Value 65535 - * @arg Min Value 0 - */ -__STATIC_INLINE uint32_t md_dma_get_bcr3_cbcr(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->BCR3, DMA_BCR3_CBCR_MSK)>>DMA_BCR3_CBCR_POSS); -} -/** - * @brief Set DMA Transfer Byte Count Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param bcr This field indicates a 16-bit transfer byte count of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_bcr3_bcr(DMA_TypeDef *dma, uint32_t bcr) -{ - MODIFY_REG(dma->BCR3, DMA_BCR3_BCR_MSK, (bcr<BCR3, DMA_BCR3_BCR_MSK)>>DMA_BCR3_BCR_POSS); -} - -/** - * @brief Set Destination Increment Offset Size bit. - * @note This bit has no meaning if bit DINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if DBUSEL are different from 00. - * @param dma DMA Instance - * @param dincos can be one of the following values: - * @arg @ref MD_DMA_DINCOS_LINKED_DWSEL - * @arg @ref MD_DMA_DINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_dincos(DMA_TypeDef *dma, uint32_t dincos) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_DINCOS_MSK, (dincos<CSR4, DMA_CSR4_DINCOS_MSK)>>DMA_CSR4_DINCOS_POS); -} -/** - * @brief Set Destination Transfer Burst Selection. - * @param dma DMA Instance - * @param dbusel can be one of the following values: - * @arg @ref MD_DMA_DBUSEL_SINGLE - * @arg @ref MD_DMA_DBUSEL_WRAP4 - * @arg @ref MD_DMA_DBUSEL_INCR4 - * @arg @ref MD_DMA_DBUSEL_WRAP8 - * @arg @ref MD_DMA_DBUSEL_INCR8 - * @arg @ref MD_DMA_DBUSEL_WRAP16 - * @arg @ref MD_DMA_DBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_dbusel(DMA_TypeDef *dma, uint32_t dbusel) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_DBUSEL_MSK, (dbusel<CSR4, DMA_CSR4_DBUSEL_MSK)>>DMA_CSR4_DBUSEL_POSS); -} -/** - * @brief Set Destination Transfer Data Width Selection. - * @param dma DMA Instance - * @param ddwsel can be one of the following values: - * @arg @ref MD_DMA_DDWSEL_ONE_BYTE - * @arg @ref MD_DMA_DDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_DDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_ddwsel(DMA_TypeDef *dma, uint32_t ddwsel) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_DDWSEL_MSK, (ddwsel<CSR4, DMA_CSR4_DDWSEL_MSK)>>DMA_CSR4_DDWSEL_POSS); -} -/** - * @brief Set Destination Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_dinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_DINC_MSK, (dinc<CSR4, DMA_CSR4_DINC_MSK)>>DMA_CSR4_DINC_POS); -} -/** - * @brief Set Source Increment Offset Size bit. - * @note This bit has no meaning if bit SINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if SBUSEL are different from 00. - * @param dma DMA Instance - * @param sincos can be one of the following values: - * @arg @ref MD_DMA_SINCOS_LINKED_SWSEL - * @arg @ref MD_DMA_SINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_sincos(DMA_TypeDef *dma, uint32_t sincos) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_SINCOS_MSK, (sincos<CSR4, DMA_CSR4_SINCOS_MSK)>>DMA_CSR4_SINCOS_POS); -} -/** - * @brief Set Source Transfer Burst Selection. - * @param dma DMA Instance - * @param sbusel can be one of the following values: - * @arg @ref MD_DMA_SBUSEL_SINGLE - * @arg @ref MD_DMA_SBUSEL_WRAP4 - * @arg @ref MD_DMA_SBUSEL_INCR4 - * @arg @ref MD_DMA_SBUSEL_WRAP8 - * @arg @ref MD_DMA_SBUSEL_INCR8 - * @arg @ref MD_DMA_SBUSEL_WRAP16 - * @arg @ref MD_DMA_SBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_sbusel(DMA_TypeDef *dma, uint32_t sbusel) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_SBUSEL_MSK, (sbusel<CSR4, DMA_CSR4_SBUSEL_MSK)>>DMA_CSR4_SBUSEL_POSS); -} -/** - * @brief Set Source Transfer Data Width Selection. - * @param dma DMA Instance - * @param sdwsel can be one of the following values: - * @arg @ref MD_DMA_SDWSEL_ONE_BYTE - * @arg @ref MD_DMA_SDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_SDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_sdwsel(DMA_TypeDef *dma, uint32_t sdwsel) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_SDWSEL_MSK, (sdwsel<CSR4, DMA_CSR4_SDWSEL_MSK)>>DMA_CSR4_SDWSEL_POSS); -} -/** - * @brief Set Source Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_sinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_SINC_MSK, (dinc<CSR4, DMA_CSR4_SINC_MSK)>>DMA_CSR4_SINC_POS); -} -/** - * @brief Set Peripheral Handshake Software Select - * @param dma DMA Instance - * @param phss can be one of the following values: - * @arg @ref MD_DMA_PHSS_UART1_TX - * @arg @ref MD_DMA_PHSS_UART2_TX - * @arg @ref MD_DMA_PHSS_UART3_TX - * @arg @ref MD_DMA_PHSS_SUART1_TX - * @arg @ref MD_DMA_PHSS_SUART2_TX - * @arg @ref MD_DMA_PHSS_SPI1_TX - * @arg @ref MD_DMA_PHSS_SPI2_TX - * @arg @ref MD_DMA_PHSS_I2C1_TX - * @arg @ref MD_DMA_PHSS_I2C2_TX - * @arg @ref MD_DMA_PHSS_AES_IN - * @arg @ref MD_DMA_PHSS_DAC - * @arg @ref MD_DMA_PHSS_CRC - * @arg @ref MD_DMA_PHSS_UART1_RX - * @arg @ref MD_DMA_PHSS_UART2_RX - * @arg @ref MD_DMA_PHSS_UART3_RX - * @arg @ref MD_DMA_PHSS_SUART1_RX - * @arg @ref MD_DMA_PHSS_SUART2_RX - * @arg @ref MD_DMA_PHSS_SPI1_RTX - * @arg @ref MD_DMA_PHSS_SPI2_RX - * @arg @ref MD_DMA_PHSS_I2C1_RX - * @arg @ref MD_DMA_PHSS_I2C2_RX - * @arg @ref MD_DMA_PHSS_AES_OUT - * @arg @ref MD_DMA_PHSS_ADCSS0 - * @arg @ref MD_DMA_PHSS_ADCSS1 - * @arg @ref MD_DMA_PHSS_ADCSS2 - * @arg @ref MD_DMA_PHSS_ADCSS3 - * @arg @ref MD_DMA_PHSS_BS16T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_AD16C4T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_AD16C4T1_COM - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP32C4T1_UP - * @arg @ref MD_DMA_PHSS_GP32C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T1_UP - * @arg @ref MD_DMA_PHSS_GP16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T2_UP - * @arg @ref MD_DMA_PHSS_GP16C4T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T3_UP - * @arg @ref MD_DMA_PHSS_GP16C4T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T1_UP - * @arg @ref MD_DMA_PHSS_GP16C2T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_COM - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T2_UP - * @arg @ref MD_DMA_PHSS_GP16C2T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T2_COM - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T3_UP - * @arg @ref MD_DMA_PHSS_GP16C2T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T3_COM - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T4_UP - * @arg @ref MD_DMA_PHSS_GP16C2T4_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T4_COM - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_phss(DMA_TypeDef *dma, uint32_t phss) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_PHSS_MSK, (phss<CSR4, DMA_CSR4_PHSS_MSK)>>DMA_CSR4_PHSS_POSS); -} -/** - * @brief Set DMA Channel Priority. - * @param dma DMA Instance - * @param chpri can be one of the following values: - * @arg @ref MD_DMA_CHPRI_LV0 - * @arg @ref MD_DMA_CHPRI_LV1 - * @arg @ref MD_DMA_CHPRI_LV2 - * @arg @ref MD_DMA_CHPRI_LV3 - * @arg @ref MD_DMA_CHPRI_LV4 - * @arg @ref MD_DMA_CHPRI_LV5 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_chpri(DMA_TypeDef *dma, uint32_t chpri) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_CHPRI_MSK, (chpri<CSR4, DMA_CSR4_CHPRI_MSK)>>DMA_CSR4_CHPRI_POSS); -} -/** - * @brief Set DMA Mode Select. - * @param dma DMA Instance - * @param modesel can be one of the following values: - * @arg @ref MD_DMA_MODESEL_MEM_TO_MEM - * @arg @ref MD_DMA_MODESEL_PER_TO_MEM - * @arg @ref MD_DMA_MODESEL_MEM_TO_PER - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_modesel(DMA_TypeDef *dma, uint32_t modesel) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_MODESEL_MSK, (modesel<CSR4, DMA_CSR4_MODESEL_MSK)>>DMA_CSR4_MODESEL_POSS); -} -/** - * @brief Set Direct Mode Enable. - * @param dma DMA Instance - * @param dirmden can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_dirmden(DMA_TypeDef *dma, uint32_t dirmden) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_DIRMDEN_MSK, (dirmden<CSR4, DMA_CSR4_DIRMDEN_MSK)>>DMA_CSR4_DIRMDEN_POS); -} -/** - * @brief Set Peripheral flow controller - * @param dma DMA Instance - * @param pfctrl can be one of the following values: - * @arg @ref MD_DMA_PFCTRL_DMA_CTRL - * @arg @ref MD_DMA_PFCTRL_PER_CTRL - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_pfctrl(DMA_TypeDef *dma, uint32_t pfctrl) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_PFCTRL_MSK, (pfctrl<CSR4, DMA_CSR4_PFCTRL_MSK)>>DMA_CSR4_PFCTRL_POS); -} -/** - * @brief Set Circular mode - * @param dma DMA Instance - * @param circ can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_circ(DMA_TypeDef *dma, uint32_t circ) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_CIRC_MSK, (circ<CSR4, DMA_CSR4_CIRC_MSK)>>DMA_CSR4_CIRC_POS); -} -/** - * @brief Set DMA Channel Enable. - * @param dma DMA Instance - * @param chen can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr4_chen(DMA_TypeDef *dma, uint32_t chen) -{ - MODIFY_REG(dma->CSR4, DMA_CSR4_CHEN_MSK, (chen<CSR4, DMA_CSR4_CHEN_MSK)>>DMA_CSR4_CHEN_POS); -} - -/** - * @brief Set DMA Transfer Source Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param sar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_sar4_sar(DMA_TypeDef *dma, uint32_t sar) -{ - MODIFY_REG(dma->SAR4, DMA_SAR4_SAR_MSK, (sar<SAR4, DMA_SAR4_SAR_MSK)>>DMA_SAR4_SAR_POSS); -} - -/** - * @brief Set DMA Transfer Destination Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param dar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_dar4_dar(DMA_TypeDef *dma, uint32_t dar) -{ - MODIFY_REG(dma->DAR4, DMA_DAR4_DAR_MSK, (dar<DAR4, DMA_DAR4_DAR_MSK)>>DMA_DAR4_DAR_POSS); -} - -/** - * @brief Get DMA Current Transfer Byte Count - * @param dma DMA Instance - * @retval The retval can be one of the following values: - * @arg Max Value 65535 - * @arg Min Value 0 - */ -__STATIC_INLINE uint32_t md_dma_get_bcr4_cbcr(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->BCR4, DMA_BCR4_CBCR_MSK)>>DMA_BCR4_CBCR_POSS); -} -/** - * @brief Set DMA Transfer Byte Count Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param bcr This field indicates a 16-bit transfer byte count of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_bcr4_bcr(DMA_TypeDef *dma, uint32_t bcr) -{ - MODIFY_REG(dma->BCR4, DMA_BCR4_BCR_MSK, (bcr<BCR4, DMA_BCR4_BCR_MSK)>>DMA_BCR4_BCR_POSS); -} - -/** - * @brief Set Destination Increment Offset Size bit. - * @note This bit has no meaning if bit DINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if DBUSEL are different from 00. - * @param dma DMA Instance - * @param dincos can be one of the following values: - * @arg @ref MD_DMA_DINCOS_LINKED_DWSEL - * @arg @ref MD_DMA_DINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_dincos(DMA_TypeDef *dma, uint32_t dincos) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_DINCOS_MSK, (dincos<CSR5, DMA_CSR5_DINCOS_MSK)>>DMA_CSR5_DINCOS_POS); -} -/** - * @brief Set Destination Transfer Burst Selection. - * @param dma DMA Instance - * @param dbusel can be one of the following values: - * @arg @ref MD_DMA_DBUSEL_SINGLE - * @arg @ref MD_DMA_DBUSEL_WRAP4 - * @arg @ref MD_DMA_DBUSEL_INCR4 - * @arg @ref MD_DMA_DBUSEL_WRAP8 - * @arg @ref MD_DMA_DBUSEL_INCR8 - * @arg @ref MD_DMA_DBUSEL_WRAP16 - * @arg @ref MD_DMA_DBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_dbusel(DMA_TypeDef *dma, uint32_t dbusel) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_DBUSEL_MSK, (dbusel<CSR5, DMA_CSR5_DBUSEL_MSK)>>DMA_CSR5_DBUSEL_POSS); -} -/** - * @brief Set Destination Transfer Data Width Selection. - * @param dma DMA Instance - * @param ddwsel can be one of the following values: - * @arg @ref MD_DMA_DDWSEL_ONE_BYTE - * @arg @ref MD_DMA_DDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_DDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_ddwsel(DMA_TypeDef *dma, uint32_t ddwsel) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_DDWSEL_MSK, (ddwsel<CSR5, DMA_CSR5_DDWSEL_MSK)>>DMA_CSR5_DDWSEL_POSS); -} -/** - * @brief Set Destination Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_dinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_DINC_MSK, (dinc<CSR5, DMA_CSR5_DINC_MSK)>>DMA_CSR5_DINC_POS); -} -/** - * @brief Set Source Increment Offset Size bit. - * @note This bit has no meaning if bit SINC = '0'. - * This bit is protected and can be written only if EN = '0'. - * This bit is forced low by hardware when the stream is enabled (bit EN = '1') if the direct mode is selected or - * if SBUSEL are different from 00. - * @param dma DMA Instance - * @param sincos can be one of the following values: - * @arg @ref MD_DMA_SINCOS_LINKED_SWSEL - * @arg @ref MD_DMA_SINCOS_FIXED_TO_4 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_sincos(DMA_TypeDef *dma, uint32_t sincos) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_SINCOS_MSK, (sincos<CSR5, DMA_CSR5_SINCOS_MSK)>>DMA_CSR5_SINCOS_POS); -} -/** - * @brief Set Source Transfer Burst Selection. - * @param dma DMA Instance - * @param sbusel can be one of the following values: - * @arg @ref MD_DMA_SBUSEL_SINGLE - * @arg @ref MD_DMA_SBUSEL_WRAP4 - * @arg @ref MD_DMA_SBUSEL_INCR4 - * @arg @ref MD_DMA_SBUSEL_WRAP8 - * @arg @ref MD_DMA_SBUSEL_INCR8 - * @arg @ref MD_DMA_SBUSEL_WRAP16 - * @arg @ref MD_DMA_SBUSEL_INCR16 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_sbusel(DMA_TypeDef *dma, uint32_t sbusel) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_SBUSEL_MSK, (sbusel<CSR5, DMA_CSR5_SBUSEL_MSK)>>DMA_CSR5_SBUSEL_POSS); -} -/** - * @brief Set Source Transfer Data Width Selection. - * @param dma DMA Instance - * @param sdwsel can be one of the following values: - * @arg @ref MD_DMA_SDWSEL_ONE_BYTE - * @arg @ref MD_DMA_SDWSEL_ONE_HALF_WORD - * @arg @ref MD_DMA_SDWSEL_ONE_WORD - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_sdwsel(DMA_TypeDef *dma, uint32_t sdwsel) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_SDWSEL_MSK, (sdwsel<CSR5, DMA_CSR5_SDWSEL_MSK)>>DMA_CSR5_SDWSEL_POSS); -} -/** - * @brief Set Source Transfer Increment Mode - * @param dma DMA Instance - * @param dinc can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_sinc(DMA_TypeDef *dma, uint32_t dinc) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_SINC_MSK, (dinc<CSR5, DMA_CSR5_SINC_MSK)>>DMA_CSR5_SINC_POS); -} -/** - * @brief Set Peripheral Handshake Software Select - * @param dma DMA Instance - * @param phss can be one of the following values: - * @arg @ref MD_DMA_PHSS_UART1_TX - * @arg @ref MD_DMA_PHSS_UART2_TX - * @arg @ref MD_DMA_PHSS_UART3_TX - * @arg @ref MD_DMA_PHSS_SUART1_TX - * @arg @ref MD_DMA_PHSS_SUART2_TX - * @arg @ref MD_DMA_PHSS_SPI1_TX - * @arg @ref MD_DMA_PHSS_SPI2_TX - * @arg @ref MD_DMA_PHSS_I2C1_TX - * @arg @ref MD_DMA_PHSS_I2C2_TX - * @arg @ref MD_DMA_PHSS_AES_IN - * @arg @ref MD_DMA_PHSS_DAC - * @arg @ref MD_DMA_PHSS_CRC - * @arg @ref MD_DMA_PHSS_UART1_RX - * @arg @ref MD_DMA_PHSS_UART2_RX - * @arg @ref MD_DMA_PHSS_UART3_RX - * @arg @ref MD_DMA_PHSS_SUART1_RX - * @arg @ref MD_DMA_PHSS_SUART2_RX - * @arg @ref MD_DMA_PHSS_SPI1_RTX - * @arg @ref MD_DMA_PHSS_SPI2_RX - * @arg @ref MD_DMA_PHSS_I2C1_RX - * @arg @ref MD_DMA_PHSS_I2C2_RX - * @arg @ref MD_DMA_PHSS_AES_OUT - * @arg @ref MD_DMA_PHSS_ADCSS0 - * @arg @ref MD_DMA_PHSS_ADCSS1 - * @arg @ref MD_DMA_PHSS_ADCSS2 - * @arg @ref MD_DMA_PHSS_ADCSS3 - * @arg @ref MD_DMA_PHSS_BS16T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_AD16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_AD16C4T1_UP - * @arg @ref MD_DMA_PHSS_AD16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_AD16C4T1_COM - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP32C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP32C4T1_UP - * @arg @ref MD_DMA_PHSS_GP32C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T1_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T1_UP - * @arg @ref MD_DMA_PHSS_GP16C4T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T2_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T2_UP - * @arg @ref MD_DMA_PHSS_GP16C4T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH3 - * @arg @ref MD_DMA_PHSS_GP16C4T3_CH4 - * @arg @ref MD_DMA_PHSS_GP16C4T3_UP - * @arg @ref MD_DMA_PHSS_GP16C4T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T1_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T1_UP - * @arg @ref MD_DMA_PHSS_GP16C2T1_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T1_COM - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T2_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T2_UP - * @arg @ref MD_DMA_PHSS_GP16C2T2_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T2_COM - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T3_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T3_UP - * @arg @ref MD_DMA_PHSS_GP16C2T3_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T3_COM - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH1 - * @arg @ref MD_DMA_PHSS_GP16C2T4_CH2 - * @arg @ref MD_DMA_PHSS_GP16C2T4_UP - * @arg @ref MD_DMA_PHSS_GP16C2T4_TRIG - * @arg @ref MD_DMA_PHSS_GP16C2T4_COM - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_phss(DMA_TypeDef *dma, uint32_t phss) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_PHSS_MSK, (phss<CSR5, DMA_CSR5_PHSS_MSK)>>DMA_CSR5_PHSS_POSS); -} -/** - * @brief Set DMA Channel Priority. - * @param dma DMA Instance - * @param chpri can be one of the following values: - * @arg @ref MD_DMA_CHPRI_LV0 - * @arg @ref MD_DMA_CHPRI_LV1 - * @arg @ref MD_DMA_CHPRI_LV2 - * @arg @ref MD_DMA_CHPRI_LV3 - * @arg @ref MD_DMA_CHPRI_LV4 - * @arg @ref MD_DMA_CHPRI_LV5 - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_chpri(DMA_TypeDef *dma, uint32_t chpri) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_CHPRI_MSK, (chpri<CSR5, DMA_CSR5_CHPRI_MSK)>>DMA_CSR5_CHPRI_POSS); -} -/** - * @brief Set DMA Mode Select. - * @param dma DMA Instance - * @param modesel can be one of the following values: - * @arg @ref MD_DMA_MODESEL_MEM_TO_MEM - * @arg @ref MD_DMA_MODESEL_PER_TO_MEM - * @arg @ref MD_DMA_MODESEL_MEM_TO_PER - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_modesel(DMA_TypeDef *dma, uint32_t modesel) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_MODESEL_MSK, (modesel<CSR5, DMA_CSR5_MODESEL_MSK)>>DMA_CSR5_MODESEL_POSS); -} -/** - * @brief Set Direct Mode Enable. - * @param dma DMA Instance - * @param dirmden can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_dirmden(DMA_TypeDef *dma, uint32_t dirmden) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_DIRMDEN_MSK, (dirmden<CSR5, DMA_CSR5_DIRMDEN_MSK)>>DMA_CSR5_DIRMDEN_POS); -} -/** - * @brief Set Peripheral flow controller - * @param dma DMA Instance - * @param pfctrl can be one of the following values: - * @arg @ref MD_DMA_PFCTRL_DMA_CTRL - * @arg @ref MD_DMA_PFCTRL_PER_CTRL - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_pfctrl(DMA_TypeDef *dma, uint32_t pfctrl) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_PFCTRL_MSK, (pfctrl<CSR5, DMA_CSR5_PFCTRL_MSK)>>DMA_CSR5_PFCTRL_POS); -} -/** - * @brief Set Circular mode - * @param dma DMA Instance - * @param circ can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_circ(DMA_TypeDef *dma, uint32_t circ) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_CIRC_MSK, (circ<CSR5, DMA_CSR5_CIRC_MSK)>>DMA_CSR5_CIRC_POS); -} -/** - * @brief Set DMA Channel Enable. - * @param dma DMA Instance - * @param chen can be one of the following values: - * @arg Disable - * @arg Enable - * @retval None - */ -__STATIC_INLINE void md_dma_set_csr5_chen(DMA_TypeDef *dma, uint32_t chen) -{ - MODIFY_REG(dma->CSR5, DMA_CSR5_CHEN_MSK, (chen<CSR5, DMA_CSR5_CHEN_MSK)>>DMA_CSR5_CHEN_POS); -} - -/** - * @brief Set DMA Transfer Source Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param sar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_sar5_sar(DMA_TypeDef *dma, uint32_t sar) -{ - MODIFY_REG(dma->SAR5, DMA_SAR5_SAR_MSK, (sar<SAR5, DMA_SAR5_SAR_MSK)>>DMA_SAR5_SAR_POSS); -} - -/** - * @brief Set DMA Transfer Destination Address Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param dar This field indicates a 32-bit source address of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_dar5_dar(DMA_TypeDef *dma, uint32_t dar) -{ - MODIFY_REG(dma->DAR5, DMA_DAR5_DAR_MSK, (dar<DAR5, DMA_DAR5_DAR_MSK)>>DMA_DAR5_DAR_POSS); -} - -/** - * @brief Get DMA Current Transfer Byte Count - * @param dma DMA Instance - * @retval The retval can be one of the following values: - * @arg Max Value 65535 - * @arg Min Value 0 - */ -__STATIC_INLINE uint32_t md_dma_get_bcr5_cbcr(DMA_TypeDef *dma) -{ - return (READ_BIT(dma->BCR5, DMA_BCR5_CBCR_MSK)>>DMA_BCR5_CBCR_POSS); -} -/** - * @brief Set DMA Transfer Byte Count Register - * @note These bits are write-protected and can be written only when bit EN = '0' - * @param dma DMA Instance - * @param bcr This field indicates a 16-bit transfer byte count of DMA. - * @retval None - */ -__STATIC_INLINE void md_dma_set_bcr5_bcr(DMA_TypeDef *dma, uint32_t bcr) -{ - MODIFY_REG(dma->BCR5, DMA_BCR5_BCR_MSK, (bcr<BCR5, DMA_BCR5_BCR_MSK)>>DMA_BCR5_BCR_POSS); -} - -/** - * @} MD_DMA_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_DMA_Public_Functions DMA Public Functions - * @{ - */ - -/** @defgroup MD_DMA_Basic_Configuration Basic Configuration - * @{ - */ - -/** - * @} MD_DMA_Basic_Configuration - */ - - -/** - * @} MD_DMA_Public_Functions - */ - -#endif - -/** - * @} DMA - */ - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_exti.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_exti.h deleted file mode 100644 index 7f00f8320e..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_exti.h +++ /dev/null @@ -1,5167 +0,0 @@ -/** - ****************************************************************************** - * @file md_EXTI.h - * @brief ES32F0271 EXTI HEAD File. - * - * @version V1.00.01 - * @date 22/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_EXTI_H__ -#define __MD_EXTI_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_exti.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (EXTI) -/** @defgroup EXTI EXTI - * @brief EXTI micro driver - * @{ - */ - - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/* Public types ---------------------------------------------------------------*/ -/* Public constants -----------------------------------------------------------*/ - -/** @defgroup MD_EXTI_Public_Constants EXTI Public Constants - * @{ - */ - -/** @defgroup MD_EXTI_PC_Source EXTI Line Source - * @{ - */ -#define MD_EXTI_Pin_GPIOA (0x00000000UL) /*!< @brief Select GPIOA for EXTIx */ -#define MD_EXTI_Pin_GPIOB (0x00000001UL) /*!< @brief Select GPIOB for EXTIx */ -#define MD_EXTI_Pin_GPIOC (0x00000002UL) /*!< @brief Select GPIOC for EXTIx */ -#define MD_EXTI_Pin_GPIOD (0x00000003UL) /*!< @brief Select GPIOD for EXTIx */ - - /** - * @} MD_EXTI_PC_Source - */ - -/** -* @} MD_EXTI_Public_Constants -*/ - - - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_EXTI_Public_Macros EXTI Public Macros - * @{ - */ - - - -/** @defgroup MD_EXTI_PF_Basic_Configuration EXTI Configuration Management - * @{ - */ -/** - * @brief Set EXTI interrupt configuration register 1 - * @param exti EXTI Instance - * @param value The value write in EXTI->ICFG1 - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->ICFG1, value); -} - -/** - * @brief Get EXTI interrupt configuration register 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->ICFG1)); -} - -/** - * @brief Set EXTI interrupt configuration register 2 - * @param exti EXTI Instance - * @param value The value write in EXTI->ICFG2 - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->ICFG2, value); -} - -/** - * @brief Get EXTI interrupt configuration register 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->ICFG2)); -} - -/** - * @brief Set EXTI0 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio0(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO0_MSK, Source); -} - -/** - * @brief Get EXTI0 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio0(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO0_MSK)>>EXTI_ICFG1_GPIO0_POSS); -} - -/** - * @brief Set EXTI1 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio1(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO1_MSK, Source << EXTI_ICFG1_GPIO1_POSS); -} - -/** - * @brief Get EXTI1 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio1(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO1_MSK)>>EXTI_ICFG1_GPIO1_POSS); -} - -/** - * @brief Set EXTI2 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio2(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO2_MSK, Source << EXTI_ICFG1_GPIO2_POSS); -} - -/** - * @brief Get EXTI2 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio2(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO2_MSK)>>EXTI_ICFG1_GPIO2_POSS); -} - -/** - * @brief Set EXTI3 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio3(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO3_MSK, Source << EXTI_ICFG1_GPIO3_POSS); -} - -/** - * @brief Get EXTI3 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio3(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO3_MSK)>>EXTI_ICFG1_GPIO0_POSS); -} - -/** - * @brief Set EXTI4 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio4(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO4_MSK, Source << EXTI_ICFG1_GPIO4_POSS); -} - -/** - * @brief Get EXTI4 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio4(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO4_MSK)>>EXTI_ICFG1_GPIO4_POSS); -} - -/** - * @brief Set EXTI5 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio5(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO5_MSK, Source << EXTI_ICFG1_GPIO5_POSS); -} - -/** - * @brief Get EXTI5 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio5(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO5_MSK)>>EXTI_ICFG1_GPIO5_POSS); -} - -/** - * @brief Set EXTI6 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio6(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO6_MSK, Source << EXTI_ICFG1_GPIO6_POSS); -} - -/** - * @brief Get EXTI6 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio6(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO6_MSK)>>EXTI_ICFG1_GPIO6_POSS); -} - -/** - * @brief Set EXTI7 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg1_gpio7(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG1, EXTI_ICFG1_GPIO7_MSK, Source << EXTI_ICFG1_GPIO7_POSS); -} - -/** - * @brief Get EXTI7 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg1_gpio7(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG1, EXTI_ICFG1_GPIO7_MSK)>>EXTI_ICFG1_GPIO7_POSS); -} - - -/** - * @brief Set EXTI8 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio8(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO8_MSK, Source << EXTI_ICFG2_GPIO8_POSS); -} - -/** - * @brief Get EXTI8 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio8(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO8_MSK)>>EXTI_ICFG2_GPIO8_POSS); -} - -/** - * @brief Set EXTI9 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio9(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO9_MSK, Source << EXTI_ICFG2_GPIO9_POSS); -} - -/** - * @brief Get EXTI9 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio9(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO9_MSK)>>EXTI_ICFG2_GPIO9_POSS); -} - -/** - * @brief Set EXTI10 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio10(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO10_MSK, Source << EXTI_ICFG2_GPIO10_POSS); -} - -/** - * @brief Get EXTI10 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio10(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO10_MSK)>>EXTI_ICFG2_GPIO10_POSS); -} - -/** - * @brief Set EXTI11 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio11(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO11_MSK, Source << EXTI_ICFG2_GPIO11_POSS); -} - -/** - * @brief Get EXTI11 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio11(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO11_MSK)>>EXTI_ICFG2_GPIO11_POSS); -} - -/** - * @brief Set EXTI12 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio12(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO12_MSK, Source << EXTI_ICFG2_GPIO12_POSS); -} - -/** - * @brief Get EXTI12 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio12(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO12_MSK)>>EXTI_ICFG2_GPIO12_POSS); -} - -/** - * @brief Set EXTI13 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio13(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO13_MSK, Source << EXTI_ICFG2_GPIO13_POSS); -} - -/** - * @brief Get EXTI13 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio13(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO13_MSK)>>EXTI_ICFG2_GPIO13_POSS); -} - -/** - * @brief Set EXTI14 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio14(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO14_MSK, Source << EXTI_ICFG2_GPIO14_POSS); -} - -/** - * @brief Get EXTI14 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio14(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO14_MSK)>>EXTI_ICFG2_GPIO14_POSS); -} - -/** - * @brief Set EXTI15 configuration - * @param exti EXTI Instance - * @param Source This parameter can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - * @retval None - */ -__STATIC_INLINE void md_exti_set_icfg2_gpio15(EXTI_TypeDef *exti, uint32_t Source) -{ - MODIFY_REG(exti->ICFG2, EXTI_ICFG2_GPIO15_MSK, Source << EXTI_ICFG2_GPIO15_POSS); -} - -/** - * @brief Get EXTI15 configuration - * @param exti EXTI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_EXTI_Pin_GPIOA - * @arg @ref MD_EXTI_Pin_GPIOB - * @arg @ref MD_EXTI_Pin_GPIOC - * @arg @ref MD_EXTI_Pin_GPIOD - */ -__STATIC_INLINE uint32_t md_exti_get_icfg2_gpio15(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->ICFG2, EXTI_ICFG2_GPIO15_MSK)>>EXTI_ICFG2_GPIO15_POSS); -} - -/** - * @} MD_EXTI_PF_Basic_Configuration - */ - -/** @defgroup MD_EXTI_PF_RTS EXTI Rising Edge Trigger Selection Register - * @{ - */ - -/** - * @brief Set rising trigger event configuration bit of line - * @param exti EXTI Instance - * @param value The value write in EXTI->RTS - * @retval None - */ -__STATIC_INLINE void md_exti_set_rts(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->RTS, value); -} - -/** - * @brief Get rising trigger event configuration bit of line - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_get_rts(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->RTS)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO0_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO0_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 0 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO0_MSK) == (EXTI_RTS_GPIO0_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO1_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO1_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 1 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO1_MSK) == (EXTI_RTS_GPIO1_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO2_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO2_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 2 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO2_MSK) == (EXTI_RTS_GPIO2_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO3_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio3(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO3_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 3 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio3(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO3_MSK) == (EXTI_RTS_GPIO3_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO4_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio4(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO4_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 4 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio4(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO4_MSK) == (EXTI_RTS_GPIO4_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO5_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio5(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO5_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 5 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio5(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO5_MSK) == (EXTI_RTS_GPIO5_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO6_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio6(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO6_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 1 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio6(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO6_MSK) == (EXTI_RTS_GPIO6_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO7_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio7(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO7_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 7 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio7(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO7_MSK) == (EXTI_RTS_GPIO7_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO8_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio8(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO8_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 8 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio8(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO8_MSK) == (EXTI_RTS_GPIO8_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO9_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio9(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO9_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 9 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio9(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO9_MSK) == (EXTI_RTS_GPIO9_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO10_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio10(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO10_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 10 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio10(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO10_MSK) == (EXTI_RTS_GPIO10_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO11_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio11(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO11_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 11 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio11(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO11_MSK) == (EXTI_RTS_GPIO11_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO12_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio12(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO12_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 12 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio12(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO12_MSK) == (EXTI_RTS_GPIO12_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO13_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio13(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO13_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 13 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio13(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO13_MSK) == (EXTI_RTS_GPIO13_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio14(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO14_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio14(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO14_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 14 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio14(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO14_MSK) == (EXTI_RTS_GPIO14_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_GPIO15_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_gpio15(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_GPIO15_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 15 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_gpio15(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_GPIO15_MSK) == (EXTI_RTS_GPIO15_MSK)); -} - - -/** - * @brief Enable rising trigger event configuration bit of line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_cmp1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_CMP1_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_cmp1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_CMP1_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 16 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_cmp1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_CMP1_MSK) == (EXTI_RTS_CMP1_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_CMP2_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_cmp2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_CMP2_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 17 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_cmp2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_CMP2_MSK) == (EXTI_RTS_CMP2_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_PVD0_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_pvd0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_PVD0_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 20 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_pvd0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_PVD0_MSK) == (EXTI_RTS_PVD0_MSK)); -} - -/** - * @brief Enable rising trigger event configuration bit of line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_rts_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->RTS, EXTI_RTS_WAKEUP_MSK); -} - -/** - * @brief Disable rising trigger event configuration bit of line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_rts_wakeup(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->RTS, EXTI_RTS_WAKEUP_MSK); -} - -/** - * @brief Check if rising trigger event configuration bit of line 21 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_rts_wakeup(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->RTS, EXTI_RTS_WAKEUP_MSK) == (EXTI_RTS_WAKEUP_MSK)); -} - -/** - * @} MD_EXTI_PF_RTS - */ - -/** @defgroup MD_EXTI_PF_FTS EXTI Falling Edge Trigger Selection Register - * @{ - */ - -/** - * @brief Set falling trigger event configuration bit of line - * @param exti EXTI Instance - * @param value The value write in EXTI->FTS - * @retval None - */ -__STATIC_INLINE void md_exti_set_fts(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->FTS, value); -} - -/** - * @brief Get falling trigger event configuration bit of line - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_get_fts(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->FTS)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO0_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO0_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 0 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO0_MSK) == (EXTI_FTS_GPIO0_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO1_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO1_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 1 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO1_MSK) == (EXTI_FTS_GPIO1_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO2_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO2_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 2 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO2_MSK) == (EXTI_FTS_GPIO2_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO3_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio3(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO3_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 3 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio3(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO3_MSK) == (EXTI_FTS_GPIO3_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO4_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio4(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO4_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 4 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio4(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO4_MSK) == (EXTI_FTS_GPIO4_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO5_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio5(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO5_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 5 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio5(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO5_MSK) == (EXTI_FTS_GPIO5_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO6_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio6(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO6_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 6 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio6(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO6_MSK) == (EXTI_FTS_GPIO6_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO7_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio7(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO7_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 7 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio7(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO7_MSK) == (EXTI_FTS_GPIO7_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO8_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio8(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO8_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 8 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio8(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO8_MSK) == (EXTI_FTS_GPIO8_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO9_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio9(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO9_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 9 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio9(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO9_MSK) == (EXTI_FTS_GPIO9_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO10_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio10(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO10_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 10 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio10(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO10_MSK) == (EXTI_FTS_GPIO10_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO11_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio11(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO11_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 11 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio11(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO11_MSK) == (EXTI_FTS_GPIO11_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO12_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio12(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO12_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 12 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio12(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO12_MSK) == (EXTI_FTS_GPIO12_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO13_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio13(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO13_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 13 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio13(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO13_MSK) == (EXTI_FTS_GPIO13_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio14(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO14_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio14(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO14_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 14 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio14(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO14_MSK) == (EXTI_FTS_GPIO14_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_GPIO15_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_gpio15(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO15_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 15 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_gpio15(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_GPIO15_MSK) == (EXTI_FTS_GPIO15_MSK)); -} - - - -/** - * @brief Enable falling trigger event configuration bit of line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_cmp1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_CMP1_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_cmp1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_CMP1_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 16 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_cmp1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_CMP1_MSK) == (EXTI_FTS_CMP1_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_CMP2_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 18 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_cmp2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_CMP2_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 18 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_cmp2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_CMP2_MSK) == (EXTI_RTS_CMP2_MSK)); -} - - -/** - * @brief Enable falling trigger event configuration bit of line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_PVD0_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_pvd0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_PVD0_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 17 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_pvd0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_PVD0_MSK) == (EXTI_FTS_PVD0_MSK)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_fts_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->FTS, EXTI_FTS_WAKEUP_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_fts_wakeup(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_WAKEUP_MSK); -} - -/** - * @brief Check if falling trigger event configuration bit of line 21 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_fts_wakeup(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->FTS, EXTI_FTS_WAKEUP_MSK) == (EXTI_FTS_WAKEUP_MSK)); -} - - - -/** - * @} MD_EXTI_PF_FTS - */ - -/** @defgroup MD_EXTI_PF_SWI EXTI Software Interrupt Event register - * @{ - */ - -/** - * @brief Set software interrupt on line - * @param exti EXTI Instance - * @param value The value write in EXTI->SWI - * @retval None - */ -__STATIC_INLINE void md_exti_set_swi(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->SWI, value); -} - -/** - * @brief Get software interrupt on line - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_get_swi(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->SWI)); -} - -/** - * @brief Enable falling trigger event configuration bit of line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO0_MSK); -} - -/** - * @brief Disable software interrupt on line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO0_MSK); -} - -/** - * @brief Check if software interrupt on line 0 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO0_MSK) == (EXTI_SWI_GPIO0_MSK)); -} - -/** - * @brief Enable software interrupt on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO1_MSK); -} - -/** - * @brief Disable software interrupt on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO1_MSK); -} - -/** - * @brief Check if software interrupt on line 1 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO1_MSK) == (EXTI_SWI_GPIO1_MSK)); -} - -/** - * @brief Enable software interrupt on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO2_MSK); -} - -/** - * @brief Disable software interrupt on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO2_MSK); -} - -/** - * @brief Check if software interrupt on line 2 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO2_MSK) == (EXTI_SWI_GPIO2_MSK)); -} - -/** - * @brief Enable software interrupt on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO3_MSK); -} - -/** - * @brief Disable software interrupt on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio3(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO3_MSK); -} - -/** - * @brief Check if software interrupt on line 3 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio3(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO3_MSK) == (EXTI_SWI_GPIO3_MSK)); -} - -/** - * @brief Enable software interrupt on line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO4_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio4(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO4_MSK); -} - -/** - * @brief Check if software interrupt on line 4 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio4(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO4_MSK) == (EXTI_SWI_GPIO4_MSK)); -} - -/** - * @brief Enable software interrupt on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO5_MSK); -} - -/** - * @brief Disable software interrupt on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio5(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO5_MSK); -} - -/** - * @brief Check if software interrupt on line 5 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio5(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO5_MSK) == (EXTI_SWI_GPIO5_MSK)); -} - -/** - * @brief Enable software interrupt on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO6_MSK); -} - -/** - * @brief Disable software interrupt on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio6(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO6_MSK); -} - -/** - * @brief Check if software interrupt on line 6 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio6(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO6_MSK) == (EXTI_SWI_GPIO6_MSK)); -} - -/** - * @brief Enable software interrupt on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO7_MSK); -} - -/** - * @brief Disable software interrupt on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio7(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO7_MSK); -} - -/** - * @brief Check if software interrupt on line 7 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio7(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO7_MSK) == (EXTI_SWI_GPIO7_MSK)); -} - -/** - * @brief Enable software interrupt on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO8_MSK); -} - -/** - * @brief Disable software interrupt on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio8(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO8_MSK); -} - -/** - * @brief Check if software interrupt on line 8 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio8(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO8_MSK) == (EXTI_SWI_GPIO8_MSK)); -} - -/** - * @brief Enable software interrupt on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO9_MSK); -} - -/** - * @brief Disable software interrupt on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio9(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO9_MSK); -} - -/** - * @brief Check if software interrupt on line 9 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio9(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO9_MSK) == (EXTI_SWI_GPIO9_MSK)); -} - -/** - * @brief Enable software interrupt on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO10_MSK); -} - -/** - * @brief Disable software interrupt on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio10(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO10_MSK); -} - -/** - * @brief Check if software interrupt on line 10 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio10(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO10_MSK) == (EXTI_SWI_GPIO10_MSK)); -} - -/** - * @brief Enable software interrupt on line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO11_MSK); -} - -/** - * @brief Disable falling trigger event configuration bit of line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio11(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->FTS, EXTI_FTS_GPIO11_MSK); -} - -/** - * @brief Check if software interrupt on line 11 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio11(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO11_MSK) == (EXTI_SWI_GPIO11_MSK)); -} - -/** - * @brief Enable software interrupt on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO12_MSK); -} - -/** - * @brief Disable software interrupt on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio12(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO12_MSK); -} - -/** - * @brief Check if software interrupt on line 12 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio12(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO12_MSK) == (EXTI_SWI_GPIO12_MSK)); -} - -/** - * @brief Enable software interrupt on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO13_MSK); -} - -/** - * @brief Disable software interrupt on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio13(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO13_MSK); -} - -/** - * @brief Check if software interrupt on line 13 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio13(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO13_MSK) == (EXTI_SWI_GPIO13_MSK)); -} - -/** - * @brief Enable software interrupt on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio14(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO14_MSK); -} - -/** - * @brief Disable software interrupt on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio14(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO14_MSK); -} - -/** - * @brief Check if software interrupt on line 14 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio14(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO14_MSK) == (EXTI_SWI_GPIO14_MSK)); -} - -/** - * @brief Enable software interrupt on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_GPIO15_MSK); -} - -/** - * @brief Disable software interrupt on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_gpio15(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_GPIO15_MSK); -} - -/** - * @brief Check if software interrupt on line is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_gpio15(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_GPIO15_MSK) == (EXTI_SWI_GPIO15_MSK)); -} - -/** - * @brief Enable software interrupt on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_cmp1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_CMP1_MSK); -} - -/** - * @brief Disable software interrupt on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_cmp1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_CMP1_MSK); -} - -/** - * @brief Check if software interrupt on line 16 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_cmp1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_CMP1_MSK) == (EXTI_SWI_CMP1_MSK)); -} - -/** - * @brief Enable software interrupt on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_CMP2_MSK); -} - -/** - * @brief Disable software interrupt on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_cmp2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_CMP2_MSK); -} - -/** - * @brief Check if software interrupt on line 17 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_cmp2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_CMP2_MSK) == (EXTI_SWI_CMP2_MSK)); -} - - -/** - * @brief Enable software interrupt on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_PVD0_MSK); -} - -/** - * @brief Disable software interrupt on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_pvd0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_PVD0_MSK); -} - -/** - * @brief Check if software interrupt on line 20 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_pvd0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_PVD0_MSK) == (EXTI_SWI_PVD0_MSK)); -} - -/** - * @brief Enable software interrupt on line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_swi_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->SWI, EXTI_SWI_WAKEUP_MSK); -} - -/** - * @brief Disable software interrupt on line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_swi_wakeup(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->SWI, EXTI_SWI_WAKEUP_MSK); -} - -/** - * @brief Check if software interrupt on line 21 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_swi_wakeup(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->SWI, EXTI_SWI_WAKEUP_MSK) == (EXTI_SWI_WAKEUP_MSK)); -} - -/** - * @} MD_EXTI_PF_SWI - */ - - -/** @defgroup MD_EXTI_PF_ADTE EXTI ADC Trigger Enable Register - * @{ - */ -/** - * @brief Set ADC trigger enable on line - * @param exti EXTI Instance - * @param value The value write in EXTI->ADTE - * @retval None - */ -__STATIC_INLINE void md_exti_set_adte(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->ADTE, value); -} - -/** - * @brief Get ADC trigger enable on line - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_get_adte(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->ADTE)); -} - -/** - * @brief Enable ADC trigger on line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO0_MSK); -} - -/** - * @brief Disable ADC trigger on line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO0_MSK); -} - -/** - * @brief Check if ADC trigger on line 0 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO0_MSK) == (EXTI_ADTE_GPIO0_MSK)); -} - -/** - * @brief Enable ADC trigger on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO1_MSK); -} - -/** - * @brief Disable ADC trigger on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO1_MSK); -} - -/** - * @brief Check if ADC trigger on line 1 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO1_MSK) == (EXTI_ADTE_GPIO1_MSK)); -} - -/** - * @brief Enable ADC trigger on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO2_MSK); -} - -/** - * @brief Disable ADC trigger on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO2_MSK); -} - -/** - * @brief Check if ADC trigger on line 2 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO2_MSK) == (EXTI_ADTE_GPIO2_MSK)); -} - -/** - * @brief Enable ADC trigger on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO3_MSK); -} - -/** - * @brief Disable ADC trigger on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio3(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO3_MSK); -} - -/** - * @brief Check if ADC trigger on line 3 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio3(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO3_MSK) == (EXTI_ADTE_GPIO3_MSK)); -} - -/** - * @brief Enable ADC trigger on line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO4_MSK); -} - -/** - * @brief Disable ADC trigger on line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio4(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO4_MSK); -} - -/** - * @brief Check if ADC trigger on line 4 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio4(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO4_MSK) == (EXTI_ADTE_GPIO4_MSK)); -} - -/** - * @brief Enable ADC trigger on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO5_MSK); -} - -/** - * @brief Disable ADC trigger on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio5(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO5_MSK); -} - -/** - * @brief Check if ADC trigger on line 5 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio5(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO5_MSK) == (EXTI_ADTE_GPIO5_MSK)); -} - -/** - * @brief Enable ADC trigger on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO6_MSK); -} - -/** - * @brief Disable ADC trigger on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio6(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO6_MSK); -} - -/** - * @brief Check if ADC trigger on line 6 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio6(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO6_MSK) == (EXTI_ADTE_GPIO6_MSK)); -} - -/** - * @brief Enable ADC trigger on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO7_MSK); -} - -/** - * @brief Disable ADC trigger on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio7(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO7_MSK); -} - -/** - * @brief Check if ADC trigger on line 7 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio7(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO7_MSK) == (EXTI_ADTE_GPIO7_MSK)); -} - -/** - * @brief Enable ADC trigger on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO8_MSK); -} - -/** - * @brief Disable ADC trigger on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio8(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO8_MSK); -} - -/** - * @brief Check if ADC trigger on line 8 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio8(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO8_MSK) == (EXTI_ADTE_GPIO8_MSK)); -} - -/** - * @brief Enable ADC trigger on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO9_MSK); -} - -/** - * @brief Disable ADC trigger on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio9(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO9_MSK); -} - -/** - * @brief Check if ADC trigger on line 9 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio9(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO9_MSK) == (EXTI_ADTE_GPIO9_MSK)); -} - -/** - * @brief Enable ADC trigger on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO10_MSK); -} - -/** - * @brief Disable ADC trigger on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio10(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO10_MSK); -} - -/** - * @brief Check if ADC trigger on line 10 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio10(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO10_MSK) == (EXTI_ADTE_GPIO10_MSK)); -} - -/** - * @brief Enable ADC trigger on line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO11_MSK); -} - -/** - * @brief Disable ADC trigger on line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio11(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO11_MSK); -} - -/** - * @brief Check if ADC trigger on line 11 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio11(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO11_MSK) == (EXTI_ADTE_GPIO11_MSK)); -} - -/** - * @brief Enable ADC trigger on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO12_MSK); -} - -/** - * @brief Disable ADC trigger on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio12(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO12_MSK); -} - -/** - * @brief Check if ADC trigger on line 12 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio12(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO12_MSK) == (EXTI_ADTE_GPIO12_MSK)); -} - -/** - * @brief Enable ADC trigger on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO13_MSK); -} - -/** - * @brief Disable ADC trigger on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio13(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO13_MSK); -} - -/** - * @brief Check if ADC trigger on line 13 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio13(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO13_MSK) == (EXTI_ADTE_GPIO13_MSK)); -} - -/** - * @brief Enable ADC trigger on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio14(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO14_MSK); -} - -/** - * @brief Disable ADC trigger on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio14(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO14_MSK); -} - -/** - * @brief Check if ADC trigger on line 14 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio14(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO14_MSK) == (EXTI_ADTE_GPIO14_MSK)); -} - -/** - * @brief Enable ADC trigger on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_GPIO15_MSK); -} - -/** - * @brief Disable ADC trigger on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_gpio15(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_GPIO15_MSK); -} - -/** - * @brief Check if ADC trigger on line is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_gpio15(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_GPIO15_MSK) == (EXTI_ADTE_GPIO15_MSK)); -} - -/** - * @brief Enable ADC trigger on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_cmp1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_CMP1_MSK); -} - -/** - * @brief Disable ADC trigger on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_cmp1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_CMP1_MSK); -} - -/** - * @brief Check if ADC trigger on line 16 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_cmp1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_CMP1_MSK) == (EXTI_ADTE_CMP1_MSK)); -} - -/** - * @brief Enable ADC trigger on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_CMP2_MSK); -} - -/** - * @brief Disable ADC trigger on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_cmp2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_CMP2_MSK); -} - -/** - * @brief Check if ADC trigger on line 17 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_cmp2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_CMP2_MSK) == (EXTI_ADTE_CMP2_MSK)); -} - -/** - * @brief Enable ADC trigger on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_PVD0_MSK); -} - -/** - * @brief Disable ADC trigger on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_pvd0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_PVD0_MSK); -} - -/** - * @brief Check if ADC trigger on line 20 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_pvd0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_PVD0_MSK) == (EXTI_ADTE_PVD0_MSK)); -} - -/** - * @brief Enable ADC trigger on line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_adte_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ADTE, EXTI_ADTE_WAKEUP_MSK); -} - -/** - * @brief Disable ADC trigger on line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_adte_wakeup(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->ADTE, EXTI_ADTE_WAKEUP_MSK); -} - -/** - * @brief Check if ADC trigger on line 21 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_adte_wakeup(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->ADTE, EXTI_ADTE_WAKEUP_MSK) == (EXTI_ADTE_WAKEUP_MSK)); -} - - -/** - * @} MD_EXTI_PF_ADTE - */ - -/** @defgroup MD_EXTI_PF_INTERRUNPT_MANAGEMENT EXTI Interrupt Management - * @{ - */ - -/** @defgroup MD_EXTI_PF_IER EXTI Interrupt Enable Register - * @{ - */ - - -/** - * @brief Set interrupt enable on line - * @param exti EXTI Instance - * @param value The value write in EXTI->IER - * @retval None - */ -__STATIC_INLINE void md_spi_set_exti_ier(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->IER, value); -} - -/** - * @brief Enable interrupt on line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO0_MSK); -} - -/** - * @brief Enable interrupt on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO1_MSK); -} - -/** - * @brief Enable interrupt on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO2_MSK); -} - -/** - * @brief Enable interrupt on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO3_MSK); -} - -/** - * @brief Enable interrupt on line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO4_MSK); -} - -/** - * @brief Enable interrupt on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO5_MSK); -} - -/** - * @brief Enable interrupt on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO6_MSK); -} - -/** - * @brief Enable interrupt on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO7_MSK); -} - -/** - * @brief Enable interrupt on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO8_MSK); -} - -/** - * @brief Enable interrupt on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO9_MSK); -} - -/** - * @brief Enable interrupt on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO10_MSK); -} - -/** - * @brief Enable interrupt on line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO11_MSK); -} - -/** - * @brief Enable interrupt on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO12_MSK); -} - -/** - * @brief Enable interrupt on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO13_MSK); -} - -/** - * @brief Enable interrupt on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio14(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO14_MSK); -} - -/** - * @brief Enable interrupt on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_GPIO15_MSK); -} - - -/** - * @brief Enable interrupt on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_cmp1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_CMP1_MSK); -} - -/** - * @brief Enable interrupt on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_CMP2_MSK); -} - -/** - * @brief Enable interrupt on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_PVD0_MSK); -} - -/** - * @brief Enable interrupt on line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_ier_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IER, EXTI_IER_WAKEUP_MSK); -} - -/** - * @} MD_EXTI_PF_IER - */ - -/** @defgroup MD_EXTI_PF_IDR EXTI Interrupt Disable Register - * @{ - */ - -/** - * @brief Disable interrupt on line - * @param exti EXTI Instance - * @param value The value write in EXTI->IDR - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->IDR, value); -} - - -/** - * @brief Disable interrupt on line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO0_MSK); -} - -/** - * @brief Disable interrupt on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO1_MSK); -} - -/** - * @brief Disable interrupt on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO2_MSK); -} - -/** - * @brief Disable interrupt on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO3_MSK); -} - -/** - * @brief Disable interrupt on line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO4_MSK); -} - -/** - * @brief Disable interrupt on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO5_MSK); -} - -/** - * @brief Disable interrupt on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO6_MSK); -} - -/** - * @brief Disable interrupt on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO7_MSK); -} - -/** - * @brief Disable interrupt on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO8_MSK); -} - -/** - * @brief Disable interrupt on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO9_MSK); -} - -/** - * @brief Disable interrupt on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO10_MSK); -} - -/** - * @brief Disable interrupt on line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO11_MSK); -} - -/** - * @brief Disable interrupt on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO12_MSK); -} - -/** - * @brief Disable interrupt on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO13_MSK); -} - -/** - * @brief Disable interrupt on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio14(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->IDR, EXTI_IDR_GPIO14_MSK); -} - -/** - * @brief Disable interrupt on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_GPIO15_MSK); -} - -/** - * @brief Disable interrupt on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_cmp1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->IDR, EXTI_IDR_CMP1_MSK); -} - -/** - * @brief Disable interrupt on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_CMP2_MSK); -} - -/** - * @brief Disable interrupt on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_PVD0_MSK); -} - -/** - * @brief Disable interrupt on line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_idr_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->IDR, EXTI_IDR_WAKEUP_MSK); -} - - -/** - * @} MD_EXTI_PF_IDR - */ - -/** @defgroup MD_EXTI_PF_ICR EXTI Interrupt Clear Register - * @{ - */ - -/** - * @brief Interrupt Clear on line - * @param exti EXTI Instance - * @param value The value write in EXTI->ICR - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->ICR, value); -} - -/** - * @brief Interrupt Clear on line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO0_MSK); -} - -/** - * @brief Interrupt Clear on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO1_MSK); -} - -/** - * @brief Interrupt Clear on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO2_MSK); -} - -/** - * @brief Interrupt Clear on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO3_MSK); -} - -/** - * @brief Interrupt Clear on line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO4_MSK); -} - -/** - * @brief Interrupt Clear on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO5_MSK); -} - -/** - * @brief Interrupt Clear on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO6_MSK); -} - -/** - * @brief Interrupt Clear on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO7_MSK); -} - -/** - * @brief Interrupt Clear on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO8_MSK); -} - -/** - * @brief Interrupt Clear on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO9_MSK); -} - -/** - * @brief Interrupt Clear on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO10_MSK); -} - -/** - * @brief Interrupt Clear on line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO11_MSK); -} - -/** - * @brief Interrupt Clear on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO12_MSK); -} - -/** - * @brief Interrupt Clear on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO13_MSK); -} - -/** - * @brief Interrupt Clear on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio14(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO14_MSK); -} - -/** - * @brief Interrupt Clear on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_GPIO15_MSK); -} - - -/** - * @brief Interrupt Clear on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_cmp1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_CMP1_MSK); -} - -/** - * @brief Interrupt Clear on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_CMP2_MSK); -} - - -/** - * @brief Interrupt Clear on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_PVD0_MSK); -} - -/** - * @brief Interrupt Clear on line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_clear_icr_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->ICR, EXTI_ICR_WAKEUP_MSK); -} - -/** - * @} MD_EXTI_PF_ICR - */ - -/** @defgroup MD_EXTI_PF_IVS EXTI Interrupt Valid Status Register - * @{ - */ - -/** - * @brief Interrupt Valid Status on line - * @param exti EXTI Instance - * @param value The value write in EXTI->IVS - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs(EXTI_TypeDef *exti, uint32_t value) -{ - return (READ_REG(exti->IVS)); -} - -/** - * @brief Interrupt Valid Status on line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO0_MSK) == EXTI_IVS_GPIO0_POS); -} - -/** - * @brief Interrupt Valid Status on line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO1_MSK) == EXTI_IVS_GPIO1_POS); -} - -/** - * @brief Interrupt Valid Status on line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO2_MSK) == EXTI_IVS_GPIO2_POS); -} - -/** - * @brief Interrupt Valid Status on line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio3(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO3_MSK) == EXTI_IVS_GPIO3_POS); -} - -/** - * @brief Interrupt Valid Status on line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio4(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO4_MSK) == EXTI_IVS_GPIO4_POS); -} - -/** - * @brief Interrupt Valid Status on line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio5(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO5_MSK)>>EXTI_IVS_GPIO5_POS); -} - -/** - * @brief Interrupt Valid Status on line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio6(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO6_MSK) == EXTI_IVS_GPIO6_POS); -} - -/** - * @brief Interrupt Valid Status on line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio7(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO7_MSK) == EXTI_IVS_GPIO7_POS); -} - -/** - * @brief Interrupt Valid Status on line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio8(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO8_MSK) == EXTI_IVS_GPIO8_POS); -} - -/** - * @brief Interrupt Valid Status on line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio9(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO9_MSK) == EXTI_IVS_GPIO9_POS); -} - -/** - * @brief Interrupt Valid Status on line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio10(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO10_MSK) == EXTI_IVS_GPIO10_POS); -} - -/** - * @brief Interrupt Valid Status on line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio11(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO11_MSK) == EXTI_IVS_GPIO11_POS); -} - -/** - * @brief Interrupt Valid Status on line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio12(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO12_MSK) == EXTI_IVS_GPIO12_POS); -} - -/** - * @brief Interrupt Valid Status on line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio13(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO13_MSK) == EXTI_IVS_GPIO13_POS); -} - -/** - * @brief Interrupt Valid Status on line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio14(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO14_MSK) == EXTI_IVS_GPIO14_POS); -} - -/** - * @brief Interrupt Valid Status on line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_gpio15(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_GPIO15_MSK) == EXTI_IVS_GPIO15_POS); -} - -/** - * @brief Interrupt Valid Status on line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_cmp1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_CMP1_MSK) == EXTI_IVS_CMP1_POS); -} - -/** - * @brief Interrupt Valid Status on line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_cmp2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_CMP2_MSK) == EXTI_IVS_CMP2_POS); -} - - -/** - * @brief Interrupt Valid Status on line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_pvd0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_PVD0_MSK) == EXTI_IVS_PVD0_POS); -} - -/** - * @brief Interrupt Valid Status on line 21 - * @param exti EXTI Instance - * @retval None - */ - -__STATIC_INLINE uint32_t md_exti_is_enable_ivs_wakeup(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->IVS, EXTI_IVS_WAKEUP_MSK) == EXTI_IVS_WAKEUP_POS); -} - - -/** - * @} MD_EXTI_PF_IVS - */ - -/** @defgroup MD_EXTI_PF_IFM EXTI Interrupt Flag Masked Status Register - * @{ - */ - -/** - * @brief Check if Interrupt Flag Masked Status on line is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->IFM)); -} - - -/** - * @brief Check if Interrupt Flag Masked Status on line 0 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio0(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO0_MSK) == EXTI_IFM_GPIO0_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 1 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio1(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO1_MSK) == EXTI_IFM_GPIO1_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 2 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio2(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO2_MSK) == EXTI_IFM_GPIO2_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 3 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio3(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO3_MSK) == EXTI_IFM_GPIO3_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 4 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio4(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO4_MSK) == EXTI_IFM_GPIO4_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 5 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio5(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO5_MSK) == EXTI_IFM_GPIO5_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 6 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio6(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO6_MSK) == EXTI_IFM_GPIO6_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 7 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio7(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO7_MSK) == EXTI_IFM_GPIO7_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 8 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio8(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO8_MSK) == EXTI_IFM_GPIO8_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 9 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio9(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO9_MSK) == EXTI_IFM_GPIO9_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 10 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio10(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO10_MSK) == EXTI_IFM_GPIO10_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 11 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio11(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO11_MSK) == EXTI_IFM_GPIO11_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 12 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio12(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO12_MSK) == EXTI_IFM_GPIO12_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 13 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio13(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO13_MSK) == EXTI_IFM_GPIO13_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 14 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio14(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO14_MSK) == EXTI_IFM_GPIO14_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 15 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_gpio15(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_GPIO15_MSK) == EXTI_IFM_GPIO15_POS); -} - - -/** - * @brief Check if Interrupt Flag Masked Status on line 16 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_cmp1(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_CMP1_MSK) == EXTI_IFM_CMP1_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 17 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_cmp2(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_CMP2_MSK) == EXTI_IFM_CMP2_POS); -} - - -/** - * @brief Check if Interrupt Flag Masked Status on line 20 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_pvd0(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_PVD0_MSK) == EXTI_IFM_PVD0_POS); -} - -/** - * @brief Check if Interrupt Flag Masked Status on line 21 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_ifm_WAKEUP(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->IFM, EXTI_IFM_WAKEUP_MSK) == EXTI_IFM_WAKEUP_POS); -} - -/** - * @} MD_EXTI_PF_IFM - */ - -/** @defgroup MD_EXTI_PF_RIF EXTI Raw Interrupt Flag Status Register - * @{ - */ - - -/** - * @brief Check if Raw interrupt flag Status on line is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->RIF)); -} - - -/** - * @brief Check if Raw interrupt flag Status on line 0 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio0(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO0_MSK) == EXTI_RIF_GPIO0_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 1 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio1(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO1_MSK) == EXTI_RIF_GPIO1_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 2 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio2(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO2_MSK) == EXTI_RIF_GPIO2_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 3 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio3(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO3_MSK) == EXTI_RIF_GPIO3_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 4 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio4(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO4_MSK) == EXTI_RIF_GPIO4_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 5 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio5(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO5_MSK) == EXTI_RIF_GPIO5_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 6 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio6(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO6_MSK) == EXTI_RIF_GPIO6_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 7 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio7(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO7_MSK) == EXTI_RIF_GPIO7_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 8 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio8(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO8_MSK) == EXTI_RIF_GPIO8_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 9 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio9(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO9_MSK) == EXTI_RIF_GPIO9_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 10 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio10(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO10_MSK) == EXTI_RIF_GPIO10_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 11 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio11(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO11_MSK) == EXTI_RIF_GPIO11_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 12 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio12(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO12_MSK) == EXTI_RIF_GPIO12_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 13 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio13(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO13_MSK) == EXTI_RIF_GPIO13_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 14 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio14(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO14_MSK) == EXTI_RIF_GPIO14_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 15 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_gpio15(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_GPIO15_MSK) == EXTI_RIF_GPIO15_POS); -} - - -/** - * @brief Check if Raw interrupt flag Status on line 16 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_cmp1(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_CMP1_MSK) == EXTI_RIF_CMP1_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 17 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_cmp2(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_CMP2_MSK) == EXTI_RIF_CMP2_POS); -} - - -/** - * @brief Check if Raw interrupt flag Status on line 20 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_pvd0(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_PVD0_MSK) == EXTI_RIF_PVD0_POS); -} - -/** - * @brief Check if Raw interrupt flag Status on line 21 is actived - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_exti_is_active_flag_rif_WAKEUP(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_BIT(exti->RIF, EXTI_RIF_WAKEUP_MSK) == EXTI_RIF_WAKEUP_POS); -} - - -/** - * @} MD_EXTI_PF_RIF - */ - - - - -/** - * @} MD_EXTI_PF_INTERRUNPT_MANAGEMENT - */ - - - - - - -/** @defgroup MD_EXTI_PF_DEBOUNCE_SETTING EXTI Debounce Management - * @{ - */ -/** - * @brief Set debounce enable bit of line - * @param exti EXTI Instance - * @param value The value write in EXTI->DB - * @retval None - */ -__STATIC_INLINE void md_spi_set_exti_db(EXTI_TypeDef *exti, uint32_t value) -{ - WRITE_REG(exti->DB, value); -} - -/** - * @brief Get debounce enable bit of line - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_exti_db(EXTI_TypeDef *exti) -{ - return (uint32_t)(READ_REG(exti->DB)); -} - -/** - * @brief Enable debounce enable bit of line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO0_MSK); -} - -/** - * @brief Disable debounce enable bit of line 0 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO0_MSK); -} - -/** - * @brief Check if debounce enable bit of line 0 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO0_MSK) == (EXTI_DB_GPIO0_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO1_MSK); -} - -/** - * @brief Disable debounce enable bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO1_MSK); -} - -/** - * @brief Check if debounce enable bit of line 1 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO1_MSK) == (EXTI_DB_GPIO1_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO2_MSK); -} - -/** - * @brief Disable debounce enable bit of line 2 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO2_MSK); -} - -/** - * @brief Check if debounce enable bit of line 2 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO2_MSK) == (EXTI_DB_GPIO2_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio3(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO3_MSK); -} - -/** - * @brief Disable debounce enable bit of line 3 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio3(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO3_MSK); -} - -/** - * @brief Check if debounce enable bit of line 3 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio3(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO3_MSK) == (EXTI_DB_GPIO3_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio4(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO4_MSK); -} - -/** - * @brief Disable debounce enable bit of line 4 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio4(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO4_MSK); -} - -/** - * @brief Check if debounce enable bit of line 4 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio4(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO4_MSK) == (EXTI_DB_GPIO4_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio5(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO5_MSK); -} - -/** - * @brief Disable debounce enable bit of line 5 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio5(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO5_MSK); -} - -/** - * @brief Check if debounce enable bit of line 5 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio5(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO5_MSK) == (EXTI_DB_GPIO5_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio6(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO6_MSK); -} - -/** - * @brief Disable debounce enable bit of line 6 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio6(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO6_MSK); -} - -/** - * @brief Check if debounce enable bit of line 6 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio6(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO6_MSK) == (EXTI_DB_GPIO6_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio7(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO7_MSK); -} - -/** - * @brief Disable debounce enable bit of line 7 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio7(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO7_MSK); -} - -/** - * @brief Check if debounce enable bit of line 7 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio7(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO7_MSK) == (EXTI_DB_GPIO7_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio8(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO8_MSK); -} - -/** - * @brief Disable debounce enable bit of line 8 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio8(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO1_MSK); -} - -/** - * @brief Check if debounce enable bit of line 8 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio8(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO8_MSK) == (EXTI_DB_GPIO8_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio9(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO9_MSK); -} - -/** - * @brief Disable debounce enable bit of line 9 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio9(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO9_MSK); -} - -/** - * @brief Check if debounce enable bit of line 9 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio9(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO9_MSK) == (EXTI_DB_GPIO9_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio10(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO10_MSK); -} - -/** - * @brief Disable debounce enable bit of line 10 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio10(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO10_MSK); -} - -/** - * @brief Check if debounce enable bit of line 10 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio10(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO10_MSK) == (EXTI_DB_GPIO10_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio11(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO11_MSK); -} - -/** - * @brief Disable debounce enable bit of line 11 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio11(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO11_MSK); -} - -/** - * @brief Check if debounce enable bit of line 11 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio11(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO11_MSK) == (EXTI_DB_GPIO11_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio12(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO12_MSK); -} - -/** - * @brief Disable debounce enable bit of line 12 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio12(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO12_MSK); -} - -/** - * @brief Check if debounce enable bit of line 12 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio12(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO12_MSK) == (EXTI_DB_GPIO12_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio13(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO13_MSK); -} - -/** - * @brief Disable debounce enable bit of line 13 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio13(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO13_MSK); -} - -/** - * @brief Check if debounce enable bit of line 13 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio13(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO13_MSK) == (EXTI_DB_GPIO13_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio14(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO14_MSK); -} - -/** - * @brief Disable debounce enable bit of line 14 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio14(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO14_MSK); -} - -/** - * @brief Check if debounce enable bit of line 14 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio14(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO14_MSK) == (EXTI_DB_GPIO14_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 1 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_gpio15(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_GPIO15_MSK); -} - -/** - * @brief Disable debounce enable bit of line 15 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_gpio15(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_GPIO15_MSK); -} - -/** - * @brief Check if debounce enable bit of line 15 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_gpio15(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_GPIO15_MSK) == (EXTI_DB_GPIO15_MSK)); -} - - -/** - * @brief Enable debounce enable bit of line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_cmp1(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_CMP1_MSK); -} - -/** - * @brief Disable debounce enable bit of line 16 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_cmp1(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_CMP1_MSK); -} - -/** - * @brief Check if debounce enable bit of line 16 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_cmp1(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_CMP1_MSK) == (EXTI_DB_CMP1_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_cmp2(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_CMP2_MSK); -} - -/** - * @brief Disable debounce enable bit of line 17 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_cmp2(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_CMP2_MSK); -} - -/** - * @brief Check if debounce enable bit of line 17 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_cmp2(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_CMP2_MSK) == (EXTI_DB_CMP2_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_pvd0(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_PVD0_MSK); -} - -/** - * @brief Disable debounce enable bit of line 20 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_pvd0(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_PVD0_MSK); -} - -/** - * @brief Check if debounce enable bit of line 20 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_pvd0(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_PVD0_MSK) == (EXTI_DB_PVD0_MSK)); -} - -/** - * @brief Enable debounce enable bit of line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_enable_db_wakeup(EXTI_TypeDef *exti) -{ - SET_BIT(exti->DB, EXTI_DB_WAKEUP_MSK); -} - -/** - * @brief Disable debounce enable bit of line 21 - * @param exti EXTI Instance - * @retval None - */ -__STATIC_INLINE void md_exti_disable_db_wakeup(EXTI_TypeDef *exti) -{ - CLEAR_BIT(exti->DB, EXTI_DB_WAKEUP_MSK); -} - -/** - * @brief Check if debounce enable bit of line 21 is enabled - * @param exti EXTI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_exti_is_enable_db_wakeup(EXTI_TypeDef *exti) -{ - return (READ_BIT(exti->DB, EXTI_DB_WAKEUP_MSK) == (EXTI_DB_WAKEUP_MSK)); -} - -/** - * @brief Set Debounce counter - * @param exti EXTI Port - * @param dbcnt This bit can be one of following valus: - * @arg Max Value 7 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_exti_set_dbcon_dbcnt(EXTI_TypeDef *exti, uint32_t dbcnt) -{ - MODIFY_REG(exti->DBCON, EXTI_DBCON_DBCNT_MSK, (dbcnt<DBCON, EXTI_DBCON_DBCNT_MSK)>>EXTI_DBCON_DBCNT_POSS); -} - -/** - * @brief Set Debounce prescale - * @param exti EXTI Port - * @param prescale This bit can be one of following valus: - * @arg Max Value 255 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_exti_set_dbcon_dbpre(EXTI_TypeDef *exti, uint32_t prescale) -{ - MODIFY_REG(exti->DBCON, EXTI_DBCON_DBPRE_MSK, (prescale<DBCON, EXTI_DBCON_DBPRE_MSK)>>EXTI_DBCON_DBPRE_POSS); -} - - -/** - * @} MD_EXTI_PF_DEBOUNCE_SETTING - */ - - - - - - -/** - * @} MD_EXTI_Public_Macros - */ - - - - -/* Public functions -----------------------------------------------------------*/ - - - -/** - * @} EXTI - */ - -#endif - - - -/** - * @} Micro_Driver - */ - -#endif - -#ifdef __cplusplus -} -#endif - - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_fc.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_fc.h deleted file mode 100644 index a7d85653bd..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_fc.h +++ /dev/null @@ -1,832 +0,0 @@ -/** - ****************************************************************************** - * @file md_FC.h - * @brief ES32F0271 FC HEAD File. - * - * @version V1.00.01 - * @date 11/20/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_FC_H__ -#define __MD_FC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_fc.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (FC) - -/** @defgroup FC FC - * @brief FC micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_FC_Public_Types FC Public Types - * @{ - */ - -/** - * @brief MD FC Parameter Structure definition - */ -typedef struct -{ - uint32_t SAddr; /*!< Specifies the FC sector address to be erased. - This parameter should be aligned with 0x400*/ - - uint32_t SAddrC; /*!< Specifies the complement of FC sector address to be erased. - This parameter should be the complement of FC page address*/ - - uint16_t BCnt; /*!< Specifies the control byte count. - For program, this parameter should be aligned with 8 and smaller than 0x400 - For read, this parameter should be aligned with 4*/ - - uint32_t *pU32Buf; /*!< Specifies the uint32_t data buffer to program. - This parameter should be the pointer to uint32_t*/ - -} md_fc_ControlTypeDef; - -/** - * @brief MD FC Update Protect Level Structure definition - */ -typedef struct -{ - uint32_t UpdateL; /*!< Specifies the protect page bit mapping low byte (page 31~0) (0=protect, 1=unprotect). - This parameter can be any value between 0~65535*/ - - uint32_t UpdateH; /*!< Specifies the protect page bit mapping high byte (page 63~32) (0=protect, 1=unprotect). - This parameter can be any value between 0~65535*/ - - uint32_t ClearL; /*!< Specifies the reserve page bit mapping low byte (page 31~0) (0=reserve, 1=erase). - This parameter can be any value between 0~65535*/ - - uint32_t ClearH; /*!< Specifies the reserve page bit mapping high byte (page 63~32) (0=reserve, 1=erase). - This parameter can be any value between 0~65535*/ - -} md_fc_UpdProtTypeDef; - -/** - * @} MD_FC_Public_Types - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_FC_Public_Constants FC Public Constants - * @{ - */ - -#define MD_FC_PC_EF_MPAGESZ (0x00000400UL) /** @brief Select main page size */ -#define MD_FC_PC_EF_IPAGESZ (0x00000400UL) /** @brief Select information page size */ -#define MD_FC_PC_EF_MERASEID (0xA5A5AA55UL) /** @brief Select main erase ID */ - -#define MD_FC_PC_CMD_PROG_EFLASH (0xF0) /** @brief Program EFlash */ -#define MD_FC_PC_CMD_SECTOR_ERASE (0xF1) /** @brief Sector Erase */ -#define MD_FC_PC_CMD_MACRO_ERASE (0xF2) /** @brief Macro Erase */ -#define MD_FC_PC_CMD_UPDATE_LV1_PROTECT (0xF3) /** @brief Update Lv1 Protect */ -#define MD_FC_PC_CMD_UPDATE_LV2_PROTECT (0xF4) /** @brief Update Lv2 Protect */ -#define MD_FC_PC_CMD_OPTION_BYTE_ERASE (0xF5) /** @brief Option Byte Erase(Only for ISP) */ - -#define MD_FC_PC_SREMAP_MAIN (0x00) /** @brief Main Flash memory mapped at 0x0000 0000 */ -#define MD_FC_PC_SREMAP_SYSTEM (0x01) /** @brief System Flash memory mapped at 0x0000 0000 */ -#define MD_FC_PC_SREMAP_SRAM (0x02) /** @brief SRAM mapped at 0x0000 0000 */ - -/** - * @} MD_FC_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_FC_Public_Macros FC Public Macros - * @{ - */ - -/** @defgroup MD_FC_PM_WRITE_READ Common write and read registers Macros - * @{ - */ - -/** - * @brief Write a value in FC register - * @param __INSTANCE__ FC Instance - * @param __REG__ Register to be written - * @param __VALUE__ Value to be written in the register - * @retval None - */ -#define MD_FC_WRITEREG(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) - -/** - * @brief Read a value in FC register - * @param __INSTANCE__ FC Instance - * @param __REG__ Register to be read - * @retval Register value - */ -#define MD_FC_READREG(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) - -/** - * @brief Modify value in FC register - * @param __INSTANCE__ FC Instance - * @param __REG__ Register to be written - * @param __MASK__ Mask value to be written in the register - * @param __VALUE__ Value to be written in the register - * @retval None - */ -#define MD_FC_MODIFYREG(__INSTANCE__, __REG__, __MASK__, __VALUE__) MODIFY_REG(__INSTANCE__->__REG__, __MASK__, (__VALUE__)) - -/** - * @brief Set bit value in FC register - * @param __INSTANCE__ FC Instance - * @param __REG__ Register to be written - * @param __MASK__ Mask value to be set in the register - * @retval None - */ -#define MD_FC_SET_BIT(__INSTANCE__, __REG__, __MASK__) SET_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @brief Clear bit value in FC register - * @param __INSTANCE__ FC Instance - * @param __REG__ Register to be written - * @param __MASK__ Mask value to be cleared in the register - * @retval None - */ -#define MD_FC_CLEAR_BIT(__INSTANCE__, __REG__, __MASK__) CLEAR_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @brief Read bit value in FC register - * @param __INSTANCE__ FC Instance - * @param __REG__ Register to be read - * @param __MASK__ Mask value to be read in the register - * @retval Register bit value - */ -#define MD_FC_READBIT(__INSTANCE__, __REG__, __MASK__) READ_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @} MD_FC_PM_WRITE_READ - */ - -/** @defgroup MD_FC_Macro_Drivers FC Public Macro Drivers - * @{ - */ - -/** - * @brief Set FC CMD - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_cmd(uint32_t U32) -{ - MD_FC_WRITEREG(FC, CMD, U32); -} - -/** - * @brief Get FC CMD - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_cmd(void) -{ - return (MD_FC_READREG(FC, CMD)); -} - -/** - * @brief Set FC CMD Flash Command - * @note After procedure is finished, Flash command will be cleaned by itself - * @param @arg @ref MD_FC_PC_CMD_PROG_EFLASH(0xF0) : Program EFlash - * @arg @ref MD_FC_PC_CMD_SECTOR_ERASE(0xF1) : Sector Erase - * @arg @ref MD_FC_PC_CMD_MACRO_ERASE(0xF2) : Macro Erase - * @arg @ref MD_FC_PC_CMD_UPDATE_LV1_PROTECT(0xF3) : Update Lv1 Protect - * @arg @ref MD_FC_PC_CMD_UPDATE_LV2_PROTECT(0xF4) : Update Lv2 Protect - * @arg @ref MD_FC_PC_CMD_OPTION_BYTE_ERASE(0xF5) : Option Byte Erase(Only for ISP) - * @arg Else : Reserved - * @retval None - */ -__STATIC_INLINE void md_fc_set_fc_cmd(uint32_t Cmd) -{ - MD_FC_MODIFYREG(FC, CMD, FC_CMD_FC_CMD_MSK, (Cmd<>FC_CMD_FC_CMD_POSS); -} - -/** - * @brief Set FC PA - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_pa(uint32_t U32) -{ - MD_FC_WRITEREG(FC, PA, U32); -} - -/** - * @brief Get FC PA - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_pa(void) -{ - return (MD_FC_READREG(FC, PA)); -} - -/** - * @brief Set FC Program Counter - * @note Provide maximum 128 times continuous program - * @note Meanwhile user needs to fill out FC_PLD, FC_PHD and FC_CMD only - * @param @arg Max Value 0x7f - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_pa_pcnt(uint32_t PCnt) -{ - MD_FC_MODIFYREG(FC, PA, FC_PA_PCNT_MSK, (((PCnt>>3)-1)<>FC_PA_PCNT_POSS); -} - -/** - * @brief Enable FC Information Block - * @note User can program/erase Info. Block page 7 when Flash protect is disable - * @param None - * @retval None - */ -__STATIC_INLINE void md_fc_enable_pa_ifren(void) -{ - MD_FC_SET_BIT(FC, PA, FC_PA_IFREN_MSK); -} - -/** - * @brief Disable FC Information Block - * @param None - * @retval None - */ -__STATIC_INLINE void md_fc_disble_pa_ifren(void) -{ - MD_FC_CLEAR_BIT(FC, PA, FC_PA_IFREN_MSK); -} - -/** - * @brief Is FC Information Block Enabled - * @param None - * @retval The retval can be one of the following values: - * @arg 0x1 : Enable - * @arg 0x0 : Disable - */ -__STATIC_INLINE uint8_t md_fc_is_enabled_pa_ifren(void) -{ - return (MD_FC_READBIT(FC, PA, FC_PA_IFREN_MSK)>>FC_PA_IFREN_POS); -} - -/** - * @brief Set FC Program/Erase Address - * @note Program : PROG_ADDR[15:3] is double word address - * @note Sector Erase : PROG_ADDR[15:10] is page address, and PROG_ADDR[9:0] dont care - * @note Macro Erase : PROG_ADDR[15:0] dont care - * @param @arg Max Value 0xffc0 - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_pa_prog_addr(uint32_t PAddr) -{ - MD_FC_MODIFYREG(FC, PA, FC_PA_PROG_ADDR_MSK, (PAddr<>FC_PA_PROG_ADDR_POSS); -} - -/** - * @brief Set FC Program Low Data - * @note Eflash supports 64 bits data program, this register provides Low 32 bits data - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_pld(uint32_t U32) -{ - MD_FC_WRITEREG(FC, PLD, U32); -} - -/** - * @brief Get FC Program Low Data - * @note Eflash supports 64 bits data program, this register provides Low 32 bits data - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_pld(void) -{ - return (MD_FC_READREG(FC, PLD)); -} - -/** - * @brief Set FC Program High Data - * @note Eflash supports 64 bits data program, this register provides high 32 bits data - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_phd(uint32_t U32) -{ - MD_FC_WRITEREG(FC, PHD, U32); -} - -/** - * @brief Get FC Program High Data - * @note Eflash supports 64 bits data program, this register provides high 32 bits data - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_phd(void) -{ - return (MD_FC_READREG(FC, PHD)); -} - -/** - * @brief Set FC CON - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_con(uint32_t U32) -{ - MD_FC_WRITEREG(FC, CON, U32); -} - -/** - * @brief Get FC CON - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_con(void) -{ - return (MD_FC_READREG(FC, CON)); -} - -/** - * @brief Enable FC Control Sleep - * @note When receive sleep or deep sleep from CPU, controller will mask Eflash control signal when this option is selected. - * @param None - * @retval None - */ -__STATIC_INLINE void md_fc_enable_con_sleep(void) -{ - MD_FC_SET_BIT(FC, CON, FC_CON_SLEEP_MSK); -} - -/** - * @brief Disable FC Control Sleep - * @note When receive sleep or deep sleep from CPU, controller will mask Eflash control signal when this option is selected. - * @param None - * @retval None - */ -__STATIC_INLINE void md_fc_disable_con_sleep(void) -{ - MD_FC_CLEAR_BIT(FC, CON, FC_CON_SLEEP_MSK); -} - -/** - * @brief Is FC Control Sleep Enabled - * @note When receive sleep or deep sleep from CPU, controller will mask Eflash control signal when this option is selected. - * @param None - * @retval The retval can be one of the following values: - * 0x0:Disable Flash sleep mask function - * 0x1:Enable Flash sleep mask function - */ -__STATIC_INLINE uint8_t md_fc_is_enabled_con_sleep(void) -{ - return (MD_FC_READBIT(FC, CON, FC_CON_SLEEP_MSK)>>FC_CON_SLEEP_POS); -} - -/** - * @brief Enable FC Control PreFetch - * @note This function allow user to pre-fetch 64 bits data from Eflash when the last 32bits data in data buffer has been read - * @param None - * @retval None - */ -__STATIC_INLINE void md_fc_enable_con_pfen(void) -{ - MD_FC_SET_BIT(FC, CON, FC_CON_PFEN_MSK); -} - -/** - * @brief Disable FC Control PreFetch - * @note This function allow user to pre-fetch 64 bits data from Eflash when the last 32bits data in data buffer has been read - * @param None - * @retval None - */ -__STATIC_INLINE void md_fc_disable_con_pfen(void) -{ - MD_FC_CLEAR_BIT(FC, CON, FC_CON_PFEN_MSK); -} - -/** - * @brief Is FC Control PreFetch Enabled - * @note This function allow user to pre-fetch 64 bits data from Eflash when the last 32bits data in data buffer has been read - * @param None - * @retval The retval can be one of the following values: - * 0x0:Disable pre-fetch function - * 0x1:Enable pre-fetch function - */ -__STATIC_INLINE uint8_t md_fc_is_enabled_con_pfen(void) -{ - return (MD_FC_READBIT(FC, CON, FC_CON_PFEN_MSK)>>FC_CON_PFEN_POS); -} - -/** - * @brief Set FC Control Wait Cycle - * @note Eflash supports 64 bits data program, this register provides high 32 bits data - * @param @arg Max Value 0x3 - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_con_wait(uint32_t Wait) -{ - MD_FC_MODIFYREG(FC, CON, FC_CON_WAIT_MSK, (Wait<>FC_CON_WAIT_POSS); -} - -/** - * @brief Get FC STAT - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_sta(void) -{ - return (MD_FC_READREG(FC, STAT)); -} - -/** - * @brief Get FC Status Option Valid - * @note This bit is set when Option Byte Data is valid - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 : Option Byte Data is valid - * @arg Min Value 0x0 : Option Byte Data is invalid - */ -__STATIC_INLINE uint8_t md_fc_get_stat_opvd(void) -{ - return (MD_FC_READBIT(FC, STAT, FC_STAT_OPVD_MSK)>>FC_STAT_OPVD_POS); -} - -/** - * @brief Get FC Status Main Unprotect Level2 Status - * @note This bit is set when Flash main block is unprotect - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 : Lv2 Protect Function is disabled - * @arg Min Value 0x0 : Lv2 Protect Function is enabled - */ -__STATIC_INLINE uint8_t md_fc_get_stat_munp2(void) -{ - return (MD_FC_READBIT(FC, STAT, FC_STAT_MUNP2_MSK)>>FC_STAT_MUNP2_POS); -} - -/** - * @brief Get FC Status Main Unprotect Level1 Status - * @note This bit is set when Flash main block is unprotect - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 : Lv1 Protect Function is disabled - * @arg Min Value 0x0 : Lv1 Protect Function is enabled - */ -__STATIC_INLINE uint8_t md_fc_get_stat_munp1(void) -{ - return (MD_FC_READBIT(FC, STAT, FC_STAT_MUNP1_MSK)>>FC_STAT_MUNP1_POS); -} - -/** - * @brief Set FC Protect Update Low Data - * @note Update main block Lv2 Protect Page 0 ~ Page 31 - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_upl(uint32_t U32) -{ - MD_FC_WRITEREG(FC, UPL, U32); -} - -/** - * @brief Get FC Protect Update Low Data - * @note Update main block Lv2 Protect Page 0 ~ Page 31 - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_upl(void) -{ - return (MD_FC_READREG(FC, UPL)); -} - -/** - * @brief Set FC Protect Update High Data - * @note Update main block Lv2 Protect Page 63 ~ Page 32 - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_fc_set_uph(uint32_t U32) -{ - MD_FC_WRITEREG(FC, UPH, U32); -} - -/** - * @brief Get FC Protect Update High Data - * @note Update main block Lv2 Protect Page 63 ~ Page 32 - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_uph(void) -{ - return (MD_FC_READREG(FC, UPH)); -} - -/** - * @brief Get FC OP_TRIM - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_trim(void) -{ - return (MD_FC_READREG(FC, OP_TRIM)); -} - -/** - * @brief Get FC OP_TRIM BangGap trim valid - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xff - * @arg Min Value 0x0 - * @arg Value 0xa5 BG Trim is Valid - */ -__STATIC_INLINE uint32_t md_fc_get_op_trim_bgtrimvd(void) -{ - return (MD_FC_READBIT(FC, OP_TRIM, FC_OP_TRIM_BGTRIMVD_MSK)>>FC_OP_TRIM_BGTRIMVD_POSS); -} - -/** - * @brief Get FC Trim BangGap trim value - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_trim_bgtrim(void) -{ - return (MD_FC_READBIT(FC, OP_TRIM, FC_OP_TRIM_BGTRIM_MSK)>>FC_OP_TRIM_BGTRIM_POSS); -} - -/** - * @brief Get FC Trim HRC calibration value valid - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xff - * @arg Min Value 0x0 - * @arg Value 0xa5 BG Trim is Valid - */ -__STATIC_INLINE uint32_t md_fc_get_op_trim_hrctrimvd(void) -{ - return (MD_FC_READBIT(FC, OP_TRIM, FC_OP_TRIM_HRCTRIMVD_MSK)>>FC_OP_TRIM_HRCTRIMVD_POSS); -} - -/** - * @brief Get FC Trim HRC calibration value - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_trim_hrctrim(void) -{ - return (MD_FC_READBIT(FC, OP_TRIM, FC_OP_TRIM_HRCTRIM_MSK)>>FC_OP_TRIM_HRCTRIM_POSS); -} - -/** - * @brief Get FC Lv2 Protect Low 32 bits - * @note Lv2 Protect Page 0 ~ Page 31.The Bit is set to 0 when the page is protected - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_prt2l(void) -{ - return (MD_FC_READREG(FC, OP_PRT2L)); -} - -/** - * @brief Get FC Lv2 Protect High 32 bits - * @note Lv2 Protect Page 63 ~ Page 32.The Bit is set to 0 when the page is protected - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_prt2h(void) -{ - return (MD_FC_READREG(FC, OP_PRT2H)); -} - -/** - * @brief Get FC Lv1 Protect Low 32 bits - * @note Lv1 Protect Page 0 ~ Page 31.The Bit is set to 0 when the page is protected - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_prt1l(void) -{ - return (MD_FC_READREG(FC, OP_PRT1L)); -} - -/** - * @brief Get FC Lv1 Protect High 32 bits - * @note Lv1 Protect Page 63 ~ Page 32.The Bit is set to 0 when the page is protected - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_prt1h(void) -{ - return (MD_FC_READREG(FC, OP_PRT1H)); -} - -/** - * @brief Get FC OP_REMAP - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_fc_get_op_remap(void) -{ - return (MD_FC_READREG(FC, OP_REMAP)); -} - -/** - * @brief Get FC Hardware Remap Option - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xff - * @arg Min Value 0x0 - * @arg Value 0xa5 skip boot loader - */ -__STATIC_INLINE uint8_t md_fc_get_op_remap_hremap(void) -{ - return (MD_FC_READBIT(FC, OP_REMAP, FC_OP_REMAP_HREMAP_MSK)>>FC_OP_REMAP_HREMAP_POSS); -} - -/** - * @brief Get FC Software Remap Option - * @param None - * @retval The retval can be one of the following values: - * @arg @ref MD_FC_PC_SREMAP_MAIN(0x0) : Main Flash memory mapped at 0x0000 0000 - * @arg @ref MD_FC_PC_SREMAP_SYSTEM(0x1) : System Flash memory mapped at 0x0000 0000 - * @arg @ref MD_FC_PC_SREMAP_SRAM(0x2) : SRAM mapped at 0x0000 0000 - * @arg Else : Reserved - */ -__STATIC_INLINE uint8_t md_fc_get_op_remap_sremap(void) -{ - return (MD_FC_READBIT(FC, OP_REMAP, FC_OP_REMAP_SREMAP_MSK)>>FC_OP_REMAP_SREMAP_POSS); -} - -/** - * @brief Get FC Software Remap Base Address Settng Data - * @note If set 0x1, it means second 4k Byte, If set 0x2, it means third 4k Byte, and so on - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xf - * @arg Min Value 0x0 - * @note This value is invalid if the value in SREMAP field is 0x3 - */ -__STATIC_INLINE uint8_t md_fc_get_op_remap_sefbase(void) -{ - return (MD_FC_READBIT(FC, OP_REMAP, FC_OP_REMAP_SEFBASE_MSK)>>FC_OP_REMAP_SEFBASE_POSS); -} - -/** - * @} MD_FC_Macro_Drivers - */ - -/** - * @} MD_FC_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_FC_Public_Functions FC Public Functions - * @{ - */ -ErrorStatus md_fc_merase(uint32_t MEraseID); -ErrorStatus md_fc_serase(md_fc_ControlTypeDef *pSErasePara); -ErrorStatus md_fc_program(md_fc_ControlTypeDef *pProgramPara); -ErrorStatus md_fc_read(md_fc_ControlTypeDef *pReadPara); -ErrorStatus md_fc_updprotl1(md_fc_UpdProtTypeDef *pUpdPL1Para); -ErrorStatus md_fc_updprotl2(md_fc_UpdProtTypeDef *pUpdPL2Para); -ErrorStatus md_fc_updremap(uint8_t UpdRemap); -/** - * @} MD_FC_Public_Functions - */ - -#endif - -/** - * @} FC - */ - -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ - diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_gpio.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_gpio.h deleted file mode 100644 index a096fa7a01..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_gpio.h +++ /dev/null @@ -1,2873 +0,0 @@ -/** - ****************************************************************************** - * @file md_GPIO.h - * @brief ES32F0271 GPIO HEAD File. - * - * @version V1.00.02 - * @date 30/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_GPIO_H__ -#define __MD_GPIO_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_gpio.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) - -/** @defgroup GPIO GPIO - * @brief GPIO micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_GPIO_PT_INIT GPIO Public Init structures - * @{ - */ - -/** - * @brief MD GPIO Init Structure definition - */ -typedef struct -{ - uint32_t Pin; /*!< Specifies the GPIO pins to be configured. - This parameter can be any value of @ref MD_GPIO_PC_PIN */ - - uint32_t Mode; /*!< Specifies the operating mode for the selected pins. - This parameter can be a value of @ref MD_GPIO_PC_MODE. - - GPIO HW configuration can be modified afterwards using unitary function @ref md_gpio_set_mode().*/ - - uint32_t OutputType; /*!< Specifies the operating output type for the selected pins. - This parameter can be a value of @ref MD_GPIO_PC_OT. - - GPIO HW configuration can be modified afterwards using unitary function @ref md_gpio_set_output_type().*/ - - - uint32_t Pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins. - This parameter can be a value of @ref MD_GPIO_PC_PULL. - - GPIO HW configuration can be modified afterwards using unitary function @ref md_gpio_set_pull().*/ - - uint32_t OutDrive; /*!< Specifies the output driving current for the selected pins. - This parameter can be a value of @ref MD_GPIO_PC_DS. - - GPIO HW configuration can be modified afterwards using unitary function @ref md_gpio_get_ds().*/ - - uint32_t Function; /*!< Specifies the Peripheral to be connected to the selected pins. - This parameter can be a value of @ref MD_GPIO_PC_FUNCTION. - - GPIO HW configuration can be modified afterwards using unitary function @ref md_gpio_set_function0_7() and md_gpio_set_function8_15().*/ -} md_gpio_inittypedef; - -/** - * @} MD_GPIO_PT_INIT - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_GPIO_Public_Constants GPIO Public Constants - * @{ - */ - -/** @defgroup MD_GPIO_PC_PIN PIN - * @{ - */ -#define MD_GPIO_PIN_0 (0X1<<0) /*!< Select pin 0 */ -#define MD_GPIO_PIN_1 (0X1<<1) /*!< Select pin 1 */ -#define MD_GPIO_PIN_2 (0X1<<2) /*!< Select pin 2 */ -#define MD_GPIO_PIN_3 (0X1<<3) /*!< Select pin 3 */ -#define MD_GPIO_PIN_4 (0X1<<4) /*!< Select pin 4 */ -#define MD_GPIO_PIN_5 (0X1<<5) /*!< Select pin 5 */ -#define MD_GPIO_PIN_6 (0X1<<6) /*!< Select pin 6 */ -#define MD_GPIO_PIN_7 (0X1<<7) /*!< Select pin 7 */ -#define MD_GPIO_PIN_8 (0X1<<8) /*!< Select pin 8 */ -#define MD_GPIO_PIN_9 (0X1<<9) /*!< Select pin 9 */ -#define MD_GPIO_PIN_10 (0X1<<10) /*!< Select pin 10 */ -#define MD_GPIO_PIN_11 (0X1<<11) /*!< Select pin 11 */ -#define MD_GPIO_PIN_12 (0X1<<12) /*!< Select pin 12 */ -#define MD_GPIO_PIN_13 (0X1<<13) /*!< Select pin 13 */ -#define MD_GPIO_PIN_14 (0X1<<14) /*!< Select pin 14 */ -#define MD_GPIO_PIN_15 (0X1<<15) /*!< Select pin 15 */ -#define MD_GPIO_PIN_ALL (MD_GPIO_PIN_0 | MD_GPIO_PIN_1 | MD_GPIO_PIN_2 | \ - MD_GPIO_PIN_3 | MD_GPIO_PIN_4 | MD_GPIO_PIN_5 | \ - MD_GPIO_PIN_6 | MD_GPIO_PIN_7 | MD_GPIO_PIN_8 | \ - MD_GPIO_PIN_9 | MD_GPIO_PIN_10 | MD_GPIO_PIN_11 | \ - MD_GPIO_PIN_12 | MD_GPIO_PIN_13 | MD_GPIO_PIN_14 | \ - MD_GPIO_PIN_15) /*!< Select all pins */ -/** - * @} MD_GPIO_PC_PIN - */ - -/** @defgroup MD_GPIO_PC_MODE Mode - * @{ - */ -#define MD_GPIO_MODE_INPUT (0x00000000UL) /** @brief Select input mode */ -#define MD_GPIO_MODE_OUTPUT (0X00000001UL) /** @brief Select output mode */ -#define MD_GPIO_MODE_FUNCTION (0X00000002UL) /** @brief Select function mode */ -#define MD_GPIO_MODE_ANALOG (0x00000003UL) /** @brief Select analog mode */ -/** - * @} MD_GPIO_PC_MODE - */ - -/** @defgroup MD_GPIO_PC_OT Output Type - * @{ - */ -#define MD_GPIO_OUTPUT_PUSHPULL (0x00000000U) /** @brief Select push-pull as output type */ -#define MD_GPIO_OUTPUT_OPENDRAIN (0x00000001U) /** @brief Select open-drain as output type */ -/** - * @} MD_GPIO_PC_OT - */ - -/** @defgroup MD_GPIO_PC_PULL Pull Up Pull Down - * @{ - */ -#define MD_GPIO_PULL_FLOATING (0x00000000UL) /** @brief Select I/O no pull */ -#define MD_GPIO_PULL_UP (0x00000001UL) /** @brief Select I/O pull up */ -#define MD_GPIO_PULL_DOWN (0x00000002UL) /** @brief Select I/O pull down */ -/** - * @} MD_GPIO_PC_PULL - */ - -/** @defgroup MD_GPIO_PC_DS Output driving/sinking current - * @{ - */ -#define MD_GPIO_DS_16mA (0x00000001U) /** @brief Select I/O 16mA driving/sinking current */ -#define MD_GPIO_DS_8mA (0x00000000U) /** @brief Select I/O 8mA driving/sinking current */ -/** - * @} MD_GPIO_PC_DS - */ - -/** @defgroup MD_GPIO_PC_FUNCTION Alternate Function - * @{ - */ -#define MD_GPIO_AF0 (0x00000000UL) /** @brief Select alternate function 0 */ -#define MD_GPIO_AF1 (0x00000001UL) /** @brief Select alternate function 1 */ -#define MD_GPIO_AF2 (0x00000002UL) /** @brief Select alternate function 2 */ -#define MD_GPIO_AF3 (0x00000003UL) /** @brief Select alternate function 3 */ -#define MD_GPIO_AF4 (0x00000004UL) /** @brief Select alternate function 4 */ -#define MD_GPIO_AF5 (0x00000005UL) /** @brief Select alternate function 5 */ -#define MD_GPIO_AF6 (0x00000006UL) /** @brief Select alternate function 6 */ -#define MD_GPIO_AF7 (0x00000007UL) /** @brief Select alternate function 7 */ -#define MD_GPIO_AF8 (0x00000008UL) /** @brief Select alternate function 8 */ -/** - * @} MD_GPIO_PC_FUNCTION - */ - -/** @defgroup MD_GPIO_PC_FILTER Input Filter - * @{ - */ -#define MD_GPIO_FILTER_BYPASS (0x00000000UL) /** @brief Select bypass */ -#define MD_GPIO_FILTER_GLITCH (0x00000001UL) /** @brief Select glitch free for 20ns plus */ -/** - * @} MD_GPIO_PC_FILTER - */ - -/** @defgroup MD_GPIO_PC_IST Input Schmitt Trigger - * @{ - */ -#define MD_GPIO_IST_TTL (0x00000000UL) /** @brief Select TTL IO Level */ -#define MD_GPIO_IST_CMOS (0x00000001UL) /** @brief Select CMOS IO Level */ -/** - * @} MD_GPIO_PC_IST - */ - -/** @defgroup MD_GPIO_ODATA_SEL GPIO Output Select - * @{ - */ -#define MD_GPIO_OUTPUT_LOW (0x00000000UL) /** @brief Select GPIO Output Low*/ -#define MD_GPIO_OUTPUT_HIGH (0x00000001UL) /** @brief Select GPIO Output High*/ -/** - * @} MD_GPIO_ODATA_SEL - */ - -/** - * @} MD_GPIO_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_GPIO_Public_Macros GPIO Public Macros - * @{ - */ - -/** @defgroup MD_GPIO_MOD_MOD15 MOD15 - * @brief Set MOD15 configure I/O mode bit for md_gpio_set_mod() function used - * @param mod15 This parameter can be one of the following values: - * @arg @ref MD_GPIO_MODE_INPUT - * @arg @ref MD_GPIO_MODE_OUTPUT - * @arg @ref MD_GPIO_MODE_FUNCTION - * @arg @ref MD_GPIO_MODE_ANALOG - * @{ - */ -#define md_gpio_set_mod_mod15_fun(mod15) (mod15<MOD, (mod15|mod14|mod13|mod12|mod11|mod10|mod9|mod8|mod7|mod6|mod5|mod4|mod3|mod2|mod1|mod0)); -} - - - - -/** - * @brief Configure gpio mode for a dedicated pin on dedicated port. - * @note I/O mode can be Input mode, output mode, Alternate function mode, or Analog mode. - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @param Mode This parameter can be one of the following values: - * @arg @ref MD_GPIO_MODE_INPUT - * @arg @ref MD_GPIO_MODE_OUTPUT - * @arg @ref MD_GPIO_MODE_FUNCTION - * @arg @ref MD_GPIO_MODE_ANALOG - * @retval None - */ -__STATIC_INLINE void md_gpio_set_mode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) -{ - MODIFY_REG(GPIOx->MOD, (GPIO_MOD_MOD0_MSK << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U))); -} - -/** - * @brief Return gpio mode for a dedicated pin on dedicated port. - * @note I/O mode can be Input mode, output mode, Alternate function mode, or Analog mode. - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @retval Returned value can be one of the following values: - * @arg @ref MD_GPIO_MODE_INPUT - * @arg @ref MD_GPIO_MODE_OUTPUT - * @arg @ref MD_GPIO_MODE_FUNCTION - * @arg @ref MD_GPIO_MODE_ANALOG - */ -__STATIC_INLINE uint32_t md_gpio_get_mode(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->MOD, - (GPIO_MOD_MOD0_MSK << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); -} - -/** @defgroup MD_GPIO_OT_OT15 OT15 - * @brief Set OT15 output data bit for md_gpio_set_ot() function used - * @param ot15 This parameter can be one of the following values: - * @arg @ref MD_GPIO_OUTPUT_PUSHPULL - * @arg @ref MD_GPIO_OUTPUT_OPENDRAIN - * @{ - */ -#define md_gpio_set_ot_ot15_fun(ot15) (ot15<OT, (ot15|ot14|ot13|ot12|ot11|ot10|ot9|ot8|ot7|ot6|ot5|ot4|ot3|ot2|ot1|ot0)); -} - - -/** - * @brief Configure gpio output type for several pins on dedicated port. - * @note Output type as to be set when gpio pin is in output or - * alternate modes. Possible type are Push-pull or Open-drain. - * @param GPIOx GPIO Port - * @param Pin This parameter can be a combination of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @param OutputType This parameter can be one of the following values: - * @arg @ref MD_GPIO_OUTPUT_PUSHPULL - * @arg @ref MD_GPIO_OUTPUT_OPENDRAIN - * @retval None - */ -__STATIC_INLINE void md_gpio_set_output_type(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t OutputType) -{ - MODIFY_REG(GPIOx->OT, (GPIO_OT_OT0_MSK << (POSITION_VAL(Pin))), (OutputType << (POSITION_VAL(Pin)))); -} - -/** - * @brief Return gpio output type for several pins on dedicated port. - * @note Output type as to be set when gpio pin is in output or - * alternate modes. Possible type are Push-pull or Open-drain. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @retval Returned value can be one of the following values: - * @arg @ref MD_GPIO_OUTPUT_PUSHPULL - * @arg @ref MD_GPIO_OUTPUT_OPENDRAIN - */ -__STATIC_INLINE uint32_t md_gpio_get_output_type(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)((READ_BIT(GPIOx->OT, - (GPIO_OT_OT_MSK << (POSITION_VAL(Pin)))) >> (POSITION_VAL(Pin))) & (0x1U)); -} - - -/** @defgroup MD_GPIO_PUD_PUD15 PUD15 - * @brief Set PUD15 I/O pull-up or pull-down bit for md_gpio_set_pud() function used - * @param pud15 This parameter can be one of the following values: - * @arg @ref MD_GPIO_PULL_FLOATING - * @arg @ref MD_GPIO_PULL_UP - * @arg @ref MD_GPIO_PULL_DOWN - * @{ - */ -#define md_gpio_set_pud_pud15_fun(pud15) (pud15<PUD, (pud15|pud14|pud13|pud12|pud11|pud10|pud9|pud8|pud7|pud6|pud5|pud4|pud3|pud2|pud1|pud0)); -} - -/** - * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port. - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @param Pull This parameter can be one of the following values: - * @arg @ref MD_GPIO_PULL_FLOATING - * @arg @ref MD_GPIO_PULL_UP - * @arg @ref MD_GPIO_PULL_DOWN - * @retval None - */ -__STATIC_INLINE void md_gpio_set_pull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull) -{ - MODIFY_REG(GPIOx->PUD, (GPIO_PUD_PUD0_MSK << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U))); -} - -/** - * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @retval Returned value can be one of the following values: - * @arg @ref MD_GPIO_PULL_FLOATING - * @arg @ref MD_GPIO_PULL_UP - * @arg @ref MD_GPIO_PULL_DOWN - */ -__STATIC_INLINE uint32_t md_gpio_get_pull(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->PUD, - (GPIO_PUD_PUD0_MSK << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); -} - - -/** @defgroup MD_GPIO_DS_DS15 DS15 - * @brief Set DS15 I/O Driving/Sinking current bit for md_gpio_set_ds() function used - * @param ds15 This parameter can be one of the following values: - * @arg @ref MD_GPIO_DS_8mA - * @arg @ref MD_GPIO_DS_16mA - * @{ - */ -#define md_gpio_set_ds_ds15_fun(ds15) (ds15<DS, (ds15|ds14|ds13|ds12|ds11|ds10|ds9|ds8|ds7|ds6|ds5|ds4|ds3|ds2|ds1|ds0)); -} - - -/** - * @brief Configure gpio output driving/sinking current a dedicated pin on a dedicated port. - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @param Odrv This parameter can be one of the following values: - * @arg @ref MD_GPIO_DS_8mA - * @arg @ref MD_GPIO_DS_16mA - * @retval None - */ -__STATIC_INLINE void md_gpio_set_ds(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Odrv) -{ - MODIFY_REG(GPIOx->DS, (GPIO_DS_DS_MSK << (POSITION_VAL(Pin))), (Odrv << (POSITION_VAL(Pin)))); -} - -/** - * @brief Return gpio output driving/sinking current a dedicated pin on a dedicated port. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @retval Returned value can be one of the following values: - * @arg @ref MD_GPIO_DS_8mA - * @arg @ref MD_GPIO_DS_16mA - */ -__STATIC_INLINE uint32_t md_gpio_get_ds(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->DS, - (GPIO_DS_DS_MSK << (POSITION_VAL(Pin)))) >> (POSITION_VAL(Pin))); -} - -/** @defgroup MD_GPIO_AFL_AF0 AF0 - * @brief Set AF0 Alternate function selection bit for md_gpio_set_afl() function used - * @param af0 This parameter can be one of the following values: - * @arg @ref MD_GPIO_AF0 - * @arg @ref MD_GPIO_AF1 - * @arg @ref MD_GPIO_AF2 - * @arg @ref MD_GPIO_AF3 - * @arg @ref MD_GPIO_AF4 - * @arg @ref MD_GPIO_AF5 - * @arg @ref MD_GPIO_AF6 - * @arg @ref MD_GPIO_AF7 - * @{ - */ -#define md_gpio_set_afl_af0_fun(af0) (af0<AFL, (af7|af6|af5|af4|af3|af2|af1|af0)); -} - -/** - * @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. - * @note Possible values are from FUNCTION0 to FUNCTION7 depending on target. - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @param Function This parameter can be one of the following values: - * @arg @ref MD_GPIO_AF0 - * @arg @ref MD_GPIO_AF1 - * @arg @ref MD_GPIO_AF2 - * @arg @ref MD_GPIO_AF3 - * @arg @ref MD_GPIO_AF4 - * @arg @ref MD_GPIO_AF5 - * @arg @ref MD_GPIO_AF6 - * @arg @ref MD_GPIO_AF7 - * @retval None - */ -__STATIC_INLINE void md_gpio_set_function0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Function) -{ - MODIFY_REG(GPIOx->AFL, (GPIO_AFL_AF0_MSK << (POSITION_VAL(Pin) * 4U)), - (Function << (POSITION_VAL(Pin) * 4U))); -} - -/** - * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @retval Returned value can be one of the following values: - * @arg @ref MD_GPIO_AF0 - * @arg @ref MD_GPIO_AF1 - * @arg @ref MD_GPIO_AF2 - * @arg @ref MD_GPIO_AF3 - * @arg @ref MD_GPIO_AF4 - * @arg @ref MD_GPIO_AF5 - * @arg @ref MD_GPIO_AF6 - * @arg @ref MD_GPIO_AF7 - */ -__STATIC_INLINE uint32_t md_gpio_get_function0_7(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->AFL, - (GPIO_AFL_AF0_MSK << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U)); -} - - -/** @defgroup MD_GPIO_AFH_AF8 AF8 - * @brief Set AF8 Alternate function selection bit for md_gpio_set_afh() function used - * @param af8 This parameter can be one of the following values: - * @arg @ref MD_GPIO_AF0 - * @arg @ref MD_GPIO_AF1 - * @arg @ref MD_GPIO_AF2 - * @arg @ref MD_GPIO_AF3 - * @arg @ref MD_GPIO_AF4 - * @arg @ref MD_GPIO_AF5 - * @arg @ref MD_GPIO_AF6 - * @arg @ref MD_GPIO_AF7 - * @{ - */ -#define md_gpio_set_afh_af8_fun(af8) (af8<AFH, (af15|af14|af13|af12|af11|af10|af9|af8)); -} - -/** - * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. - * @note Possible values are from FUNCTION0 to FUNCTION7 depending on target. - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @param Function This parameter can be one of the following values: - * @arg @ref MD_GPIO_AF0 - * @arg @ref MD_GPIO_AF1 - * @arg @ref MD_GPIO_AF2 - * @arg @ref MD_GPIO_AF3 - * @arg @ref MD_GPIO_AF4 - * @arg @ref MD_GPIO_AF5 - * @arg @ref MD_GPIO_AF6 - * @arg @ref MD_GPIO_AF7 - * @retval None - */ -__STATIC_INLINE void md_gpio_set_function8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Function) -{ - MODIFY_REG(GPIOx->AFH, (GPIO_AFH_AF8_MSK << (POSITION_VAL(Pin >> 8U) * 4U)), - (Function << (POSITION_VAL(Pin >> 8U) * 4U))); -} - -/** - * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @retval Returned value can be one of the following values: - * @arg @ref MD_GPIO_AF0 - * @arg @ref MD_GPIO_AF1 - * @arg @ref MD_GPIO_AF2 - * @arg @ref MD_GPIO_AF3 - * @arg @ref MD_GPIO_AF4 - * @arg @ref MD_GPIO_AF5 - * @arg @ref MD_GPIO_AF6 - * @arg @ref MD_GPIO_AF7 - */ -__STATIC_INLINE uint32_t md_gpio_get_function8_15(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->AFH, - (GPIO_AFH_AF8_MSK << (POSITION_VAL(Pin >> 8U) * 4U))) >> (POSITION_VAL(Pin >> 8U) * 4U)); -} - -/** - * @brief Lock configuration of several pins for a dedicated port. - * @note When the lock sequence has been applied on a port bit, the - * value of this port bit can no longer be modified until the - * next reset. - * @note LOCK key write sequence: - * WR GPIOx_LCK = (~LCK[15:0]<<16) + LCK[15:0] - * WR GPIOx_LCK = (~LCK[15:0]<<16) + LCK[15:0] - * @param GPIOx GPIO Port - * @param PinMask This parameter can be a combination of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @arg @ref MD_GPIO_PIN_ALL - * @retval None - */ -__STATIC_INLINE void md_gpio_set_lock(GPIO_TypeDef *GPIOx, uint32_t PinMask) -{ - SET_BIT(GPIOx->LCK, PinMask); -} - -/** - * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0. - * @param GPIOx GPIO Port - * @param PinMask This parameter can be a combination of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @arg @ref MD_GPIO_PIN_ALL - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_gpio_get_lock(GPIO_TypeDef *GPIOx, uint32_t PinMask) -{ - return (READ_BIT(GPIOx->LCK, PinMask) == (PinMask)); -} - - - -/** @defgroup MD_GPIO_IST_IST15 IST15 - * @brief Set IST15 configure the input schmitt trigger level bit for md_gpio_set_ist_fun() function used - * @param ist15 This parameter can be one of the following values: - * @arg @ref MD_GPIO_IST_TTL - * @arg @ref MD_GPIO_IST_CMOS - * @{ - */ -#define md_gpio_set_ist_ist15_fun(ist15) (ist15<IST, (ist15|ist14|ist13|ist12|ist11|ist10|ist9|ist8|ist7|ist6|ist5|ist4|ist3|ist2|ist1|ist0)); -} - -/** - * @brief Configure GPIOx port Input Schmitt Trigger Register. - * @note Warning: only one pin can be passed as parameter. - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @param Iolev This parameter can be one of the following values: - * @arg @ref MD_GPIO_IST_TTL - * @arg @ref MD_GPIO_IST_CMOS - * @retval None - */ -__STATIC_INLINE void md_gpio_set_ist(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Iolev) -{ - MODIFY_REG(GPIOx->IST, (GPIO_IST_IST_MSK << (POSITION_VAL(Pin))), (Iolev << (POSITION_VAL(Pin)))); -} - -/** - * @brief Return GPIOx port Input Schmitt Trigger Register - * @param GPIOx GPIO Port - * @param Pin This parameter can be one of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @retval The retval can be one of the following values: - * @arg @ref MD_GPIO_IST_TTL - * @arg @ref MD_GPIO_IST_CMOS - */ -__STATIC_INLINE uint32_t md_gpio_get_ist(GPIO_TypeDef *GPIOx, uint32_t Pin) -{ - return (uint32_t)(READ_BIT(GPIOx->IST, (GPIO_IST_IST_MSK << (POSITION_VAL(Pin)))) >> (POSITION_VAL(Pin))); -} - -/** - * @brief Return full input data register value for a dedicated port. - * @param GPIOx GPIO Port - * @retval Input data register value of port - */ -__STATIC_INLINE uint32_t md_gpio_get_input_port(GPIO_TypeDef *GPIOx) -{ - return (uint32_t)(READ_REG(GPIOx->IDATA)); -} - - - - -/** @defgroup MD_GPIO_ODATA_OD15 OD15 - * @brief Set OD15 set/reset bit for md_gpio_set_bsbr() function used - * @param od15 This parameter can be one of the following values: - * @arg @ref MD_GPIO_OUTPUT_LOW - * @arg @ref MD_GPIO_OUTPUT_HIGH - * @{ - */ -#define md_gpio_set_odata_od15_fun(od15) (od15<ODATA, (od15|od14|od13|od12|od11|od10|od9|od8|od7|od6|od5|od4|od3|od2|od1|od0)); -} - - - - - -/** - * @brief Write output data register for the port. - * @param GPIOx GPIO Port - * @param PortValue Level value for each pin of the port - * @retval None - */ -__STATIC_INLINE void md_gpio_set_output_port(GPIO_TypeDef *GPIOx, uint32_t PortValue) -{ - WRITE_REG(GPIOx->ODATA, PortValue); -} - -/** - * @brief Return full output data register value for a dedicated port. - * @param GPIOx GPIO Port - * @retval Output data register value of port - */ -__STATIC_INLINE uint32_t md_gpio_get_output_port(GPIO_TypeDef *GPIOx) -{ - return (uint32_t)(READ_REG(GPIOx->ODATA)); -} - -/** - * @brief Set several pins to high level on dedicated gpio port. - * @param GPIOx GPIO Port - * @param PinMask This parameter can be a combination of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @arg @ref MD_GPIO_PIN_ALL - * @retval None - */ -__STATIC_INLINE void md_gpio_set_pin_high(GPIO_TypeDef *GPIOx, uint32_t PinMask) -{ - WRITE_REG(GPIOx->BSBR, PinMask); -} - -/** - * @brief Reset several pins to low level on dedicated gpio port. - * @param GPIOx GPIO Port - * @param PinMask This parameter can be a combination of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @arg @ref MD_GPIO_PIN_ALL - * @retval None - */ -__STATIC_INLINE void md_gpio_set_pin_low(GPIO_TypeDef *GPIOx, uint32_t PinMask) -{ - WRITE_REG(GPIOx->BSBR, (PinMask << 16)); -} - - -/** @defgroup MD_GPIO_FIR_FIR15 FIR15 - * @brief Set FIR15 configure the input signal over thought a glitch filter bit for md_gpio_set_fir() function used - * @param fir15 This parameter can be one of the following values: - * @arg @ref MD_GPIO_FILTER_BYPASS - * @arg @ref MD_GPIO_FILTER_GLITCH - * @{ - */ -#define md_gpio_set_fir_fir15_fun(fir15) (fir15<FIR, (fir15|fir14|fir13|fir12|fir11|fir10|fir9|fir8|fir7|fir6|fir5|fir4|fir3|fir2|fir1|fir0)); -} - - -/** - * @brief Write input filter register for the port. - * @note These bits are written by software to configure - * the input signal over thought a glitch filter. - * @param GPIOx GPIO Port - * @param PinMask This parameter can be a combination of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @arg @ref MD_GPIO_PIN_ALL - * @retval None - */ -__STATIC_INLINE void md_gpio_set_filter(GPIO_TypeDef *GPIOx, uint32_t PinMask) -{ - WRITE_REG(GPIOx->FIR, PinMask); -} - -/** - * @brief Return full input filter data register value for a dedicated port. - * @param GPIOx GPIO Port - * @param PinMask This parameter can be a combination of the following values: - * @arg @ref MD_GPIO_PIN_0 - * @arg @ref MD_GPIO_PIN_1 - * @arg @ref MD_GPIO_PIN_2 - * @arg @ref MD_GPIO_PIN_3 - * @arg @ref MD_GPIO_PIN_4 - * @arg @ref MD_GPIO_PIN_5 - * @arg @ref MD_GPIO_PIN_6 - * @arg @ref MD_GPIO_PIN_7 - * @arg @ref MD_GPIO_PIN_8 - * @arg @ref MD_GPIO_PIN_9 - * @arg @ref MD_GPIO_PIN_10 - * @arg @ref MD_GPIO_PIN_11 - * @arg @ref MD_GPIO_PIN_12 - * @arg @ref MD_GPIO_PIN_13 - * @arg @ref MD_GPIO_PIN_14 - * @arg @ref MD_GPIO_PIN_15 - * @arg @ref MD_GPIO_PIN_ALL - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_gpio_get_filter(GPIO_TypeDef *GPIOx, uint32_t PinMask) -{ - return (READ_BIT(GPIOx->FIR, PinMask) == (PinMask)); -} - -/** - * @} MD_GPIO_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_GPIO_Public_Functions GPIO Public Functions - * @{ - */ - -/** @defgroup MD_GPIO_PF_Port_Configuration Port Configuration - * @{ - */ - -/** - * @} MD_GPIO_PF_Port_Configuration - */ - -/** @defgroup MD_GPIO_PF_Data_Access Data Access - * @{ - */ - -/** - * @} MD_GPIO_PF_Data_Access - */ - - -/** @defgroup MD_GPIO_PF_Init Initialization and de-initialization functions - * @{ - */ - -ErrorStatus md_gpio_deinit(GPIO_TypeDef *GPIOx); -ErrorStatus md_gpio_init(GPIO_TypeDef *GPIOx, md_gpio_inittypedef *GPIO_InitStruct); -void md_gpio_struct_init(md_gpio_inittypedef *GPIO_InitStruct); - -/** - * @} MD_GPIO_PF_Init - */ - -/** - * @} MD_GPIO_Public_Functions - */ - -#endif - -/** - * @} GPIO - */ - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_hdiv.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_hdiv.h deleted file mode 100644 index 5baf2d5d23..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_hdiv.h +++ /dev/null @@ -1,292 +0,0 @@ -/** - ****************************************************************************** - * @file md_HDIV.h - * @brief ES32F0271 HDIV HEAD File. - * - * @version V1.00.01 - * @date 11/20/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_HDIV_H__ -#define __MD_HDIV_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_hdiv.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (HDIV) - -/** @defgroup HDIV HDIV - * @brief HDIV micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ - -/** - * @brief MD HDIV Parameter Structure definition - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_HDIV_Public_Constants HDIV Public Constants - * @{ - */ - -/** - * @} MD_HDIV_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_HDIV_Public_Macros HDIV Public Macros - * @{ - */ - -/** @defgroup MD_HDIV_PM_WRITE_READ Common write and read registers Macros - * @{ - */ - -/** - * @brief Write a value in HDIV register - * @param __INSTANCE__ HDIV Instance - * @param __REG__ Register to be written - * @param __VALUE__ Value to be written in the register - * @retval None - */ -#define MD_HDIV_WRITEREG(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) - -/** - * @brief Read a value in HDIV register - * @param __INSTANCE__ HDIV Instance - * @param __REG__ Register to be read - * @retval Register value - */ -#define MD_HDIV_READREG(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) - -/** - * @brief Modify value in HDIV register - * @param __INSTANCE__ HDIV Instance - * @param __REG__ Register to be written - * @param __MASK__ Mask value to be written in the register - * @param __VALUE__ Value to be written in the register - * @retval None - */ -#define MD_HDIV_MODIFYREG(__INSTANCE__, __REG__, __MASK__, __VALUE__) MODIFY_REG(__INSTANCE__->__REG__, __MASK__, (__VALUE__)) - -/** - * @brief Set bit value in HDIV register - * @param __INSTANCE__ HDIV Instance - * @param __REG__ Register to be read - * @param __MASK__ Mask value to be set in the register - * @retval None - */ -#define MD_HDIV_SET_BIT(__INSTANCE__, __REG__, __MASK__) SET_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @brief Clear bit value in HDIV register - * @param __INSTANCE__ HDIV Instance - * @param __REG__ Register to be read - * @param __MASK__ Mask value to be cleased in the register - * @retval None - */ -#define MD_HDIV_CLEAR_BIT(__INSTANCE__, __REG__, __MASK__) CLEAR_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @brief Read bit value in HDIV register - * @param __INSTANCE__ HDIV Instance - * @param __REG__ Register to be read - * @param __MASK__ Mask value to be read in the register - * @retval Register bit value - */ -#define MD_HDIV_READBIT(__INSTANCE__, __REG__, __MASK__) READ_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @} MD_HDIV_PM_WRITE_READ - */ - -/** @defgroup MD_HDIV_Macro_Drivers HDIV Public Macro Drivers - * @{ - */ - -/** - * @brief Set HDIV DIVDR - * @note This register is given the dividend of divider before calculation starting - * @note When this register is written, hardware divider will start calculate - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_hdiv_set_divdr(uint32_t U32) -{ - MD_HDIV_WRITEREG(HDIV, DIVDR, U32); -} - -/** - * @brief Get HDIV DIVIDEND - * @note This register is given the dividend of divider before calculation starting - * @note When this register is written, hardware divider will start calculate - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_hdiv_get_divdr(void) -{ - return (MD_HDIV_READREG(HDIV, DIVDR)); -} - -/** - * @brief Set HDIV DIVSR - * @note This register is given the divisor of divider before calculation starts - * @note When this register is written, hardware divider will start calculate - * @param @arg Max Value 0xffffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_hdiv_set_divsr(uint32_t U32) -{ - MD_HDIV_WRITEREG(HDIV, DIVSR, U32); -} - -/** - * @brief Get HDIV DIVSR - * @note This register is given the divisor of divider before calculation starts. - * @note When this register is written, hardware divider will start calculate - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_hdiv_get_divsr(void) -{ - return (MD_HDIV_READREG(HDIV, DIVSR)); -} - -/** - * @brief Get HDIV DIVQR - * @note This register holds the quotient result of divider after calculation complete - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_hdiv_get_divqr(void) -{ - return (MD_HDIV_READREG(HDIV, DIVQR)); -} - -/** - * @brief Get HDIV DIVRR - * @note This register holds the remainder result of divider after calculation complete - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_hdiv_get_divrr(void) -{ - return (MD_HDIV_READREG(HDIV, DIVRR)); -} - -/** - * @brief Get HDIV DIVSTAT - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x7 - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_hdiv_get_divstat(void) -{ - return (MD_HDIV_READREG(HDIV, DIVSTAT)); -} - -/** - * @brief Is HDIV DIVSTAT SIGN Active - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 : Signed - * @arg Min Value 0x0 : Unsigned - */ -__STATIC_INLINE uint8_t md_hdiv_get_divsts_sign(void) -{ - return (MD_HDIV_READBIT(HDIV, DIVSTAT, HDIV_DIVSTAT_SIGN_MSK)>>HDIV_DIVSTAT_SIGN_POS); -} - -/** - * @brief Is HDIV DIVSTAT DIV0 Active - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 : The divisor is 0 - * @arg Min Value 0x0 : The divisor is not 0 - */ -__STATIC_INLINE uint8_t md_hdiv_get_divsts_div0(void) -{ - return (MD_HDIV_READBIT(HDIV, DIVSTAT, HDIV_DIVSTAT_DIV0_MSK)>>HDIV_DIVSTAT_DIV0_POS); -} - -/** - * @brief Is HDIV DIVSTAT BUSY Active - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 : The divider is busy - * @arg Min Value 0x0 : The divider is not busy - */ -__STATIC_INLINE uint8_t md_hdiv_get_divsts_busy(void) -{ - return (MD_HDIV_READBIT(HDIV, DIVSTAT, HDIV_DIVSTAT_BUSY_MSK)>>HDIV_DIVSTAT_BUSY_POS); -} - -/** - * @} MD_HDIV_Macro_Drivers - */ - -/** - * @} MD_HDIV_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_HDIV_Public_Functions HDIV Public Functions - * @{ - */ - -/** - * @} MD_HDIV_Public_Functions - */ - -#endif - -/** - * @} HDIV - */ - -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_i2c.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_i2c.h deleted file mode 100644 index 9f2e2ff964..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_i2c.h +++ /dev/null @@ -1,3273 +0,0 @@ -/** - ****************************************************************************** - * @file md_i2c.h - * @brief ES32F0271 I2C HEAD File. - * - * @version V0.01 - * @date 4/12/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_I2C_H__ -#define __MD_I2C_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_i2c.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (I2C1) | defined (I2C2) - -/** @defgroup I2C I2C - * @brief I2C micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - - -/* Public Init Structure ------------------------------------------------------*/ -/** @defgroup MD_I2C_PT_INIT I2C Public Init structure - * @brief I2C Init structure. - * @{ - */ -typedef struct -{ - uint32_t Timing; /*!< Specifies the I2C_TIMINGR_register value. - This parameter calculated by referring to I2C initialization section in Reference manual */ - - uint32_t Address1; /*!< Specifies the first device address. - This parameter can be a 7-bit or 10-bit address. */ - - uint32_t AddrSize; /*!< Specifies the device address 1 size (7-bit or 10-bit). - This parameter can be a value of @ref I2C_LL_EC_OWNADDRESS1 - - This feature can be modified afterwards using unitary function @ref LL_I2C_SetOwnAddress1(). */ - - uint32_t DualAddressMode; /*!< Specifies if dual addressing mode is selected. - This parameter can be a value of @ref I2C_DUAL_ADDRESSING_MODE */ - - uint32_t Address2; /*!< Specifies the second device own address if dual addressing mode is selected - This parameter can be a 7-bit address. */ - - uint32_t Address2Masks; /*!< Specifies the acknowledge mask address second device own address if dual addressing mode is selected - This parameter can be a value of @ref I2C_OWN_ADDRESS2_MASKS */ -} md_i2c_inittypedef; -/** - * @} MD_I2C_PT_INIT - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_I2C_Public_Constants I2C Public Constants - * @{ - */ - -/** @defgroup MD_I2C_ADDRESSING_MODE I2C Addressing Mode - * @{ - */ -#define MD_I2C_ADDRESSINGMODE_7BIT (0x00000000U) /*!< DISABLE */ -#define MD_I2C_ADDRESSINGMODE_10BIT (I2C_CON2_ADD10_MSK) /*!< I2C_CON2_ADD10_MSK = 1<<11 */ -/** - * @} MD_I2C_ADDRESSING_MODE - */ - -/** @defgroup MD_I2C_DUAL_ADDRESSING_MODE I2C Dual Addressing Mode - * @{ - */ -#define MD_I2C_DUALADDRESS_DISABLE (0x00000000U) /*!< DISABLE */ -#define MD_I2C_DUALADDRESS_ENABLE (I2C_ADDR2_OA2EN_MSK) /*!< I2C_ADDR2_OA2EN_MSK = 1<<15 */ -/** - * @} MD_I2C_DUAL_ADDRESSING_MODE - */ - -/** @defgroup MD_I2C_TIMING_CONFIG I2C Timing Config - * @note pllmul<<28|presc<<24|scll<<16|sclh<<8|sdadel<<4|scldel - * @{ - */ -/* pllmul presc scll sclh sdadel scldel */ -#define CLK10kHz8M (1<<28) |(1<<24) |(0xC7<<16)|(0xC3<<8)|(2<<4)|(4) /*!< APB = 8MHz; CLK = 10kHz */ -#define CLK100kHz8M (1<<28) |(1<<24) |(0x13<<16)|(0xF<<8) |(2<<4)|(4) /*!< APB = 8MHz; CLK = 100kHz */ -#define CLK400kHz8M (1<<28) |(0<<24) |(9<<16) |(3<<8) |(1<<4)|(3) /*!< APB = 8MHz; CLK = 400kHz */ -#define CLK500kHz8M (1<<28) |(0<<24) |(6<<16) |(3<<8) |(0<<4)|(1) /*!< APB = 8MHz; CLK = 500kHz */ -#define CLK10kHz16M (3<<28) |(3<<24) |(0xC7<<16)|(0xC3<<8)|(2<<4)|(4) /*!< APB = 16MHz; CLK = 10kHz */ -#define CLK100kHz16M (3<<28) |(3<<24) |(0x13<<16)|(0xF<<8) |(2<<4)|(4) /*!< APB = 16MHz; CLK = 100kHz */ -#define CLK400kHz16M (3<<28) |(1<<24) |(9<<16) |(3<<8) |(2<<4)|(3) /*!< APB = 16MHz; CLK = 400kHz */ -#define CLK1000kHz16M (3<<28) |(0<<24) |(4<<16) |(2<<8) |(0<<4)|(2) /*!< APB = 16MHz; CLK = 1000kHz */ -#define CLK10kHz48M (11U<<28)|(0xB<<24)|(0xC7<<16)|(0xC3<<8)|(2<<4)|(4) /*!< APB = 48MHz; CLK = 10kHz */ -#define CLK100kHz48M (11U<<28)|(0xB<<24)|(0x13<<16)|(0xF<<8) |(2<<4)|(4) /*!< APB = 48MHz; CLK = 100kHz */ -#define CLK400kHz48M (11U<<28)|(5<<24) |(9<<16) |(3<<8) |(3<<4)|(3) /*!< APB = 48MHz; CLK = 400kHz */ -#define CLK1000kHz48M (11U<<28)|(5<<24) |(3<<16) |(1<<8) |(0<<4)|(1) /*!< APB = 48MHz; CLK = 1000kHz */ -/** - * @} MD_I2C_TIMING_CONFIG - */ - -/** @defgroup MD_I2C_ADDRESS2_MASKS I2C Address2 Masks - * @{ - */ -#define MD_I2C_ADDR2_NOMASK (0x0000U) /*!< NOMASK */ -#define MD_I2C_ADDR2_MASK01 (0x0100U) /*!< MASK01 */ -#define MD_I2C_ADDR2_MASK02 (0x0200U) /*!< MASK02 */ -#define MD_I2C_ADDR2_MASK03 (0x0300U) /*!< MASK03 */ -#define MD_I2C_ADDR2_MASK04 (0x0400U) /*!< MASK04 */ -#define MD_I2C_ADDR2_MASK05 (0x0500U) /*!< MASK05 */ -#define MD_I2C_ADDR2_MASK06 (0x0600U) /*!< MASK06 */ -#define MD_I2C_ADDR2_MASK07 (0x0700U) /*!< MASK07 */ -/** - * @} MD_I2C_ADDRESS2_MASKS - */ - -/** @defgroup MD_I2C_GENERAL_CALL_ADDRESSING_MODE I2C General Call Addressing Mode - * @{ - */ -#define MD_I2C_GENERALCALL_DISABLE (0x00000000U) /*!< DISABLE */ -#define MD_I2C_GENERALCALL_ENABLE (I2C_CON1_GCEN_MSK) /*!< I2C_CON1_GCEN_MSK = 1<<19 */ -/** - * @} MD_I2C_GENERAL_CALL_ADDRESSING_MODE - */ - -/** @defgroup MD_I2C_NOSTRETCH_MODE I2C No-Stretch Mode - * @{ - */ -#define MD_I2C_NOSTRETCH_DISABLE (0x00000000U) /*!< DISABLE */ -#define MD_I2C_NOSTRETCH_ENABLE (I2C_CON1_NOSTRETCH_MSK) /*!< I2C_CON1_NOSTRETCH_MSK = 1<<17 */ -/** - * @} MD_I2C_NOSTRETCH_MODE - */ - -/** @defgroup MD_I2C_MODE I2C Mode - * @{ - */ -#define MD_I2C_MODE_NONE ((uint8_t)0x00U /*!< None */ -#define MD_I2C_MODE_MASTER ((uint8_t)0x10U) /*!< Master */ -#define MD_I2C_MODE_SLAVE ((uint8_t)0x20U) /*!< Slave */ -#define MD_I2C_MODE_MEM ((uint8_t)0x40U) /*!< Mem */ -/** - * @} MD_I2C_MODE - */ - -/** @defgroup MD_I2C_PECBYTE_ENABLE Pecbyte Enable - * @{ - */ -#define MD_I2C_PECBYTE_ENABLE I2C_CON2_PECBYTE_MSK /*!< I2C_CON2_PECBYTE_MSK = 1<<26 */ -/** - * @} MD_I2C_PECBYTE_ENABLE - */ - -/** @defgroup MD_I2C_AUTOEND_ENABLE I2C Autoend Enable - * @{ - */ -#define MD_I2C_SOFTEND_MODE (0x00000000U) /*!< DISABLE */ -#define MD_I2C_AUTOEND_MODE (I2C_CON2_AUTOEND_MSK) /*!< I2C_CON2_AUTOEND_MSK = 1<<25 */ -/** - * @} MD_I2C_AUTOEND_ENABLE - */ - -/** @defgroup MD_I2C_RELOAD_MODE I2C Reload Mode - * @{ - */ -#define MD_I2C_NORELOAD_MODE (0x00000000U) /*!< DISABLE */ -#define MD_I2C_RELOAD_MODE (I2C_CON2_RELOAD_MSK) /*!< I2C_CON2_RELOAD_MSK = 1<<24 */ -/** - * @} MD_I2C_RELOAD_MODE - */ - -/** @defgroup MD_I2C_NACKNOWLEDGE Acknowledge Generation - * @{ - */ -#define MD_I2C_ACK 0x00000000U /*!< ACK is sent after current received byte. */ -#define MD_I2C_NACK I2C_CON2_NACK_MSK /*!< NACK is sent after current received byte, I2C_CON2_NACK_MSK = 1<<15 */ -/** - * @} MD_I2C_NACKNOWLEDGE - */ - -/** @defgroup MD_I2C_STOP_GENERATION Stop Generation - * @{ - */ -#define MD_I2C_STOP_GENERATION I2C_CON2_STOP_MSK /*!< I2C_CON2_STOP_MSK = 1<<14 */ -/** - * @} MD_I2C_STOP_GENERATION - */ - -/** @defgroup MD_I2C_START_GENERATION Start Generation - * @{ - */ -#define MD_I2C_START_GENERATION I2C_CON2_START_MSK /*!< I2C_CON2_PECBYTE_MSK = 1<<13 */ -/** - * @} MD_I2C_START_GENERATION - */ - -/** @defgroup MD_I2C_HEAD10R Acknowledge Generation - * @{ - */ -#define MD_I2C_GENERAL_10BIT_READ 0x00000000U /*!< DISABLE */ -#define MD_I2C_SIMPLIFIED_10BIT_READ I2C_CON2_HEAD10R_MSK /*!< I2C_CON2_HEAD10R_MSK = 1<<12 */ -/** - * @} MD_I2C_HEAD10R - */ - -/** @defgroup MD_I2C_TRANSFER_DIRECTION Transfer direction (master mode) - * @{ - */ -#define MD_I2C_MASTER_WRITE 0x00000000U /*!< Master Write */ -#define MD_I2C_MASTER_READ I2C_CON2_RD_WRN_MSK /*!< I2C_CON2_RD_WRN_MSK = 1<<10 */ -/** - * @} MD_I2C_TRANSFER_DIRECTION - */ - -/** @defgroup MD_I2C_OA1_MODE Own Address 1 mode - * @{ - */ -#define MD_I2C_OA1_7BIT 0x00000000U /*!< OA1 7-bit mode */ -#define MD_I2C_OA1_10BIT I2C_ADDR1_OA1MODE_MSK /*!< I2C_ADDR1_OA1MODE_MSK = 1<<10 */ -/** - * @} MD_I2C_OA1_MODE - */ - -/** @defgroup MD_I2C_TIDLE_MODE Tidle mode - * @{ - */ -#define MD_I2C_LOW_TIMEOUTA 0x00000000U /*!< TIMEOUTA is used to detect SCL low timeout */ -#define MD_I2C_IDLE_TIMEOUTA I2C_TIMEOUTR_TIDLE_MSK /*!< TIMEOUTA is used to detectbus idle condition, I2C_TIMEOUTR_TIDLE_MSK = 1<<12 */ -/** - * @} MD_I2C_TIDLE_MODE - */ - -/** @defgroup MD_I2C_RXFIFO_THRESHOLD FIFO Threshold - * @{ - */ -#define MD_I2C_RXFIFO_THRESHOLD_RX1 0U<CON1, Reg_Value); -} - -/** - * @brief I2C Get CON1 - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_con1(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->CON1)); -} - -/** - * @brief I2C PEC Enable - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_pecen(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_PECEN_MSK); -} - -/** - * @brief I2C PEC Disable - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_pecen(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_PECEN_MSK); -} - -/** - * @brief Indicate if I2C PEC is enabled - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to '0' - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_pecen(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_PECEN_MSK) == (I2C_CON1_PECEN_MSK)); -} - -/** - * @brief I2C Alert Enable - * @note When ALERTEN = 0, the SMBA pin can be used as a standard GPIO.If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_alerten(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_ALERTEN_MSK); -} - -/** - * @brief I2C Alert Disable - * @note When ALERTEN = 0, the SMBA pin can be used as a standard GPIO.If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_alerten(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_ALERTEN_MSK); -} - -/** - * @brief Indicate if I2C PEC is enabled - * @note When ALERTEN = 0, the SMBA pin can be used as a standard GPIO.If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_alerten(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_ALERTEN_MSK) == (I2C_CON1_ALERTEN_MSK)); -} - -/** - * @brief I2C SMBus Device Default address Enable - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. Device default address 0b1100 001. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_smbden(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_SMBDEN_MSK); -} - -/** - * @brief I2C SMBus Device Default address Disable - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. Device default address 0b1100 001. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_smbden(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_SMBDEN_MSK); -} - -/** - * @brief Indicate if I2C SMBus Device Default address is enabled - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. Device default address 0b1100 001. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_smbden(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_SMBDEN_MSK) == (I2C_CON1_SMBDEN_MSK)); -} - -/** - * @brief I2C SMBus Host address Enable - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. Host default address 0b0001 000. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_smbhen(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_SMBHEN_MSK); -} - -/** - * @brief I2C SMBus Host address Disable - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. Host default address 0b0001 000. - * This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_smbhen(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_SMBHEN_MSK); -} - -/** - * @brief Indicate if I2C SMBus Host address is enabled - * @note If the SMBus feature is not supported,this bit is reserved and forced by hardware to 0. Host default address 0b0001 000. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_smbhen(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_SMBHEN_MSK) == (I2C_CON1_SMBHEN_MSK)); -} - -/** - * @brief I2C general call Enable - * @note This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_gcen(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_GCEN_MSK); -} - -/** - * @brief I2C general call Disable - * @note This register must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_gcen(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_GCEN_MSK); -} - -/** - * @brief Indicate if I2C general call is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_gcen(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_GCEN_MSK) == (I2C_CON1_GCEN_MSK)); -} - -/** - * @brief I2C clock stretching Disable - * @note Clock stretching disables. This bit can only be programmed when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_nostretch(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_NOSTRETCH_MSK); -} - -/** - * @brief I2C clock stretching Enable - * @note Clock stretching enables.This bit can only be programmed when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_nostretch(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_NOSTRETCH_MSK); -} - -/** - * @brief Indicate if I2C clock nostretching is enabled - * @note This bit can only be programmed when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_nostretch(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_NOSTRETCH_MSK) == (I2C_CON1_NOSTRETCH_MSK)); -} - -/** - * @brief I2C slave byte control Enable - * @note This bit can only be programmed when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_sbc(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_SBC_MSK); -} - -/** - * @brief I2C slave byte control Disable - * @note This bit can only be programmed when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_sbc(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_SBC_MSK); -} - -/** - * @brief Indicate if I2C slave byte control is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_sbc(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_SBC_MSK) == (I2C_CON1_SBC_MSK)); -} - -/** - * @brief I2C DMA reception requests Enable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_rxdmaen(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_RXDMAEN_MSK); -} - -/** - * @brief I2C DMA reception requests Disable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_rxdmaen(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_RXDMAEN_MSK); -} - -/** - * @brief Indicate if I2C DMA reception requests is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_rxdmaen(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_RXDMAEN_MSK) == (I2C_CON1_RXDMAEN_MSK)); -} - -/** - * @brief I2C DMA transmission requests Enable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_txdmaen(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_TXDMAEN_MSK); -} - -/** - * @brief I2C DMA transmission requests Disable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_txdmaen(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_TXDMAEN_MSK); -} - -/** - * @brief Indicate if I2C DMA transmission requests is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_txdmaen(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_TXDMAEN_MSK) == (I2C_CON1_TXDMAEN_MSK)); -} - -/** - * @brief Set I2C digital noise filter - * @note If the analog filter is also enabled,the digital filter is added to the analog filter. - * This filter can only be programmed when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @param filter_capability digital noise filter capability - * @arg Max Value 0xFF - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con1_dnf(I2C_TypeDef *I2Cx, uint32_t filter_capability) -{ - MODIFY_REG(I2Cx->CON1, I2C_CON1_DNF_MSK, filter_capability<CON1, I2C_CON1_DNF_MSK)>>I2C_CON1_DNF_POSS); -} - -/** - * @brief I2C Peripheral Enable - * @note When PE = 0, the I2C SCL and SDA lines are released. - * Internal state machines and status bits are put back to their reset value. - * When cleared, PE must be kept low for at least 3 APB clock cycles. - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con1_pe(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON1, I2C_CON1_PE_MSK); -} - -/** - * @brief I2C Peripheral Disable - * @note When PE = 0, the I2C SCL and SDA lines are released.Internal state machines and status bits are put back to their reset value.When cleared,PE must be kept low for at least 3 APB clock cycles - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con1_pe(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON1, I2C_CON1_PE_MSK); -} - -/** - * @brief Indicate if Peripheral is enabled - * @note When PE = 0, the I2C SCL and SDA lines are released.Internal state machines and status bits are put back to their reset value.When cleared,PE must be kept low for at least 3 APB clock cycles - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con1_pe(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON1, I2C_CON1_PE_MSK) == (I2C_CON1_PE_MSK)); -} - -/** - * @brief I2C Set CON2 - * @note None - * @param I2Cx I2C Instance - * @param Reg_Value is a 32-bit value - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2(I2C_TypeDef *I2Cx, uint32_t Reg_Value) -{ - WRITE_REG(I2Cx->CON2, Reg_Value); -} - -/** - * @brief I2C Get CON2 - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_con2(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->CON2)); -} - -/** - * @brief I2C Set ACK Update - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_ack_upd(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON2, I2C_CON2_ACK_UPD_MSK); -} - -/** - * @brief I2C Hold Ack Enable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_con2_holdack(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->CON2, I2C_CON2_HOLDACK_MSK); -} - -/** - * @brief I2C Hold Ack Disable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_con2_holdack(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->CON2, I2C_CON2_HOLDACK_MSK); -} - -/** - * @brief Indicate if I2C Hold Ack is enabled - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_con2_holdack(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->CON2, I2C_CON2_HOLDACK_MSK) == (I2C_CON2_HOLDACK_MSK)); -} - -/** - * @brief Set I2C Packet error checking byte - * @note This bit is set by software, and cleared by hardware when the PEC is transferred, - * or when a STOP condition or an Address matched is received, also when PE=0. - * Writing 0 to this bit has no effet. This bit has no effect when RELOAD is set, - * and when SBC is 0 in the slave mode. - * If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. - * @param I2Cx I2C Instance - * @param setbit - * @arg @ref MD_I2C_PECBYTE_ENABLE - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_pecbyte(I2C_TypeDef *I2Cx, uint32_t setbit) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_PECBYTE_MSK, setbit); -} - -/** - * @brief Get I2C Packet error checking byte - * @note This bit is set by software, and cleared by hardware when the PEC is transferred, - * or when a STOP condition or an Address matched is received, also when PE=0. - * Writing 0 to this bit has no effet. This bit has no effect when RELOAD is set, - * and when SBC is 0 in the slave mode. - * If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_pecbyte(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_PECBYTE_MSK)>>I2C_CON2_PECBYTE_POS); -} - -/** - * @brief Set I2C automatic end mode or software end mode(master mode) - * @note This bit has no effect in slave mode or when the RELOAD bit is set. - * Software end mode: TC flag is set when NBYTES data are transferred, stretching SCL low. - * Automatic end mode: a STOP condition is automatically sent when NBYTES data are transferred. - * @param I2Cx I2C Instance - * @param setbit - * @arg @ref MD_I2C_SOFTEND_MODE - * @arg @ref MD_I2C_AUTOEND_MODE - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_autoend(I2C_TypeDef *I2Cx, uint32_t setbit) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_AUTOEND_MSK, setbit); -} - -/** - * @brief Get I2C automatic or software end mode(master mode) - * @note This bit has no effect in slave mode or when the RELOAD bit is set. - * Software end mode: TC flag is set when NBYTES data are transferred, stretching SCL low. - * Automatic end mode: a STOP condition is automatically sent when NBYTES data are transferred. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_autoend(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_AUTOEND_MSK)>>I2C_CON2_AUTOEND_POS); -} - -/** - * @brief Set I2C NBYTES reload mode or not - * @note RELOAD = 0: The transfer is completed after the NBYTES data transfer (STOP or RESTART will follow). - * RELOAD = 1: The transfer is not completed after the NBYTES data transfer (NBYTES will be reloaded). - * TCR flag is set when NBYTES data are transferred, stretching SCL low. - * @param I2Cx I2C Instance - * @param setbit - * @arg @ref MD_I2C_NORELOAD_MODE - * @arg @ref MD_I2C_RELOAD_MODE - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_reload(I2C_TypeDef *I2Cx, uint32_t setbit) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_RELOAD_MSK, setbit); -} - -/** - * @brief Get I2C RELOAD value - * @note RELOAD = 0: The transfer is completed after the NBYTES data transfer (STOP or RESTART will follow). - * RELOAD = 1: The transfer is not completed after the NBYTES data transfer (NBYTES will be reloaded). - * TCR flag is set when NBYTES data are transferred, stretching SCL low. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_reload(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_RELOAD_MSK)>>I2C_CON2_RELOAD_POS); -} - -/** - * @brief Set I2C number of bytes - * @note The number of bytes to be transmitted/received is programmed there. - * This field is dont care in slave mode with SBC=0. - * Changing these bits when the START bit is set is not allowed. - * @param I2Cx I2C Instance - * @param nbytes number of bytes - * @arg Max Value 0xFF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_nbytes(I2C_TypeDef *I2Cx, uint32_t nbytes) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_NBYTES_MSK, nbytes<CON2, I2C_CON2_NBYTES_MSK)>>I2C_CON2_NBYTES_POSS); -} - -/** - * @brief Set I2C NACK generation(slave mode) - * @note Writing 0 to this bit has no effect. This bit is used in slave mode only. - * When an overrun occurs in slave receiver NOSTRETCH mode,a NACK is automatically generated whatever the NACK bit value. - * When hardware PEC checking is enabled(PECBYTE = 1),the PEC acknowledge value does not depend on the NACK value. - * @param I2Cx I2C Instance - * @param nack nack generation - * @arg @ref MD_I2C_NACK - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_nack(I2C_TypeDef *I2Cx, uint32_t nack) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_NACK_MSK, nack); -} - -/** - * @brief Get I2C NACK bit state(slave mode) - * @note NACK=1: will generate NACK - * NACK=0: will generate ACK - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_nack(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_NACK_MSK)>>I2C_CON2_NACK_POS); -} - -/** - * @brief Set I2C Stop generation(master mode) - * @note Writing 0 to this bit has no effect. - * @param I2Cx I2C Instance - * @param stop_generate stop generate - * @arg MD_I2C_STOP_GENERATION - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_stop(I2C_TypeDef *I2Cx, uint32_t stop_generate) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_STOP_MSK, stop_generate); -} - -/** - * @brief Get I2C state of STOP bit(master mode) - * @note Writing 0 to this bit has no effect. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_stop(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_STOP_MSK)>>I2C_CON2_STOP_POS); -} - -/** - * @brief Set I2C Start generation - * @note Writing 0 to this bit has no effect.The START bit can be set even if the bus is BUSY or I2C is in slave mode. - * In 10-bit addressing mode, if a NACK is received on the first part of the address, - * the START bit is not cleared by hardware and the master will resend the address sequence. - * @param I2Cx I2C Instance - * @param start_generate stop generate - * @arg MD_I2C_START_GENERATION - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_start(I2C_TypeDef *I2Cx, uint32_t start_generate) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_START_MSK, start_generate); -} - -/** - * @brief Get I2C state of START bit - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_start(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_START_MSK)>>I2C_CON2_START_POS); -} - -/** - * @brief Set the master operates in 10-bit addressing mode(master receiver mode) - * @note Changing this bit when the START bit is set is not allowed. - * It can be used when the 10-bit transmission was done before. - * @param I2Cx I2C Instance - * @param read_header format of read header - * @arg @ref MD_I2C_GENERAL_10BIT_READ - * @arg @ref MD_I2C_SIMPLIFIED_10BIT_READ - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_head10r(I2C_TypeDef *I2Cx, uint32_t read_header) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_HEAD10R_MSK, read_header); -} - -/** - * @brief Indicate if I2C 10-bit address header only read direction is enabled(master receiver mode) - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_head10r(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_HEAD10R_MSK)>>I2C_CON2_HEAD10R_POS); -} - -/** - * @brief I2C 10-bit addressing mode Enable(master mode) - * @note Changing this bit when the START bit is set is not allowed. - * @param I2Cx I2C Instance - * @param addrmode - @arg @ref MD_I2C_ADDRESSINGMODE_7BIT - @arg @ref MD_I2C_ADDRESSINGMODE_10BIT - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_add10(I2C_TypeDef *I2Cx, uint32_t addrmode) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_ADD10_MSK, addrmode); -} - -/** - * @brief Get I2C addressing mode is 10-bit or 7-bit mode(master mode) - * @note ADD10=1: 10-bit mode - * ADD10=0: 7-bit mode - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_add10(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_ADD10_MSK)>>I2C_CON2_ADD10_POS); -} - -/** - * @brief Set Master transfer direction(master mode) - * @note Changing this bit when the START bit is set is not allowed. - * @param I2Cx I2C Instance - * @param direction - * @arg @ref MD_I2C_MASTER_WRITE - * @arg @ref MD_I2C_MASTER_READ - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_rd_wrn(I2C_TypeDef *I2Cx, uint32_t direction) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_RD_WRN_MSK, direction); -} - -/** - * @brief Get Master transfer direction(master mode) - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_con2_rd_wrn(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_RD_WRN_MSK)>>I2C_CON2_RD_WRN_POS); -} - -/** - * @brief Set I2C slave address(master mode) - * @note Changing these bits when the START bit is set is not allowed - * For 7-bit mode, bit 7 to 1 are valid; for 10-bit mode, all 10 bits are valid. - * @param I2Cx I2C Instance - * @param slave_addr I2C slave address - * @arg Max Value 7-bit: 0xFF / 10-bit: 0x3FF - * @arg Min Value 7-bit: 0x2 / 10-bit: 0x1 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_con2_sadd(I2C_TypeDef *I2Cx, uint32_t slave_addr) -{ - MODIFY_REG(I2Cx->CON2, I2C_CON2_SADD_MSK, slave_addr); -} - -/** - * @brief Get I2C slave address(master mode) - * @note Changing these bits when the START bit is set is not allowed - * For 7-bit mode, bit 7 to 1 are valid; for 10-bit mode, all 10 bits are valid. - * @param I2Cx I2C Instance - * @retval I2C slave address - * @arg Max Value 7-bit: 0xFF / 10-bit: 0x3FF - * @arg Min Value 7-bit: 0x2 / 10-bit: 0x1 - */ -__STATIC_INLINE uint32_t md_i2c_get_sadd_7bit(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->CON2, I2C_CON2_SADD_MSK)); -} - -/** - * @brief Set I2C ADDR1 - * @note These bits can be written only when OA1EN=0 except OA1EN. - * @param I2Cx I2C Instance - * @param Reg_Value is a 32-bit value - * @retval None - */ -__STATIC_INLINE void md_i2c_set_addr1(I2C_TypeDef *I2Cx, uint32_t Reg_Value) -{ - WRITE_REG(I2Cx->ADDR1, Reg_Value); -} - -/** - * @brief Get I2C ADDR1 - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_addr1(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->ADDR1)); -} - -/** - * @brief I2C address register 1 Enable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_addr1_oa1en(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ADDR1, I2C_ADDR1_OA1EN_MSK); -} - -/** - * @brief I2C address register 1 Disable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_addr1_oa1en(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->ADDR1, I2C_ADDR1_OA1EN_MSK); -} - -/** - * @brief Indicate if address register 1 is enabled - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_addr1_oa1en(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->ADDR1, I2C_ADDR1_OA1EN_MSK) == (I2C_ADDR1_OA1EN_MSK)); -} - -/** - * @brief Set I2C OA1 bit mode - * @param I2Cx I2C Instance - * @param oa1mode - * @arg @ref MD_I2C_OA1_7BIT - * @arg @ref MD_I2C_OA1_10BIT - * @retval None - */ -__STATIC_INLINE void md_i2c_set_addr1_oa1mode(I2C_TypeDef *I2Cx, uint32_t oa1mode) -{ - MODIFY_REG(I2Cx->ADDR1, I2C_ADDR1_OA1MODE_MSK, oa1mode); -} - -/** - * @brief Get I2C own address 1 mode - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_addr1_oa1mode(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->ADDR1, I2C_ADDR1_OA1MODE_MSK)>>I2C_ADDR1_OA1MODE_POS); -} - -/** - * @brief Set I2C address1 - * @note For 7-bit mode, bit 7 to 1 are valid; for 10-bit mode, all 10 bits are valid. - * @param I2Cx I2C Instance - * @param own_addr I2C own address1 - * @arg Max Value 7-bit: 0xFF / 10-bit: 0x3FF - * @arg Min Value 7-bit: 0x2 / 10-bit: 0x1 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_addr1_oa1(I2C_TypeDef *I2Cx, uint32_t own_addr) -{ - MODIFY_REG(I2Cx->ADDR1, I2C_ADDR1_OA1_MSK, own_addr); -} - -/** - * @brief Get I2C address1 - * @note For 7-bit mode, bit 7 to 1 are valid; for 10-bit mode, all 10 bits are valid. - * @param I2Cx I2C Instance - * @retval I2C own address1 - * @arg Max Value 7-bit: 0xFF / 10-bit: 0x3FF - * @arg Min Value 7-bit: 0x2 / 10-bit: 0x1 - */ -__STATIC_INLINE uint32_t md_i2c_get_addr1_oa1(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->ADDR1, I2C_ADDR1_OA1_MSK)); -} - -/** - * @brief Set I2C ADDR2 - * @note These bits can be written only when OA2EN=0 except OA2EN. - * @param I2Cx I2C Instance - * @param Reg_Value is a 32-bit value - * @retval None - */ -__STATIC_INLINE void md_i2c_set_addr2(I2C_TypeDef *I2Cx, uint32_t Reg_Value) -{ - WRITE_REG(I2Cx->ADDR2, Reg_Value); -} - -/** - * @brief Get I2C ADDR2 - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_addr2(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->ADDR2)); -} - -/** - * @brief I2C own address register 2 Enable - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_addr2_oa2en(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ADDR2, I2C_ADDR2_OA2EN_MSK); -} - -/** - * @brief I2C own address register 2 Disable - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_addr2_oa2en(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->ADDR2, I2C_ADDR2_OA2EN_MSK); -} - -/** - * @brief Indicate if address register 2 is enabled - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_addr2_oa2en(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->ADDR2, I2C_ADDR2_OA2EN_MSK) == (I2C_ADDR2_OA2EN_MSK)); -} - -/** - * @brief Set I2C own address2 mask - * @note These bits can be written only when OA2EN=0. - * As soon as OA2MSK is not equal to 0,the reserved I2C addresses(0b0000xxx and 0b1111xxx) are not acknowledged even if the comparison matches. - * @param I2Cx I2C Instance - * @param oa2_mask I2C own address2 mask - * @arg @ref MD_I2C_ADDR2_NOMASK - * @arg @ref MD_I2C_ADDR2_MASK01 - * @arg @ref MD_I2C_ADDR2_MASK02 - * @arg @ref MD_I2C_ADDR2_MASK03 - * @arg @ref MD_I2C_ADDR2_MASK04 - * @arg @ref MD_I2C_ADDR2_MASK05 - * @arg @ref MD_I2C_ADDR2_MASK06 - * @arg @ref MD_I2C_ADDR2_MASK07 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_addr2_oa2mask(I2C_TypeDef *I2Cx, uint32_t oa2_mask) -{ - MODIFY_REG(I2Cx->ADDR2, I2C_ADDR2_OA2MSK_MSK, oa2_mask); -} - -/** - * @brief Get I2C address2 mask - * @note None - * As soon as OA2MSK is not equal to 0,the reserved I2C addresses(0b0000xxx and 0b1111xxx) are not acknowledged even if the comparison matches. - * @param I2Cx I2C Instance - * @retval I2C own address2 mask(value 0 to 7) - */ -__STATIC_INLINE uint32_t md_i2c_get_addr2_oa2mask(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->ADDR2, I2C_ADDR2_OA2MSK_MSK)>>I2C_ADDR2_OA2MSK_POSS); -} - -/** - * @brief Set I2C own address2 - * @note These bits can be written only when OA2EN=0. - * @param I2Cx I2C Instance - * @param own_addr I2C own address2 - * @arg Max Value 0x7F - * @arg Min Value 0x1 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_addr2_oa2(I2C_TypeDef *I2Cx, uint32_t own_addr) -{ - MODIFY_REG(I2Cx->ADDR2, I2C_ADDR2_OA2_MSK, own_addr <ADDR2, I2C_ADDR2_OA2_MSK)>>I2C_ADDR2_OA2_POSS); -} - -/** - * @brief Set I2C TIMINGR - * @note These bits must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @param Reg_Value is a 32-bit value - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timingr(I2C_TypeDef *I2Cx, uint32_t Reg_Value) -{ - WRITE_REG(I2Cx->TIMINGR, Reg_Value); -} - -/** - * @brief Get I2C TIMINGR - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_timingr(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->TIMINGR)); -} - -/** - * @brief Set I2C Timing prescaler - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @param timing_prescaler - * @arg Max Value 0xF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timingr_presc(I2C_TypeDef *I2Cx, uint32_t timing_prescaler) -{ - MODIFY_REG(I2Cx->TIMINGR, I2C_TIMINGR_PRESC_MSK, timing_prescaler << I2C_TIMINGR_PRESC_POSS); -} - -/** - * @brief Get I2C Timing prescaler - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval timing_prescaler - * @arg Max Value 0xF - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_i2c_get_timingr_presc(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_PRESC_MSK)>>I2C_TIMINGR_PRESC_POSS); -} - -/** - * @brief Set I2C date setup time - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @param data_setup_time - * @arg Max Value 0xF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timingr_scldel(I2C_TypeDef *I2Cx, uint32_t data_setup_time) -{ - MODIFY_REG(I2Cx->TIMINGR, I2C_TIMINGR_SCLDEL_MSK, data_setup_time <TIMINGR, I2C_TIMINGR_SCLDEL_MSK)>>I2C_TIMINGR_SCLDEL_POSS); -} - -/** - * @brief Set I2C date hold time - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @param data_hold_time - * @arg Max Value 0xF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timingr_sdadel(I2C_TypeDef *I2Cx, uint32_t data_hold_time) -{ - MODIFY_REG(I2Cx->TIMINGR, I2C_TIMINGR_SDADEL_MSK, data_hold_time << I2C_TIMINGR_SDADEL_POSS); -} - -/** - * @brief Get I2C date hold time - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval data_hold_time - * @arg Max Value 0xF - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_i2c_get_timingr_sdadel(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SDADEL_MSK)>>I2C_TIMINGR_SDADEL_POSS); -} - -/** - * @brief Set I2C SCL high period(master mode) - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @param SCL_hperiod - * @arg Max Value 0xFF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timingr_sclh(I2C_TypeDef *I2Cx, uint32_t SCL_hperiod) -{ - MODIFY_REG(I2Cx->TIMINGR, I2C_TIMINGR_SCLH_MSK, SCL_hperiod << I2C_TIMINGR_SCLH_POSS); -} - -/** - * @brief Get I2C SCL high period(master mode) - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval SCL_hperiod - * @arg Max Value 0xFF - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_i2c_get_timingr_sclh(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SCLH_MSK)>>I2C_TIMINGR_SCLH_POSS); -} - -/** - * @brief Set I2C SCL low period(master mode) - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @param SCL_lperiod - * @arg Max Value 0xFF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timingr_scll(I2C_TypeDef *I2Cx, uint32_t SCL_lperiod) -{ - MODIFY_REG(I2Cx->TIMINGR, I2C_TIMINGR_SCLL_MSK, SCL_lperiod << I2C_TIMINGR_SCLL_POSS); -} - -/** - * @brief Get I2C SCL low period(master mode) - * @note This register must be configured when the I2C is disabled(PE = 0) - * @param I2Cx I2C Instance - * @retval SCL_lperiod - * @arg Max Value 0xFF - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_i2c_get_timingr_scll(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SCLL_MSK)); -} - -/** - * @brief Set I2C TIMEOUTR - * @note These bits can be written only when TEXTEN=0 and TIMEOUTEN=0 except TEXTEN and TIMEOUTEN. - * @param I2Cx I2C Instance - * @param Reg_Value is a 32-bit value - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timeoutr(I2C_TypeDef *I2Cx, uint32_t Reg_Value) -{ - WRITE_REG(I2Cx->TIMEOUTR, Reg_Value); -} - -/** - * @brief Get I2C TIMEOUTR - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_timeoutr(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->TIMEOUTR)); -} - -/** - * @brief I2C Extended clock timeout Enable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_timeoutr_texten(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TEXTEN_MSK); -} - -/** - * @brief I2C Extended clock timeout Disable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_timeoutr_texten(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TEXTEN_MSK); -} - -/** - * @brief Indicate if I2C Extended clock timeout is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_timeoutr_texten(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TEXTEN_MSK) == (I2C_TIMEOUTR_TEXTEN_MSK)); -} - -/** - * @brief Set I2C Bus timeout B - * @note These bits can be written only when TEXTEN = 0 - * @param I2Cx I2C Instance - * @param timeoutb Bus timeout B - * @arg Max Value 0xFFFFFF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timeoutr_timeoutb(I2C_TypeDef *I2Cx, uint32_t timeoutb) -{ - MODIFY_REG(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTB_MSK, timeoutb << I2C_TIMEOUTR_TIMEOUTB_POSS); -} - -/** - * @brief Get I2C Bus timeout B - * @note These bits can be written only when TEXTEN = 0 - * @param I2Cx I2C Instance - * @retval Bus timeout B - * @arg Max Value 0xFFFFFF - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_i2c_get_timeoutr_timeoutb(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTB_MSK)>>I2C_TIMEOUTR_TIMEOUTB_POSS); -} - -/** - * @brief I2C clock timeout Enable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_timeoutr_timeouten(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTEN_MSK); -} - -/** - * @brief I2C clock timeout Disable - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_timeoutr_timeouten(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTEN_MSK); -} - -/** - * @brief Indicate if I2C clock timeout is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_timeoutr_timeouten(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTEN_MSK) == (I2C_TIMEOUTR_TIMEOUTEN_MSK)); -} - -/** - * @brief Set I2C Tidle to decide a timeouta mode - * @note This bit can be written only when TIMOUTEN = 0 - * @param I2Cx I2C Instance - * @param tidle_mode - * @arg @ref MD_I2C_LOW_TIMEOUTA - * @arg @ref MD_I2C_IDLE_TIMEOUTA - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timeoutr_tidle(I2C_TypeDef *I2Cx, uint32_t tidle_mode) -{ - MODIFY_REG(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIDLE_MSK, tidle_mode); -} - -/** - * @brief Get I2C Tidle to know a timeouta mode - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_timeoutr_tidle(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIDLE_MSK)>>I2C_TIMEOUTR_TIDLE_POS); -} - -/** - * @brief Set I2C Bus timeout A - * @note These bits can be written only when TIMOUTEN = 0 - * @param I2Cx I2C Instance - * @param timeouta Bus timeout A - * @arg Max Value 0xFFFFFF - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_timeoutr_timeouta(I2C_TypeDef *I2Cx, uint32_t timeouta) -{ - MODIFY_REG(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTA_MSK, timeouta << I2C_TIMEOUTR_TIMEOUTA_POSS); -} - -/** - * @brief Get I2C Bus timeout A - * @note These bits can be written only when TIMOUTEN = 0 - * @param I2Cx I2C Instance - * @retval Bus timeout A - * @arg Max Value 0xFFFFFF - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_i2c_get_timeoutr_timeouta(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTA_MSK)); -} - -/** - * @brief Get I2C STAT - * @note All bits are read-only - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_stat(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->STAT)); -} - -/** - * @brief Get address match code(slave mode) - * @note These bits are updated with the received address when an address match event occurs(ADDR=1). - * @param I2Cx I2C Instance - * @retval 7-bit received address value - */ -__STATIC_INLINE uint32_t md_i2c_get_stat_addcode(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->STAT, I2C_STAT_ADDCODE_MSK)>>I2C_STAT_ADDCODE_POSS); -} - -/** - * @brief Get transfer direction(slave mode) - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_get_stat_dir(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->STAT, I2C_STAT_DIR_MSK)>>I2C_STAT_DIR_POS); -} - -/** - * @brief Indicate if I2C busy flag is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_busy(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_BUSY_MSK) == (I2C_STAT_BUSY_MSK)); -} - -/** - * @brief Indicate if I2C transfer complete reload flag (TCR) is active - * @note This bit is cleared by hardware when PE = 0. - * This flag is only for master mode,or for slave mode when the SBC bit is set - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_tcr(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_TCR_MSK) == (I2C_STAT_TCR_MSK)); -} - -/** - * @brief Indicate if I2C transfer complete flag (TC) is active - * @note This bit is cleared by hardware when PE = 0. - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_tc(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_TC_MSK) == (I2C_STAT_TC_MSK)); -} - -/** - * @brief Indicate if I2C Rx FIFO level over threshold flag (RXTH) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_rxth(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_RXTH_MSK) == (I2C_STAT_RXTH_MSK)); -} - -/** - * @brief Indicate if I2C Rx buffer underflow flag (RXUD) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_rxud(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_RXUD_MSK) == (I2C_STAT_RXUD_MSK)); -} - -/** - * @brief Indicate if I2C Rx buffer overflow flag (RXOV) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_rxov(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_RXOV_MSK) == (I2C_STAT_RXOV_MSK)); -} - -/** - * @brief Indicate if I2C Rx buffer full flag (RXF) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_rxf(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_RXF_MSK) == (I2C_STAT_RXF_MSK)); -} - -/** - * @brief Indicate if I2C Rx buffer empty flag (RXE) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_rxe(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_RXE_MSK) == (I2C_STAT_RXE_MSK)); -} - -/** - * @brief Indicate if I2C Tx FIFO level over threshold flag (TXTH) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_txth(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_TXTH_MSK) == (I2C_STAT_TXTH_MSK)); -} - -/** - * @brief Indicate if I2C Tx buffer underflow flag (TXUD) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_is_active_stat_txud(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_TXUD_MSK) == (I2C_STAT_TXUD_MSK)); -} - -/** - * @brief Indicate if I2C Tx buffer overflow flag (TXOV) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_txov(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_TXOV_MSK) == (I2C_STAT_TXOV_MSK)); -} - -/** - * @brief Indicate if I2C Tx buffer full flag (TXF) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_txf(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_TXF_MSK) == (I2C_STAT_TXF_MSK)); -} - -/** - * @brief Indicate if I2C Tx buffer empty flag (TXE) is active - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_stat_txe(I2C_TypeDef *I2Cx) -{ - return (uint32_t)(READ_BIT(I2Cx->STAT, I2C_STAT_TXE_MSK) == (I2C_STAT_TXE_MSK)); -} - -/** - * @brief Set I2C FCON - * @note FIFO trigger threshold must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @param Reg_Value is a 32-bit value - * @retval None - */ -__STATIC_INLINE void md_i2c_set_fcon(I2C_TypeDef *I2Cx, uint32_t Reg_Value) -{ - WRITE_REG(I2Cx->FCON, Reg_Value); -} - -/** - * @brief Get I2C FCON - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_fcon(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->FCON)); -} - -/** - * @brief Set RXFIFO trigger threshold - * @note Receive FIFO trigger threshold must be configured when the I2C is disabled (PE = 0). - * @param I2Cx I2C Instance - * @param rxfifo_trigger_threshold This parameter can be one of the following values: - * @arg @ref MD_I2C_RXFIFO_THRESHOLD_RX1 - * @arg @ref MD_I2C_RXFIFO_THRESHOLD_RX4 - * @arg @ref MD_I2C_RXFIFO_THRESHOLD_RX8 - * @arg @ref MD_I2C_RXFIFO_THRESHOLD_RX14 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_fcon_rxfth(I2C_TypeDef *I2Cx, uint32_t rxfifo_trigger_threshold) -{ - MODIFY_REG(I2Cx->FCON, I2C_FCON_RXFTH_MSK, rxfifo_trigger_threshold); -} - -/** - * @brief Get RXFIFO trigger threshold - * @note None - * @param I2Cx I2C Instance - * @retval The retval can be 0 to 3 - */ -__STATIC_INLINE uint32_t md_i2c_get_fcon_rxfth(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->FCON, I2C_FCON_RXFTH_MSK)>>I2C_FCON_RXFTH_POSS); -} - -/** - * @brief Set I2C RXFIFO reset - * @note None - * @param I2Cx I2C Instance - * @arg @ref MD_I2C_RXFIFO_RESET - * @retval None - */ -__STATIC_INLINE void md_i2c_set_fcon_rxfrst(I2C_TypeDef *I2Cx, uint32_t reset) -{ - MODIFY_REG(I2Cx->FCON, I2C_FCON_RXFRST_MSK, reset); -} - -/** - * @brief Get I2C RXFIFO level - * @note None - * @param I2Cx I2C Instance - * @retval It's from 0 to 16 - */ -__STATIC_INLINE uint32_t md_i2c_get_rxfifo_level(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->FCON, I2C_FCON_RXFLV_MSK)>>I2C_FCON_RXFLV_POSS); -} - -/** - * @brief Set TXFIFO trigger threshold - * @param I2Cx I2C Instance - * @param txfifo_trigger_threshold This parameter can be one of the following values: - * @arg @ref MD_I2C_TXFIFO_THRESHOLD_TX0 - * @arg @ref MD_I2C_TXFIFO_THRESHOLD_TX2 - * @arg @ref MD_I2C_TXFIFO_THRESHOLD_TX4 - * @arg @ref MD_I2C_TXFIFO_THRESHOLD_TX8 - * @retval None - */ -__STATIC_INLINE void md_i2c_set_fcon_txfth(I2C_TypeDef *I2Cx, uint32_t txfifo_trigger_threshold) -{ - MODIFY_REG(I2Cx->FCON, I2C_FCON_TXFTH_MSK, txfifo_trigger_threshold); -} - -/** - * @brief Get TXFIFO trigger threshold - * @param I2Cx I2C Instance - * @retval It's from 0 to 3 - */ -__STATIC_INLINE uint32_t md_i2c_get_txfifo_trigger_threshold(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->FCON, I2C_FCON_TXFTH_MSK)>>I2C_FCON_TXFTH_POSS); -} - -/** - * @brief I2C TXFIFO reset - * @note None - * @param I2Cx I2C Instance - * @arg @ref MD_I2C_TXFIFO_RESET - * @retval None - */ -__STATIC_INLINE void md_i2c_set_fcon_txfrst(I2C_TypeDef *I2Cx, uint32_t reset) -{ - MODIFY_REG(I2Cx->FCON, I2C_FCON_TXFRST_MSK, reset); -} - -/** - * @brief Get TXFIFO level - * @note None - * @param I2Cx I2C Instance - * @retval It's from 0 to 16 - */ -__STATIC_INLINE uint32_t md_i2c_get_txfifo_level(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->FCON, I2C_FCON_TXFLV_MSK)); -} - -/** - * @brief Get packet error checking register - * @note None - * @param I2Cx I2C Instance - * @retval 8-bit pec value - */ -__STATIC_INLINE uint32_t md_i2c_get_pecr_pec(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->PECR, I2C_PECR_PEC_MSK)); -} - -/** - * @brief 8-bit receive data - * @note None - * @param I2Cx I2C Instance - * @retval 8-bit receive data - */ -__STATIC_INLINE uint32_t md_i2c_recv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RXDATA, I2C_RXDATA_RXDATA_MSK)); -} - -/** - * @brief 8-bit transmit data - * @note These bits can be written only when TXE = 1. - * @param I2Cx I2C Instance - * @param txdata Transmit Data - * @arg Max value 0xFF - * @arg Min value 0 - * @retval None - */ -__STATIC_INLINE void md_i2c_send(I2C_TypeDef *I2Cx, uint32_t txdata) -{ - MODIFY_REG(I2Cx->TXDATA, I2C_TXDATA_TXDATA_MSK, txdata); -} - -/** - * @brief Set I2C IER - * @note None - * @param I2Cx I2C Instance - * @param ier - * @retval None - */ -__STATIC_INLINE void md_i2c_set_ier(I2C_TypeDef *I2Cx, uint32_t ier) -{ - WRITE_REG(I2Cx->IER, ier); -} - -/** - * @brief Enable SMBus alert interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_alertie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_ALERTIE_MSK); -} - -/** - * @brief Enable timeout interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_toutie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_TOUTIE_MSK); -} - -/** - * @brief Enable PEC error interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_peceie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_PECEIE_MSK); -} - -/** - * @brief Enable arbitration loss interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_arloie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_ARLOIE_MSK); -} - -/** - * @brief Enable bus error interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_berrie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_BERRIE_MSK); -} - -/** - * @brief Enable stop detection interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_stopie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_STOPIE_MSK); -} - -/** - * @brief Enable NACK reception interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_nackie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_NACKIE_MSK); -} - -/** - * @brief Enable address matched interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_addrie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_ADDRIE_MSK); -} - -/** - * @brief Enable transfer complete and reload interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_tcrie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_TCRIE_MSK); -} - -/** - * @brief Enable transfer complete interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_tcie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_TCIE_MSK); -} - -/** - * @brief Enable receive buffer over threshold interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_rxthie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_RXTHIE_MSK); -} - -/** - * @brief Enable receive buffer underrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_rxudie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_RXUDIE_MSK); -} - -/** - * @brief Enable receive buffer ovrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_rxovie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_RXOVIE_MSK); -} - -/** - * @brief Enable receive buffer full interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_rxfie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_RXFIE_MSK); -} - -/** - * @brief Enable transmit buffer under threshold interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_txthie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_TXTHIE_MSK); -} - -/** - * @brief Enable transmit buffer underrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_txudie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_TXUDIE_MSK); -} - -/** - * @brief Enable transmit buffer ovrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_txovie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_TXOVIE_MSK); -} - -/** - * @brief Enable transmit buffer empty interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_enable_ier_txeie(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->IER, I2C_IER_TXEIE_MSK); -} - -/** - * @brief Set I2C IDR - * @note None - * @param I2Cx I2C Instance - * @param ier - * @retval None - */ -__STATIC_INLINE void md_i2c_set_idr(I2C_TypeDef *I2Cx, uint32_t idr) -{ - WRITE_REG(I2Cx->IDR, idr); -} - -/** - * @brief Disable SMBus alert interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_alertid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_ALERTID_MSK); -} - -/** - * @brief Disable timeout interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_toutid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_TOUTID_MSK); -} - -/** - * @brief Disable PEC error interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_peceid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_PECEID_MSK); -} - -/** - * @brief Disable arbitration loss interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_arloid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_ARLOID_MSK); -} - -/** - * @brief Disable bus error interrupt. - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_berrid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_BERRID_MSK); -} - -/** - * @brief Disable stop detection interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_stopid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_STOPID_MSK); -} - -/** - * @brief Disable NACK reception interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_nackid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_NACKID_MSK); -} - -/** - * @brief Disable address matched interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_addrid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_ADDRID_MSK); -} - -/** - * @brief Disable transfer complete and reload interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_tcrid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_TCRID_MSK); -} - -/** - * @brief Disable transfer complete interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_tcid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_TCID_MSK); -} - -/** - * @brief Disable receive buffer over threshold interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_rxthid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_RXTHID_MSK); -} - -/** - * @brief Disable receive buffer underrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_rxudid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_RXUDID_MSK); -} - -/** - * @brief Disable receive buffer ovrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_rxovid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_RXOVID_MSK); -} - -/** - * @brief Disable receive buffer full interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_rxfid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_RXFID_MSK); -} - -/** - * @brief Disable transmit buffer under threshold interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_txthid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_TXTHID_MSK); -} - -/** - * @brief Disable transmit buffer underrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_txudid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_TXUDID_MSK); -} - -/** - * @brief Disable transmit buffer ovrun interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_txovid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_TXOVID_MSK); -} - -/** - * @brief Disable transmit buffer empty interrupt - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_disable_idr_txeid(I2C_TypeDef *I2Cx) -{ - CLEAR_BIT(I2Cx->IDR, I2C_IDR_TXEID_MSK); -} - -/** - * @brief Get I2C IVS - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_ivs(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->IVS)); -} - -/** - * @brief Check if SMBus alert interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_alertiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_ALERTIV_MSK) == (I2C_IVS_ALERTIV_MSK)); -} - -/** - * @brief Check if timeout interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_toutiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_TOUTIV_MSK) == (I2C_IVS_TOUTIV_MSK)); -} - -/** - * @brief Check if PEC error interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_peceiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_PECEIV_MSK) == (I2C_IVS_PECEIV_MSK)); -} - -/** - * @brief Check if arbitration loss interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_arloiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_ARLOIV_MSK) == (I2C_IVS_ARLOIV_MSK)); -} - -/** - * @brief Check if bus error interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_berriv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_BERRIV_MSK) == (I2C_IVS_BERRIV_MSK)); -} - -/** - * @brief Check if stop detection interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_stopiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_STOPIV_MSK) == (I2C_IVS_STOPIV_MSK)); -} - -/** - * @brief Check if NACK reception interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_nackiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_NACKIV_MSK) == (I2C_IVS_NACKIV_MSK)); -} - -/** - * @brief Check if address matched interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_addriv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_ADDRIV_MSK) == (I2C_IVS_ADDRIV_MSK)); -} - -/** - * @brief Check if transfer complete and reload interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_tcriv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_TCRIV_MSK) == (I2C_IVS_TCRIV_MSK)); -} - -/** - * @brief Check if transfer complete interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_tciv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_TCIV_MSK) == (I2C_IVS_TCIV_MSK)); -} - -/** - * @brief Check if receive buffer over threshold interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_rxthiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_RXTHIV_MSK) == (I2C_IVS_RXTHIV_MSK)); -} - -/** - * @brief Check if receive buffer underrun interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_rxudiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_RXUDIV_MSK) == (I2C_IVS_RXUDIV_MSK)); -} - -/** - * @brief Check if receive buffer ovrun interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_rxoviv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_RXOVIV_MSK) == (I2C_IVS_RXOVIV_MSK)); -} - -/** - * @brief Check if receive buffer full interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_rxfiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_RXFIV_MSK) == (I2C_IVS_RXFIV_MSK)); -} - -/** - * @brief Check if transmit buffer under threshold interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_txthiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_TXTHIV_MSK) == (I2C_IVS_TXTHIV_MSK)); -} - -/** - * @brief Check if transmit buffer underrun interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_txudiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_TXUDIV_MSK) == (I2C_IVS_TXUDIV_MSK)); -} - -/** - * @brief Check if transmit buffer ovrun interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_txoviv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_TXOVIV_MSK) == (I2C_IVS_TXOVIV_MSK)); -} - -/** - * @brief Check if transmit buffer empty interrupt is enabled - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_enabled_ivs_txeiv(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IVS, I2C_IVS_TXEIV_MSK) == (I2C_IVS_TXEIV_MSK)); -} - -/** - * @brief Get I2C RIF - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_rif(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->RIF)); -} - -/** - * @brief Get SMBus alert raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_alertri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_ALERTRI_MSK) == (I2C_RIF_ALERTRI_MSK)); -} - -/** - * @brief Get timeout raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_toutri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_TOUTRI_MSK) == (I2C_RIF_TOUTRI_MSK)); -} - -/** - * @brief Get PEC error raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_peceri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_PECERI_MSK) == (I2C_RIF_PECERI_MSK)); -} - -/** - * @brief Get arbitration loss raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_arlori(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_ARLORI_MSK) == (I2C_RIF_ARLORI_MSK)); -} - -/** - * @brief Get bus error raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_berrri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_BERRRI_MSK) == (I2C_RIF_BERRRI_MSK)); -} - -/** - * @brief Get stop detection raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_stopri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_STOPRI_MSK) == (I2C_RIF_STOPRI_MSK)); -} - -/** - * @brief Get NACK reception raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_nackri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_NACKRI_MSK) == (I2C_RIF_NACKRI_MSK)); -} - -/** - * @brief Get address matched raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_addrri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_ADDRRI_MSK) == (I2C_RIF_ADDRRI_MSK)); -} - -/** - * @brief Get transfer complete and reload raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_tcrri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_TCRRI_MSK) == (I2C_RIF_TCRRI_MSK)); -} - -/** - * @brief Get transfer complete raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_tcri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_TCRI_MSK) == (I2C_RIF_TCRI_MSK)); -} - -/** - * @brief Get receive buffer over threshold raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_rxthri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_RXTHRI_MSK) == (I2C_RIF_RXTHRI_MSK)); -} - -/** - * @brief Get receive buffer underrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_rxudri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_RXUDRI_MSK) == (I2C_RIF_RXUDRI_MSK)); -} - -/** - * @brief Get receive buffer ovrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_rxovri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_RXOVRI_MSK) == (I2C_RIF_RXOVRI_MSK)); -} - -/** - * @brief Get receive buffer full raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_rxfri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_RXFRI_MSK) == (I2C_RIF_RXFRI_MSK)); -} - -/** - * @brief Get transmit buffer under threshold raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_txthri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_TXTHRI_MSK) == (I2C_RIF_TXTHRI_MSK)); -} - -/** - * @brief Get transmit buffer underrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_txudri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_TXUDRI_MSK) == (I2C_RIF_TXUDRI_MSK)); -} - -/** - * @brief Get transmit buffer ovrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_txovri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_TXOVRI_MSK) == (I2C_RIF_TXOVRI_MSK)); -} - -/** - * @brief Get transmit buffer empty raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_rif_txeri(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->RIF, I2C_RIF_TXERI_MSK) == (I2C_RIF_TXERI_MSK)); -} - -/** - * @brief Set I2C ICR - * @note None - * @param I2Cx I2C Instance - * @param icr - * @retval None - */ -__STATIC_INLINE void md_i2c_set_icr(I2C_TypeDef *I2Cx, uint32_t icr) -{ - WRITE_REG(I2Cx->ICR, icr); -} - -/** - * @brief Clear SMBus alert raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_alertic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_ALERTIC_MSK); -} - -/** - * @brief Clear timeout raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_toutic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_TOUTIC_MSK); -} - -/** - * @brief Clear PEC error raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_peceic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_PECEIC_MSK); -} - -/** - * @brief Clear arbitration loss raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_arloic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_ARLOIC_MSK); -} - -/** - * @brief Clear bus error raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_berric(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_BERRIC_MSK); -} - -/** - * @brief Clear stop detection raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_stopic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_STOPIC_MSK); -} - -/** - * @brief Clear NACK reception raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_nackic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_NACKIC_MSK); -} - -/** - * @brief Clear address matched raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_addric(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_ADDRIC_MSK); -} - -/** - * @brief Clear transfer complete and reload raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_tcric(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_TCRIC_MSK); -} - -/** - * @brief Clear transfer complete raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_tcic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_TCIC_MSK); -} - -/** - * @brief Clear receive buffer over threshold raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_rxthic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_RXTHIC_MSK); -} - -/** - * @brief Clear receive buffer underrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_rxudic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_RXUDIC_MSK); -} - -/** - * @brief Clear receive buffer ovrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_rxovic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_RXOVIC_MSK); -} - -/** - * @brief Clear receive buffer full raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_rxfic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_RXFIC_MSK); -} - -/** - * @brief Clear transmit buffer under threshold raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_txthic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_TXTHIC_MSK); -} - -/** - * @brief Clear transmit buffer underrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_txudic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_TXUDIC_MSK); -} - -/** - * @brief Clear transmit buffer ovrun raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_txovic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_TXOVIC_MSK); -} - -/** - * @brief Clear transmit buffer empty raw interrupt flag - * @note None - * @param I2Cx I2C Instance - * @retval None - */ -__STATIC_INLINE void md_i2c_clear_icr_txeic(I2C_TypeDef *I2Cx) -{ - SET_BIT(I2Cx->ICR, I2C_ICR_TXEIC_MSK); -} - -/** - * @brief Get I2C IFM - * @note None - * @param I2Cx I2C Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_i2c_get_ifm(I2C_TypeDef *I2Cx) -{ - return (uint32_t) (READ_REG(I2Cx->IFM)); -} - -/** - * @brief Get SMBus alert interrupt flag massked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_alertfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_ALERTFM_MSK) == (I2C_IFM_ALERTFM_MSK)); -} - -/** - * @brief Get timeout interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_toutfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_TOUTFM_MSK) == (I2C_IFM_TOUTFM_MSK)); -} - -/** - * @brief Get PEC error interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_pecefm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_PECEFM_MSK) == (I2C_IFM_PECEFM_MSK)); -} - -/** - * @brief Get arbitration loss interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_arlofm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_ARLOFM_MSK) == (I2C_IFM_ARLOFM_MSK)); -} - -/** - * @brief Get bus error interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_berrfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_BERRFM_MSK) == (I2C_IFM_BERRFM_MSK)); -} - -/** - * @brief Get stop detection interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_stopfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_STOPFM_MSK) == (I2C_IFM_STOPFM_MSK)); -} - -/** - * @brief Get NACK reception interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_nackfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_NACKFM_MSK) == (I2C_IFM_NACKFM_MSK)); -} - -/** - * @brief Get address matched interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_addrfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_ADDRFM_MSK) == (I2C_IFM_ADDRFM_MSK)); -} - -/** - * @brief Get transfer complete and reload interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_tcrfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_TCRFM_MSK) == (I2C_IFM_TCRFM_MSK)); -} - -/** - * @brief Get transfer complete interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_tcfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_TCFM_MSK) == (I2C_IFM_TCFM_MSK)); -} - -/** - * @brief Get receive buffer over threshold interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_rxthfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_RXTHFM_MSK) == (I2C_IFM_RXTHFM_MSK)); -} - -/** - * @brief Get receive buffer underrun interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_rxudfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_RXUDFM_MSK) == (I2C_IFM_RXUDFM_MSK)); -} - -/** - * @brief Get receive buffer ovrun interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_rxovfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_RXOVFM_MSK) == (I2C_IFM_RXOVFM_MSK)); -} - -/** - * @brief Get receive buffer full interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_rxffm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_RXFFM_MSK) == (I2C_IFM_RXFFM_MSK)); -} - -/** - * @brief Get transmit buffer under threshold interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_txthfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_TXTHFM_MSK) == (I2C_IFM_TXTHFM_MSK)); -} - -/** - * @brief Get transmit buffer underrun interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_txudfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_TXUDFM_MSK) == (I2C_IFM_TXUDFM_MSK)); -} - -/** - * @brief Get transmit buffer ovrun interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_txovfm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_TXOVFM_MSK) == (I2C_IFM_TXOVFM_MSK)); -} - -/** - * @brief Get transmit buffer empty interrupt flag masked status - * @note None - * @param I2Cx I2C Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_i2c_is_active_ifm_txefm(I2C_TypeDef *I2Cx) -{ - return (READ_BIT(I2Cx->IFM, I2C_IFM_TXEFM_MSK) == (I2C_IFM_TXEFM_MSK)); -} - -/** - * @} MD_I2C_Public_Macros - */ - - - - - - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_I2C_Public_Functions I2C Public Functions - * @{ - */ - -/** @defgroup MD_I2C_PF_Basic_Configuration I2C Configuration - * @{ - */ - -//ErrorStatus md_i2c_deinit(I2C_TypeDef *I2Cx); -ErrorStatus md_i2c_init(I2C_TypeDef *I2Cx, md_i2c_inittypedef *I2C_InitStruct); -void md_i2c_struct_init(md_i2c_inittypedef *I2C_InitStruct); -void md_i2c_master_send(I2C_TypeDef *I2Cx, uint8_t Nbyte, uint32_t addr10, uint16_t DevAddr, uint8_t *txbuf); -void md_i2c_master_rece(I2C_TypeDef *I2Cx, uint8_t Nbyte, uint32_t addr10, uint16_t DevAddr, uint8_t *rxbuf); -void md_i2c_slave_send(I2C_TypeDef *I2Cx, uint8_t Num, uint8_t *txbuf); -void md_i2c_slave_rece(I2C_TypeDef *I2Cx, uint8_t Num, uint8_t *rxbuf); - -/** - * @} MD_I2C_PF_Init - */ - -/** - * @} MD_I2C_Public_Functions - */ - -#endif - -/* Private macros ------------------------------------------------------------*/ -/** @defgroup MD_I2C_Private_Macro I2C Private Macros - * @{ - */ -#define IS_MD_I2C_ALL_INSTANCE(__INSTANCE__) ((__INSTANCE__ == I2C1) \ - || (__INSTANCE__ == I2C2) \ - || (__INSTANCE__ == I2C3)) - -#define IS_MD_I2C_TIMING(__VALUE__) ((__VALUE__ == CLK10kHz8M) \ - || (__VALUE__ == CLK100kHz8M)) \ - || (__VALUE__ == CLK400kHz8M)) \ - || (__VALUE__ == CLK500kHz8M)) \ - || (__VALUE__ == CLK10kHz16M)) \ - || (__VALUE__ == CLK100kHz16M)) \ - || (__VALUE__ == CLK400kHz16M)) \ - || (__VALUE__ == CLK1000kHz16M)) \ - || (__VALUE__ == CLK10kHz48M)) \ - || (__VALUE__ == CLK100kHz48M)) \ - || (__VALUE__ == CLK400kHz48M)) \ - || (__VALUE__ == CLK1000kHz48M)) - -#define IS_MD_I2C_ADDRSIZE(__VALUE__) ((__VALUE__ == MD_I2C_ADDRESSINGMODE_7BIT) \ - || (__VALUE__ == MD_I2C_ADDRESSINGMODE_10BIT)) - -#define IS_MD_I2C_ADDRESS1(__VALUE__) (__VALUE__ <= 0x000003FFU) -#define IS_MD_I2C_ADDRESS2(__VALUE__) (__VALUE__ <= (uint16_t)0x00FFU) - -#define IS_MD_I2C_DUALADDRESSMODE(__VALUE__) ((__VALUE__ == MD_I2C_DUALADDRESS_DISABLE) \ - || (__VALUE__ == MD_I2C_DUALADDRESS_ENABLE)) -#define IS_MD_I2C_ADDRESS2MASKS(__VALUE__) ((__VALUE__ == MD_I2C_ADDR2_NOMASK) \ - || (__VALUE__ == MD_I2C_ADDR2_MASK01) \ - || (__VALUE__ == MD_I2C_ADDR2_MASK02) \ - || (__VALUE__ == MD_I2C_ADDR2_MASK03) \ - || (__VALUE__ == MD_I2C_ADDR2_MASK04) \ - || (__VALUE__ == MD_I2C_ADDR2_MASK05) \ - || (__VALUE__ == MD_I2C_ADDR2_MASK06) \ - || (__VALUE__ == MD_I2C_ADDR2_MASK07)) - -/** - * @} MD_I2C_Private_Macro - */ - -/** - * @} I2C - */ - -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_rcu.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_rcu.h deleted file mode 100644 index 1b9b6ff09b..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_rcu.h +++ /dev/null @@ -1,5804 +0,0 @@ -/** - ****************************************************************************** - * @file md_RCU.h - * @brief ES32F0271 RCU HEAD File. - * - * @version V1.00.02 - * @date 30/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_RCU_H__ -#define __MD_RCU_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include -#include "es32f0271.h" -#include "reg_rcu.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (RCU) - -/** @defgroup RCU RCU - * @brief RCU micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/** @defgroup MD_RCU_Private_Constants RCU Private Constants - * @{ - */ - -#define __HOSC (8000000UL) -#define __HRC (4000000UL) -#define __LOSC ( 32768UL) -#define __LRC ( 32000UL) -#define __PLL1 (48000000UL) - -/** - * @} MD_RCU_Private_Constants - */ -/* Private macros -------------------------------------------------------------*/ -/* Public types ---------------------------------------------------------------*/ -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_RCU_Public_Types RCU Public Init Type - * @{ - */ - -typedef struct -{ - uint32_t Mpre; /*! MCO clock prescaler */ - uint32_t Msw; /*! MCO clock output */ - uint32_t PllMul; /*! PLL multiplication factor */ - uint32_t PllSrc; /*! PLL clock source */ - uint32_t HoscDiv; /*! PLL base clock 4MHz HOSC clock prescale */ - uint32_t Ppre; /*! APB clock prescaler */ - uint32_t Hpre; /*! AHB clock prescaler */ - uint32_t Sw; /*! system clock */ - uint8_t SysClock;/*! system clock enable */ -} md_rcu_init_typedef; - -/** - * @} MD_RCU_Public_Types - */ -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_RCU_Public_Constants RCU Public Constants - * @{ - */ - -/** @defgroup MD_RCU_SWRDY_FLAG System clock switch ready flag - * @{ - */ -#define MD_RCU_SWRDY_NOT_READY (0x00000000UL) /** @brief System clock not ready */ -#define MD_RCU_SWRDY_READY (0x00000001UL) /** @brief System clock ready */ -/** - * @} MD_RCU_SWRDY_FLAG - */ - -/** @defgroup MD_RCU_CSSFLG_FLAG Clock Security System flag - * @{ - */ -#define MD_RCU_CSSFLG_NO_FAIL (0x00000000UL) /** @brief No clock security event caused by HOSC clock failure */ -#define MD_RCU_CSSFLG_FAIL (0x00000001UL) /** @brief Clock security event caused by HOSC clock failure */ -/** - * @} MD_RCU_CSSFLG_FLAG - */ - -/** @defgroup MD_RCU_PLL1_FLAG PLL1 clock ready flag - * @{ - */ -#define MD_RCU_PLL1_NOT_READY (0x00000000UL) /** @brief PLL1 not ready */ -#define MD_RCU_PLL1_READY (0x00000001UL) /** @brief PLL1 ready */ -/** - * @} MD_RCU_PLL1_FLAG - */ - -/** @defgroup MD_RCU_PLL0_FLAG PLL0 clock ready flag - * @{ - */ -#define MD_RCU_PLL0_NOT_READY (0x00000000UL) /** @brief PLL0 not ready */ -#define MD_RCU_PLL0_READY (0x00000001UL) /** @brief PLL0 ready */ -/** - * @} MD_RCU_PLL0_FLAG - */ - -/** @defgroup MD_RCU_LOSCRDY_FLAG LOSC clock ready flag - * @{ - */ -#define MD_RCU_LOSCRDY_NOT_READY (0x00000000UL) /** @brief LOSC oscillator not ready */ -#define MD_RCU_LOSCRDY_READY (0x00000001UL) /** @brief LOSC oscillator ready */ -/** - * @} MD_RCU_LOSCRDY_FLAG - */ - -/** @defgroup MD_RCU_LRCRDY_FLAG LRC clock ready flag - * @{ - */ -#define MD_RCU_LRCRDY_NOT_READY (0x00000000UL) /** @brief LRC oscillator not ready */ -#define MD_RCU_LRCRDY_READY (0x00000001UL) /** @brief LRC oscillator ready */ -/** - * @} MD_RCU_LRCRDY_FLAG - */ - -/** @defgroup MD_RCU_HOSCRDY_FLAG HOSC clock ready flag - * @{ - */ -#define MD_RCU_HOSCRDY_NOT_READY (0x00000000UL) /** @brief HOSC oscillator not ready */ -#define MD_RCU_HOSCRDY_READY (0x00000001UL) /** @brief HOSC oscillator ready */ -/** - * @} MD_RCU_HOSCRDY_FLAG - */ - -/** @defgroup MD_RCU_HRCRDY_FLAG HRC clock ready flag - * @{ - */ -#define MD_RCU_HRCRDY_NOT_READY (0x00000000UL) /** @brief HRC oscillator not ready */ -#define MD_RCU_HRCRDY_READY (0x00000001UL) /** @brief HRC oscillator ready */ -/** - * @} MD_RCU_HRCRDY_FLAG - */ - -/** @defgroup MD_RCU_MCO_OUTPUT Microcontroller clock output select - * @{ - */ -#define MD_RCU_MCO_DISABLE (0x00000000UL) /** @brief MCO output disabled, no clock on MCO */ -#define MD_RCU_MCO_LRC (0x00000001UL) /** @brief Internal low speed (LRC) oscillator clock selected */ -#define MD_RCU_MCO_LOSC (0x00000002UL) /** @brief External low speed (LOSC) oscillator clock selected */ -#define MD_RCU_MCO_HRC (0x00000003UL) /** @brief Internal high speed (HRC) oscillator clock selected */ -#define MD_RCU_MCO_HOSC (0x00000004UL) /** @brief External high speed (HOSC) oscillator clock selected */ -#define MD_RCU_MCO_PLL0 (0x00000005UL) /** @brief PLL0 clock selected */ -#define MD_RCU_MCO_PLL1 (0x00000006UL) /** @brief PLL1 clock selected */ -#define MD_RCU_MCO_SYSCLK (0x00000007UL) /** @brief System clock selected(SYSCLK) */ -#define MD_RCU_MCO_HCLK (0x00000008UL) /** @brief AHB clock selected(HCLK) */ -#define MD_RCU_MCO_PCLK (0x00000009UL) /** @brief APB clock selected(PCLK) */ -/** - * @} MD_RCU_MCO_OUTPUT - */ - -/** @defgroup MD_RCU_PLL_SRC PLL0/1 reference clock source - * @{ - */ -#define MD_RCU_PLL_SRC_HRC (0x00000000UL) /** @brief HRC selected as PLL0/1 reference clock */ -#define MD_RCU_PLL_SRC_HOSCDIV (0x00000001UL) /** @brief HOSC/HOSCDIV selected as PLL reference clock */ -/** - * @} MD_RCU_PLL_SRC - */ - -/** @defgroup MD_RCU_APB_CLK_DIV APB clock prescaler(PCLK) - * @{ - */ -#define MD_RCU_PPRE_HCLK_DIV_1 (0x00000000UL) /** @brief HCLK not divided */ -#define MD_RCU_PPRE_HCLK_DIV_2 (0x00000004UL) /** @brief HCLK divided by 2 */ -#define MD_RCU_PPRE_HCLK_DIV_4 (0x00000005UL) /** @brief HCLK divided by 4 */ -#define MD_RCU_PPRE_HCLK_DIV_8 (0x00000006UL) /** @brief HCLK divided by 8 */ -#define MD_RCU_PPRE_HCLK_DIV_16 (0x00000007UL) /** @brief HCLK divided by 16 */ -/** - * @} MD_RCU_APB_CLK_DIV - */ - -/** @defgroup MD_RCU_AHB_CLK_DIV AHB clock prescaler(HCLK) - * @{ - */ -#define MD_RCU_HPRE_SYSCLK_DIV_1 (0x00000000UL) /** @brief SYSCLK not divided */ -#define MD_RCU_HPRE_SYSCLK_DIV_2 (0x00000008UL) /** @brief SYSCLK divided by 2 */ -#define MD_RCU_HPRE_SYSCLK_DIV_4 (0x00000009UL) /** @brief SYSCLK divided by 4 */ -#define MD_RCU_HPRE_SYSCLK_DIV_8 (0x0000000AUL) /** @brief SYSCLK divided by 8 */ -#define MD_RCU_HPRE_SYSCLK_DIV_16 (0x0000000BUL) /** @brief SYSCLK divided by 16 */ -/** - * @} MD_RCU_AHB_CLK_DIV - */ - -/** @defgroup MD_RCU_SYS_CLK_SW System clock switch(SYSCLK) - * @{ - */ -#define MD_RCU_SYSCLK_HRC (0x00000000UL) /** @brief HRC selected as system clock */ -#define MD_RCU_SYSCLK_HOSC (0x00000001UL) /** @brief HOSC selected as system clock */ -#define MD_RCU_SYSCLK_LRC (0x00000002UL) /** @brief LRC selected as system clock */ -#define MD_RCU_SYSCLK_LOSC (0x00000003UL) /** @brief LOSC selected as system clock */ -#define MD_RCU_SYSCLK_PLL0 (0x00000004UL) /** @brief PLL0 selected as system clock */ -/** - * @} MD_RCU_SYS_CLK_SW - */ - -/** @defgroup MD_RCU_PSCK_I2S2CKSL SPI2/I2S2 External Clock Source Select - * @{ - */ -#define MD_RCU_PSCK_I2S2CKSL_DISABLE (0x00000000UL) /** @brief Disable External Clock (default value) */ -#define MD_RCU_PSCK_I2S2CKSL_I2SCLK1 (0x00000001UL) -#define MD_RCU_PSCK_I2S2CKSL_I2SCLK2 (0x00000002UL) -/** - * @} MD_RCU_PSCK_I2S2CKSL - */ - -/** @defgroup MD_RCU_PSCK_I2S1CKSL SPI1/I2S1 External Clock Source Select - * @{ - */ -#define MD_RCU_PSCK_I2S1CKSL_DISABLE (0x00000000UL) /** @brief Disable External Clock (default value) */ -#define MD_RCU_PSCK_I2S1CKSL_I2SCLK1 (0x00000001UL) -#define MD_RCU_PSCK_I2S1CKSL_I2SCLK2 (0x00000002UL) -/** - * @} MD_RCU_PSCK_I2S1CKSL - */ - - -/** - * @} MD_RCU_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_RCU_Public_Macros RCU Public Macros - * @{ - */ - -/** - * @brief Get System clock switch ready flag - * @note This bit is set by hardware to indicate that the system clock change is stable. - * When the CKCFG bit was set and finish configuartion process. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_SWRDY_NOT_READY - * @arg @ref MD_RCU_SWRDY_READY - */ -__STATIC_INLINE uint32_t md_rcu_get_con_swrdy(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_SWRDY_MSK)>>RCU_CON_SWRDY_POS); -} -/** - * @brief Get Clock Security System flag - * @note This bit is reset by software by writing the CSSON bit. - * It is set by hardware in case of HOSC clock failure. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_CSSFLG_NO_FAIL - * @arg @ref MD_RCU_CSSFLG_FAIL - */ -__STATIC_INLINE uint32_t md_rcu_get_con_cssflg(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_CSSFLG_MSK)>>RCU_CON_CSSFLG_POS); -} -/** - * @brief Get PLL1 clock ready flag - * @note This bit is set by hardware to indicate that the PLL1 oscillator is stable. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_PLL1_NOT_READY - * @arg @ref MD_RCU_PLL1_READY - */ -__STATIC_INLINE uint32_t md_rcu_get_con_pll1rdy(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_PLL1RDY_MSK)>>RCU_CON_PLL1RDY_POS); -} -/** - * @brief Get PLL0 clock ready flag - * @note This bit is set by hardware to indicate that the PLL0 oscillator is stable. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_PLL0_NOT_READY - * @arg @ref MD_RCU_PLL0_READY - */ -__STATIC_INLINE uint32_t md_rcu_get_con_pll0rdy(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_PLL0RDY_MSK)>>RCU_CON_PLL0RDY_POS); -} -/** - * @brief Get LOSCRDY clock ready flag - * @note This bit is set by hardware to indicate that the LOSC oscillator is stable. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_LOSCRDY_NOT_READY - * @arg @ref MD_RCU_LOSCRDY_READY - */ -__STATIC_INLINE uint32_t md_rcu_get_con_loscrdy(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_LOSCRDY_MSK)>>RCU_CON_LOSCRDY_POS); -} -/** - * @brief Get LRCRDY clock ready flag - * @note This bit is set by hardware to indicate that the LRC oscillator is stable. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_LRCRDY_NOT_READY - * @arg @ref MD_RCU_LRCRDY_READY - */ -__STATIC_INLINE uint32_t md_rcu_get_con_lrcrdy(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_LRCRDY_MSK)>>RCU_CON_LRCRDY_POS); -} -/** - * @brief Get HOSCRDY clock ready flag - * @note This bit is set by hardware to indicate that the HOSC oscillator is stable. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_HOSCRDY_NOT_READY - * @arg @ref MD_RCU_HOSCRDY_READY - */ -__STATIC_INLINE uint32_t md_rcu_get_con_hoscrdy(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_HOSCRDY_MSK)>>RCU_CON_HOSCRDY_POS); -} -/** - * @brief Get HRCRDY clock ready flag - * @note This bit is set by hardware to indicate that the HRC oscillator is stable. - * @param rcu RCU Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RCU_HRCRDY_NOT_READY - * @arg @ref MD_RCU_HRCRDY_READY - */ -__STATIC_INLINE uint32_t md_rcu_get_con_hrcrdy(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_HRCRDY_MSK)>>RCU_CON_HRCRDY_POS); -} -/** - * @brief Clock security system enable(CSS) - * @note Set and cleared by software to enable the clock security system. - * When CSSON is set, the clock detector is enabled by hardware when the HOSC oscillator is ready, - * and disabled by hardware if a HOSC clock failure is detected. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_con_csson(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CON, RCU_CON_CSSON_MSK); -} -/** - * @brief Clock security system disable(CSS) - * @note Set and cleared by software to enable the clock security system. - * When CSSON is set, the clock detector is enabled by hardware when the HOSC oscillator is ready, - * and disabled by hardware if a HOSC clock failure is detected. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_con_csson(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->CON, RCU_CON_CSSON_MSK); -} -/** - * @brief Get Clock security system (CSS) - * @note Set and cleared by software to enable the clock security system. - * When CSSON is set, the clock detector is enabled by hardware when the HOSC oscillator is ready, - * and disabled by hardware if a HOSC clock failure is detected. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_con_csson(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_CSSON_MSK)>>RCU_CON_CSSON_POS); -} -/** - * @brief PLL1 enable bit(for USB PHY) - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_con_pll1on(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CON, RCU_CON_PLL1ON_MSK); -} -/** - * @brief PLL1 disable bit(for USB PHY) - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_con_pll1on(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->CON, RCU_CON_PLL1ON_MSK); -} -/** - * @brief Get PLL1 bit(for USB PHY) - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_con_pll1on(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_PLL1ON_MSK)>>RCU_CON_PLL1ON_POS); -} -/** - * @brief PLL0 enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_con_pll0on(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CON, RCU_CON_PLL0ON_MSK); -} -/** - * @brief PLL0 disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_con_pll0on(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->CON, RCU_CON_PLL0ON_MSK); -} -/** - * @brief Get PLL0 bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_con_pll0on(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_PLL0ON_MSK)>>RCU_CON_PLL0ON_POS); -} -/** - * @brief External low speed oscillator clock enbale bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_con_loscon(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CON, RCU_CON_LOSCON_MSK); -} -/** - * @brief External low speed oscillator clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_con_loscon(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->CON, RCU_CON_LOSCON_MSK); -} -/** - * @brief Get External low speed oscillator clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_con_loscon(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_LOSCON_MSK)>>RCU_CON_LOSCON_POS); -} -/** - * @brief Internal low speed oscillator clock enbale bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_con_lrcon(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CON, RCU_CON_LRCON_MSK); -} -/** - * @brief Internal low speed oscillator clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_con_lrcon(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->CON, RCU_CON_LRCON_MSK); -} -/** - * @brief Get Internal low speed oscillator clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_con_lrcon(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_LRCON_MSK)>>RCU_CON_LRCON_POS); -} -/** - * @brief External high speed oscillator clock enbale bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_con_hoscon(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CON, RCU_CON_HOSCON_MSK); -} -/** - * @brief External high speed oscillator clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_con_hoscon(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->CON, RCU_CON_HOSCON_MSK); -} -/** - * @brief Get External high speed oscillator clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_con_hoscon(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_HOSCON_MSK)>>RCU_CON_HOSCON_POS); -} -/** - * @brief Internal high speed oscillator clock enbale bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_con_hrcon(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CON, RCU_CON_HRCON_MSK); -} -/** - * @brief Internal high speed oscillator clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_con_hrcon(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->CON, RCU_CON_HRCON_MSK); -} -/** - * @brief Get Internal high speed oscillator clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_con_hrcon(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->CON, RCU_CON_HRCON_MSK)>>RCU_CON_HRCON_POS); -} - -/** @defgroup MD_RCU_CON_CSSON CSSON - * @brief Set Clock security system bit for md_rcu_set_con() function used - * @param csson This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_rcu_set_con_csson_fun(csson) (csson<CON, (csson|pll1on|pll0on|loscon|lrcon|hoscon|hrcon)); -} - -/** - * @brief Clock configuration set bit - * @note This bit is write-only. A read to this bit returns the value 0. - * If set is bit to high, start to configurate clock setting. - * When the clock configuration process was finished, this bit was clear to zero by self. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_ckcfg(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->CFG, RCU_CFG_CKCFG_MSK); -} -/** - * @brief Set Microcontroller clock output prescaler - * @note Output Frequency = MCO/(MPRE+1) - * @param rcu RCU Instance - * @param mpre This parameter can be one of the following values: - * @arg Max Value 7 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_mpre(RCU_TypeDef *rcu, uint32_t mpre) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_MPRE_MSK, (mpre<CFG, RCU_CFG_MPRE_MSK)>>RCU_CFG_MPRE_POSS); -} -/** - * @brief Set Microcontroller clock output (MCO) - * @param rcu RCU Instance - * @param msw This parameter can be one of the following values: - * @arg @ref MD_RCU_MCO_DISABLE - * @arg @ref MD_RCU_MCO_LRC - * @arg @ref MD_RCU_MCO_LOSC - * @arg @ref MD_RCU_MCO_HRC - * @arg @ref MD_RCU_MCO_HOSC - * @arg @ref MD_RCU_MCO_PLL0 - * @arg @ref MD_RCU_MCO_PLL1 - * @arg @ref MD_RCU_MCO_SYSCLK - * @arg @ref MD_RCU_MCO_HCLK - * @arg @ref MD_RCU_MCO_PCLK - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_msw(RCU_TypeDef *rcu, uint32_t msw) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_MSW_MSK, (msw<CFG, RCU_CFG_MSW_MSK)>>RCU_CFG_MSW_POSS); -} -/** - * @brief Set PLL0 multiplication factor - * @note PLL0 output clock frequency is 4*(PLL0MUL+1)MHz - * @param rcu RCU Instance - * @param pllmul can be one of the following values: - * @arg Max Value 31 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_pllmul(RCU_TypeDef *rcu, uint32_t pllmul) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_PLLMUL_MSK, (pllmul<CFG, RCU_CFG_PLLMUL_MSK)>>RCU_CFG_PLLMUL_POSS); -} -/** - * @brief Set PLL0/1 reference clock source - * @param rcu RCU Instance - * @param pllsrc This parameter can be one of the following values: - * @arg @ref MD_RCU_PLL_SRC_HRC - * @arg @ref MD_RCU_PLL_SRC_HOSCDIV - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_pllsrc(RCU_TypeDef *rcu, uint32_t pllsrc) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_PLLSRC_MSK, (pllsrc<CFG, RCU_CFG_PLLSRC_MSK)>>RCU_CFG_PLLSRC_POS); -} -/** - * @brief Set HOSC clock division factor for PLL0/1 reference clock 4 MHz - * @note These bits are set and cleared by software to select HOSCDIV division factor. - * @note PLL_reference_clock (4 MHz) = HOSC / (HOSCDIV+1) - * @param rcu RCU Instance - * @param hoscdiv can be one of the following values: - * @arg Max Value 7 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_hoscdiv(RCU_TypeDef *rcu, uint32_t hoscdiv) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_HOSCDIV_MSK, (hoscdiv<CFG, RCU_CFG_HOSCDIV_MSK)>>RCU_CFG_HOSCDIV_POSS); -} -/** - * @brief Set APB clock prescaler(PCLK) - * @param rcu RCU Instance - * @param ppre The retval can be one of the following values: - * @arg @ref MD_RCU_PPRE_HCLK_DIV_1 - * @arg @ref MD_RCU_PPRE_HCLK_DIV_2 - * @arg @ref MD_RCU_PPRE_HCLK_DIV_4 - * @arg @ref MD_RCU_PPRE_HCLK_DIV_8 - * @arg @ref MD_RCU_PPRE_HCLK_DIV_16 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_ppre(RCU_TypeDef *rcu, uint32_t ppre) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_PPRE_MSK, (ppre<CFG, RCU_CFG_PPRE_MSK)>>RCU_CFG_PPRE_POSS); -} -/** - * @brief Set AHB clock prescaler(HCLK) - * @param rcu RCU Instance - * @param hpre can be one of the following values: - * @arg @ref MD_RCU_HPRE_SYSCLK_DIV_1 - * @arg @ref MD_RCU_HPRE_SYSCLK_DIV_2 - * @arg @ref MD_RCU_HPRE_SYSCLK_DIV_4 - * @arg @ref MD_RCU_HPRE_SYSCLK_DIV_8 - * @arg @ref MD_RCU_HPRE_SYSCLK_DIV_16 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_hpre(RCU_TypeDef *rcu, uint32_t hpre) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_HPRE_MSK, (hpre<CFG, RCU_CFG_HPRE_MSK)>>RCU_CFG_HPRE_POSS); -} -/** - * @brief Set System clock switch(SYSCLK) - * @param rcu RCU Instance - * @param sw can be one of the following values: - * @arg @ref MD_RCU_SYSCLK_HRC - * @arg @ref MD_RCU_SYSCLK_HOSC - * @arg @ref MD_RCU_SYSCLK_LRC - * @arg @ref MD_RCU_SYSCLK_LOSC - * @arg @ref MD_RCU_SYSCLK_PLL0 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_cfg_sw(RCU_TypeDef *rcu, uint32_t sw) -{ - MODIFY_REG(rcu->CFG, RCU_CFG_SW_MSK, (sw<CFG, RCU_CFG_SW_MSK)>>RCU_CFG_SW_POSS); -} -/** @defgroup MD_RCU_CFG_MPRE MPRE - * @brief Set Microcontroller clock output prescaler bit for md_rcu_set_cfg() function used - * @param mpre This parameter can be one of the following values: - * @arg Max Value 7 - * @arg Min Value 0 - * @{ - */ -#define md_rcu_set_cfg_mpre_fun(mpre) (mpre<CFG, (mpre|msw|pllmul|pllsrc|hoscdiv|ppre|hpre|sw)); -} - -/** - * @brief Set SPI2/I2S2 External Clock Source Select - * @param rcu RCU Instance - * @param i2s2ckdl This parameter can be one of the following values: - * @arg @ref MD_RCU_PSCK_I2S2CKSL_DISABLE - * @arg @ref MD_RCU_PSCK_I2S2CKSL_I2SCLK1 - * @arg @ref MD_RCU_PSCK_I2S2CKSL_I2SCLK2 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_psck_i2s2ckdl(RCU_TypeDef *rcu, uint32_t i2s2ckdl) -{ - MODIFY_REG(rcu->PSCK, RCU_PSCK_I2S2CKSL_MSK, (i2s2ckdl<PSCK, RCU_PSCK_I2S2CKSL_MSK)>>RCU_PSCK_I2S2CKSL_POSS); -} -/** - * @brief Set SPI1/I2S1 External Clock Source Select - * @param rcu RCU Instance - * @param i2s1ckdl This parameter can be one of the following values: - * @arg @ref MD_RCU_PSCK_I2S1CKSL_DISABLE - * @arg @ref MD_RCU_PSCK_I2S1CKSL_I2SCLK1 - * @arg @ref MD_RCU_PSCK_I2S1CKSL_I2SCLK2 - * @retval None - */ -__STATIC_INLINE void md_rcu_set_psck_i2s1ckdl(RCU_TypeDef *rcu, uint32_t i2s1ckdl) -{ - MODIFY_REG(rcu->PSCK, RCU_PSCK_I2S1CKSL_MSK, (i2s1ckdl<PSCK, RCU_PSCK_I2S1CKSL_MSK)>>RCU_PSCK_I2S1CKSL_POSS); -} - -/** @defgroup MD_RCU_PSCK_I2S2CKSL_ I2S2CKSL - * @brief Set SPI2/I2S2 External Clock Source Select bit for md_rcu_set_psck() function used - * @param i2s2ckdl This parameter can be one of the following values: - * @arg @ref MD_RCU_PSCK_I2S2CKSL_DISABLE - * @arg @ref MD_RCU_PSCK_I2S2CKSL_I2SCLK1 - * @arg @ref MD_RCU_PSCK_I2S2CKSL_I2SCLK2 - * @{ - */ -#define md_rcu_set_psck_i2s2ckdl_fun(i2s2ckdl) (i2s2ckdl<PSCK, (i2s2ckdl|i2s1ckdl)); -} - -/** - * @brief GPIOD reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_gpden(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_GPDEN_MSK); -} -/** - * @brief GPIOD reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_gpden(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_GPDEN_MSK); -} -/** - * @brief Get GPIOD reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_gpden(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_GPDEN_MSK)>>RCU_AHBRST_GPDEN_POS); -} -/** - * @brief GPIOC reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_gpcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_GPCEN_MSK); -} -/** - * @brief GPIOC reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_gpcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_GPCEN_MSK); -} -/** - * @brief Get GPIOC reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_gpcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_GPCEN_MSK)>>RCU_AHBRST_GPCEN_POS); -} -/** - * @brief GPIOB reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_gpben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_GPBEN_MSK); -} -/** - * @brief GPIOB reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_gpben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_GPBEN_MSK); -} -/** - * @brief Get GPIOB reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_gpben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_GPBEN_MSK)>>RCU_AHBRST_GPBEN_POS); -} -/** - * @brief GPIOA reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_gpaen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_GPAEN_MSK); -} -/** - * @brief GPIOA reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_gpaen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_GPAEN_MSK); -} -/** - * @brief Get GPIOA reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_gpaen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_GPAEN_MSK)>>RCU_AHBRST_GPAEN_POS); -} -/** - * @brief HDIV reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_hdiven(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_HDIVEN_MSK); -} -/** - * @brief HDIV reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_hdiven(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_HDIVEN_MSK); -} -/** - * @brief Get HDIV reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_hdiven(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_HDIVEN_MSK)>>RCU_AHBRST_HDIVEN_POS); -} -/** - * @brief USB reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_usben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_USBEN_MSK); -} -/** - * @brief USB reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_usben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_USBEN_MSK); -} -/** - * @brief Get USB reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_usben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_USBEN_MSK)>>RCU_AHBRST_USBEN_POS); -} -/** - * @brief AES reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_aesen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_AESEN_MSK); -} -/** - * @brief AES reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_aesen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_AESEN_MSK); -} -/** - * @brief Get AES reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_aesen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_AESEN_MSK)>>RCU_AHBRST_AESEN_POS); -} -/** - * @brief CRC reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_crcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_CRCEN_MSK); -} -/** - * @brief CRC reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_crcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_CRCEN_MSK); -} -/** - * @brief Get CRC reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_crcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_CRCEN_MSK)>>RCU_AHBRST_CRCEN_POS); -} -/** - * @brief RTC reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_rtcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_RTCEN_MSK); -} -/** - * @brief RTC reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_rtcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_RTCEN_MSK); -} -/** - * @brief Get RTC reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_rtcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_RTCEN_MSK)>>RCU_AHBRST_RTCEN_POS); -} -/** - * @brief DMA1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbrst_dma1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBRST, RCU_AHBRST_DMA1EN_MSK); -} -/** - * @brief DMA1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbrst_dma1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBRST, RCU_AHBRST_DMA1EN_MSK); -} -/** - * @brief Get DMA1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbrst_dma1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBRST, RCU_AHBRST_DMA1EN_MSK)>>RCU_AHBRST_DMA1EN_POS); -} - -/** @defgroup MD_RCU_AHBRST_GPDEN GPDEN - * @brief Set GPIOD reset request bit for md_rcu_set_ahbrst() function used - * @param gpden This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_rcu_set_ahbrst_gpden_fun(gpden) (gpden<AHBRST, (gpden|gpcen|gpben|gpaen|hdiven|usben|aesen|crcen|rtcen|dma1en)); -} - -/** - * @brief DAC reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_dacen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_DACEN_MSK); -} -/** - * @brief DAC reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_dacen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_DACEN_MSK); -} -/** - * @brief Get DAC reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_dacen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_DACEN_MSK)>>RCU_APB1RST_DACEN_POS); -} -/** - * @brief I2C2 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_i2c2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_I2C2EN_MSK); -} -/** - * @brief I2C2 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_i2c2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_I2C2EN_MSK); -} -/** - * @brief Get I2C2 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_i2c2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_I2C2EN_MSK)>>RCU_APB1RST_I2C2EN_POS); -} -/** - * @brief I2C1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_i2c1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_I2C1EN_MSK); -} -/** - * @brief I2C1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_i2c1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_I2C1EN_MSK); -} -/** - * @brief Get I2C1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_i2c1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_I2C1EN_MSK)>>RCU_APB1RST_I2C1EN_POS); -} -/** - * @brief SUART2 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_suart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_SUART2EN_MSK); -} -/** - * @brief SUART2 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_suart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_SUART2EN_MSK); -} -/** - * @brief Get SUART2 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_suart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_SUART2EN_MSK)>>RCU_APB1RST_SUART2EN_POS); -} -/** - * @brief SUART1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_suart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_SUART1EN_MSK); -} -/** - * @brief SUART1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_suart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_SUART1EN_MSK); -} -/** - * @brief Get SUART1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_suart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_SUART1EN_MSK)>>RCU_APB1RST_SUART1EN_POS); -} -/** - * @brief UART3 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_uart3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_UART3EN_MSK); -} -/** - * @brief UART3 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_uart3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_UART3EN_MSK); -} -/** - * @brief Get UART3 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_uart3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_UART3EN_MSK)>>RCU_APB1RST_UART3EN_POS); -} -/** - * @brief UART2 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_uart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_UART2EN_MSK); -} -/** - * @brief UART2 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_uart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_UART2EN_MSK); -} -/** - * @brief Get UART2 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_uart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_UART2EN_MSK)>>RCU_APB1RST_UART2EN_POS); -} -/** - * @brief SPI2 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_spi2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_SPI2EN_MSK); -} -/** - * @brief SPI2 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_spi2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_SPI2EN_MSK); -} -/** - * @brief Get SPI2 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_spi2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_SPI2EN_MSK)>>RCU_APB1RST_SPI2EN_POS); -} -/** - * @brief IWDT reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_iwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_IWDTEN_MSK); -} -/** - * @brief IWDT reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_iwdten(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_IWDTEN_MSK); -} -/** - * @brief Get IWDT reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_iwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_IWDTEN_MSK)>>RCU_APB1RST_IWDTEN_POS); -} -/** - * @brief WWDT reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_wwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_WWDTEN_MSK); -} -/** - * @brief WWDT reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_wwdten(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_WWDTEN_MSK); -} -/** - * @brief Get WWDT reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_wwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_WWDTEN_MSK)>>RCU_APB1RST_WWDTEN_POS); -} -/** - * @brief BS16T1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_bs16t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_BS16T1EN_MSK); -} -/** - * @brief BS16T1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_bs16t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_BS16T1EN_MSK); -} -/** - * @brief Get BS16T1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_bs16t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_BS16T1EN_MSK)>>RCU_APB1RST_BS16T1EN_POS); -} -/** - * @brief GP16C4T3 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_gp16c4t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T3EN_MSK); -} -/** - * @brief GP16C4T3 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_gp16c4t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T3EN_MSK); -} -/** - * @brief Get GP16C4T3 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_gp16c4t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T3EN_MSK)>>RCU_APB1RST_GP16C4T3EN_POS); -} -/** - * @brief GP16C4T2 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_gp16c4t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T2EN_MSK); -} -/** - * @brief GP16C4T2 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_gp16c4t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T2EN_MSK); -} -/** - * @brief Get GP16C4T2 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_gp16c4t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T2EN_MSK)>>RCU_APB1RST_GP16C4T2EN_POS); -} -/** - * @brief GP16C4T1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_gp16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T1EN_MSK); -} -/** - * @brief GP16C4T1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_gp16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T1EN_MSK); -} -/** - * @brief Get GP16C4T1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_gp16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_GP16C4T1EN_MSK)>>RCU_APB1RST_GP16C4T1EN_POS); -} -/** - * @brief GP32C4T1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1rst_gp32c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1RST, RCU_APB1RST_GP32C4T1EN_MSK); -} -/** - * @brief GP32C4T1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1rst_gp32c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1RST, RCU_APB1RST_GP32C4T1EN_MSK); -} -/** - * @brief Get GP32C4T1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1rst_gp32c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1RST, RCU_APB1RST_GP32C4T1EN_MSK)>>RCU_APB1RST_GP32C4T1EN_POS); -} - -/** @defgroup MD_RCU_APB1RST_DACEN DACEN - * @brief Set DAC reset request bit for md_rcu_set_apb1rst() function used - * @param dacen This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_rcu_set_apb1rst_dacen_fun(dacen) (dacen<APB1RST, (dacen|i2c2en|i2c1en|suart2en|suart1en|uart3en|uart2en|spi2en|iwdten|wwdten| - bs16t1en|gp16c4t3en|gp16c4t2en|gp16c4t1en|gp32c4t1en)); -} - -/** - * @brief CMP reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_cmpen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_CMPEN_MSK); -} -/** - * @brief CMP reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_cmpen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_CMPEN_MSK); -} -/** - * @brief Get CMP reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_cmpen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_CMPEN_MSK)>>RCU_APB2RST_CMPEN_POS); -} -/** - * @brief GP16C2T4 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_gp16c2t4en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T4EN_MSK); -} -/** - * @brief GP16C2T4 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_gp16c2t4en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T4EN_MSK); -} -/** - * @brief Get GP16C2T4 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_gp16c2t4en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T4EN_MSK)>>RCU_APB2RST_GP16C2T4EN_POS); -} -/** - * @brief GP16C2T3 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_gp16c2t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T3EN_MSK); -} -/** - * @brief GP16C2T3 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_gp16c2t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T3EN_MSK); -} -/** - * @brief Get GP16C2T3 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_gp16c2t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T3EN_MSK)>>RCU_APB2RST_GP16C2T3EN_POS); -} -/** - * @brief GP16C2T2 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_gp16c2t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T2EN_MSK); -} -/** - * @brief GP16C2T2 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_gp16c2t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T2EN_MSK); -} -/** - * @brief Get GP16C2T2 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_gp16c2t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T2EN_MSK)>>RCU_APB2RST_GP16C2T2EN_POS); -} -/** - * @brief GP16C2T1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_gp16c2t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T1EN_MSK); -} -/** - * @brief GP16C2T1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_gp16c2t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T1EN_MSK); -} -/** - * @brief Get GP16C2T1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_gp16c2t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_GP16C2T1EN_MSK)>>RCU_APB2RST_GP16C2T1EN_POS); -} -/** - * @brief UART1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_uart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_UART1EN_MSK); -} -/** - * @brief UART1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_uart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_UART1EN_MSK); -} -/** - * @brief Get UART1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_uart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_UART1EN_MSK)>>RCU_APB2RST_UART1EN_POS); -} -/** - * @brief SPI1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_spi1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_SPI1EN_MSK); -} -/** - * @brief SPI1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_spi1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_SPI1EN_MSK); -} -/** - * @brief Get SPI1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_spi1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_SPI1EN_MSK)>>RCU_APB2RST_SPI1EN_POS); -} -/** - * @brief AD16C4T1 reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_ad16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_AD16C4T1EN_MSK); -} -/** - * @brief AD16C4T1 reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_ad16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_AD16C4T1EN_MSK); -} -/** - * @brief Get AD16C4T1 reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_ad16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_AD16C4T1EN_MSK)>>RCU_APB2RST_AD16C4T1EN_POS); -} -/** - * @brief ADC reset request enable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2rst_adcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2RST, RCU_APB2RST_ADCEN_MSK); -} -/** - * @brief ADC reset request disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2rst_adcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2RST, RCU_APB2RST_ADCEN_MSK); -} -/** - * @brief Get ADC reset request bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2rst_adcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2RST, RCU_APB2RST_ADCEN_MSK)>>RCU_APB2RST_ADCEN_POS); -} - -/** @defgroup MD_RCU_APB2RST_CMPEN CMPEN - * @brief Set CMP reset request bit for md_rcu_set_apb2rst() function used - * @param cmpen This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_rcu_set_apb2rst_cmpen_fun(cmpen) (cmpen<APB2RST, (cmpen|gp16c2t4en|gp16c2t3en|gp16c2t2en|gp16c2t1en|uart1en|spi1en|ad16c4t1en|adcen)); -} - -/** - * @brief GPIOD clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_gpden(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_GPDEN_MSK); -} -/** - * @brief GPIOD Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_gpden(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_GPDEN_MSK); -} -/** - * @brief Get GPIOD Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_gpden(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_GPDEN_MSK)>>RCU_AHBEN_GPDEN_POS); -} -/** - * @brief GPIOC clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_gpcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_GPCEN_MSK); -} -/** - * @brief GPIOC Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_gpcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_GPCEN_MSK); -} -/** - * @brief Get GPIOC Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_gpcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_GPCEN_MSK)>>RCU_AHBEN_GPCEN_POS); -} -/** - * @brief GPIOB clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_gpben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_GPBEN_MSK); -} -/** - * @brief GPIOB Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_gpben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_GPBEN_MSK); -} -/** - * @brief Get GPIOB Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_gpben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_GPBEN_MSK)>>RCU_AHBEN_GPBEN_POS); -} -/** - * @brief GPIOA clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_gpaen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_GPAEN_MSK); -} -/** - * @brief GPIOA Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_gpaen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_GPAEN_MSK); -} -/** - * @brief Get GPIOA Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_gpaen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_GPAEN_MSK)>>RCU_AHBEN_GPAEN_POS); -} -/** - * @brief HDIV clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_hdiven(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_HDIVEN_MSK); -} -/** - * @brief HDIV Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_hdiven(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_HDIVEN_MSK); -} -/** - * @brief Get HDIV Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_hdiven(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_HDIVEN_MSK)>>RCU_AHBEN_HDIVEN_POS); -} -/** - * @brief USB clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_usben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_USBEN_MSK); -} -/** - * @brief USB Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_usben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_USBEN_MSK); -} -/** - * @brief Get USB Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_usben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_USBEN_MSK)>>RCU_AHBEN_USBEN_POS); -} -/** - * @brief AES clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_aesen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_AESEN_MSK); -} -/** - * @brief AES Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_aesen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_AESEN_MSK); -} -/** - * @brief Get AES Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_aesen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_AESEN_MSK)>>RCU_AHBEN_AESEN_POS); -} -/** - * @brief CRC clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_crcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_CRCEN_MSK); -} -/** - * @brief CRC Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_crcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_CRCEN_MSK); -} -/** - * @brief Get CRC Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_crcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_CRCEN_MSK)>>RCU_AHBEN_CRCEN_POS); -} -/** - * @brief RTC clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_rtcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_RTCEN_MSK); -} -/** - * @brief RTC Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_rtcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_RTCEN_MSK); -} -/** - * @brief Get RTC Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_rtcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_RTCEN_MSK)>>RCU_AHBEN_RTCEN_POS); -} -/** - * @brief DMA1 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahben_dma1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBEN, RCU_AHBEN_DMA1EN_MSK); -} -/** - * @brief DMA1 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahben_dma1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBEN, RCU_AHBEN_DMA1EN_MSK); -} -/** - * @brief Get DMA1 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahben_dma1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBEN, RCU_AHBEN_DMA1EN_MSK)>>RCU_AHBEN_DMA1EN_POS); -} - -/** @defgroup MD_RCU_AHBEN_GPDEN GPDEN - * @brief Set GPIOD clock bit for md_rcu_set_ahben() function used - * @param gpden This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_rcu_set_ahben_gpden_fun(gpden) (gpden<AHBEN, (gpden|gpcen|gpben|gpaen|hdiven|usben|aesen|crcen|rtcen|dma1en)); -} - -/** - * @brief DAC clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_dacen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_DACEN_MSK); -} -/** - * @brief DAC Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_dacen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_DACEN_MSK); -} -/** - * @brief Get DAC Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_dacen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_DACEN_MSK)>>RCU_APB1EN_DACEN_POS); -} -/** - * @brief I2C2 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_i2c2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_I2C2EN_MSK); -} -/** - * @brief I2C2 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_i2c2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_I2C2EN_MSK); -} -/** - * @brief Get I2C2 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_i2c2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_I2C2EN_MSK)>>RCU_APB1EN_I2C2EN_POS); -} -/** - * @brief I2C1 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_i2c1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_I2C1EN_MSK); -} -/** - * @brief I2C1 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_i2c1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_I2C1EN_MSK); -} -/** - * @brief Get I2C1 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_i2c1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_I2C1EN_MSK)>>RCU_APB1EN_I2C1EN_POS); -} -/** - * @brief SUART2 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_suart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_SUART2EN_MSK); -} -/** - * @brief SUART2 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_suart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_SUART2EN_MSK); -} -/** - * @brief Get SUART2 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_suart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_SUART2EN_MSK)>>RCU_APB1EN_SUART2EN_POS); -} -/** - * @brief SUART1 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_suart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_SUART1EN_MSK); -} -/** - * @brief SUART1 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_suart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_SUART1EN_MSK); -} -/** - * @brief Get SUART1 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_suart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_SUART1EN_MSK)>>RCU_APB1EN_SUART1EN_POS); -} -/** - * @brief UART3 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_uart3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_UART3EN_MSK); -} -/** - * @brief UART3 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_uart3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_UART3EN_MSK); -} -/** - * @brief Get UART3 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_uart3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_UART3EN_MSK)>>RCU_APB1EN_UART3EN_POS); -} -/** - * @brief UART2 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_uart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_UART2EN_MSK); -} -/** - * @brief UART2 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_uart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_UART2EN_MSK); -} -/** - * @brief Get UART2 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_uart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_UART2EN_MSK)>>RCU_APB1EN_UART2EN_POS); -} -/** - * @brief SPI2 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_spi2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_SPI2EN_MSK); -} -/** - * @brief SPI2 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_spi2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_SPI2EN_MSK); -} -/** - * @brief Get SPI2 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_spi2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_SPI2EN_MSK)>>RCU_APB1EN_SPI2EN_POS); -} -/** - * @brief IWDT clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_iwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_IWDTEN_MSK); -} -/** - * @brief IWDT Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_iwdten(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_IWDTEN_MSK); -} -/** - * @brief Get IWDT Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_iwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_IWDTEN_MSK)>>RCU_APB1EN_IWDTEN_POS); -} -/** - * @brief WWDT clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_wwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_WWDTEN_MSK); -} -/** - * @brief WWDT Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_wwdten(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_WWDTEN_MSK); -} -/** - * @brief Get WWDT Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_wwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_WWDTEN_MSK)>>RCU_APB1EN_WWDTEN_POS); -} -/** - * @brief BS16T1 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_bs16t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_BS16T1EN_MSK); -} -/** - * @brief BS16T1 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_bs16t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_BS16T1EN_MSK); -} -/** - * @brief Get BS16T1 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_bs16t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_BS16T1EN_MSK)>>RCU_APB1EN_BS16T1EN_POS); -} -/** - * @brief GP16C4T3 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_gp16c4t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T3EN_MSK); -} -/** - * @brief GP16C4T3 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_gp16c4t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T3EN_MSK); -} -/** - * @brief Get GP16C4T3 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_gp16c4t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T3EN_MSK)>>RCU_APB1EN_GP16C4T3EN_POS); -} -/** - * @brief GP16C4T2 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_gp16c4t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T2EN_MSK); -} -/** - * @brief GP16C4T2 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_gp16c4t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T2EN_MSK); -} -/** - * @brief Get GP16C4T2 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_gp16c4t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T2EN_MSK)>>RCU_APB1EN_GP16C4T2EN_POS); -} -/** - * @brief GP16C4T1 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_gp16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T1EN_MSK); -} -/** - * @brief GP16C4T1 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_gp16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T1EN_MSK); -} -/** - * @brief Get GP16C4T1 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_gp16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_GP16C4T1EN_MSK)>>RCU_APB1EN_GP16C4T1EN_POS); -} -/** - * @brief GP32C4T1 clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1en_gp32c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1EN, RCU_APB1EN_GP32C4T1EN_MSK); -} -/** - * @brief GP32C4T1 Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1en_gp32c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1EN, RCU_APB1EN_GP32C4T1EN_MSK); -} -/** - * @brief Get GP32C4T1 Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1en_gp32c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1EN, RCU_APB1EN_GP32C4T1EN_MSK)>>RCU_APB1EN_GP32C4T1EN_POS); -} - -/** @defgroup MD_RCU_APB1EN_DACEN DACEN - * @brief Set DAC clock bit for md_rcu_set_apb1en() function used - * @param dacen This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_rcu_set_apb1en_dacen_fun(dacen) (dacen<APB1EN, (dacen|i2c2en|i2c1en|suart2en|suart1en|uart3en|uart2en|spi2en|iwdten|wwdten| - bs16t1en|gp16c4t3en|gp16c4t2en|gp16c4t1en|gp32c4t1en)); -} - -/** - * @brief CMP clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_cmpen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_CMPEN_MSK); -} -/** - * @brief CMP Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_cmpen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_CMPEN_MSK); -} -/** - * @brief Get CMP Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_cmpen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_CMPEN_MSK)>>RCU_APB2EN_CMPEN_POS); -} -/** - * @brief GP16C2T4EN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_gp16c2t4en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T4EN_MSK); -} -/** - * @brief GP16C2T4EN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_gp16c2t4en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T4EN_MSK); -} -/** - * @brief Get GP16C2T4EN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_gp16c2t4en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T4EN_MSK)>>RCU_APB2EN_GP16C2T4EN_POS); -} -/** - * @brief GP16C2T3EN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_gp16c2t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T3EN_MSK); -} -/** - * @brief GP16C2T3EN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_gp16c2t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T3EN_MSK); -} -/** - * @brief Get GP16C2T3EN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_gp16c2t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T3EN_MSK)>>RCU_APB2EN_GP16C2T3EN_POS); -} -/** - * @brief GP16C2T2EN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_gp16c2t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T2EN_MSK); -} -/** - * @brief GP16C2T2EN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_gp16c2t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T2EN_MSK); -} -/** - * @brief Get GP16C2T2EN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_gp16c2t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T2EN_MSK)>>RCU_APB2EN_GP16C2T2EN_POS); -} -/** - * @brief GP16C2T1EN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_gp16c2t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T1EN_MSK); -} -/** - * @brief GP16C2T1EN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_gp16c2t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T1EN_MSK); -} -/** - * @brief Get GP16C2T1EN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_gp16c2t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_GP16C2T1EN_MSK)>>RCU_APB2EN_GP16C2T1EN_POS); -} -/** - * @brief UART1EN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_uart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_UART1EN_MSK); -} -/** - * @brief UART1EN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_uart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_UART1EN_MSK); -} -/** - * @brief Get UART1EN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_uart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_UART1EN_MSK)>>RCU_APB2EN_UART1EN_POS); -} -/** - * @brief SPI1EN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_spi1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_SPI1EN_MSK); -} -/** - * @brief SPI1EN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_spi1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_SPI1EN_MSK); -} -/** - * @brief Get SPI1EN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_spi1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_SPI1EN_MSK)>>RCU_APB2EN_SPI1EN_POS); -} -/** - * @brief AD16C4T1EN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_ad16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_AD16C4T1EN_MSK); -} -/** - * @brief AD16C4T1EN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_ad16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_AD16C4T1EN_MSK); -} -/** - * @brief Get AD16C4T1EN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_ad16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_AD16C4T1EN_MSK)>>RCU_APB2EN_AD16C4T1EN_POS); -} -/** - * @brief ADCEN clock enable bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2en_adcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2EN, RCU_APB2EN_ADCEN_MSK); -} -/** - * @brief ADCEN Clock disable bit - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2en_adcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2EN, RCU_APB2EN_ADCEN_MSK); -} -/** - * @brief Get ADCEN Clock bit - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2en_adcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2EN, RCU_APB2EN_ADCEN_MSK)>>RCU_APB2EN_ADCEN_POS); -} - -/** @defgroup MD_RCU_APB2EN_CMPEN CMPEN - * @brief Set CMP clock bit for md_rcu_set_apb2en() function used - * @param cmpen This parameter can be one of the following values: - * @arg @ref DISABLE - * @arg @ref ENABLE - * @{ - */ -#define md_rcu_set_apb2en_cmpen_fun(cmpen) (cmpen<APB2EN, (cmpen|gp16c2t4en|gp16c2t3en|gp16c2t2en|gp16c2t1en|uart1en|spi1en|ad16c4t1en|adcen)); -} - - - - - - - - - - -/** - * @brief GPDEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_gpden(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_GPDEN_MSK); -} -/** - * @brief GPDEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_gpden(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_GPDEN_MSK); -} -/** - * @brief Get GPDEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_gpden(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_GPDEN_MSK)>>RCU_AHBSL_GPDEN_POS); -} -/** - * @brief GPCEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_gpcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_GPCEN_MSK); -} -/** - * @brief GPCEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_gpcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_GPCEN_MSK); -} -/** - * @brief Get GPCEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_gpcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_GPCEN_MSK)>>RCU_AHBSL_GPCEN_POS); -} -/** - * @brief GPBEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_gpben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_GPBEN_MSK); -} -/** - * @brief GPBEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_gpben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_GPBEN_MSK); -} -/** - * @brief Get GPBEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_gpben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_GPBEN_MSK)>>RCU_AHBSL_GPBEN_POS); -} -/** - * @brief GPAEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_gpaen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_GPAEN_MSK); -} -/** - * @brief GPAEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_gpaen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_GPAEN_MSK); -} -/** - * @brief Get GPAEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_gpaen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_GPAEN_MSK)>>RCU_AHBSL_GPAEN_POS); -} -/** - * @brief HDIVEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_hdiven(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_HDIVEN_MSK); -} -/** - * @brief HDIVEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_hdiven(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_HDIVEN_MSK); -} -/** - * @brief Get HDIVEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_hdiven(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_HDIVEN_MSK)>>RCU_AHBSL_HDIVEN_POS); -} -/** - * @brief USBEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_usben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_USBEN_MSK); -} -/** - * @brief USBEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_usben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_USBEN_MSK); -} -/** - * @brief Get USBEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_usben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_USBEN_MSK)>>RCU_AHBSL_USBEN_POS); -} -/** - * @brief AESEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_aesen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_AESEN_MSK); -} -/** - * @brief AESEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_aesen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_AESEN_MSK); -} -/** - * @brief Get AESEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_aesen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_AESEN_MSK)>>RCU_AHBSL_AESEN_POS); -} -/** - * @brief CRCEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_crcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_CRCEN_MSK); -} -/** - * @brief CRCEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_crcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_CRCEN_MSK); -} -/** - * @brief Get CRCEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_crcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_CRCEN_MSK)>>RCU_AHBSL_CRCEN_POS); -} -/** - * @brief RTCEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_rtcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_RTCEN_MSK); -} -/** - * @brief RTCEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_rtcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_RTCEN_MSK); -} -/** - * @brief Get RTCEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_rtcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_RTCEN_MSK)>>RCU_AHBSL_RTCEN_POS); -} -/** - * @brief DMA1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbsl_dma1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBSL, RCU_AHBSL_DMA1EN_MSK); -} -/** - * @brief DMA1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbsl_dma1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBSL, RCU_AHBSL_DMA1EN_MSK); -} -/** - * @brief Get DMA1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbsl_dma1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBSL, RCU_AHBSL_DMA1EN_MSK)>>RCU_AHBSL_DMA1EN_POS); -} - -/** - * @brief DAC clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_dacen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_DACEN_MSK); -} -/** - * @brief DAC clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_dacen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_DACEN_MSK); -} -/** - * @brief Get DAC clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_dacen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_DACEN_MSK)>>RCU_APB1SL_DACEN_POS); -} -/** - * @brief I2C2EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_i2c2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_I2C2EN_MSK); -} -/** - * @brief I2C2EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_i2c2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_I2C2EN_MSK); -} -/** - * @brief Get I2C2EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_i2c2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_I2C2EN_MSK)>>RCU_APB1SL_I2C2EN_POS); -} -/** - * @brief I2C1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_i2c1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_I2C1EN_MSK); -} -/** - * @brief I2C1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_i2c1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_I2C1EN_MSK); -} -/** - * @brief Get I2C1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_i2c1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_I2C1EN_MSK)>>RCU_APB1SL_I2C1EN_POS); -} -/** - * @brief SUART2EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_suart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_SUART2EN_MSK); -} -/** - * @brief SUART2EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_suart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_SUART2EN_MSK); -} -/** - * @brief Get SUART2EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_suart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_SUART2EN_MSK)>>RCU_APB1SL_SUART2EN_POS); -} -/** - * @brief SUART1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_suart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_SUART1EN_MSK); -} -/** - * @brief SUART1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_suart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_SUART1EN_MSK); -} -/** - * @brief Get SUART1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_suart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_SUART1EN_MSK)>>RCU_APB1SL_SUART1EN_POS); -} -/** - * @brief UART3EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_uart3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_UART3EN_MSK); -} -/** - * @brief UART3EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_uart3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_UART3EN_MSK); -} -/** - * @brief Get UART3EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_uart3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_UART3EN_MSK)>>RCU_APB1SL_UART3EN_POS); -} -/** - * @brief UART2EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_uart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_UART2EN_MSK); -} -/** - * @brief UART2EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_uart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_UART2EN_MSK); -} -/** - * @brief Get UART2EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_uart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_UART2EN_MSK)>>RCU_APB1SL_UART2EN_POS); -} -/** - * @brief SPI2EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_spi2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_SPI2EN_MSK); -} -/** - * @brief SPI2EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_spi2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_SPI2EN_MSK); -} -/** - * @brief Get SPI2EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_spi2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_SPI2EN_MSK)>>RCU_APB1SL_SPI2EN_POS); -} -/** - * @brief IWDTEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_iwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_IWDTEN_MSK); -} -/** - * @brief IWDTEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_iwdgen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_IWDTEN_MSK); -} -/** - * @brief Get IWDTEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_iwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_IWDTEN_MSK)>>RCU_APB1SL_IWDTEN_POS); -} -/** - * @brief WWDTEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_wwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_WWDTEN_MSK); -} -/** - * @brief WWDTEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_wwdten(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_WWDTEN_MSK); -} -/** - * @brief Get WWDTEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_wwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_WWDTEN_MSK)>>RCU_APB1SL_WWDTEN_POS); -} -/** - * @brief BS16T1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_bs16t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_BS16T1EN_MSK); -} -/** - * @brief BS16T1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_bs16t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_BS16T1EN_MSK); -} -/** - * @brief Get BS16T1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_bs16t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_BS16T1EN_MSK)>>RCU_APB1SL_BS16T1EN_POS); -} -/** - * @brief GP16C4T3EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_gp16c4t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T3EN_MSK); -} -/** - * @brief GP16C4T3EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_gp16c4t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T3EN_MSK); -} -/** - * @brief Get GP16C4T3EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_gp16c4t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T3EN_MSK)>>RCU_APB1SL_GP16C4T3EN_POS); -} -/** - * @brief GP16C4T2EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_gp16c4t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T2EN_MSK); -} -/** - * @brief GP16C4T2EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_gp16c4t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T2EN_MSK); -} -/** - * @brief Get GP16C4T2EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). -y*/ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_gp16c4t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T2EN_MSK)>>RCU_APB1SL_GP16C4T2EN_POS); -} -/** - * @brief GP16C4T1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_gp16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T1EN_MSK); -} -/** - * @brief GP16C4T1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_gp16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T1EN_MSK); -} -/** - * @brief Get GP16C4T1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_gp16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_GP16C4T1EN_MSK)>>RCU_APB1SL_GP16C4T1EN_POS); -} -/** - * @brief GP32C4T1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1sl_gp32c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1SL, RCU_APB1SL_GP32C4T1EN_MSK); -} -/** - * @brief GP32C4T1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1sl_gp32c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1SL, RCU_APB1SL_GP32C4T1EN_MSK); -} -/** - * @brief Get GP32C4T1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1sl_gp32c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1SL, RCU_APB1SL_GP32C4T1EN_MSK)>>RCU_APB1SL_GP32C4T1EN_POS); -} - -/** - * @brief CMP clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_cmpen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_CMPEN_MSK); -} -/** - * @brief CMP clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_cmpen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_CMPEN_MSK); -} -/** - * @brief Get CMP clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_cmpen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_CMPEN_MSK)>>RCU_APB2SL_CMPEN_POS); -} -/** - * @brief GP16C2T4EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_gp16c2t4en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T4EN_MSK); -} -/** - * @brief GP16C2T4EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_gp16c2t4en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T4EN_MSK); -} -/** - * @brief Get GP16C2T4EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_gp16c2t4en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T4EN_MSK)>>RCU_APB2SL_GP16C2T4EN_POS); -} -/** - * @brief GP16C2T3EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_gp16c2t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T3EN_MSK); -} -/** - * @brief GP16C2T3EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_gp16c2t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T3EN_MSK); -} -/** - * @brief Get GP16C2T3EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_gp16c2t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T3EN_MSK)>>RCU_APB2SL_GP16C2T3EN_POS); -} -/** - * @brief GP16C2T2EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_gp16c2t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T2EN_MSK); -} -/** - * @brief GP16C2T2EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_gp16c2t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T2EN_MSK); -} -/** - * @brief Get GP16C2T2EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_gp16c2t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T2EN_MSK)>>RCU_APB2SL_GP16C2T2EN_POS); -} -/** - * @brief GP16C2T1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_gp16c2t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T1EN_MSK); -} -/** - * @brief GP16C2T1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_gp16c2t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T1EN_MSK); -} -/** - * @brief Get GP16C2T1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_gp16c2t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_GP16C2T1EN_MSK)>>RCU_APB2SL_GP16C2T1EN_POS); -} -/** - * @brief UART1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_uart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_UART1EN_MSK); -} -/** - * @brief UART1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_uart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_UART1EN_MSK); -} -/** - * @brief Get UART1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_uart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_UART1EN_MSK)>>RCU_APB2SL_UART1EN_POS); -} -/** - * @brief SPI1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_spi1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_SPI1EN_MSK); -} -/** - * @brief SPI1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_spi1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_SPI1EN_MSK); -} -/** - * @brief Get SPI1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_spi1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_SPI1EN_MSK)>>RCU_APB2SL_SPI1EN_POS); -} -/** - * @brief AD16C4T1EN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_ad16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_AD16C4T1EN_MSK); -} -/** - * @brief AD16C4T1EN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_ad16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_AD16C4T1EN_MSK); -} -/** - * @brief Get AD16C4T1EN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_ad16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_AD16C4T1EN_MSK)>>RCU_APB2SL_AD16C4T1EN_POS); -} -/** - * @brief ADCEN clock enable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2sl_adcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2SL, RCU_APB2SL_ADCEN_MSK); -} -/** - * @brief ADCEN clock disable during Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2sl_adcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2SL, RCU_APB2SL_ADCEN_MSK); -} -/** - * @brief Get ADCEN clock during Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2sl_adcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2SL, RCU_APB2SL_ADCEN_MSK)>>RCU_APB2SL_ADCEN_POS); -} - -/** - * @brief GPIOD clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_gpden(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_GPDEN_MSK); -} -/** - * @brief GPIOD clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_gpden(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_GPDEN_MSK); -} -/** - * @brief Get GPIOD clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_gpden(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_GPDEN_MSK)>>RCU_AHBDSL_GPDEN_POS); -} -/** - * @brief GPIOC clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_gpcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_GPCEN_MSK); -} -/** - * @brief GPIOC clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_gpcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_GPCEN_MSK); -} -/** - * @brief Get GPIOC clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_gpcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_GPCEN_MSK)>>RCU_AHBDSL_GPCEN_POS); -} -/** - * @brief GPIOB clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_gpben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_GPBEN_MSK); -} -/** - * @brief GPIOB clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_gpben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_GPBEN_MSK); -} -/** - * @brief Get GPIOB clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_gpben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_GPBEN_MSK)>>RCU_AHBDSL_GPBEN_POS); -} -/** - * @brief GPIOA clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_gpaen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_GPAEN_MSK); -} -/** - * @brief GPIOA clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_gpaen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_GPAEN_MSK); -} -/** - * @brief Get GPIOA clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_gpaen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_GPAEN_MSK)>>RCU_AHBDSL_GPAEN_POS); -} -/** - * @brief HDIV clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_hdiven(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_HDIVEN_MSK); -} -/** - * @brief HDIV clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_hdiven(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_HDIVEN_MSK); -} -/** - * @brief Get HDIV clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_hdiven(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_HDIVEN_MSK)>>RCU_AHBDSL_HDIVEN_POS); -} -/** - * @brief USB clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_usben(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_USBEN_MSK); -} -/** - * @brief USB clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_usben(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_USBEN_MSK); -} -/** - * @brief Get USB clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_usben(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_USBEN_MSK)>>RCU_AHBDSL_USBEN_POS); -} -/** - * @brief AES clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_aesen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_AESEN_MSK); -} -/** - * @brief AES clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_aesen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_AESEN_MSK); -} -/** - * @brief Get AES clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_aesen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_AESEN_MSK)>>RCU_AHBDSL_AESEN_POS); -} -/** - * @brief CRC clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_crcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_CRCEN_MSK); -} -/** - * @brief CRC clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_crcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_CRCEN_MSK); -} -/** - * @brief Get CRC clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_crcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_CRCEN_MSK)>>RCU_AHBDSL_CRCEN_POS); -} -/** - * @brief RTC clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_rtcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_RTCEN_MSK); -} -/** - * @brief RTC clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_rtcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_RTCEN_MSK); -} -/** - * @brief Get RTC clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_rtcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_RTCEN_MSK)>>RCU_AHBDSL_RTCEN_POS); -} -/** - * @brief DMA1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_ahbdsl_dma1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->AHBDSL, RCU_AHBDSL_DMA1EN_MSK); -} -/** - * @brief DMA1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_ahbdsl_dma1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->AHBDSL, RCU_AHBDSL_DMA1EN_MSK); -} -/** - * @brief Get DMA1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_ahbdsl_dma1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->AHBDSL, RCU_AHBDSL_DMA1EN_MSK)>>RCU_AHBDSL_DMA1EN_POS); -} - -/** - * @brief DAC clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_dacen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_DACEN_MSK); -} -/** - * @brief DAC clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_dacen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_DACEN_MSK); -} -/** - * @brief Get DAC clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_dacen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_DACEN_MSK)>>RCU_APB1DSL_DACEN_POS); -} -/** - * @brief I2C2 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_apb1dslen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_I2C2EN_MSK); -} -/** - * @brief I2C2 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_apb1dslen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_I2C2EN_MSK); -} -/** - * @brief Get I2C2 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_apb1dslen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_I2C2EN_MSK)>>RCU_APB1DSL_I2C2EN_POS); -} -/** - * @brief I2C1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_i2c1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_I2C1EN_MSK); -} -/** - * @brief I2C1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_i2c1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_I2C1EN_MSK); -} -/** - * @brief Get I2C1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_i2c1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_I2C1EN_MSK)>>RCU_APB1DSL_I2C1EN_POS); -} -/** - * @brief SUART2 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_suart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_SUART2EN_MSK); -} -/** - * @brief SUART2 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_suart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_SUART2EN_MSK); -} -/** - * @brief Get SUART2 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_suart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_SUART2EN_MSK)>>RCU_APB1DSL_SUART2EN_POS); -} -/** - * @brief SUART1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_suart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_SUART1EN_MSK); -} -/** - * @brief SUART1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_suart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_SUART1EN_MSK); -} -/** - * @brief Get SUART1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_suart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_SUART1EN_MSK)>>RCU_APB1DSL_SUART1EN_POS); -} -/** - * @brief UART3 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_uart3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_UART3EN_MSK); -} -/** - * @brief UART3 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_uart3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_UART3EN_MSK); -} -/** - * @brief Get UART3 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_uart3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_UART3EN_MSK)>>RCU_APB1DSL_UART3EN_POS); -} -/** - * @brief UART2 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_uart2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_UART2EN_MSK); -} -/** - * @brief UART2 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_uart2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_UART2EN_MSK); -} -/** - * @brief Get UART2 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_uart2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_UART2EN_MSK)>>RCU_APB1DSL_UART2EN_POS); -} -/** - * @brief SPI2 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_spi2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_SPI2EN_MSK); -} -/** - * @brief SPI2 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_spi2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_SPI2EN_MSK); -} -/** - * @brief Get SPI2 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_spi2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_SPI2EN_MSK)>>RCU_APB1DSL_SPI2EN_POS); -} -/** - * @brief IWDT clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_iwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_IWDTEN_MSK); -} -/** - * @brief IWDT clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_iwdten(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_IWDTEN_MSK); -} -/** - * @brief Get IWDT clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_iwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_IWDTEN_MSK)>>RCU_APB1DSL_IWDTEN_POS); -} -/** - * @brief WWDT clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_wwdten(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_WWDTEN_MSK); -} -/** - * @brief WWDT clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_wwdten(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_WWDTEN_MSK); -} -/** - * @brief Get WWDT clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_wwdten(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_WWDTEN_MSK)>>RCU_APB1DSL_WWDTEN_POS); -} -/** - * @brief BS16T1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_bs16t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_BS16T1EN_MSK); -} -/** - * @brief BS16T1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_bs16t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_BS16T1EN_MSK); -} -/** - * @brief Get BS16T1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_bs16t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_BS16T1EN_MSK)>>RCU_APB1DSL_BS16T1EN_POS); -} -/** - * @brief GP16C4T3 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_gp16c4t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T3EN_MSK); -} -/** - * @brief GP16C4T3 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_gp16c4t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T3EN_MSK); -} -/** - * @brief Get GP16C4T3 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_gp16c4t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T3EN_MSK)>>RCU_APB1DSL_GP16C4T3EN_POS); -} -/** - * @brief GP16C4T2 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_gp16c4t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T2EN_MSK); -} -/** - * @brief GP16C4T2 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_gp16c4t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T2EN_MSK); -} -/** - * @brief Get GP16C4T2 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_gp16c4t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T2EN_MSK)>>RCU_APB1DSL_GP16C4T2EN_POS); -} -/** - * @brief GP16C4T1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_gp16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T1EN_MSK); -} -/** - * @brief GP16C4T1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_gp16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T1EN_MSK); -} -/** - * @brief Get GP16C4T1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_gp16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_GP16C4T1EN_MSK)>>RCU_APB1DSL_GP16C4T1EN_POS); -} -/** - * @brief GP32C4T1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb1dsl_gp32c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB1DSL, RCU_APB1DSL_GP32C4T1EN_MSK); -} -/** - * @brief GP32C4T1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb1dsl_gp32c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB1DSL, RCU_APB1DSL_GP32C4T1EN_MSK); -} -/** - * @brief Get GP32C4T1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb1dsl_gp32c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB1DSL, RCU_APB1DSL_GP32C4T1EN_MSK)>>RCU_APB1DSL_GP32C4T1EN_POS); -} - -/** - * @brief CMP clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_cmpen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_CMPEN_MSK); -} -/** - * @brief CMP clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_cmpen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_CMPEN_MSK); -} -/** - * @brief Get CMP clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_cmpen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_CMPEN_MSK)>>RCU_APB2DSL_CMPEN_POS); -} -/** - * @brief GP16C2T4 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_gp16c2t4en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T4EN_MSK); -} -/** - * @brief GP16C2T4 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_gp16c2t4en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T4EN_MSK); -} -/** - * @brief Get GP16C2T4 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_gp16c2t4en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T4EN_MSK)>>RCU_APB2DSL_GP16C2T4EN_POS); -} -/** - * @brief GP16C2T3 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_gp16c2t3en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T3EN_MSK); -} -/** - * @brief GP16C2T3 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_gp16c2t3en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T3EN_MSK); -} -/** - * @brief Get GP16C2T3 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_gp16c2t3en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T3EN_MSK)>>RCU_APB2DSL_GP16C2T3EN_POS); -} -/** - * @brief GP16C2T2 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_gp16c2t2en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T2EN_MSK); -} -/** - * @brief GP16C2T2 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_gp16c2t2en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T2EN_MSK); -} -/** - * @brief Get GP16C2T2 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_gp16c2t2en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T2EN_MSK)>>RCU_APB2DSL_GP16C2T2EN_POS); -} -/** - * @brief GP16C2T1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_gp16c2t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T1EN_MSK); -} -/** - * @brief GP16C2T1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_gp16c2t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T1EN_MSK); -} -/** - * @brief Get GP16C2T1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_gp16c2t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_GP16C2T1EN_MSK)>>RCU_APB2DSL_GP16C2T1EN_POS); -} -/** - * @brief UART1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_uart1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_UART1EN_MSK); -} -/** - * @brief UART1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_uart1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_UART1EN_MSK); -} -/** - * @brief Get UART1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_uart1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_UART1EN_MSK)>>RCU_APB2DSL_UART1EN_POS); -} -/** - * @brief SPI1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_spi1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_SPI1EN_MSK); -} -/** - * @brief SPI1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_spi1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_SPI1EN_MSK); -} -/** - * @brief Get SPI1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_spi1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_SPI1EN_MSK)>>RCU_APB2DSL_SPI1EN_POS); -} -/** - * @brief AD16C4T1 clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_ad16c4t1en(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_AD16C4T1EN_MSK); -} -/** - * @brief AD16C4T1 clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_ad16c4t1en(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_AD16C4T1EN_MSK); -} -/** - * @brief Get AD16C4T1 clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_ad16c4t1en(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_AD16C4T1EN_MSK)>>RCU_APB2DSL_AD16C4T1EN_POS); -} -/** - * @brief ADC clock enable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_enable_apb2dsl_adcen(RCU_TypeDef *rcu) -{ - SET_BIT(rcu->APB2DSL, RCU_APB2DSL_ADCEN_MSK); -} -/** - * @brief ADC clock disable during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval None - */ -__STATIC_INLINE void md_rcu_disable_apb2dsl_adcen(RCU_TypeDef *rcu) -{ - CLEAR_BIT(rcu->APB2DSL, RCU_APB2DSL_ADCEN_MSK); -} -/** - * @brief Get ADC clock during Deep Sleep mode bit. - * @param rcu RCU Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_rcu_get_apb2dsl_adcen(RCU_TypeDef *rcu) -{ - return (READ_BIT(rcu->APB2DSL, RCU_APB2DSL_ADCEN_MSK)>>RCU_APB2DSL_ADCEN_POS); -} - -/** - * @} MD_RCU_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_RCU_Public_Functions RCU Public Functions - * @{ - */ - -/** @defgroup MD_RCU_PF_Basic_Configuration Basic Configuration - * @{ - */ -void md_rcu_init(void); -void md_rcu_init_set(RCU_TypeDef *, md_rcu_init_typedef *); -void md_rcu_pllreinit(uint8_t); -/** - * @} MD_RCU_PF_Basic_Configuration - */ - -/** - * @} MD_RCU_Public_Functions - */ - -#endif - -/** - * @} RCU - */ - -/** - * @} Micro_Driver - */ -#ifdef __cplusplus -} - -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_rtc.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_rtc.h deleted file mode 100644 index 4de23ae628..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_rtc.h +++ /dev/null @@ -1,2785 +0,0 @@ -/** - ****************************************************************************** - * @file md_RTC.h - * @brief ES32F0271 RTC HEAD File. - * - * @version V1.00.02 - * @date 30/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_RTC_H__ -#define __MD_RTC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include -#include "es32f0271.h" -#include "reg_rtc.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (RTC) - -/** @defgroup RTC RTC - * @brief RTC micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_RTC_PT_INIT RTC Public Init structures - * @{ - */ - -/** - * @brief MD RTC Init Structure definition - */ - - -/** - * @} MD_RTC_PT_INIT - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_RTC_Public_Constants RTC Public Constants - * @{ - */ - -/** @defgroup MD_RTC_CON_MODE_ RTC Clock Calibration Mode - * @{ - */ -#define MD_RTC_CON_MODE_INCR (0x00000000UL) /** @brief Increase calibration value when match calibration cycle. */ -#define MD_RTC_CON_MODE_DECR (0X00000001UL) /** @brief DMA Decrease calibration value when match calibration cycle. */ -/** - * @} MD_RTC_CON_MODE_ - */ - -/** @defgroup MD_RTC_CON_CYCLE_ RTC Calibration Cycle Select - * @{ - */ -#define MD_RTC_CON_CYCLE_60S (0x00000000UL) /** @brief When enable Calibration Function, the calibrate cycle is 60s. */ -#define MD_RTC_CON_CYCLE_1S (0X00000001UL) /** @brief When enable Calibration Function, the calibrate cycle is 1s. */ -/** - * @} MD_RTC_CON_CYCLE_ - */ - -/** @defgroup MD_RTC_CON_CKSEL_ RTC Clock Source Selection - * @{ - */ -#define MD_RTC_CON_CKSEL_NO (0x00000000UL) /** @brief No clock */ -#define MD_RTC_CON_CKSEL_LOSC (0X00000001UL) /** @brief LOSC oscillator clock used as RTC clock */ -#define MD_RTC_CON_CKSEL_LRC (0x00000002UL) /** @brief LRC oscillator clock used as RTC clock */ -#define MD_RTC_CON_CKSEL_PLL (0X00000003UL) /** @brief PLL Reference clock source divided by 128 used as RTC clock */ -/** - * @} MD_RTC_CON_CKSEL_ - */ - -/** @defgroup MD_RTC_WKUP_WKSCAL RTC Wakeup Counter Scale Value - * @{ - */ -#define MD_RTC_WKUP_WKSCAL_DIV1 (0x00000000UL) /** @brief Divide 1, wakeup counter will count each second. */ -#define MD_RTC_WKUP_WKSCAL_DIV2 (0X00000001UL) /** @brief Divide 2, wakeup counter will count each 1/2 second. */ -#define MD_RTC_WKUP_WKSCAL_DIV4 (0x00000002UL) /** @brief Divide 4, wakeup counter will count each 1/4 second. */ -#define MD_RTC_WKUP_WKSCAL_DIV8 (0X00000003UL) /** @brief Divide 8, wakeup counter will count each 1/8 second. */ -#define MD_RTC_WKUP_WKSCAL_DIV16 (0X00000004UL) /** @brief Divide 16, wakeup counter will count each 1/16 second. */ -/** - * @} MD_RTC_WKUP_WKSCAL - */ - -/** @defgroup MD_RTC_WKUP_WKSEL RTC Wakeup Counter Events Select - * @{ - */ -#define MD_RTC_WKUP_WKSEL_OFF (0x00000000UL) /** @brief OFF */ -#define MD_RTC_WKUP_WKSEL_RTC (0X00000001UL) /** @brief Start counter when RTC start. */ -#define MD_RTC_WKUP_WKSEL_SLEEP (0x00000002UL) /** @brief Start counter when receive sleep flag. */ -/** - * @} MD_RTC_WKUP_WKSEL - */ - -/** @defgroup MD_RTC_STAT_SYNDONE RTC Calendar Synchronization status - * @{ - */ -#define MD_RTC_STAT_SYNDONE_UNDER (0x00000000UL) /** @brief RTC is under Synchronization procedure */ -#define MD_RTC_STAT_SYNDONE_CMP (0X00000001UL) /** @brief RTC Synchronization procedure is Completed */ -/** - * @} MD_RTC_STAT_SYNDONE - */ - -/** @defgroup MD_RTC_BKEN_BKEN Read RTC Backup Register Enable - * @{ - */ -#define MD_RTC_BKEN_BKEN_CONTROL (0x00000000UL) /** @brief Read RTCTIME & RTCCAL From control register. */ -#define MD_RTC_BKEN_BKEN_BACKUP (0X00000001UL) /** @brief Read RTCTIME & RTCCAL From backup register. */ -/** - * @} MD_RTC_BKEN_BKEN - */ - -/** - * @} MD_RTC_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_RTC_Public_Macros RTC Public Macros - * @{ - */ - -/** - * @brief Set RTC Clock Calibration Mode - * @param rtc RTC Instance - * @param mode can be one of the following values: - * @arg @ref MD_RTC_CON_MODE_INCR - * @arg @ref MD_RTC_CON_MODE_DECR - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_mode(RTC_TypeDef *rtc, uint32_t mode) -{ - MODIFY_REG(rtc->CON, RTC_CON_MODE_MSK, (mode<CON, RTC_CON_MODE_MSK)>>RTC_CON_MODE_POS); -} -/** - * @brief Set RTC Clock Calibration Value - * @param rtc RTC Instance - * @param calval Max calibration value is CALV. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_calval(RTC_TypeDef *rtc, uint32_t calval) -{ - MODIFY_REG(rtc->CON, RTC_CON_CALVAL_MSK, (calval<CON, RTC_CON_CALVAL_MSK)>>RTC_CON_CALVAL_POSS); -} -/** - * @brief Set RTC Clock Counter Scale - * @param rtc RTC Instance - * @param scale Max divider of This counter is (SCALE+1). - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_scale(RTC_TypeDef *rtc, uint32_t scale) -{ - MODIFY_REG(rtc->CON, RTC_CON_SCALE_MSK, (scale<CON, RTC_CON_SCALE_MSK)>>RTC_CON_SCALE_POSS); -} -/** - * @brief Set RTC Clock Counter Prescale - * @param rtc RTC Instance - * @param pscale Max divider of This counter is (PSCALE+1). - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_pscale(RTC_TypeDef *rtc, uint32_t pscale) -{ - MODIFY_REG(rtc->CON, RTC_CON_PSCALE_MSK, (pscale<CON, RTC_CON_PSCALE_MSK)>>RTC_CON_PSCALE_POSS); -} -/** - * @brief Set RTC Calibration Cycle Select - * @param rtc RTC Instance - * @param cycle This parameter can be one of the following values: - * @arg @ref MD_RTC_CON_CYCLE_60S - * @arg @ref MD_RTC_CON_CYCLE_1S - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_cycle(RTC_TypeDef *rtc, uint32_t cycle) -{ - MODIFY_REG(rtc->CON, RTC_CON_CYCLE_MSK, (cycle<CON, RTC_CON_CYCLE_MSK)>>RTC_CON_CYCLE_POS); -} -/** - * @brief Set RTC Calibration Function Enable - * @param rtc RTC Instance - * @param calib This parameter can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_calib(RTC_TypeDef *rtc, uint32_t calib) -{ - MODIFY_REG(rtc->CON, RTC_CON_CALIB_MSK, (calib<CON, RTC_CON_CALIB_MSK)>>RTC_CON_CALIB_POS); -} -/** - * @brief Set RTC Clock Source Selection - * @param rtc RTC Instance - * @param cksel This parameter can be one of the following values: - * @arg @ref MD_RTC_CON_CKSEL_NO - * @arg @ref MD_RTC_CON_CKSEL_LOSC - * @arg @ref MD_RTC_CON_CKSEL_LRC - * @arg @ref MD_RTC_CON_CKSEL_PLL - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_cksel(RTC_TypeDef *rtc, uint32_t cksel) -{ - MODIFY_REG(rtc->CON, RTC_CON_CKSEL_MSK, (cksel<CON, RTC_CON_CKSEL_MSK)>>RTC_CON_CKSEL_POSS); -} -/** - * @brief Set RTC Counter Enable bit - * @param rtc RTC Instance - * @param rtcen This parameter can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_con_rtcen(RTC_TypeDef *rtc, uint32_t rtcen) -{ - MODIFY_REG(rtc->CON, RTC_CON_RTCEN_MSK, (rtcen<CON, RTC_CON_RTCEN_MSK)>>RTC_CON_RTCEN_POS); -} - -/** @defgroup MD_RTC_CON_MODE MODE - * @brief Set RTC Clock Calibration Mode bit for md_rtc_set_con() function used - * @param mode This parameter can be one of the following values: - * @arg @ref MD_RTC_CON_MODE_INCR - * @arg @ref MD_RTC_CON_MODE_DECR - * @{ - */ -#define md_rtc_set_con_mode_fun(mode) (mode<CON, (mode|calval|scale|pscale|cycle|calib|cksel|rtcen)); -} - - -/** - * @brief Set RTC Wakeup Counter Scale Value - * @param rtc RTC Instance - * @param wkscal This parameter can be one of the following values: - * @arg @ref MD_RTC_WKUP_WKSCAL_DIV1 - * @arg @ref MD_RTC_WKUP_WKSCAL_DIV2 - * @arg @ref MD_RTC_WKUP_WKSCAL_DIV4 - * @arg @ref MD_RTC_WKUP_WKSCAL_DIV8 - * @arg @ref MD_RTC_WKUP_WKSCAL_DIV16 - * @retval None - */ -__STATIC_INLINE void md_rtc_set_wkup_wkscal(RTC_TypeDef *rtc, uint32_t wkscal) -{ - MODIFY_REG(rtc->WKUP, RTC_WKUP_WKSCAL_MSK, (wkscal<WKUP, RTC_WKUP_WKSCAL_MSK)>>RTC_WKUP_WKSCAL_POSS); -} -/** - * @brief Set RTC Wakeup Counter Events Select - * @param rtc RTC Instance - * @param wksel This parameter can be one of the following values: - * @arg @ref MD_RTC_WKUP_WKSEL_OFF - * @arg @ref MD_RTC_WKUP_WKSEL_RTC - * @arg @ref MD_RTC_WKUP_WKSEL_SLEEP - * @retval None - */ -__STATIC_INLINE void md_rtc_set_wkup_wksel(RTC_TypeDef *rtc, uint32_t wksel) -{ - MODIFY_REG(rtc->WKUP, RTC_WKUP_WKSEL_MSK, (wksel<WKUP, RTC_WKUP_WKSEL_MSK)>>RTC_WKUP_WKSEL_POSS); -} -/** - * @brief Set RTC Wakeup Counter setting value - * @param rtc RTC Instance - * @param wkcal Max value is WKCAL seconds - * @retval None - */ -__STATIC_INLINE void md_rtc_set_wkup_wkcal(RTC_TypeDef *rtc, uint32_t wkcal) -{ - MODIFY_REG(rtc->WKUP, RTC_WKUP_WKCAL_MSK, (wkcal<WKUP, RTC_WKUP_WKCAL_MSK)>>RTC_WKUP_WKCAL_POSS); -} - - -/** - * @brief Set Week Value - * @param rtc RTC Instance - * @param week value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_time_week(RTC_TypeDef *rtc, uint32_t week) -{ - MODIFY_REG(rtc->TIME, RTC_TIME_WEEK_MSK, (week<TIME, RTC_TIME_WEEK_MSK)>>RTC_TIME_WEEK_POSS); -} -/** - * @brief Set Hour Tens Value - * @param rtc RTC Instance - * @param hour_t Hour tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_time_hour_t(RTC_TypeDef *rtc, uint32_t hour_t) -{ - MODIFY_REG(rtc->TIME, RTC_TIME_HOUR_T_MSK, (hour_t<TIME, RTC_TIME_HOUR_T_MSK)>>RTC_TIME_HOUR_T_POSS); -} -/** - * @brief Set Hour Units Value - * @param rtc RTC Instance - * @param hour_u Hour units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_time_hour_u(RTC_TypeDef *rtc, uint32_t hour_u) -{ - MODIFY_REG(rtc->TIME, RTC_TIME_HOUR_U_MSK, (hour_u<TIME, RTC_TIME_HOUR_U_MSK)>>RTC_TIME_HOUR_U_POSS); -} -/** - * @brief Set Minute Tens Value - * @param rtc RTC Instance - * @param min_t Minute tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_time_min_t(RTC_TypeDef *rtc, uint32_t min_t) -{ - MODIFY_REG(rtc->TIME, RTC_TIME_MIN_T_MSK, (min_t<TIME, RTC_TIME_MIN_T_MSK)>>RTC_TIME_MIN_T_POSS); -} -/** - * @brief Set Minute Units Value - * @param rtc RTC Instance - * @param min_u Minute units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_time_min_u(RTC_TypeDef *rtc, uint32_t min_u) -{ - MODIFY_REG(rtc->TIME, RTC_TIME_MIN_U_MSK, (min_u<TIME, RTC_TIME_MIN_U_MSK)>>RTC_TIME_MIN_U_POSS); -} -/** - * @brief Set Second Tens Value - * @param rtc RTC Instance - * @param sec_t Second tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_time_sec_t(RTC_TypeDef *rtc, uint32_t sec_t) -{ - MODIFY_REG(rtc->TIME, RTC_TIME_SEC_T_MSK, (sec_t<TIME, RTC_TIME_SEC_T_MSK)>>RTC_TIME_SEC_T_POSS); -} -/** - * @brief Set Second Units Value - * @param rtc RTC Instance - * @param sec_u Second units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_time_sec_u(RTC_TypeDef *rtc, uint32_t sec_u) -{ - MODIFY_REG(rtc->TIME, RTC_TIME_SEC_U_MSK, (sec_u<TIME, RTC_TIME_SEC_U_MSK)>>RTC_TIME_SEC_U_POSS); -} - -/** @defgroup MD_RTC_TIME_WEEK WEEK - * @brief Set Week Value bit bit for md_rtc_set_time() function used - * @param week value in RTC timer, in BCD format. - * @{ - */ -#define md_rtc_set_time_week_fun(week) (week<TIME, (week|hour_t|hour_u|min_t|min_u|sec_t|sec_u)); -} - - - - - - - - - - -/** - * @brief Set Year Tens Value - * @param rtc RTC Instance - * @param year_t Year tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_cal_year_t(RTC_TypeDef *rtc, uint32_t year_t) -{ - MODIFY_REG(rtc->CAL, RTC_CAL_YEAR_T_MSK, (year_t<CAL, RTC_CAL_YEAR_T_MSK)>>RTC_CAL_YEAR_T_POSS); -} -/** - * @brief Set Year Units Value - * @param rtc RTC Instance - * @param year_u Year units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_cal_year_u(RTC_TypeDef *rtc, uint32_t year_u) -{ - MODIFY_REG(rtc->CAL, RTC_CAL_YEAR_U_MSK, (year_u<CAL, RTC_CAL_YEAR_U_MSK)>>RTC_CAL_YEAR_U_POSS); -} -/** - * @brief Set Month Tens Value - * @param rtc RTC Instance - * @param mon_t Month tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_cal_mon_t(RTC_TypeDef *rtc, uint32_t mon_t) -{ - MODIFY_REG(rtc->CAL, RTC_CAL_MON_T_MSK, (mon_t<CAL, RTC_CAL_MON_T_MSK)>>RTC_CAL_MON_T_POS); -} -/** - * @brief Set Month Units Value - * @param rtc RTC Instance - * @param mon_u Month units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_cal_mon_u(RTC_TypeDef *rtc, uint32_t mon_u) -{ - MODIFY_REG(rtc->CAL, RTC_CAL_MON_U_MSK, (mon_u<CAL, RTC_CAL_MON_U_MSK)>>RTC_CAL_MON_U_POSS); -} -/** - * @brief Set Date Tens Value - * @param rtc RTC Instance - * @param date_t Date tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_cal_date_t(RTC_TypeDef *rtc, uint32_t date_t) -{ - MODIFY_REG(rtc->CAL, RTC_CAL_DATE_T_MSK, (date_t<CAL, RTC_CAL_DATE_T_MSK)>>RTC_CAL_DATE_T_POSS); -} -/** - * @brief Set Date Units Value - * @param rtc RTC Instance - * @param date_u Date units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_cal_date_u(RTC_TypeDef *rtc, uint32_t date_u) -{ - MODIFY_REG(rtc->CAL, RTC_CAL_DATE_U_MSK, (date_u<CAL, RTC_CAL_DATE_U_MSK)>>RTC_CAL_DATE_U_POSS); -} - -/** - * @brief Set Alarm Week Value - * @param rtc RTC Instance - * @param week Alarm Week value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_altime_week(RTC_TypeDef *rtc, uint32_t week) -{ - MODIFY_REG(rtc->ALTIME, RTC_ALTIME_WEEK_MSK, (week<ALTIME, RTC_ALTIME_WEEK_MSK)>>RTC_ALTIME_WEEK_POSS); -} -/** - * @brief Set Alarm Hour Tens Value - * @param rtc RTC Instance - * @param hour_t Alarm Hour tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_altime_hour_t(RTC_TypeDef *rtc, uint32_t hour_t) -{ - MODIFY_REG(rtc->ALTIME, RTC_ALTIME_HOUR_T_MSK, (hour_t<ALTIME, RTC_ALTIME_HOUR_T_MSK)>>RTC_ALTIME_HOUR_T_POSS); -} -/** - * @brief Set Alarm Hour Units Value - * @param rtc RTC Instance - * @param hour_u Alarm Hour units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_altime_hour_u(RTC_TypeDef *rtc, uint32_t hour_u) -{ - MODIFY_REG(rtc->ALTIME, RTC_ALTIME_HOUR_U_MSK, (hour_u<ALTIME, RTC_ALTIME_HOUR_U_MSK)>>RTC_ALTIME_HOUR_U_POSS); -} -/** - * @brief Set Alarm Minute Tens Value - * @param rtc RTC Instance - * @param min_t Alarm Minute tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_altime_min_t(RTC_TypeDef *rtc, uint32_t min_t) -{ - MODIFY_REG(rtc->ALTIME, RTC_ALTIME_MIN_T_MSK, (min_t<ALTIME, RTC_ALTIME_MIN_T_MSK)>>RTC_ALTIME_MIN_T_POSS); -} -/** - * @brief Set Alarm Minute Units Value - * @param rtc RTC Instance - * @param min_u Alarm Minute units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_altime_min_u(RTC_TypeDef *rtc, uint32_t min_u) -{ - MODIFY_REG(rtc->ALTIME, RTC_ALTIME_MIN_U_MSK, (min_u<ALTIME, RTC_ALTIME_MIN_U_MSK)>>RTC_ALTIME_MIN_U_POSS); -} -/** - * @brief Set Alarm Second Tens Value - * @param rtc RTC Instance - * @param sec_t Alarm Second tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_altime_sec_t(RTC_TypeDef *rtc, uint32_t sec_t) -{ - MODIFY_REG(rtc->ALTIME, RTC_ALTIME_SEC_T_MSK, (sec_t<ALTIME, RTC_ALTIME_SEC_T_MSK)>>RTC_ALTIME_SEC_T_POSS); -} -/** - * @brief Set Alarm Second Units Value - * @param rtc RTC Instance - * @param sec_u Alarm Second units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_altime_sec_u(RTC_TypeDef *rtc, uint32_t sec_u) -{ - MODIFY_REG(rtc->ALTIME, RTC_ALTIME_SEC_U_MSK, (sec_u<ALTIME, RTC_ALTIME_SEC_U_MSK)>>RTC_ALTIME_SEC_U_POSS); -} - -/** - * @brief Set Alarm Year Tens Value - * @param rtc RTC Instance - * @param year_t Alarm Year tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alcal_year_t(RTC_TypeDef *rtc, uint32_t year_t) -{ - MODIFY_REG(rtc->ALCAL, RTC_ALCAL_YEAR_T_MSK, (year_t<ALCAL, RTC_ALCAL_YEAR_T_MSK)>>RTC_ALCAL_YEAR_T_POSS); -} -/** - * @brief Set Alarm Year Units Value - * @param rtc RTC Instance - * @param year_u Alarm Year units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alcal_year_u(RTC_TypeDef *rtc, uint32_t year_u) -{ - MODIFY_REG(rtc->ALCAL, RTC_ALCAL_YEAR_U_MSK, (year_u<ALCAL, RTC_ALCAL_YEAR_U_MSK)>>RTC_ALCAL_YEAR_U_POSS); -} -/** - * @brief Set Alarm Month Tens Value - * @param rtc RTC Instance - * @param mon_t Alarm Month tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alcal_mon_t(RTC_TypeDef *rtc, uint32_t mon_t) -{ - MODIFY_REG(rtc->ALCAL, RTC_ALCAL_MON_T_MSK, (mon_t<ALCAL, RTC_ALCAL_MON_T_MSK)>>RTC_ALCAL_MON_T_POS); -} -/** - * @brief Set Alarm Month Units Value - * @param rtc RTC Instance - * @param mon_u Alarm Month units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alcal_mon_u(RTC_TypeDef *rtc, uint32_t mon_u) -{ - MODIFY_REG(rtc->ALCAL, RTC_ALCAL_MON_U_MSK, (mon_u<ALCAL, RTC_ALCAL_MON_U_MSK)>>RTC_ALCAL_MON_U_POSS); -} -/** - * @brief Set Alarm Date Tens Value - * @param rtc RTC Instance - * @param date_t Alarm Date tens value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alcal_date_t(RTC_TypeDef *rtc, uint32_t date_t) -{ - MODIFY_REG(rtc->ALCAL, RTC_ALCAL_DATE_T_MSK, (date_t<ALCAL, RTC_ALCAL_DATE_T_MSK)>>RTC_ALCAL_DATE_T_POSS); -} -/** - * @brief Set Alarm Date Units Value - * @param rtc RTC Instance - * @param date_u Alarm Date units value in RTC timer, in BCD format. - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alcal_date_u(RTC_TypeDef *rtc, uint32_t date_u) -{ - MODIFY_REG(rtc->ALCAL, RTC_ALCAL_DATE_U_MSK, (date_u<ALCAL, RTC_ALCAL_DATE_U_MSK)>>RTC_ALCAL_DATE_U_POSS); -} - -/** - * @brief Set Year Alarm Function Enable - * @param rtc RTC Instance - * @param year can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alen_year(RTC_TypeDef *rtc, uint32_t year) -{ - MODIFY_REG(rtc->ALEN, RTC_ALEN_YEAR_MSK, (year<ALEN, RTC_ALEN_YEAR_MSK)>>RTC_ALEN_YEAR_POS); -} -/** - * @brief Set Month Alarm Function Enable - * @param rtc RTC Instance - * @param month can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alen_month(RTC_TypeDef *rtc, uint32_t month) -{ - MODIFY_REG(rtc->ALEN, RTC_ALEN_MONTH_MSK, (month<ALEN, RTC_ALEN_MONTH_MSK)>>RTC_ALEN_MONTH_POS); -} -/** - * @brief Set Date Alarm Function Enable - * @param rtc RTC Instance - * @param date can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alen_date(RTC_TypeDef *rtc, uint32_t date) -{ - MODIFY_REG(rtc->ALEN, RTC_ALEN_DATE_MSK, (date<ALEN, RTC_ALEN_DATE_MSK)>>RTC_ALEN_DATE_POS); -} -/** - * @brief Set Week Alarm Function Enable - * @param rtc RTC Instance - * @param week can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alen_week(RTC_TypeDef *rtc, uint32_t week) -{ - MODIFY_REG(rtc->ALEN, RTC_ALEN_WEEK_MSK, (week<ALEN, RTC_ALEN_WEEK_MSK)>>RTC_ALEN_WEEK_POS); -} -/** - * @brief Set Hour Alarm Function Enable - * @param rtc RTC Instance - * @param hour can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alen_hour(RTC_TypeDef *rtc, uint32_t hour) -{ - MODIFY_REG(rtc->ALEN, RTC_ALEN_HOUR_MSK, (hour<ALEN, RTC_ALEN_HOUR_MSK)>>RTC_ALEN_HOUR_POS); -} -/** - * @brief Set Minute Alarm Function Enable - * @param rtc RTC Instance - * @param min can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alen_min(RTC_TypeDef *rtc, uint32_t min) -{ - MODIFY_REG(rtc->ALEN, RTC_ALEN_MIN_MSK, (min<ALEN, RTC_ALEN_MIN_MSK)>>RTC_ALEN_MIN_POS); -} -/** - * @brief Set Second Alarm Function Enable - * @param rtc RTC Instance - * @param sec can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_alen_sec(RTC_TypeDef *rtc, uint32_t sec) -{ - MODIFY_REG(rtc->ALEN, RTC_ALEN_SEC_MSK, (sec<ALEN, RTC_ALEN_SEC_MSK)>>RTC_ALEN_SEC_POS); -} - -/** - * @brief Set RTC Wakeup Counter Match Trigger Enable - * @param rtc RTC Instance - * @param wktm can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_wktm(RTC_TypeDef *rtc, uint32_t wktm) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_WKTM_MSK, (wktm<TRIG, RTC_TRIG_WKTM_MSK)>>RTC_TRIG_WKTM_POS); -} -/** - * @brief Set RTC 1 Hz Trigger Enable - * @param rtc RTC Instance - * @param f1hz can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_f1hz(RTC_TypeDef *rtc, uint32_t f1hz) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_F1HZ_MSK, (f1hz<TRIG, RTC_TRIG_F1HZ_MSK)>>RTC_TRIG_F1HZ_POS); -} -/** - * @brief Set RTC Year Roll Alarm Trigger Enable - * @param rtc RTC Instance - * @param ryear can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_ryear(RTC_TypeDef *rtc, uint32_t ryear) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_RYEAR_MSK, (ryear<TRIG, RTC_TRIG_RYEAR_MSK)>>RTC_TRIG_RYEAR_POS); -} -/** - * @brief Set RTC Month Roll Alarm Trigger Enable - * @param rtc RTC Instance - * @param rmon can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_rmon(RTC_TypeDef *rtc, uint32_t rmon) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_RMON_MSK, (rmon<TRIG, RTC_TRIG_RMON_MSK)>>RTC_TRIG_RMON_POS); -} -/** - * @brief Set RTC Date Roll Alarm Trigger Enable - * @param rtc RTC Instance - * @param rdate can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_rdate(RTC_TypeDef *rtc, uint32_t rdate) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_RDATE_MSK, (rdate<TRIG, RTC_TRIG_RDATE_MSK)>>RTC_TRIG_RDATE_POS); -} -/** - * @brief Set RTC Week Roll Alarm Trigger Enable - * @param rtc RTC Instance - * @param rweek can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_rweek(RTC_TypeDef *rtc, uint32_t rweek) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_RWEEK_MSK, (rweek<TRIG, RTC_TRIG_RWEEK_MSK)>>RTC_TRIG_RWEEK_POS); -} -/** - * @brief Set RTC Hour Roll Alarm Trigger Enable - * @param rtc RTC Instance - * @param rhour can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_rhour(RTC_TypeDef *rtc, uint32_t rhour) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_RHOUR_MSK, (rhour<TRIG, RTC_TRIG_RHOUR_MSK)>>RTC_TRIG_RHOUR_POS); -} -/** - * @brief Set RTC Minute Roll Alarm Trigger Enable - * @param rtc RTC Instance - * @param rmin can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_rmin(RTC_TypeDef *rtc, uint32_t rmin) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_RMIN_MSK, (rmin<TRIG, RTC_TRIG_RMIN_MSK)>>RTC_TRIG_RMIN_POS); -} -/** - * @brief Set RTC Second Roll Alarm Trigger Enable - * @param rtc RTC Instance - * @param rsec can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_rsec(RTC_TypeDef *rtc, uint32_t rsec) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_RSEC_MSK, (rsec<TRIG, RTC_TRIG_RSEC_MSK)>>RTC_TRIG_RSEC_POS); -} -/** - * @brief Set RTC Match All Alarm Trigger Enable - * @param rtc RTC Instance - * @param amall can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_amall(RTC_TypeDef *rtc, uint32_t amall) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_AMALL_MSK, (amall<TRIG, RTC_TRIG_AMALL_MSK)>>RTC_TRIG_AMALL_POS); -} -/** - * @brief Set RTC Match Year Alarm Trigger Enable - * @param rtc RTC Instance - * @param ayear can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_ayear(RTC_TypeDef *rtc, uint32_t ayear) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_AYEAR_MSK, (ayear<TRIG, RTC_TRIG_AYEAR_MSK)>>RTC_TRIG_AYEAR_POS); -} -/** - * @brief Set RTC Match Month Alarm Trigger Enable - * @param rtc RTC Instance - * @param amon can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_amon(RTC_TypeDef *rtc, uint32_t amon) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_AMON_MSK, (amon<TRIG, RTC_TRIG_AMON_MSK)>>RTC_TRIG_AMON_POS); -} -/** - * @brief Set RTC Match Date Alarm Trigger Enable - * @param rtc RTC Instance - * @param adate can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_adate(RTC_TypeDef *rtc, uint32_t adate) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_ADTAE_MSK, (adate<TRIG, RTC_TRIG_ADTAE_MSK)>>RTC_TRIG_ADTAE_POS); -} -/** - * @brief Set RTC Match Week Alarm Trigger Enable - * @param rtc RTC Instance - * @param aweek can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_aweek(RTC_TypeDef *rtc, uint32_t aweek) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_AWEEK_MSK, (aweek<TRIG, RTC_TRIG_AWEEK_MSK)>>RTC_TRIG_AWEEK_POS); -} -/** - * @brief Set RTC Match Hour Alarm Trigger Enable - * @param rtc RTC Instance - * @param ahour can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_ahour(RTC_TypeDef *rtc, uint32_t ahour) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_AHOUR_MSK, (ahour<TRIG, RTC_TRIG_AHOUR_MSK)>>RTC_TRIG_AHOUR_POS); -} -/** - * @brief Set RTC Match Minute Alarm Trigger Enable - * @param rtc RTC Instance - * @param amin can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_amin(RTC_TypeDef *rtc, uint32_t amin) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_AMIN_MSK, (amin<TRIG, RTC_TRIG_AMIN_MSK)>>RTC_TRIG_AMIN_POS); -} -/** - * @brief Set RTC Match Second Alarm Trigger Enable - * @param rtc RTC Instance - * @param asec can be one of the following values: - * @arg DISABLE - * @arg ENABLE - * @retval None - */ -__STATIC_INLINE void md_rtc_set_trig_asec(RTC_TypeDef *rtc, uint32_t asec) -{ - MODIFY_REG(rtc->TRIG, RTC_TRIG_ASEC_MSK, (asec<TRIG, RTC_TRIG_ASEC_MSK)>>RTC_TRIG_ASEC_POS); -} - -/** - * @brief Set RTC Wakeup Counter Match Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_wktm(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_WKTM_MSK); -} -/** - * @brief Set RTC 1 Hz Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_f1hz(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_F1HZ_MSK); -} -/** - * @brief Set RTC Year Roll Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_ryear(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_RYEAR_MSK); -} -/** - * @brief Set RTC Month Roll Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_rmon(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_RMON_MSK); -} -/** - * @brief Set RTC Date Roll Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_rdate(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_RDATE_MSK); -} -/** - * @brief Set RTC Week Roll Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_rweek(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_RWEEK_MSK); -} -/** - * @brief Set RTC Hour Roll Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_rhour(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_RHOUR_MSK); -} -/** - * @brief Set RTC Minute Roll Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_rmin(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_RMIN_MSK); -} -/** - * @brief Set RTC Second Roll Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_rsec(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_RSEC_MSK); -} -/** - * @brief Set RTC Match All Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_amall(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_AMALL_MSK); -} -/** - * @brief Set RTC Match Year Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_ayear(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_AYEAR_MSK); -} -/** - * @brief Set RTC Match Month Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_amon(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_AMON_MSK); -} -/** - * @brief Set RTC Match Date Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_adate(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_ADTAE_MSK); -} -/** - * @brief Set RTC Match Week Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_aweek(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_AWEEK_MSK); -} -/** - * @brief Set RTC Match Hour Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_ahour(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_AHOUR_MSK); -} -/** - * @brief Set RTC Match Minute Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_amin(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_AMIN_MSK); -} -/** - * @brief Set RTC Match Second Alarm Interrupt Enable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_ier_asec(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IER, RTC_IER_ASEC_MSK); -} - -/** - * @brief Set RTC Wakeup Counter Match Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_wktm(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_WKTM_MSK); -} -/** - * @brief Set RTC 1 Hz Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_f1hz(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_F1HZ_MSK); -} -/** - * @brief Set RTC Year Roll Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_ryear(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_RYEAR_MSK); -} -/** - * @brief Set RTC Month Roll Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_rmon(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_RMON_MSK); -} -/** - * @brief Set RTC Date Roll Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_rdate(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_RDATE_MSK); -} -/** - * @brief Set RTC Week Roll Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_rweek(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_RWEEK_MSK); -} -/** - * @brief Set RTC Hour Roll Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_rhour(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_RHOUR_MSK); -} -/** - * @brief Set RTC Minute Roll Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_rmin(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_RMIN_MSK); -} -/** - * @brief Set RTC Second Roll Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_rsec(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_RSEC_MSK); -} -/** - * @brief Set RTC Match All Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_amall(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_AMALL_MSK); -} -/** - * @brief Set RTC Match Year Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_ayear(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_AYEAR_MSK); -} -/** - * @brief Set RTC Match Month Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_amon(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_AMON_MSK); -} -/** - * @brief Set RTC Match Date Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_adate(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_ADTAE_MSK); -} -/** - * @brief Set RTC Match Week Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_aweek(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_AWEEK_MSK); -} -/** - * @brief Set RTC Match Hour Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_ahour(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_AHOUR_MSK); -} -/** - * @brief Set RTC Match Minute Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_amin(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_AMIN_MSK); -} -/** - * @brief Set RTC Match Second Alarm Interrupt Disable bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_enable_idr_asec(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->IDR, RTC_IDR_ASEC_MSK); -} - -/** - * @brief Get RTC Wakeup Counter Match Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_wktm(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_WKTM_MSK)>>RTC_IVS_WKTM_POS); -} -/** - * @brief Get RTC 1 Hz Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_f1hz(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_F1HZ_MSK)>>RTC_IVS_F1HZ_POS); -} -/** - * @brief Get RTC Year Roll Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_ryear(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_RYEAR_MSK)>>RTC_IVS_RYEAR_POS); -} -/** - * @brief Get RTC Month Roll Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_rmon(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_RMON_MSK)>>RTC_IVS_RMON_POS); -} -/** - * @brief Get RTC Date Roll Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_rdate(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_RDATE_MSK)>>RTC_IVS_RDATE_POS); -} -/** - * @brief Get RTC Week Roll Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_rweek(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_RWEEK_MSK)>>RTC_IVS_RWEEK_POS); -} -/** - * @brief Get RTC Hour Roll Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_rhour(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_RHOUR_MSK)>>RTC_IVS_RHOUR_POS); -} -/** - * @brief Get RTC Minute Roll Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_rmin(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_RMIN_MSK)>>RTC_IVS_RMIN_POS); -} -/** - * @brief Get RTC Second Roll Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_rsec(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_RSEC_MSK)>>RTC_IVS_RSEC_POS); -} -/** - * @brief Get RTC Match All Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_amall(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_AMALL_MSK)>>RTC_IVS_AMALL_POS); -} -/** - * @brief Get RTC Match Year Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_ayear(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_AYEAR_MSK)>>RTC_IVS_AYEAR_POS); -} -/** - * @brief Get RTC Match Month Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_amon(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_AMON_MSK)>>RTC_IVS_AMON_POS); -} -/** - * @brief Get RTC Match Date Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_adate(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_ADTAE_MSK)>>RTC_IVS_ADTAE_POS); -} -/** - * @brief Get RTC Match Week Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_aweek(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_AWEEK_MSK)>>RTC_IVS_AWEEK_POS); -} -/** - * @brief Get RTC Match Hour Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_ahour(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_AHOUR_MSK)>>RTC_IVS_AHOUR_POS); -} -/** - * @brief Get RTC Match Minute Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_amin(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_AMIN_MSK)>>RTC_IVS_AMIN_POS); -} -/** - * @brief Get RTC Match Second Alarm Interrupt Valid Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ivs_asec(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IVS, RTC_IVS_ASEC_MSK)>>RTC_IVS_ASEC_POS); -} - -/** - * @brief Get RTC Wakeup Counter Match Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_wktm(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_WKTM_MSK)>>RTC_RIF_WKTM_POS); -} -/** - * @brief Get RTC 1 Hz Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_f1hz(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_F1HZ_MSK)>>RTC_RIF_F1HZ_POS); -} -/** - * @brief Get RTC Year Roll Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_ryear(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_RYEAR_MSK)>>RTC_RIF_RYEAR_POS); -} -/** - * @brief Get RTC Month Roll Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_rmon(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_RMON_MSK)>>RTC_RIF_RMON_POS); -} -/** - * @brief Get RTC Date Roll Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_rdate(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_RDATE_MSK)>>RTC_RIF_RDATE_POS); -} -/** - * @brief Get RTC Week Roll Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_rweek(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_RWEEK_MSK)>>RTC_RIF_RWEEK_POS); -} -/** - * @brief Get RTC Hour Roll Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_rhour(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_RHOUR_MSK)>>RTC_RIF_RHOUR_POS); -} -/** - * @brief Get RTC Minute Roll Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_rmin(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_RMIN_MSK)>>RTC_RIF_RMIN_POS); -} -/** - * @brief Get RTC Second Roll Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_rsec(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_RSEC_MSK)>>RTC_RIF_RSEC_POS); -} -/** - * @brief Get RTC Match All Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_amall(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_AMALL_MSK)>>RTC_RIF_AMALL_POS); -} -/** - * @brief Get RTC Match Year Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_ayear(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_AYEAR_MSK)>>RTC_RIF_AYEAR_POS); -} -/** - * @brief Get RTC Match Month Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_amon(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_AMON_MSK)>>RTC_RIF_AMON_POS); -} -/** - * @brief Get RTC Match Date Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_adate(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_ADTAE_MSK)>>RTC_RIF_ADTAE_POS); -} -/** - * @brief Get RTC Match Week Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_aweek(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_AWEEK_MSK)>>RTC_RIF_AWEEK_POS); -} -/** - * @brief Get RTC Match Hour Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_ahour(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_AHOUR_MSK)>>RTC_RIF_AHOUR_POS); -} -/** - * @brief Get RTC Match Minute Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_amin(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_AMIN_MSK)>>RTC_RIF_AMIN_POS); -} -/** - * @brief Get RTC Match Second Alarm Raw Interrupt Flag Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_rif_asec(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->RIF, RTC_RIF_ASEC_MSK)>>RTC_RIF_ASEC_POS); -} - -/** - * @brief Get RTC Wakeup Counter Match Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_wktm(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_WKTM_MSK)>>RTC_IFM_WKTM_POS); -} -/** - * @brief Get RTC 1 Hz Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_f1hz(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_F1HZ_MSK)>>RTC_IFM_F1HZ_POS); -} -/** - * @brief Get RTC Year Roll Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_ryear(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_RYEAR_MSK)>>RTC_IFM_RYEAR_POS); -} -/** - * @brief Get RTC Month Roll Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_rmon(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_RMON_MSK)>>RTC_IFM_RMON_POS); -} -/** - * @brief Get RTC Date Roll Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_rdate(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_RDATE_MSK)>>RTC_IFM_RDATE_POS); -} -/** - * @brief Get RTC Week Roll Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_rweek(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_RWEEK_MSK)>>RTC_IFM_RWEEK_POS); -} -/** - * @brief Get RTC Hour Roll Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_rhour(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_RHOUR_MSK)>>RTC_IFM_RHOUR_POS); -} -/** - * @brief Get RTC Minute Roll Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_rmin(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_RMIN_MSK)>>RTC_IFM_RMIN_POS); -} -/** - * @brief Get RTC Second Roll Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_rsec(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_RSEC_MSK)>>RTC_IFM_RSEC_POS); -} -/** - * @brief Get RTC Match All Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_amall(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_AMALL_MSK)>>RTC_IFM_AMALL_POS); -} -/** - * @brief Get RTC Match Year Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_ayear(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_AYEAR_MSK)>>RTC_IFM_AYEAR_POS); -} -/** - * @brief Get RTC Match Month Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_amon(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_AMON_MSK)>>RTC_IFM_AMON_POS); -} -/** - * @brief Get RTC Match Date Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_adate(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_ADTAE_MSK)>>RTC_IFM_ADTAE_POS); -} -/** - * @brief Get RTC Match Week Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_aweek(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_AWEEK_MSK)>>RTC_IFM_AWEEK_POS); -} -/** - * @brief Get RTC Match Hour Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_ahour(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_AHOUR_MSK)>>RTC_IFM_AHOUR_POS); -} -/** - * @brief Get RTC Match Minute Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_amin(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_AMIN_MSK)>>RTC_IFM_AMIN_POS); -} -/** - * @brief Get RTC Match Second Alarm Interrupt Flag Masked Status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg DISABLE - * @arg ENABLE - */ -__STATIC_INLINE uint32_t md_rtc_get_ifm_asec(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->IFM, RTC_IFM_ASEC_MSK)>>RTC_IFM_ASEC_POS); -} - -/** - * @brief Set RTC Wakeup Counter Match Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_wktm(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_WKTM_MSK); -} -/** - * @brief Set RTC 1 Hz Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_f1hz(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_F1HZ_MSK); -} -/** - * @brief Set RTC Year Roll Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_ryear(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_RYEAR_MSK); -} -/** - * @brief Set RTC Month Roll Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_rmon(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_RMON_MSK); -} -/** - * @brief Set RTC Date Roll Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_rdate(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_RDATE_MSK); -} -/** - * @brief Set RTC Week Roll Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_rweek(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_RWEEK_MSK); -} -/** - * @brief Set RTC Hour Roll Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_rhour(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_RHOUR_MSK); -} -/** - * @brief Set RTC Minute Roll Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_rmin(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_RMIN_MSK); -} -/** - * @brief Set RTC Second Roll Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_rsec(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_RSEC_MSK); -} -/** - * @brief Set RTC Match All Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_amall(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_AMALL_MSK); -} -/** - * @brief Set RTC Match Year Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_ayear(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_AYEAR_MSK); -} -/** - * @brief Set RTC Match Month Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_amon(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_AMON_MSK); -} -/** - * @brief Set RTC Match Date Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_adate(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_ADTAE_MSK); -} -/** - * @brief Set RTC Match Week Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_aweek(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_AWEEK_MSK); -} -/** - * @brief Set RTC Match Hour Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_ahour(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_AHOUR_MSK); -} -/** - * @brief Set RTC Match Minute Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_amin(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_AMIN_MSK); -} -/** - * @brief Set RTC Match Second Alarm Interrupt Clear bit - * @param rtc RTC Instance - * @retval None - */ -__STATIC_INLINE void md_rtc_clear_icr_asec(RTC_TypeDef *rtc) -{ - SET_BIT(rtc->ICR, RTC_ICR_ASEC_MSK); -} - -/** - * @brief Get RTC Calendar Synchronization status bit - * @param rtc RTC Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_RTC_STAT_SYNDONE_UNDER - * @arg @ref MD_RTC_STAT_SYNDONE_CMP - */ -__STATIC_INLINE uint32_t md_rtc_get_stat_syndone(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->STAT, RTC_STAT_SYNDONE_MSK)>>RTC_STAT_SYNDONE_POS); -} -/** - * @brief Get RTC Calendar Status bit - * @param rtc RTC Instance - * @retval State of bit (1 or 0). - * @note 0 = RTC calendar is not empty - * 1 = RTC calendar is empty - */ -__STATIC_INLINE uint32_t md_rtc_get_stat_empty(RTC_TypeDef *rtc) -{ - return (READ_BIT(rtc->STAT, RTC_STAT_EMPTY_MSK)>>RTC_STAT_EMPTY_POS); -} - -/** - * @brief Set Read RTC Backup Register Enable bit - * @param rtc RTC Instance - * @param bken can be one of the following values: - * @arg @ref MD_RTC_BKEN_BKEN_CONTROL - * @arg @ref MD_RTC_BKEN_BKEN_BACKUP - * @retval None - */ -__STATIC_INLINE void md_rtc_set_bken_bken(RTC_TypeDef *rtc, uint32_t bken) -{ - MODIFY_REG(rtc->BKEN, RTC_BKEN_BKEN_MSK, (bken<BKEN, RTC_BKEN_BKEN_MSK)>>RTC_BKEN_BKEN_POS); -} - -/** - * @} MD_RTC_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_RTC_Public_Functions RTC Public Functions - * @{ - */ - -/** @defgroup MD_RTC_PF_Basic_Configuration Basic Configuration - * @{ - */ - -/** - * @} MD_RTC_PF_Basic_Configuration - */ - -/** @defgroup MD_RTC_PF_Data_Access Data Access - * @{ - */ - -/** - * @} MD_RTC_PF_Data_Access - */ - -/** @defgroup MD_RTC_PF_Init Initialization and de-initialization functions - * @{ - */ - -/** - * @} MD_RTC_PF_Init - */ - -/** - * @} MD_RTC_Public_Functions - */ - -#endif - -/** - * @} RTC - */ - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} - -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_spi.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_spi.h deleted file mode 100644 index 74f01e6312..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_spi.h +++ /dev/null @@ -1,2523 +0,0 @@ -/** - ****************************************************************************** - * @file md_spi.h - * @brief ES32F0271 SPI Head File. - * - * @version V1.00.01 - * @date 06/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_SPI_H__ -#define __MD_SPI_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_spi.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (SPI1) || defined (SPI2) - -/** @defgroup SPI SPI - * @brief SPI micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_SPI_Public_Types SPI Public Types - * @{ - */ - -/** @defgroup MD_SPI_PT_INIT SPI Public Init structure - * @{ - */ - -/** - * @brief SPI Init structure. - */ -typedef struct -{ - uint32_t Mode; /*!< Specifies the SPI mode (Master/Slave). - This parameter can be a value of @ref MD_SPI_PC_MODE. - - This feature can be modified afterwards using unitary function @ref md_spi_set_con1_mstren().*/ - - uint32_t ClockPhase; /*!< Specifies the clock active edge for the bit capture. - This parameter can be a value of @ref MD_SPI_PC_PHASE. - - This feature can be modified afterwards using unitary function @ref md_spi_set_con1_cpha().*/ - - uint32_t ClockPolarity; /*!< Specifies the serial clock steady state. - This parameter can be a value of @ref MD_SPI_PC_POLARITY. - - This feature can be modified afterwards using unitary function @ref md_spi_get_con1_cpol().*/ - - uint32_t BaudRate; /*!< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock. - This parameter can be a value of @ref MD_SPI_PC_BAUDRATEPRESCALER. - @note The communication clock is derived from the master clock. The slave clock does not need to be set. - - This feature can be modified afterwards using unitary function @ref md_spi_set_con1_baud().*/ - - uint32_t BitOrder; /*!< Specifies whether data transfers start from MSB or LSB bit. - This parameter can be a value of @ref MD_SPI_PC_BIT_ORDER. - - This feature can be modified afterwards using unitary function @ref md_spi_set_con1_lsbfirst().*/ - - uint32_t TransferDirection; /*!< Specifies the SPI unidirectional or bidirectional data mode. - This parameter can be a value of @ref MD_SPI_PC_TRANSFER_DIRECTION. - - This feature can be modified afterwards using unitary function @ref md_spi_set_con1_bidimode().*/ - - uint32_t DataWidth; /*!< Specifies the SPI data width. - This parameter can be a value of @ref MD_SPI_PC_FRAME_FORMAT. - - This feature can be modified afterwards using unitary function @ref md_spi_set_con1_dlen().*/ - - uint32_t NSS; /*!< Specifies whether the NSS signal is managed by hardware (NSS pin) or by software using the SSI bit. - This parameter can be a value of @ref MD_SPI_PC_NSS_MODE. - - This feature can be modified afterwards using unitary function @ref md_spi_set_con1_ssout().*/ - - uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not. - This parameter can be a value of @ref MD_SPI_EC_CRC_CALCULATION. - - This feature can be modified afterwards using unitary functions @ref md_spi_enable_con1_crcen() and @ref md_spi_disable_con1_crcen().*/ - - uint32_t CRCPoly; /*!< Specifies the polynomial used for the CRC calculation. - This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF. - - This feature can be modified afterwards using unitary function.*/ - -} md_spi_inittypedef; - - - - -/** - * @} MD_SPI_PT_INIT - */ - -/** - * @} MD_SPI_Public_Types - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_SPI_Public_Constants SPI Public Constants - * @{ - */ - -/** @defgroup MD_SPI_PC_MODE SPI Operation Mode - * @{ - */ -#define MD_SPI_MODE_SLAVE 0x00000000U /*!< Slave configuration */ -#define MD_SPI_MODE_MASTER (SPI_CON1_MSTREN_MSK) /*!< Master configuration */ -/** - * @} MD_SPI_PC_MODE - */ - -/** @defgroup MD_SPI_PC_PROTOCOL SPI Serial Protocol - * @{ - */ -#define MD_SPI_PROTOCOL_MOTOROLA 0x00000000U /*!< Motorola mode. Used as default value */ -#define MD_SPI_PROTOCOL_TI (SPI_CON2_FRF_MSK) /*!< TI mode */ -/** - * @} MD_SPI_PC_PROTOCOL - */ - -/** @defgroup MD_SPI_PC_PHASE SPI Clock Phase - * @{ - */ -#define MD_SPI_PHASE_1EDGE 0x00000000U /*!< First clock transition is the first data capture edge */ -#define MD_SPI_PHASE_2EDGE (SPI_CON1_CPHA_MSK) /*!< Second clock transition is the first data capture edge */ -/** - * @} MD_SPI_PC_PHASE - */ - -/** @defgroup MD_SPI_PC_POLARITY SPI Clock Polarity - * @{ - */ -#define MD_SPI_POLARITY_LOW 0x00000000U /*!< Clock to 0 when idle */ -#define MD_SPI_POLARITY_HIGH (SPI_CON1_CPOL_MSK) /*!< Clock to 1 when idle */ -/** - * @} MD_SPI_PC_POLARITY - */ - -/** @defgroup MD_SPI_PC_BAUDRATEPRESCALER SPI Baud Rate Prescaler - * @{ - */ -#define MD_SPI_BAUDRATEPRESCALER_DIV2 0x00000000U /*!< BaudRate control equal to fPCLK/2 */ -#define MD_SPI_BAUDRATEPRESCALER_DIV4 (0x1U<CON1, value); -} - -/** - * @brief Get SPI control register (SPIx_CON1) - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_con1(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->CON1)); -} - -/** - - * @brief Set SPI clock phase - * @note This bit should not be changed when communication is ongoing. \n - This bit is not used in SPI TI mode. - * @param SPIx SPI Instance - * @param ClockPhase This parameter can be one of the following values: - * @arg @ref MD_SPI_PHASE_1EDGE - * @arg @ref MD_SPI_PHASE_2EDGE - * @retval None - - */ -__STATIC_INLINE void md_spi_set_con1_cpha(SPI_TypeDef *SPIx, uint32_t ClockPhase) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_CPHA_MSK, ClockPhase); -} - -/** - * @brief Get SPI clock phase - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_SPI_PHASE_1EDGE - * @arg @ref MD_SPI_PHASE_2EDGE - */ -__STATIC_INLINE uint32_t md_spi_get_con1_cpha(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_CPHA_MSK)>>SPI_CON1_CPHA_POS); -} - -/** - * @brief Set SPI clock polarity - * @note This bit should not be changed when communication is ongoing. - * This bit is not used in SPI TI mode. - * @param SPIx SPI Instance - * @param ClockPolarity This parameter can be one of the following values: - * @arg @ref MD_SPI_POLARITY_LOW - * @arg @ref MD_SPI_POLARITY_HIGH - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_cpol(SPI_TypeDef *SPIx, uint32_t ClockPolarity) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_CPOL_MSK, ClockPolarity); -} - -/** - * @brief Get SPI clock polarity - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_SPI_POLARITY_LOW - * @arg @ref MD_SPI_POLARITY_HIGH - */ -__STATIC_INLINE uint32_t md_spi_get_con1_cpol(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_CPOL_MSK)>>SPI_CON1_CPOL_POS); -} - -/** - * @brief Set SPI master selection - * @note This bit should not be changed when communication is ongoing. - * @param SPIx SPI Instance - * @param Mode This parameter can be one of the following values: - * @arg @ref MD_SPI_MODE_MASTER - * @arg @ref MD_SPI_MODE_SLAVE - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_mstren(SPI_TypeDef *SPIx, uint32_t Mode) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_MSTREN_MSK, Mode); -} - -/** - * @brief Get SPI SPI operation mode (Master or Slave) - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_SPI_MODE_MASTER - * @arg @ref MD_SPI_MODE_SLAVE - */ -__STATIC_INLINE uint32_t md_spi_get_con1_mstren(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_MSTREN_MSK )>>SPI_CON1_MSTREN_POS); -} - -/** - * @brief Set SPI baud rate control - * @note These bits should not be changed when communication is ongoing. SPI BaudRate = fPCLK/Prescaler. - * @param SPIx SPI Instance - * @param BaudRate This parameter can be one of the following values: - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV2 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV4 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV8 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV16 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV32 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV64 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV128 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV256 - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_baud(SPI_TypeDef *SPIx, uint32_t BaudRate) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_BAUD_MSK, BaudRate); -} - -/** - * @brief Get SPI baud rate prescaler - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV2 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV4 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV8 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV16 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV32 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV64 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV128 - * @arg @ref MD_SPI_BAUDRATEPRESCALER_DIV256 - */ -__STATIC_INLINE uint32_t md_spi_get_con1_baud(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_BAUD_MSK)>>SPI_CON1_BAUD_POSS); -} - -/** - * @brief Enable SPI peripheral - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con1_spien(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON1, SPI_CON1_SPIEN_MSK); -} - -/** - * @brief Disable SPI peripheral - * @note When disabling the SPI, follow the procedure described in the Reference Manual. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con1_spien(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON1, SPI_CON1_SPIEN_MSK); -} - -/** - * @brief Check if SPI peripheral is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enable_con1_spien(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON1, SPI_CON1_SPIEN_MSK) == (SPI_CON1_SPIEN_MSK)); -} - -/** - * @brief Set SPI frame format - * @note This bit should not be changed when communication is ongoing. This bit is not used in SPI TI mode. - * @param SPIx SPI Instance - * @param BitOrder This parameter can be one of the following values: - * @arg @ref MD_SPI_LSB_FIRST - * @arg @ref MD_SPI_MSB_FIRST - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_lsbfirst(SPI_TypeDef *SPIx, uint32_t BitOrder) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_LSBFST_MSK, BitOrder); -} - -/** - * @brief Get SPI transfer bit order - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_SPI_LSB_FIRST - * @arg @ref MD_SPI_MSB_FIRST - */ -__STATIC_INLINE uint32_t md_spi_get_con1_lsbfirst(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_LSBFST_MSK)>>SPI_CON1_LSBFST_POS); -} - -/** - * @brief Set SPI Internal slave select - * @note This bit has an effect only when the SSEN bit is set. The value of this bit is forced onto the NSS pin. - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg BIT_SET - * @arg BIT_RESET - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_ssout(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_SSOUT_MSK , value); -} - -/** - * @brief Get SPI Internal slave select - * @param SPIx SPI Instance - * @retval State of 1 or 0 - */ -__STATIC_INLINE uint32_t md_spi_get_con1_ssout(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_SSOUT_MSK)>>SPI_CON1_SSOUT_POS); -} - -/** - * @brief Enable SPI software slave management - * @note When the SSEN bit is set, the NSS pin input is replaced with the value from the SSOUT bit. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con1_ssen(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON1, SPI_CON1_SSEN_MSK); -} - -/** - * @brief Disable SPI software slave management - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con1_ssen(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON1, SPI_CON1_SSEN_MSK); -} - -/** - * @brief Check if SPI peripheral is software slave management - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enable_con1_ssen(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON1, SPI_CON1_SSEN_MSK) == (SPI_CON1_SSEN_MSK)); -} - -/** - * @brief Set SPI receive only mode enable - * @note This bit enables simplex communication using a single unidirectional line to receive data exclusively. \n - Keep BIDEN bit clear when receive only mode is active.This bit is also useful in a multislave system \n - in which this particular slave is not accessed, the output from the accessed slave is not corrupted. - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg BIT_SET - * @arg BIT_RESET - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_rxo(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_RXO_MSK , value); -} - -/** - * @brief Set SPI receive only mode enable - * @param SPIx SPI Instance - * @retval State of 1 or 0 - */ -__STATIC_INLINE uint32_t md_spi_get_con1_rxo(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_RXO_MSK)>>SPI_CON1_RXO_POS); -} - -/** - * @brief Set data frame format - * @param SPIx SPI Instance - * @param DataWidth This parameter can be one of the following values: - * @arg @ref MD_SPI_FRAME_FORMAT_8BIT - * @arg @ref MD_SPI_FRAME_FORMAT_16BIT - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_flen(SPI_TypeDef *SPIx, uint32_t DataWidth) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_FLEN_MSK, DataWidth); -} - -/** - * @brief Get data frame format - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_SPI_FRAME_FORMAT_8BIT - * @arg @ref MD_SPI_FRAME_FORMAT_16BIT - */ -__STATIC_INLINE uint32_t md_spi_get_con1_flen(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_FLEN_MSK)>>SPI_CON1_FLEN_POS); -} - -/** - * @brief Set CRCNext to transfer CRC on the line - * @note This bit has to be written as soon as the last data is written in the SPIx_DATA register. - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg BIT_SET - * @arg BIT_RESET - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_crcnext(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_NXTCRC_MSK, value); -} - -/** - * @brief Get CRCNext to transfer CRC on the line - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval State of 1 or 0 - */ -__STATIC_INLINE uint32_t md_spi_get_con1_crcnext(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_NXTCRC_MSK)>>SPI_CON1_NXTCRC_POS); -} - -/** - * @brief Enable SPI hardware CRC calculation - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con1_crcen(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON1, SPI_CON1_CRCEN_MSK); -} - -/** - * @brief Disable SPI hardware CRC calculation - * @note When disabling the SPI, follow the procedure described in the Reference Manual. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con1_crcen(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON1, SPI_CON1_CRCEN_MSK); -} - -/** - * @brief Check if hardware CRC calculation is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enable_con1_crcen(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON1, SPI_CON1_CRCEN_MSK) == (SPI_CON1_CRCEN_MSK)); -} - -/** - * @brief Enable SPI Output enable in bidirectional mode - * @note Output enable in bidirectional mode. This bit combined with the BIDEN bit selects the direction of \n - transfer in bidirectional mode - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con1_bidoen(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON1, SPI_CON1_BIDOEN_MSK); -} - -/** - * @brief Disable Output enable in bidirectional mode - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con1_bidoen(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON1, SPI_CON1_BIDOEN_MSK); -} - -/** - * @brief Check if Output enable in bidirectional mode is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enable_con1_bidoen(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON1, SPI_CON1_BIDOEN_MSK) == (SPI_CON1_BIDOEN_MSK)); -} - -/** - * @brief Set Bidirectional data mode enable - * @note Bidirectional data mode enable. This bit enables half-duplex communication using common single bidirectional \n - data line. Keep RXO bit clear when bidirectional mode is active. - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_SPI_FULL_DUPLEX - * @arg @ref MD_SPI_HALF_DUPLEX - * @retval None - */ -__STATIC_INLINE void md_spi_set_con1_bidimode(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->CON1, SPI_CON1_BIDEN_MSK, value); -} - -/** - * @brief Get Bidirectional data mode enable - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow: - * @arg @ref MD_SPI_FULL_DUPLEX - * @arg @ref MD_SPI_HALF_DUPLEX - */ -__STATIC_INLINE uint32_t md_spi_get_con1_bidimode(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON1, SPI_CON1_BIDEN_MSK)>>SPI_CON1_BIDEN_POS); -} - - -/** - * @} MD_SPI_CON1 - */ - - - -/** @defgroup MD_SPI_CON2 SPI Control Register 2 - * @{ - */ - -/** - * @brief Set SPI control register 2 (SPIx_CON2) - * @param SPIx SPI Instance - * @param value The value write in SPIx_CON2 - * @retval None - */ -__STATIC_INLINE void md_spi_set_con2(SPI_TypeDef *SPIx, uint32_t value) -{ - WRITE_REG(SPIx->CON2, value); -} - -/** - * @brief Get SPI control register 2(SPIx_CON2) - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_con2(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->CON2)); -} - - -/** - * @brief Enable Rx buffer DMA - * @note When this bit is set, a DMA request is generated whenever the RXTH flag is set. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con2_rxdmaen(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON2, SPI_CON2_RXDMA_MSK); -} - -/** - * @brief Disable Rx buffer DMA - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con2_rxdmaen(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON2, SPI_CON2_RXDMA_MSK); -} - -/** - * @brief Check if Rx buffer DMA is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_con2_rxdmaen(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON2, SPI_CON2_RXDMA_MSK) == (SPI_CON2_RXDMA_MSK)); -} - -/** - * @brief Enable Tx buffer DMA enable - * @note When this bit is set, a DMA request is generated whenever the TXTH flag is set. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con2_txdmaen(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON2, SPI_CON2_TXDMA_MSK); -} - -/** - * @brief Disable Tx buffer DMA enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con2_txdmaen(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON2, SPI_CON2_TXDMA_MSK); -} - -/** - * @brief Check if Tx buffer DMA enable is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_con2_txdmaen(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON2, SPI_CON2_TXDMA_MSK) == (SPI_CON2_TXDMA_MSK)); -} - -/** - * @brief Enable SS output enable - * @note SS output is enabled in master mode and when the SPI interface is enabled. The SPI interface cannot \n - work in a multimaster environment. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con2_ssoe(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON2, SPI_CON2_NSSOE_MSK); -} - -/** - * @brief Disable SS output enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con2_ssoe(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON2, SPI_CON2_NSSOE_MSK); -} - -/** - * @brief Check if SS output enable is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_con2_ssoe(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON2, SPI_CON2_NSSOE_MSK) == (SPI_CON2_NSSOE_MSK)); -} - -/** - * @brief Enable NSS pulse management - * @note This bit is used in master mode only. It allow the SPI to generate an NSS pulse between two consecutive \n - data when doing continuous transfers. In the case of a single data transfer, it forces the NSS pin high \n - level after the transfer. It has no meaning if CPHA = ’1’, or FRF = ’1’.This bit should not be changed \n - when communication is ongoing. This bit is not used in SPI TI mode. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_con2_nssp(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->CON2, SPI_CON2_NSSP_MSK); -} - -/** - * @brief Disable NSS pulse management - * @note This bit should not be changed when communication is ongoing. This bit is not used in SPI TI mode. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_con2_nssp(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->CON2, SPI_CON2_NSSP_MSK); -} - -/** - * @brief Check if NSS pulse is enabled - * @note This bit should not be changed when communication is ongoing. This bit is not used in SPI TI mode. - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_con2_nssp(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->CON2, SPI_CON2_NSSP_MSK) == (SPI_CON2_NSSP_MSK)); -} - -/** - * @brief Set frame format - * @note This bit should be written only when SPI is disabled (SPE = 0) for correct operation. - * @param SPIx SPI Instance - * @param Standard This parameter can be one of the following values: - * @arg @ref MD_SPI_PROTOCOL_MOTOROLA - * @arg @ref MD_SPI_PROTOCOL_TI - * @retval None - */ -__STATIC_INLINE void md_spi_set_con2_frf(SPI_TypeDef *SPIx, uint32_t Standard) -{ - MODIFY_REG(SPIx->CON2, SPI_CON2_FRF_MSK, Standard); -} - -/** - * @brief Get frame format - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_SPI_PROTOCOL_MOTOROLA - * @arg @ref MD_SPI_PROTOCOL_TI - */ -__STATIC_INLINE uint32_t md_spi_get_con2_frf(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON2, SPI_CON2_FRF_MSK)>>SPI_CON2_FRF_POS); -} - - -/** - * @brief Set transmit FIFO trigger threshold - * @note This is used to select the threshold level in the transmit FIFO at which the Transmit FIFO \n - trigger threshold flag is generated. - * @param SPIx SPI Instance - * @param Threshold This parameter can be one of the following values: - * @arg @ref MD_SPI_TX_FIFO_TH_0BIT - * @arg @ref MD_SPI_TX_FIFO_TH_2BIT - * @arg @ref MD_SPI_TX_FIFO_TH_4BIT - * @arg @ref MD_SPI_TX_FIFO_TH_8BIT - * @retval None - */ -__STATIC_INLINE void md_spi_set_con2_txfth(SPI_TypeDef *SPIx, uint32_t Threshold) -{ - MODIFY_REG(SPIx->CON2, SPI_CON2_TXFTH_MSK, Threshold<CON2, SPI_CON2_TXFTH_MSK)>>SPI_CON2_TXFTH_POSS); -} - -/** - * @brief Set receive FIFO trigger threshold - * @note This is used to select the threshold level in the receiver FIFO at which the Receive FIFO \n - trigger threshold flag is generated. - * @param SPIx SPI Instance - * @param Threshold This parameter can be one of the following values: - * @arg @ref MD_SPI_RX_FIFO_TH_1BIT - * @arg @ref MD_SPI_RX_FIFO_TH_4BIT - * @arg @ref MD_SPI_RX_FIFO_TH_8BIT - * @arg @ref MD_SPI_RX_FIFO_TH_14BIT - * @retval None - */ -__STATIC_INLINE void md_spi_set_con2_rxfth(SPI_TypeDef *SPIx, uint32_t Threshold) -{ - MODIFY_REG(SPIx->CON2, SPI_CON2_RXFTH_MSK, Threshold<CON2, SPI_CON2_RXFTH_MSK)>>SPI_CON2_RXFTH_POSS); -} - - -/** - * @} MD_SPI_CON2 - */ - -/** - * @defgroup MD_SPI_STAT SPI Status Register - * @{ - */ - - -/** - * @brief Get SPI status register(SPIx_STAT) - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_stat(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->STAT)); -} - -/** - * @brief Check if SPI transmit buffer empty is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_txe(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_TXE_MSK)== (SPI_STAT_TXE_MSK)); -} - -/** - * @brief Check if SPI transmit buffer full is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_txf(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_TXF_MSK)== (SPI_STAT_TXF_MSK)); -} - -/** - * @brief Check if SPI transmit buffer overflow is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_txov(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_TXOV_MSK)== (SPI_STAT_TXOV_MSK)); -} - -/** - * @brief Check if SPI transmit buffer underflow is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_txud(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_TXUD_MSK) == (SPI_STAT_TXUD_MSK)); -} - -/** - * @brief Check if SPI Tx FIFO level under threshold is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_txth(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_TXTH_MSK) == (SPI_STAT_TXTH_MSK)); -} - -/** - * @brief Check if SPI receive buffer empty is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_rxe(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_RXE_MSK) == (SPI_STAT_RXE_MSK)); -} - -/** - * @brief Check if SPI receive buffer full is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_rxf(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_RXF_MSK)== (SPI_STAT_RXF_MSK)); -} - -/** - * @brief Get SPI receive buffer overflow - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_rxov(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->CON2, SPI_STAT_RXOV_MSK)== (SPI_STAT_RXOV_MSK)); -} - -/** - * @brief Check if SPI receive buffer underflow is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_rxud(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_RXUD_MSK)== (SPI_STAT_RXUD_MSK)); -} - -/** - * @brief Check if SPI Rx FIFO level over threshold is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_rxth(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_RXTH_MSK)== (SPI_STAT_RXTH_MSK)); -} - -/** - * @brief Check if SPI channel side is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_chside(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_CHSIDE_MSK)== (SPI_STAT_CHSIDE_MSK)); -} - -/** - * @brief Check if SPI busy flag is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_stat_busy(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_BUSY_MSK)== (SPI_STAT_BUSY_MSK)); -} - -/** - * @brief Get SPI Tx FIFO level - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_stat_txflv(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_TXFLV_MSK) >> SPI_STAT_TXFLV_POSS); -} - -/** - * @brief Get SPI Rx FIFO level - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_stat_rxflv(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->STAT, SPI_STAT_RXFLV_MSK) >> SPI_STAT_RXFLV_POSS); -} - -/** - * @} MD_SPI_STAT - */ - - -/** @defgroup MD_SPI_DATA SPI Data Register - * @{ - */ - -/** - * @brief Read 8-Bits in the data register - * @param SPIx SPI Instance - * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFF - */ -__STATIC_INLINE uint8_t md_spi_recv_data8(SPI_TypeDef *SPIx) -{ - return (uint8_t)(READ_REG(SPIx->DATA)); -} - -/** - * @brief Read 16-Bits in the data register - * @param SPIx SPI Instance - * @retval RxData Value between Min_Data=0x00 and Max_Data=0xFFFF - */ -__STATIC_INLINE uint16_t md_spi_recv_data16(SPI_TypeDef *SPIx) -{ - return (uint16_t)(READ_REG(SPIx->DATA)); -} - -/** - * @brief Write 8-Bits in the data register - * @param SPIx SPI Instance - * @param TxData Value between Min_Data=0x00 and Max_Data=0xFF - * @retval None - */ -__STATIC_INLINE void md_spi_send_data8(SPI_TypeDef *SPIx, uint8_t TxData) -{ - SPIx->DATA = (uint8_t)TxData; -} - -/** - * @brief Write 16-Bits in the data register - * @param SPIx SPI Instance - * @param TxData Value between Min_Data=0x0000 and Max_Data=0xFFFF - * @retval None - */ -__STATIC_INLINE void md_spi_send_data16(SPI_TypeDef *SPIx, uint16_t TxData) -{ - SPIx->DATA = (uint16_t)TxData; -} - -/** - * @} MD_SPI_DATA - */ - -/** @defgroup MD_SPI_CRC SPI CRC Manangement - * @{ MD_SPI_CRC - */ - -/** - * @brief Set CRC polynmomial register (SPIx_CRCPLOY) - * @note When CRC calculation is enabled, the RxCRC[15:0] bits contain the computed CRC value of the subsequently \n - received bytes. This register is reset when the CRCEN bit in SPIx_CR1 register is written to 1. The CRC is \n - calculated serially using the polynomial programmed in the SPIx_CRCPLOY register. Only the 8 LSB bits are \n - considered when the CRC frame format is set to be 8-bit length (CRCL bit in the SPIx_CON1 is cleared). CRC \n - calculation is done based on any CRC8 standard. The entire 16-bits of this register are considered when a \n - 16-bit CRC frame format is selected (CRCL bit in the SPIx_CR1 register is set). CRC calculation is done based \n - on any CRC16 standard. - Note: A read to this register when the BSY Flag is set could return an incorrect value. These bits are not \n - used in I2S mode. - * @param SPIx SPI Instance - * @param CRCPoly This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFFF - * @retval None - */ -__STATIC_INLINE void md_spi_set_crcploy(SPI_TypeDef *SPIx, uint32_t CRCPoly) -{ - WRITE_REG(SPIx->CRCPOLY, (uint16_t)CRCPoly); -} - -/** - * @brief Get CRC polynmomial register (SPIx_CRCPLOY) - * @param SPIx SPI Instance - * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF - */ -__STATIC_INLINE uint32_t md_spi_get_crcploy(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->CRCPOLY)); -} - -/** - * @brief Get Rx CRC register - * @note When CRC calculation is enabled, the RxCRC[7:0] bits contain the computed CRC value of the subsequently \n - transmitted bytes. This register is reset when the CRCEN bit of SPIx_CON1 is written to 1. The CRC is calculated \n - serially using the polynomial programmed in the SPIx_CRCPLOY register. Only the 8 LSB bits are considered \n - when the CRC frame format is set to be 8-bit length (FLEN bit in the SPIx_CON1 is cleared). CRC calculation is \n - done based on any CRC8 standard. The entire 16-bits of this register are considered when a 16-bit CRC frame \n - format is selected (CRCL bit in the SPIx_CR1 register is set). CRC calculation is done based on any CRC16 standard. \n - Note: A read to this register when the BSY flag is set could return an incorrect value. These bits are not used \n - in I2S mode. - * @param SPIx SPI Instance - * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF - */ -__STATIC_INLINE uint32_t md_spi_get_rxcrc(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->RXCRC)); -} - -/** - * @brief Get Tx CRC register - * @note When CRC calculation is enabled, the TxCRC[7:0] bits contain the computed CRC value of the subsequently \n - transmitted bytes. This register is reset when the CRCEN bit of SPIx_CON1 is written to 1. The CRC is calculated \n - serially using the polynomial programmed in the SPIx_CRCPLOY register. Only the 8 LSB bits are considered \n - when the CRC frame format is set to be 8-bit length (FLEN bit in the SPIx_CR1 is cleared). CRC calculation is \n - done based on any CRC8 standard. The entire 16-bits of this register are considered when a 16-bit CRC frame \n - format is selected (CRCL bit in the SPIx_CR1 register is set). CRC calculation is done based on any CRC16 standard. \n - Note: A read to this register when the BSY flag is set could return an incorrect value. These bits are not used \n - in I2S mode. - * @param SPIx SPI Instance - * @retval Returned value is a number between Min_Data = 0x00 and Max_Data = 0xFFFF - */ -__STATIC_INLINE uint32_t md_spi_get_txcrc(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->TXCRC)); -} - -/** - * @} MD_SPI_CRC - */ - - - -/** @defgroup MD_SPI_I2S I2S Configuration Management - * @{ - */ - - -/** @defgroup MD_SPI_I2SCFG I2S Configuration register - * @{ - */ - -/** - * @brief Set SPI I2S configuration register(SPIx_I2SCFG) - * @param SPIx SPI Instance - * @param value The value write in SPIx_I2SCFG - * @retval None - */ -__STATIC_INLINE void md_spi_set_I2SCFG(SPI_TypeDef *SPIx, uint32_t value) -{ - WRITE_REG(SPIx->I2SCFG, value); -} - -/** - * @brief Get SPI I2S configuration register (SPIx_I2SCFG) - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_I2SCFG(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->I2SCFG)); -} - -/** - * @brief Set channel legth(number of bits per audio channel) - * @note The bit write operation has a meaning only if DATLEN = 00 otherwise the channel length is fixed to 32-bit by \n - hardware whatever the value filled in. - Note: For correct operation, this bit should be configured when the I2S is disabled. It is not used in SPI mode. - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_I2S_CHANNEL_LENGTH_16BIT - * @arg @ref MD_I2S_CHANNEL_LENGTH_32BIT - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2scfg_chlen(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SCFG, SPI_I2SCFG_CHLEN_MSK, value); -} - -/** - * @brief Get channel legth(number of bits per audio channel) - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return: - * @arg @ref MD_I2S_CHANNEL_LENGTH_16BIT - * @arg @ref MD_I2S_CHANNEL_LENGTH_32BIT - */ -__STATIC_INLINE uint32_t md_spi_get_i2scfg_chlen(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_CHLEN_MSK)); -} - -/** - * @brief Set Data length to be transferred - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_I2S_DATA_LENGTH_16BIT - * @arg @ref MD_I2S_DATA_LENGTH_24BIT - * @arg @ref MD_I2S_DATA_LENGTH_32BIT - * @arg @ref MD_I2S_DATA_LENGTH_NOT_ALLOWED - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2scfg_datlen(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SCFG, SPI_I2SCFG_DATLEN_MSK, value); -} - -/** - * @brief Get Data length to be transferred - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @arg @ref MD_I2S_DATA_LENGTH_16BIT - * @arg @ref MD_I2S_DATA_LENGTH_24BIT - * @arg @ref MD_I2S_DATA_LENGTH_32BIT - * @arg @ref MD_I2S_DATA_LENGTH_NOT_ALLOWED - */ -__STATIC_INLINE uint32_t md_spi_get_i2scfg_datlen(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_DATLEN_MSK)>>SPI_I2SCFG_DATLEN_POSS); -} - -/** - * @brief Set Inactive state clock polarity - * @note Note: For correct operation, this bit should be configured when the I2S is disabled. It is not used \n - in SPI mode. The bit CKPOL does not affect the CK edge sensitivity used to receive or transmit the SD \n - and WS signals. - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_I2S_POLARITY_LOW - * @arg @ref MD_I2S_POLARITY_HIGH - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2scfg_ckpol(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SCFG, SPI_I2SCFG_CKPOL_MSK, value); -} - -/** - * @brief Get Inactive state clock polarity - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg @ref MD_I2S_POLARITY_LOW - * @arg @ref MD_I2S_POLARITY_HIGH - */ -__STATIC_INLINE uint32_t md_spi_get_i2scfg_ckpol(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_CKPOL_MSK)>>SPI_I2SCFG_CKPOL_POS); -} - -/** - * @brief Set I2S standard selection - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_I2S_PHILIPS_STANDARD - * @arg @ref MD_I2S_MSB_STANDARD - * @arg @ref MD_I2S_LSB_STANDARD - * @arg @ref MD_I2S_PCM_STANDARD - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2scfg_i2sstd(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SCFG, SPI_I2SCFG_I2SSTD_MSK, value); -} - -/** - * @brief Get I2S standard selection - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg @ref MD_I2S_PHILIPS_STANDARD - * @arg @ref MD_I2S_MSB_STANDARD - * @arg @ref MD_I2S_LSB_STANDARD - * @arg @ref MD_I2S_PCM_STANDARD - */ -__STATIC_INLINE uint32_t md_spi_get_i2scfg_i2sstd(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_I2SSTD_MSK)>>SPI_I2SCFG_I2SSTD_POSS); -} - -/** - * @brief Set PCM frame synchronization - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_I2S_FRAME_SYN_SHORT - * @arg @ref MD_I2S_FRAME_SYN_LONG - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2scfg_pcmsync(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SCFG, SPI_I2SCFG_PCMSYNC_MSK, value); -} - -/** - * @brief Get PCM frame synchronization - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg @ref MD_I2S_FRAME_SYN_SHORT - * @arg @ref MD_I2S_FRAME_SYN_LONG - */ -__STATIC_INLINE uint32_t md_spi_get_i2scfg_pcmsync(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_PCMSYNC_MSK)>>SPI_I2SCFG_PCMSYNC_POS); -} - -/** - * @brief Set I2S configuration mode - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_I2S_SLAVE_TX - * @arg @ref MD_I2S_SLAVE_RX - * @arg @ref MD_I2S_MASTER_TX - * @arg @ref MD_I2S_MASTER_RX - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2scfg_i2scfg(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SCFG, SPI_I2SCFG_I2SCFG_MSK, value); -} - -/** - * @brief Get I2S configuration mode - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg @ref MD_I2S_SLAVE_TX - * @arg @ref MD_I2S_SLAVE_RX - * @arg @ref MD_I2S_MASTER_TX - * @arg @ref MD_I2S_MASTER_RX - */ -__STATIC_INLINE uint32_t md_spi_get_i2scfg_i2scfg(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_I2SCFG_MSK)>>SPI_I2SCFG_I2SCFG_POSS); -} - -/** - * @brief Enable I2S enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_i2scfg_i2se(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->I2SCFG, SPI_I2SCFG_I2SE_MSK); -} - -/** - * @brief Disable I2S enable - * @note When disabling the I2S, follow the procedure described in the Reference Manual. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_i2scfg_i2se(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->I2SCFG, SPI_I2SCFG_I2SE_MSK); -} - -/** - * @brief Check if I2S enable is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enable_i2scfg_i2se(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_I2SE_MSK) == (SPI_I2SCFG_I2SE_MSK)); -} - -/** - * @brief Set I2S mode selection - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg @ref MD_I2S_MODE_SPI - * @arg @ref MD_I2S_MODE_I2S - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2scfg_i2smod(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SCFG, SPI_I2SCFG_I2SMOD_MSK, value); -} - -/** - * @brief Get I2S mode selection - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg @ref MD_I2S_MODE_SPI - * @arg @ref MD_I2S_MODE_I2S - */ -__STATIC_INLINE uint32_t md_spi_get_i2scfg_i2smod(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SCFG, SPI_I2SCFG_I2SMOD_MSK)>>SPI_I2SCFG_I2SMOD_POS); -} - - -/** - * @} MD_SPI_I2SCFG - */ - -/**@defgroup MD_SPI_I2SPR I2S Prescaler register - * @{ - */ - - - -/** - * @brief Set SPI I2S configuration register(SPIx_I2SPR) - * @param SPIx SPI Instance - * @param value The value write in SPIx_I2SPR - * @retval None - */ -__STATIC_INLINE void md_spi_set_I2SPR(SPI_TypeDef *SPIx, uint32_t value) -{ - WRITE_REG(SPIx->I2SPR, value); -} - -/** - * @brief Get SPI I2S configuration register (SPIx_I2SPR) - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_get_I2SPR(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_REG(SPIx->I2SPR)); -} - -/** - * @brief Set I2S linear prescaler - * @note I2SDIV [7:0] = 0 or I2SDIV [7:0] = 1 are forbidden values. \n - Note: These bits should be configured when the I2S is disabled. \n - They are used only when the I2S is in master mode. They are not used in SPI mode. - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg Max:255 - * @arg Min:2 - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2spr_i2sdiv(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_I2SDIV_MSK, value); -} - -/** - * @brief Get I2S linear prescaler - * @note 0 or 1 are forbidden values - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg Max:255 - * @arg Min:2 - */ -__STATIC_INLINE uint32_t md_spi_get_i2spr_i2sdiv(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_I2SDIV_MSK)>>SPI_I2SPR_I2SDIV_POSS); -} - -/** - * @brief Set Odd factor for the prescaler - * @note 0 or 1 are forbidden values - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg MD_I2S_EVEN - * @arg MD_I2S_ODD - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2spr_odd(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_ODD_MSK, value); -} - -/** - * @brief Get Odd factor for the prescaler - * @note 0 or 1 are forbidden values - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg MD_I2S_EVEN - * @arg MD_I2S_ODD - */ -__STATIC_INLINE uint32_t md_spi_get_i2spr_odd(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_ODD_MSK)>>SPI_I2SPR_ODD_POS); -} - -/** - * @brief Master clock output enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_i2spr_mckoe(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE_MSK); -} - -/** - * @brief Master clock output disable - * @note When disabling the I2S, follow the procedure described in the Reference Manual. - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_i2spr_mckoe(SPI_TypeDef *SPIx) -{ - CLEAR_BIT(SPIx->I2SCFG, SPI_I2SPR_MCKOE_MSK); -} - -/** - * @brief Check if Master clock output enable is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enable_i2spr_mckoe(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->I2SPR, SPI_I2SPR_MCKOE_MSK) == (SPI_I2SPR_MCKOE_MSK)); -} - -/** - * @brief Set External I2S Clock Enable - * @note 0 or 1 are forbidden values - * @param SPIx SPI Instance - * @param value This bit can be set to: - * @arg MD_I2S_APB_CLOCK - * @arg MD_I2S_EXTERNAL_CLOCK - * @retval None - */ -__STATIC_INLINE void md_spi_set_i2spr_extcken(SPI_TypeDef *SPIx, uint32_t value) -{ - MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_EXTCKEN_MSK, value); -} - -/** - * @brief Get External I2S Clock Enable - * @note 0 or 1 are forbidden values - * @param SPIx SPI Instance - * @retval Returned value can be one of the following values: - * @retval Return follow : - * @arg MD_I2S_APB_CLOCK - * @arg MD_I2S_EXTERNAL_CLOCK - */ -__STATIC_INLINE uint32_t md_spi_get_i2spr_extcken(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->I2SPR, SPI_I2SPR_EXTCKEN_MSK)>>SPI_I2SPR_EXTCKEN_POS); -} - - - - - - -/** - * @} MD_SPI_I2SPR - */ - - - -/** - * @} MD_SPI_I2S - */ - - -/** @defgroup MD_SPI_PF_Interrupt_Management SPI Interrupt Management - * @{ - */ - -/** @defgroup MD_SPI_IER SPI Interrupt Enable Register - * @{ - */ - - -/** - * @brief Frame format error interrupt enable - * @note This bit controls the generation of an interrupt when an error condition occurs (CRCERR, OVR, MODF in SPI mode, FRE at TI mode). - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_freie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_FREIE_MSK); -} - -/** - * @brief Mode fault interrupt enable - * @note This bit controls the generation of an interrupt when an error condition occurs (CRCERR, OVR, MODF in SPI mode, FRE at TI mode). - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_modfie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_MODFIE_MSK); -} - -/** - * @brief CRC error interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_crcerrie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_CRCERRIE_MSK); -} - -/** - * @brief Receive buffer over threshold interrupt enable - * @note This bit controls the generation of an interrupt when an error condition occurs (CRCERR, OVR, MODF in SPI mode, FRE at TI mode). - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_rxthie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_RXTHIE_MSK); -} - -/** - * @brief Transmit buffer over threshold interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_txthie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_TXTHIE_MSK); -} - -/** - * @brief Receive buffer underrun interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_rxudie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_RXUDIE_MSK); -} - -/** - * @brief Transmit buffer underrun interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_txudie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_TXUDIE_MSK); -} - -/** - * @brief Receive buffer overrun interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_rxovie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_RXOVIE_MSK); -} - -/** - * @brief Transmit buffer overrun interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_txovie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_TXOVIE_MSK); -} - -/** - * @brief Receive buffer full interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_rxfie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_RXFIE_MSK); -} - -/** - * @brief Transmit buffer empty interrupt enable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_enable_ier_txeie(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IER, SPI_IER_TXEIE_MSK); -} - -/** - * @} MD_SPI_IER - */ - - -/** @defgroup MD_SPI_IDR SPI Interrupt Disable Register - * @{ - */ - -/** - * @brief Frame format error interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_freid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_FREID_MSK); -} - -/** - * @brief Mode fault interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_modfid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_MODFID_MSK); -} - -/** - * @brief CRC error interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_crcerrid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_CRCERRID_MSK); -} - -/** - * @brief Receive buffer under threshold interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_rxthid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_RXTHID_MSK); -} - -/** - * @brief Transmit buffer under threshold interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_txthid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_TXTHID_MSK); -} - -/** - * @brief Receive buffer underrun interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_rxudid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_RXUDID_MSK); -} - -/** - * @brief Transmit buffer underrun interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_txudid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_TXUDID_MSK); -} - -/** - * @brief Receive buffer overrun interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_rxovid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_RXOVID_MSK); -} - -/** - * @brief Transmit buffer overrun interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_txovid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_TXOVID_MSK); -} - -/** - * @brief Receive buffer full interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_rxfid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_RXFID_MSK); -} - -/** - * @brief Transmit buffer empty interrupt disable - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE void md_spi_disable_idr_txeid(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->IDR, SPI_IDR_TXEID_MSK); -} - -/** - * @} MD_SPI_IDR - */ - -/** @defgroup MD_SPI_ICR SPI Interrupt Clear Status Register - * @{ - */ - -/** - * @brief Frame format error interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_freic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_FREIC_MSK); -} - -/** - * @brief Mode fault interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_modfic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_MODFIC_MSK); -} - -/** - * @brief CRC error interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_crcerric(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_CRCERRIC_MSK); -} - -/** - * @brief Receive buffer over threshold interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_rxthic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_RXTHIC_MSK); -} - -/** - * @brief Transmit buffer over threshold interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_txthic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_TXTHIC_MSK); -} - -/** - * @brief Receive buffer underrun interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_rxudic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_RXUDIC_MSK); -} - -/** - * @brief Transmit buffer underrun interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_txudic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_TXUDIC_MSK); -} - -/** - * @brief Receive buffer overrun interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_rxovic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_RXOVIC_MSK); -} - -/** - * @brief Transmit buffer overrun interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_txovic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_TXOVIC_MSK); -} - -/** - * @brief Receive buffer full interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_rxfic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_RXFIC_MSK); -} - -/** - * @brief Transmit buffer empty interrupt clear - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_spi_clear_icr_txeic(SPI_TypeDef *SPIx) -{ - SET_BIT(SPIx->ICR, SPI_ICR_TXEIC_MSK); -} - -/** - * @} MD_SPI_ICR - */ - -/** @defgroup MD_SPI_IVS SPI Interrupt Valid Status Register - * @{ - */ - - -/** - * @brief Check if Frame format error interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_freiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_FREIV_MSK) == (SPI_IVS_FREIV_MSK)); -} - -/** - * @brief Check if Mode fault interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_modfiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_MODFIV_MSK) == (SPI_IVS_MODFIV_MSK)); -} - -/** - * @brief Check if CRC error interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_crcerriv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_CRCERRIV_MSK) == (SPI_IVS_CRCERRIV_MSK)); -} - -/** - * @brief Check if Receive buffer under threshold interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_rxthiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_RXTHIV_MSK) == (SPI_IVS_RXTHIV_MSK)); -} - -/** - * @brief Check if Transmit buffer under threshold interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_it_txthiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_TXTHIV_MSK) == (SPI_IVS_TXTHIV_MSK)); -} - -/** - * @brief Check if Receive buffer under underrun interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_rxudiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_RXUDIV_MSK) == (SPI_IVS_RXUDIV_MSK)); -} - -/** - * @brief Check if Transmit buffer underrun interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_it_txudiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_TXUDIV_MSK) == (SPI_IVS_TXUDIV_MSK)); -} - -/** - * @brief Check if Receive buffer overrun interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_rxoviv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_RXOVIV_MSK) == (SPI_IVS_RXOVIV_MSK)); -} - -/** - * @brief Check if Transmit buffer overrun interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_txoviv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_TXOVIV_MSK) == (SPI_IVS_TXOVIV_MSK)); -} - -/** - * @brief Check if Receive buffer full interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_rxfiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_RXFIV_MSK) == (SPI_IVS_RXFIV_MSK)); -} - -/** - * @brief Check if Transmit buffer empty interrupt valid is enabled - * @param SPIx SPI Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_spi_is_enabled_ivs_txeiv(SPI_TypeDef *SPIx) -{ - return (READ_BIT(SPIx->IVS, SPI_IVS_TXEIV_MSK) == (SPI_IVS_TXEIV_MSK)); -} - - -/** - * @} MD_SPI_IVS - */ - - -/** @defgroup MD_SPI_RIF SPI Raw Interrupt Flag Status Register - * @{ - */ - -/** - * @brief Check if Transmit buffer empty interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_txeri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_TXERI_MSK)==(SPI_RIF_TXERI_MSK)); -} - -/** - * @brief Check if Transmit buffer overrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_txovri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_TXOVRI_MSK)==(SPI_RIF_TXOVRI_MSK)); -} - -/** - * @brief Check if Transmit buffer underrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_txudri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_TXUDRI_MSK)==(SPI_RIF_TXUDRI_MSK)); -} - -/** - * @brief Check if Transmit buffer under threshold interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_txthri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_TXTHRI_MSK)==(SPI_RIF_TXTHRI_MSK)); -} - -/** - * @brief Check if Receive buffer full interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_rxfri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_RXFRI_MSK)==(SPI_RIF_RXFRI_MSK)); -} - -/** - * @brief Check if Receive buffer overrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_rxovri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_RXOVRI_MSK)==(SPI_RIF_RXOVRI_MSK)); -} - -/** - * @brief Check if Receive buffer underrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_rxudri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_RXUDRI_MSK)==(SPI_RIF_RXUDRI_MSK)); -} - -/** - * @brief Check if Receive buffer over threshold interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_rxthri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_RXTHRI_MSK)==(SPI_RIF_RXTHRI_MSK)); -} - -/** - * @brief Check if CRC error interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_crcerrri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_CRCERRRI_MSK)==(SPI_RIF_CRCERRRI_MSK)); -} - -/** - * @brief Check if Mode fault interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_modfri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_MODFRI_MSK)==(SPI_RIF_MODFRI_MSK)); -} - -/** - * @brief Check if Frame format error interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_rif_freri(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->RIF, SPI_RIF_FRERI_MSK)==(SPI_RIF_FRERI_MSK)); -} - -/** - * @} MD_SPI_RIF - */ - -/** @defgroup MD_SPI_IFM SPI Interrupt Masked Flag Status Register - * @{ - */ - -/** - * @brief Check if Transmit buffer empty interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_txefm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_TXEFM_MSK)==(SPI_IFM_TXEFM_MSK)); -} - -/** - * @brief Check if Transmit buffer overrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_txovfm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_TXOVFM_MSK)==(SPI_IFM_TXOVFM_MSK)); -} - -/** - * @brief Check if Transmit buffer underrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_txudfm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_TXUDFM_MSK)==(SPI_IFM_TXUDFM_MSK)); -} - -/** - * @brief Check if Transmit buffer under threshold interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_txthfm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_TXTHFM_MSK)==(SPI_IFM_TXTHFM_MSK)); -} - -/** - * @brief Check if Receive buffer full interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_rxffm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_RXFFM_MSK)==(SPI_IFM_RXFFM_MSK)); -} - -/** - * @brief Check if Receive buffer overrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_rxovfm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_RXOVFM_MSK)==(SPI_IFM_RXOVFM_MSK)); -} - -/** - * @brief Check if Receive buffer underrun interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_rxudfm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_RXUDFM_MSK)==(SPI_IFM_RXUDFM_MSK)); -} - -/** - * @brief Check if Receive buffer over threshold interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_rxthfm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_RXTHFM_MSK)==(SPI_IFM_RXTHFM_MSK)); -} - -/** - * @brief Check if CRC error interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_crcerrfm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_CRCERRFM_MSK)==(SPI_IFM_CRCERRFM_MSK)); -} - -/** - * @brief Check if Mode fault interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_modffm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_MODFFM_MSK)==(SPI_IFM_MODFFM_MSK)); -} - -/** - * @brief Check if Frame format error interrupt flag status is actived - * @param SPIx SPI Instance - * @retval None - */ -__STATIC_INLINE uint32_t md_spi_is_active_flag_ifm_frefm(SPI_TypeDef *SPIx) -{ - return (uint32_t)(READ_BIT(SPIx->IFM, SPI_IFM_FREFM_MSK)==(SPI_IFM_FREFM_MSK)); -} - -/** - * @} MD_SPI_IFM - */ - - - -/** - * @} MD_SPI_PF_Interrupt_Management - */ - - - -/** - * @} MD_SPI_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_SPI_Public_Functions SPI Public Functions - * @{ - */ - - - - -/** @defgroup MD_SPI_PF_Init SPI Initialization and De-Initialization functions - * @{ - */ - -ErrorStatus md_spi_init(SPI_TypeDef *SPIx, md_spi_inittypedef *SPI_InitStruct); -void md_spi_struct_init(md_spi_inittypedef *SPI_InitStruct); -void SPISingleWr(SPI_TypeDef *SPIx, uint8_t data); -uint8_t SPISSingleRd(SPI_TypeDef *SPIx); -/** - * @} MD_SPI_PF_Init - */ - -/** - * @} MD_SPI_Public_Functions - */ - -/** - * @} SPI - */ - -#endif - -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_syscfg.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_syscfg.h deleted file mode 100644 index 0da1bfc14d..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_syscfg.h +++ /dev/null @@ -1,1249 +0,0 @@ -/** - ****************************************************************************** - * @file md_SYSCFG.h - * @brief ES32F0271 SYSCFG HEAD File. - * - * @version V1.00.02 - * @date 30/11/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_SYSCFG_H__ -#define __MD_SYSCFG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include -#include "es32f0271.h" -#include "reg_syscfg.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (SYSCFG) - -/** @defgroup SYSCFG SYSCFG - * @brief SYSCFG micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_SYSCFG_PT_INIT RCC Public Init structures - * @{ - */ - -/** - * @brief MD SYSCFG Init Structure definition - */ - - -/** - * @} MD_SYSCFG_PT_INIT - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_SYSCFG_Public_Constants SYSCFG Public Constants - * @{ - */ - -/** @defgroup MD_SYSCFG_REMAP_REALMOD_FLAG Current Memory mapping Status - * @{ - */ -#define MD_SYSCFG_REALMOD_MAIN (0x00000000UL) /** @brief Main Flash memory mapped at 0x00000000 */ -#define MD_SYSCFG_REALMOD_SYSTEM (0x00000001UL) /** @brief System Flash memory mapped at 0x00000000 */ -#define MD_SYSCFG_REALMOD_SRAM (0x00000002UL) /** @brief SRAM mapped at 0x00000000 */ -/** - * @} MD_SYSCFG_REMAP_REALMOD_FLAG - */ - -/** @defgroup MD_SYSCFG_REMAP_MEMMOD_FLAG Memory mapping selection bits - * @{ - */ -#define MD_SYSCFG_MEMMOD_MAIN (0x00000000UL) /** @brief Main Flash memory mapped at 0x00000000 */ -#define MD_SYSCFG_MEMMOD_SYSTEM (0x00000001UL) /** @brief System Flash memory mapped at 0x00000000 */ -#define MD_SYSCFG_MEMMOD_SRAM (0x00000002UL) /** @brief SRAM mapped at 0x00000000 */ -/** - * @} MD_SYSCFG_REMAP_MEMMOD_FLAG - */ - -/** @defgroup MD_SYSCFG_IRSEL_PLR_FLAG IR Polarity - * @{ - */ -#define MD_SYSCFG_PLR_INV_SEL1_AND_SEL2 (0x00000000UL) /** @brief IR out = ~(SEL1 & SEL2) */ -#define MD_SYSCFG_PLR_SEL1_AND_SEL2 (0x00000001UL) /** @brief IR out = SEL1 & SEL2 */ -/** - * @} MD_SYSCFG_IRSEL_PLR_FLAG - */ - -/** @defgroup MD_SYSCFG_IRSEL_SEL2 IR Select 2 - * @{ - */ -#define MD_SYSCFG_SEL2_OFF (0x00000000UL) /** @brief 0000: OFF */ -#define MD_SYSCFG_SEL2_GP16C2T4_CH1 (0x00000001UL) /** @brief 0001: GP16C2T4_CH1 */ -#define MD_SYSCFG_SEL2_GP16C2T4_CH2 (0x00000002UL) /** @brief 0010: GP16C2T4_CH2 */ -#define MD_SYSCFG_SEL2_UART3_TX (0x00000003UL) /** @brief 0100: UART3_TX */ -#define MD_SYSCFG_SEL2_SUART2_TX (0x00000004UL) /** @brief 1000: SUART2_TX */ -/** - * @} MD_SYSCFG_IRSEL_SEL2 - */ - -/** @defgroup MD_SYSCFG_IRSEL_SEL1 IR Select 1 - * @{ - */ -#define MD_SYSCFG_SEL1_OFF (0x00000000UL) /** @brief 0000: OFF */ -#define MD_SYSCFG_SEL1_GP16C2T2_CH1 (0x00000001UL) /** @brief 0001: GP16C2T2_CH1 */ -#define MD_SYSCFG_SEL1_GP16C2T2_CH2 (0x00000002UL) /** @brief 0010: GP16C2T2_CH2 */ -#define MD_SYSCFG_SEL1_GP16C2T3_CH1 (0x00000003UL) /** @brief 0100: GP16C2T3_CH1 */ -#define MD_SYSCFG_SEL1_GP16C2T3_CH2 (0x00000004UL) /** @brief 1000: GP16C2T3_CH2 */ -/** - * @} MD_SYSCFG_IRSEL_SEL1 - */ - -/** @defgroup MD_SYSCFG_CFG_DBGH_EN DBG Halt enable bit - * @{ - */ -#define MD_SYSCFG_DBGH_EN_IWDT (0x00002000UL) -#define MD_SYSCFG_DBGH_EN_WWDT (0x00001000UL) -#define MD_SYSCFG_DBGH_EN_BS16T1 (0x00000200UL) -#define MD_SYSCFG_DBGH_EN_GP16C4T3 (0x00000100UL) -#define MD_SYSCFG_DBGH_EN_GP16C4T2 (0x00000080UL) -#define MD_SYSCFG_DBGH_EN_GP16C4T1 (0x00000040UL) -#define MD_SYSCFG_DBGH_EN_GP32C4T1 (0x00000020UL) -#define MD_SYSCFG_DBGH_EN_GP16C2T4 (0x00000010UL) -#define MD_SYSCFG_DBGH_EN_GP16C2T3 (0x00000008UL) -#define MD_SYSCFG_DBGH_EN_GP16C2T2 (0x00000004UL) -#define MD_SYSCFG_DBGH_EN_GP16C2T1 (0x00000002UL) -#define MD_SYSCFG_DBGH_EN_AD16C4T1 (0x00000001UL) -/** - * @} MD_SYSCFG_CFG_DBGH_EN - */ - -/** @defgroup MD_SYSCFG_CFG_VTST Voltage testing - * @{ - */ -#define MD_SYSCFG_VTST_LDO (0x00000000UL) /** @brief 00: LDO Buffer Voltage */ -#define MD_SYSCFG_VTST_BANDGAP_REF (0x00000001UL) /** @brief 01: BandGap Reference Voltage */ -#define MD_SYSCFG_VTST_LDO1V2 (0x00000002UL) /** @brief 10: LDO1V2 Voltage */ -#define MD_SYSCFG_VTST_LDO1V5 (0x00000003UL) /** @brief 11: LDO1V5 Voltage */ -/** - * @} MD_SYSCFG_CFG_VTST - */ - -/** @defgroup MD_SYSCFG_CFG_VRLS These bits are written by software to select the voltage reference level by the ADC/DAC - * @{ - */ -#define MD_SYSCFG_VRLS_1V5 (0x00000000UL) /** @brief 000: 1.5V */ -#define MD_SYSCFG_VRLS_2V (0x00000001UL) /** @brief 001: 2.0V */ -#define MD_SYSCFG_VRLS_2V5 (0x00000002UL) /** @brief 010: 2.5V */ -#define MD_SYSCFG_VRLS_3V (0x00000003UL) /** @brief 011: 3.0V */ -#define MD_SYSCFG_VRLS_3V5 (0x00000004UL) /** @brief 100: 3.5V */ -#define MD_SYSCFG_VRLS_4V (0x00000005UL) /** @brief 101: 4.0V */ -#define MD_SYSCFG_VRLS_4V5 (0x00000006UL) /** @brief 110: 4.5V */ -#define MD_SYSCFG_VRLS_5V (0x00000007UL) /** @brief 111: 5.0V(VDD5) */ -/** - * @} MD_SYSCFG_CFG_VRLS - */ - -/** @defgroup MD_SYSCFG_PWCON_PVLS These bits are written by software to select the voltage reference level by the ADC/DAC - * @{ - */ -#define MD_SYSCFG_PVLS_R1V9_F2V (0x00000000UL) /** @brief 0000: R-1.9V, F-2.0V */ -#define MD_SYSCFG_PVLS_R2V1_F2V2 (0x00000001UL) /** @brief 0001: R-2.1V, F-2.2V */ -#define MD_SYSCFG_PVLS_R2V3_F2V4 (0x00000002UL) /** @brief 0010: R-2.3V, F-2.4V */ -#define MD_SYSCFG_PVLS_R2V5_F2V6 (0x00000003UL) /** @brief 0011: R-2.5V, F-2.6V */ -#define MD_SYSCFG_PVLS_R2V7_F2V8 (0x00000004UL) /** @brief 0100: R-2.7V, F-2.8V */ -#define MD_SYSCFG_PVLS_R2V9_F3V (0x00000005UL) /** @brief 0101: R-2.9V, F-3.0V */ -#define MD_SYSCFG_PVLS_R3V1_F3V2 (0x00000006UL) /** @brief 0110: R-3.1V, F-3.2V */ -#define MD_SYSCFG_PVLS_R3V3_F3V4 (0x00000007UL) /** @brief 0111: R-3.3V, F-3.4V */ -#define MD_SYSCFG_PVLS_R3V5_F3V6 (0x00000008UL) /** @brief 1000: R-3.5V, F-3.6V */ -#define MD_SYSCFG_PVLS_R3V7_F3V8 (0x00000009UL) /** @brief 1001: R-3.7V, F-3.8V */ -#define MD_SYSCFG_PVLS_R3V9_F4V (0x0000000AUL) /** @brief 1010: R-3.9V, F-4.0V */ -#define MD_SYSCFG_PVLS_R4V1_F4V2 (0x0000000BUL) /** @brief 1011: R-4.1V, F-4.2V */ -#define MD_SYSCFG_PVLS_R4V3_F4V4 (0x0000000CUL) /** @brief 1100: R-4.3V, F-4.4V */ -#define MD_SYSCFG_PVLS_R4V5_F4V6 (0x0000000DUL) /** @brief 1101: R-4.5V, F-4.6V */ -#define MD_SYSCFG_PVLS_R4V7_F4V8 (0x0000000EUL) /** @brief 1110: R-4.7V, F-4.8V */ -#define MD_SYSCFG_PVLS_R4V9_F5V (0x0000000FUL) /** @brief 1111: R-4.9V, F-5.0V */ -/** - * @} MD_SYSCFG_PWCON_PVLS - */ - -/** @defgroup MD_SYSCFG_WKCON_LPLS Low Power Level Select - * @{ - */ -#define MD_SYSCFG_LPLS_LV0 (0x00000000UL) /** @brief 0 : Level 0, Sleep Mode (Normal) */ -#define MD_SYSCFG_LPLS_LV1 (0x00000001UL) /** @brief 1 : Level 1, Stop Mode (All Clock OFF) */ -#define MD_SYSCFG_LPLS_LV2 (0x00000002UL) /** @brief 2 : Level 2, Standby Mode (SRAM retention) */ -#define MD_SYSCFG_LPLS_LV3 (0x00000003UL) /** @brief 3 : Level 3, Low Power Mode (LDO off) */ -#define MD_SYSCFG_LPLS_LV4 (0x00000004UL) /** @brief 4 : Level 3, Ultra Low Power Mode(LDO off/BandGap off) */ -/** - * @} MD_SYSCFG_WKCON_LPLS - */ - -/** @defgroup MD_SYSCFG_WKCON_WKEG WKEGx:WKUPx pin edge sensitive type select - * @{ - */ -#define MD_SYSCFG_WKCON_WKEG_NRST (0x00000800UL) -#define MD_SYSCFG_WKCON_WKEG_PVD (0x00000400UL) -#define MD_SYSCFG_WKCON_WKEG_CMP0 (0x00000200UL) -#define MD_SYSCFG_WKCON_WKEG_RTC (0x00000100UL) -#define MD_SYSCFG_WKCON_WKEG_PIN7 (0x00000080UL) -#define MD_SYSCFG_WKCON_WKEG_PIN6 (0x00000040UL) -#define MD_SYSCFG_WKCON_WKEG_PIN5 (0x00000020UL) -#define MD_SYSCFG_WKCON_WKEG_PIN4 (0x00000010UL) -#define MD_SYSCFG_WKCON_WKEG_PIN3 (0x00000008UL) -#define MD_SYSCFG_WKCON_WKEG_PIN2 (0x00000004UL) -#define MD_SYSCFG_WKCON_WKEG_PIN1 (0x00000002UL) -#define MD_SYSCFG_WKCON_WKEG_PIN0 (0x00000001UL) -/** - * @} MD_SYSCFG_WKCON_WKEG - */ - -/** @defgroup MD_SYSCFG_WKCON_WKEN WKENx: Enable WKUPx pin or wakeup event - * @{ - */ -#define MD_SYSCFG_WKCON_WKEN_NRST (0x00000800UL) -#define MD_SYSCFG_WKCON_WKEN_PVD (0x00000400UL) -#define MD_SYSCFG_WKCON_WKEN_CMP0 (0x00000200UL) -#define MD_SYSCFG_WKCON_WKEN_RTC (0x00000100UL) -#define MD_SYSCFG_WKCON_WKEN_PIN7 (0x00000080UL) -#define MD_SYSCFG_WKCON_WKEN_PIN6 (0x00000040UL) -#define MD_SYSCFG_WKCON_WKEN_PIN5 (0x00000020UL) -#define MD_SYSCFG_WKCON_WKEN_PIN4 (0x00000010UL) -#define MD_SYSCFG_WKCON_WKEN_PIN3 (0x00000008UL) -#define MD_SYSCFG_WKCON_WKEN_PIN2 (0x00000004UL) -#define MD_SYSCFG_WKCON_WKEN_PIN1 (0x00000002UL) -#define MD_SYSCFG_WKCON_WKEN_PIN0 (0x00000001UL) -/** - * @} MD_SYSCFG_WKCON_WKEN - */ - -/** @defgroup MD_SYSCFG_WKSTAT_FG FGx: WKUPx pin or wakeup event flag - * @{ - */ -#define MD_SYSCFG_WKSTAT_FG_NRST (0x00000800UL) -#define MD_SYSCFG_WKSTAT_FG_PVD (0x00000400UL) -#define MD_SYSCFG_WKSTAT_FG_CMP0 (0x00000200UL) -#define MD_SYSCFG_WKSTAT_FG_RTC (0x00000100UL) -#define MD_SYSCFG_WKSTAT_FG_PIN7 (0x00000080UL) -#define MD_SYSCFG_WKSTAT_FG_PIN6 (0x00000040UL) -#define MD_SYSCFG_WKSTAT_FG_PIN5 (0x00000020UL) -#define MD_SYSCFG_WKSTAT_FG_PIN4 (0x00000010UL) -#define MD_SYSCFG_WKSTAT_FG_PIN3 (0x00000008UL) -#define MD_SYSCFG_WKSTAT_FG_PIN2 (0x00000004UL) -#define MD_SYSCFG_WKSTAT_FG_PIN1 (0x00000002UL) -#define MD_SYSCFG_WKSTAT_FG_PIN0 (0x00000001UL) -/** - * @} MD_SYSCFG_WKSTAT_FG - */ - -/** - * @} MD_SYSCFG_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_SYSCFG_Public_Macros SYSCFG Public Macros - * @{ - */ - -/** - * @brief Get Current Memory mapping Status - * @param syscfg SYSCFG Instance - * @retval The retval can be one of the following values: - * @arg @ref MD_SYSCFG_REALMOD_MAIN - * @arg @ref MD_SYSCFG_REALMOD_SYSTEM - * @arg @ref MD_SYSCFG_REALMOD_SRAM - */ -__STATIC_INLINE uint32_t md_syscfg_get_remap_REALMOD(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->REMAP, SYSCFG_REMAP_REALMOD_MSK)>>SYSCFG_REMAP_REALMOD_POSS); -} -/** - * @brief Set Remap Main Flash Base Address Selection - * @note If set 0x1, it means second 4k Byte, If set 0x2, it means third 4k Byte, and so on. - * @param syscfg SYSCFG Instance - * @param efbase This parameter can be one of the following values: - * @arg Max Value 15 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_remap_efbase(SYSCFG_TypeDef *syscfg, uint32_t efbase) -{ - MODIFY_REG(syscfg->REMAP, SYSCFG_REMAP_EFBASE_MSK, (efbase<REMAP, SYSCFG_REMAP_EFBASE_MSK)>>SYSCFG_REMAP_EFBASE_POSS); -} -/** - * @brief Set Memory mapping selection bits - * @param syscfg SYSCFG Instance - * @param memmod This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_MEMMOD_MAIN - * @arg @ref MD_SYSCFG_MEMMOD_SYSTEM - * @arg @ref MD_SYSCFG_MEMMOD_SRAM - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_remap_memmod(SYSCFG_TypeDef *syscfg, uint32_t memmod) -{ - MODIFY_REG(syscfg->REMAP, SYSCFG_REMAP_MEMMOD_MSK, (memmod<REMAP, SYSCFG_REMAP_MEMMOD_MSK)>>SYSCFG_REMAP_MEMMOD_POSS); -} -/** - * @brief Set Start Remap bit - * @note This bit set High to start remapping process, that will be auto clear when process was finish. - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_remap_remap(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->REMAP, SYSCFG_REMAP_REMAP_MSK); -} -/** - * @brief Get Start Remap bit - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_remap_remap(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->REMAP, SYSCFG_REMAP_REMAP_MSK)>>SYSCFG_REMAP_REMAP_POS); -} - -/** - * @brief Set IR Polarity - * @param syscfg SYSCFG Instance - * @param plr This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_PLR_INV_SEL1_AND_SEL2 - * @arg @ref MD_SYSCFG_PLR_SEL1_AND_SEL2 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_irsel_plr(SYSCFG_TypeDef *syscfg, uint32_t plr) -{ - MODIFY_REG(syscfg->IRSEL, SYSCFG_IRSEL_PLR_MSK, (plr<IRSEL, SYSCFG_IRSEL_PLR_MSK)>>SYSCFG_IRSEL_PLR_POS); -} -/** - * @brief Set IR Select 2 - * @param syscfg SYSCFG Instance - * @param sel2 This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_SEL2_OFF - * @arg @ref MD_SYSCFG_SEL2_GP16C2T4_CH1 - * @arg @ref MD_SYSCFG_SEL2_GP16C2T4_CH2 - * @arg @ref MD_SYSCFG_SEL2_UART3_TX - * @arg @ref MD_SYSCFG_SEL2_SUART2_TX - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_irsel_sel2(SYSCFG_TypeDef *syscfg, uint32_t sel2) -{ - MODIFY_REG(syscfg->IRSEL, SYSCFG_IRSEL_SEL2_MSK, (sel2<IRSEL, SYSCFG_IRSEL_SEL2_MSK)>>SYSCFG_IRSEL_SEL2_POSS); -} -/** - * @brief Set IR Select 1 - * @param syscfg SYSCFG Instance - * @param sel1 This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_SEL1_OFF - * @arg @ref MD_SYSCFG_SEL1_GP16C2T2_CH1 - * @arg @ref MD_SYSCFG_SEL1_GP16C2T2_CH2 - * @arg @ref MD_SYSCFG_SEL1_GP16C2T3_CH1 - * @arg @ref MD_SYSCFG_SEL1_GP16C2T3_CH2 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_irsel_sel1(SYSCFG_TypeDef *syscfg, uint32_t sel1) -{ - MODIFY_REG(syscfg->IRSEL, SYSCFG_IRSEL_SEL1_MSK, (sel1<IRSEL, SYSCFG_IRSEL_SEL1_MSK)>>SYSCFG_IRSEL_SEL1_POSS); -} - -/** - * @brief Set DBG Halt enable bit - * @note 0: The counter clock is fed even if the core is halted - * 1: The counter clock is stopped when the core is halted - * @param syscfg SYSCFG Instance - * @param sel1 This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_DBGH_EN_IWDT - * @arg @ref MD_SYSCFG_DBGH_EN_WWDT - * @arg @ref MD_SYSCFG_DBGH_EN_BS16T1 - * @arg @ref MD_SYSCFG_DBGH_EN_GP16C4T3 - * @arg @ref MD_SYSCFG_DBGH_EN_GP16C4T2 - * @arg @ref MD_SYSCFG_DBGH_EN_GP16C4T1 - * @arg @ref MD_SYSCFG_DBGH_EN_GP32C4T1 - * @arg @ref MD_SYSCFG_DBGH_EN_GP16C2T4 - * @arg @ref MD_SYSCFG_DBGH_EN_GP16C2T3 - * @arg @ref MD_SYSCFG_DBGH_EN_GP16C2T2 - * @arg @ref MD_SYSCFG_DBGH_EN_GP16C2T1 - * @arg @ref MD_SYSCFG_DBGH_EN_AD16C4T1 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_cfg_dbgh_en(SYSCFG_TypeDef *syscfg, uint32_t sel1) -{ - MODIFY_REG(syscfg->CFG, SYSCFG_CFG_DBGH_EN_MSK, (sel1<CFG, SYSCFG_CFG_DBGH_EN_MSK)>>SYSCFG_CFG_DBGH_EN_POSS); -} -/** - * @brief PVD lock enable bit - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_cfg_pvdlck(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->CFG, SYSCFG_CFG_PVD_LCK_MSK); -} -/** - * @brief PVD lock disable bit - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_cfg_pvdlck(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->CFG, SYSCFG_CFG_PVD_LCK_MSK); -} -/** - * @brief Get PVD lock bit - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_cfg_pvdlck(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->CFG, SYSCFG_CFG_PVD_LCK_MSK)>>SYSCFG_CFG_PVD_LCK_POS); -} -/** - * @brief Clock security system lock enable bit - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_cfg_csslck(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->CFG, SYSCFG_CFG_CSS_LCK_MSK); -} -/** - * @brief Clock security system lock enable bit - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_cfg_csslck(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->CFG, SYSCFG_CFG_CSS_LCK_MSK); -} -/** - * @brief Clock security system lock enable bit - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_cfg_csslck(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->CFG, SYSCFG_CFG_CSS_LCK_MSK)>>SYSCFG_CFG_CSS_LCK_POS); -} -/** - * @brief Cortex-M0 LOCKUP bit enable bit - * @note This bit is set by software and cleared by a system reset. - * It can be use to enable and lock the connection of Cortex-M0 LOCKUP (Hardfault) output to AD16C4T/GP16C2T1-4 Break input. - * @note 1: Cortex-M0 LOCKUP output connected to AD16C4T/GP16C2T1/GP16C2T2/GP16C2T3/GP16C2T4 Break input - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_cfg_cpulck(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->CFG, SYSCFG_CFG_CPU_LCK_MSK); -} -/** - * @brief Cortex-M0 LOCKUP bit disable bit - * @note 0: Cortex-M0 LOCKUP output disconnected from AD16C4T / GP16C2T1-4 Break input - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_cfg_cpulck(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->CFG, SYSCFG_CFG_CPU_LCK_MSK); -} -/** - * @brief Get Cortex-M0 LOCKUP bit - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_cfg_cpulck(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->CFG, SYSCFG_CFG_CPU_LCK_MSK)>>SYSCFG_CFG_CPU_LCK_POS); -} -/** - * @brief Set Voltage testing, This bit is set and cleared by software. - * @param syscfg SYSCFG Instance - * @param vtst This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_VTST_LDO - * @arg @ref MD_SYSCFG_VTST_BANDGAP_REF - * @arg @ref MD_SYSCFG_VTST_LDO1V2 - * @arg @ref MD_SYSCFG_VTST_LDO1V5 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_cfg_vtst(SYSCFG_TypeDef *syscfg, uint32_t vtst) -{ - MODIFY_REG(syscfg->CFG, SYSCFG_CFG_VTST_MSK, (vtst<CFG, SYSCFG_CFG_VTST_MSK)>>SYSCFG_CFG_VTST_POSS); -} -/** - * @brief Enable External NRST Pin reset request - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_cfg_nrstreq(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->CFG, SYSCFG_CFG_NRSTREQ_MSK); -} -/** - * @brief Disable External NRST Pin reset request - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_cfg_nrstreq(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->CFG, SYSCFG_CFG_NRSTREQ_MSK); -} -/** - * @brief External NRST Pin reset request - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_cfg_nrstreq(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->CFG, SYSCFG_CFG_NRSTREQ_MSK)>>SYSCFG_CFG_NRSTREQ_POS); -} -/** - * @brief ADC/DAC current generator enabled - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_cfg_currgen(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->CFG, SYSCFG_CFG_CURRGEN_MSK); -} -/** - * @brief ADC/DAC current generator disabled - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_cfg_currgen(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->CFG, SYSCFG_CFG_CURRGEN_MSK); -} -/** - * @brief ADC/DAC current generator status - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_cfg_currgen(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->CFG, SYSCFG_CFG_CURRGEN_MSK)>>SYSCFG_CFG_CURRGEN_POS); -} -/** - * @brief Temperature sensor enabled - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_cfg_tempen(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->CFG, SYSCFG_CFG_TEMPEN_MSK); -} -/** - * @brief Temperature sensor disabled - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_cfg_tempen(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->CFG, SYSCFG_CFG_TEMPEN_MSK); -} -/** - * @brief Get Temperature sensor status - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_cfg_tempen(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->CFG, SYSCFG_CFG_TEMPEN_MSK)>>SYSCFG_CFG_TEMPEN_POS); -} -/** - * @brief Voltage reference enabled - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_cfg_vrefen(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->CFG, SYSCFG_CFG_VREFEN_MSK); -} -/** - * @brief Voltage reference disabled - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_cfg_vrefen(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->CFG, SYSCFG_CFG_VREFEN_MSK); -} -/** - * @brief Get Voltage reference status - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_cfg_vrefen(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->CFG, SYSCFG_CFG_VREFEN_MSK)>>SYSCFG_CFG_VREFEN_POS); -} -/** - * @brief Set These bits are written by software to select the voltage reference level by the ADC/DAC: - * @param syscfg SYSCFG Instance - * @param vlrs This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_VRLS_1V5 - * @arg @ref MD_SYSCFG_VRLS_2V - * @arg @ref MD_SYSCFG_VRLS_2V5 - * @arg @ref MD_SYSCFG_VRLS_3V - * @arg @ref MD_SYSCFG_VRLS_3V5 - * @arg @ref MD_SYSCFG_VRLS_4V - * @arg @ref MD_SYSCFG_VRLS_4V5 - * @arg @ref MD_SYSCFG_VRLS_5V - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_cfg_vlrs(SYSCFG_TypeDef *syscfg, uint32_t vlrs) -{ - MODIFY_REG(syscfg->CFG, SYSCFG_CFG_VRLS_MSK, (vlrs<CFG, SYSCFG_CFG_VRLS_MSK)>>SYSCFG_CFG_VRLS_POSS); -} - -/** - * @brief WKCON0-7 IO Setting Value LOCKED enabled - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_pwcon_iolock(SYSCFG_TypeDef *syscfg) -{ - MODIFY_REG(syscfg->PWCON, SYSCFG_PWCON_IOLOCK_MSK, (ENABLE<PWCON, SYSCFG_PWCON_IOLOCK_MSK, (DISABLE<PWCON, SYSCFG_PWCON_IOLOCK_MSK)>>SYSCFG_PWCON_IOLOCK_POS); -} -/** - * @brief Set BandGap Trimming Value - * @param syscfg SYSCFG Instance - * @param bgtrim This parameter can be one of the following values: - * @arg Max Value 15 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_pwcon_bgtrim(SYSCFG_TypeDef *syscfg, uint32_t bgtrim) -{ - MODIFY_REG(syscfg->PWCON, SYSCFG_PWCON_BGTRIM_MSK, (bgtrim<PWCON, SYSCFG_PWCON_BGTRIM_MSK)>>SYSCFG_PWCON_BGTRIM_POSS); -} -/** - * @brief HSI auto calibration result value LOCK - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_pwcon_hrclock(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->PWCON, SYSCFG_PWCON_HRCLOCK_MSK); -} -/** - * @brief HSI auto calibration result value unLOCK - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_pwcon_hrclock(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->PWCON, SYSCFG_PWCON_HRCLOCK_MSK); -} -/** - * @brief Get HSI auto calibration result value - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_pwcon_hrclock(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->PWCON, SYSCFG_PWCON_HRCLOCK_MSK)>>SYSCFG_PWCON_HRCLOCK_POS); -} -/** - * @brief Set HSI auto calibration result value - * @param syscfg SYSCFG Instance - * @param hsitrim This parameter can be one of the following values: - * @arg Max Value 255 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_pwcon_hrctrim(SYSCFG_TypeDef *syscfg, uint32_t hsitrim) -{ - MODIFY_REG(syscfg->PWCON, SYSCFG_PWCON_HRCTRIM_MSK, (hsitrim<PWCON, SYSCFG_PWCON_HRCTRIM_MSK)>>SYSCFG_PWCON_HRCTRIM_POSS); -} -/** - * @brief Set LSI Driver Select - * @param syscfg SYSCFG Instance - * @param loscdrv This parameter can be one of the following values: - * @arg Max Value 7 - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_pwcon_loscdrv(SYSCFG_TypeDef *syscfg, uint32_t loscdrv) -{ - MODIFY_REG(syscfg->PWCON, SYSCFG_PWCON_LOSCDRV_MSK, (loscdrv<PWCON, SYSCFG_PWCON_LOSCDRV_MSK)>>SYSCFG_PWCON_LOSCDRV_POSS); -} -/** - * @brief Power voltage detector(PVD) enable - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_pwcon_pvden(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->PWCON, SYSCFG_PWCON_PVDEN_MSK); -} -/** - * @brief Power voltage detector(PVD) disable - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_disable_pwcon_pvden(SYSCFG_TypeDef *syscfg) -{ - CLEAR_BIT(syscfg->PWCON, SYSCFG_PWCON_PVDEN_MSK); -} -/** - * @brief Get Power voltage detector(PVD) status - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_pwcon_pvden(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->PWCON, SYSCFG_PWCON_PVDEN_MSK)>>SYSCFG_PWCON_PVDEN_POS); -} -/** - * @brief Set power voltage detector - * @note These bits are written by software to select the voltage threshold detected by the power voltage detector - * @param syscfg SYSCFG Instance - * @param pvls This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_PVLS_R1V9_F2V - * @arg @ref MD_SYSCFG_PVLS_R2V1_F2V2 - * @arg @ref MD_SYSCFG_PVLS_R2V3_F2V4 - * @arg @ref MD_SYSCFG_PVLS_R2V5_F2V6 - * @arg @ref MD_SYSCFG_PVLS_R2V7_F2V8 - * @arg @ref MD_SYSCFG_PVLS_R2V9_F3V - * @arg @ref MD_SYSCFG_PVLS_R3V1_F3V2 - * @arg @ref MD_SYSCFG_PVLS_R3V3_F3V4 - * @arg @ref MD_SYSCFG_PVLS_R3V5_F3V6 - * @arg @ref MD_SYSCFG_PVLS_R3V7_F3V8 - * @arg @ref MD_SYSCFG_PVLS_R3V9_F4V - * @arg @ref MD_SYSCFG_PVLS_R4V1_F4V2 - * @arg @ref MD_SYSCFG_PVLS_R4V3_F4V4 - * @arg @ref MD_SYSCFG_PVLS_R4V5_F4V6 - * @arg @ref MD_SYSCFG_PVLS_R4V7_F4V8 - * @arg @ref MD_SYSCFG_PVLS_R4V9_F5V - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_pwcon_pvls(SYSCFG_TypeDef *syscfg, uint32_t pvls) -{ - MODIFY_REG(syscfg->PWCON, SYSCFG_PWCON_PVLS_MSK, (pvls<PWCON, SYSCFG_PWCON_PVLS_MSK)>>SYSCFG_PWCON_PVLS_POSS); -} - -/** - * @brief Clear Wake Flag enable - * @param syscfg SYSCFG Instance - * @retval None - */ -__STATIC_INLINE void md_syscfg_enable_wkcon_wkclr(SYSCFG_TypeDef *syscfg) -{ - SET_BIT(syscfg->WKCON, SYSCFG_WKCON_WKCLR_MSK); -} -/** - * @brief Set Low Power Level Select - * @param syscfg SYSCFG Instance - * @param lpls The parameter can be one of the following values: - * @arg @ref MD_SYSCFG_LPLS_LV0 - * @arg @ref MD_SYSCFG_LPLS_LV1 - * @arg @ref MD_SYSCFG_LPLS_LV2 - * @arg @ref MD_SYSCFG_LPLS_LV3 - * @arg @ref MD_SYSCFG_LPLS_LV4 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_wkcon_lpls(SYSCFG_TypeDef *syscfg, uint32_t lpls) -{ - MODIFY_REG(syscfg->WKCON, SYSCFG_WKCON_LPLS_MSK, (lpls<WKCON, SYSCFG_WKCON_LPLS_MSK)>>SYSCFG_WKCON_LPLS_POSS); -} -/** - * @brief Set WKUPx pin edge sensitive type select - * @note 0 : Falling Edge-sensitive (default) - * 1 : Rising Edge-sensitive - * @param syscfg SYSCFG Instance - * @param wkeg This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_WKCON_WKEG_NRST - * @arg @ref MD_SYSCFG_WKCON_WKEG_PVD - * @arg @ref MD_SYSCFG_WKCON_WKEG_CMP0 - * @arg @ref MD_SYSCFG_WKCON_WKEG_RTC - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN7 - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN6 - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN5 - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN4 - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN3 - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN2 - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN1 - * @arg @ref MD_SYSCFG_WKCON_WKEG_PIN0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_wkcon_wkeg(SYSCFG_TypeDef *syscfg, uint32_t wkeg) -{ - MODIFY_REG(syscfg->WKCON, SYSCFG_WKCON_WKEG_MSK, (wkeg<WKCON, SYSCFG_WKCON_WKEG_MSK)>>SYSCFG_WKCON_WKEG_POSS); -} - -/** - * @brief Set Enable WKUPx pin or wakeup event - * @note 0: WKUPx pin is used for general purpose I/Os. An event on the WKUPx pin does not wakeup the device from Standby mode. - * 1: WKUPx pin is used for wakeup from Standby mode. - * @param syscfg SYSCFG Instance - * @param wken This parameter can be one of the following values: - * @arg @ref MD_SYSCFG_WKCON_WKEN_NRST - * @arg @ref MD_SYSCFG_WKCON_WKEN_PVD - * @arg @ref MD_SYSCFG_WKCON_WKEN_CMP0 - * @arg @ref MD_SYSCFG_WKCON_WKEN_RTC - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN7 - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN6 - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN5 - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN4 - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN3 - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN2 - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN1 - * @arg @ref MD_SYSCFG_WKCON_WKEN_PIN0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_wkcon_wken(SYSCFG_TypeDef *syscfg, uint32_t wken) -{ - MODIFY_REG(syscfg->WKCON, SYSCFG_WKCON_WKEN_MSK, (wken<WKCON, SYSCFG_WKCON_WKEN_MSK)>>SYSCFG_WKCON_WKEN_POSS); -} -/** - * @brief Set SYSCFG WCON register - * @param syscfg SYSCFG Instance - * @param uint32_t wcon - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_wkcon(SYSCFG_TypeDef *syscfg, uint32_t wcon) -{ - WRITE_REG(syscfg->WKCON, wcon); -} - -/** - * @brief Get Wakeup Flag - * @param syscfg SYSCFG Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_syscfg_get_wkstat_flag(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->WKSTAT, SYSCFG_WKSTAT_FLAG_MSK)>>SYSCFG_WKSTAT_FLAG_POS); -} -/** - * @brief Get WKCON pin0 or wakeup event flag. - * @note When this bit was set to 1, a wakeup event occurs. - * @param syscfg SYSCFG Instance - * @retval State of bit. - * @arg @ref MD_SYSCFG_WKSTAT_FG_NRST - * @arg @ref MD_SYSCFG_WKSTAT_FG_PVD - * @arg @ref MD_SYSCFG_WKSTAT_FG_CMP0 - * @arg @ref MD_SYSCFG_WKSTAT_FG_RTC - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN7 - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN6 - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN5 - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN4 - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN3 - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN2 - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN1 - * @arg @ref MD_SYSCFG_WKSTAT_FG_PIN0 - */ -__STATIC_INLINE uint32_t md_syscfg_get_wkstat_fg(SYSCFG_TypeDef *syscfg) -{ - return (READ_BIT(syscfg->WKSTAT, SYSCFG_WKSTAT_FG_MSK)>>SYSCFG_WKSTAT_FG_POSS); -} - - -/** - * @brief Set Backup Register 0. - * @note This field was saved in the always on block, reset by power reset. - * @param syscfg SYSCFG Instance - * @param bkreg0 This parameter can be one of the following values: - * @arg Max Value 0xFFFFFFFF - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_bkreg0(SYSCFG_TypeDef *syscfg, uint32_t bkreg0) -{ - MODIFY_REG(syscfg->BKREG0, SYSCFG_BKREG0_BKREG0_MSK, (bkreg0<BKREG0, SYSCFG_BKREG0_BKREG0_MSK)>>SYSCFG_BKREG0_BKREG0_POSS); -} - -/** - * @brief Set Backup Register 1. - * @note This field was saved in the always on block, reset by power reset. - * @param syscfg SYSCFG Instance - * @param bkreg1 This parameter can be one of the following values: - * @arg Max Value 0xFFFFFFFF - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_bkreg1(SYSCFG_TypeDef *syscfg, uint32_t bkreg1) -{ - MODIFY_REG(syscfg->BKREG1, SYSCFG_BKREG1_BKREG1_MSK, (bkreg1<BKREG1, SYSCFG_BKREG1_BKREG1_MSK)>>SYSCFG_BKREG1_BKREG1_POSS); -} - -/** - * @brief Set Backup Register 2. - * @note This field was saved in the always on block, reset by power reset. - * @param syscfg SYSCFG Instance - * @param bkreg2 This parameter can be one of the following values: - * @arg Max Value 0xFFFFFFFF - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_bkreg2(SYSCFG_TypeDef *syscfg, uint32_t bkreg2) -{ - MODIFY_REG(syscfg->BKREG2, SYSCFG_BKREG2_BKREG2_MSK, (bkreg2<BKREG2, SYSCFG_BKREG2_BKREG2_MSK)>>SYSCFG_BKREG2_BKREG2_POSS); -} - -/** - * @brief Set Backup Register 3. - * @note This field was saved in the always on block, reset by power reset. - * @param syscfg SYSCFG Instance - * @param bkreg3 This parameter can be one of the following values: - * @arg Max Value 0xFFFFFFFF - * @arg Min Value 0 - * @retval None - */ -__STATIC_INLINE void md_syscfg_set_bkreg3(SYSCFG_TypeDef *syscfg, uint32_t bkreg3) -{ - MODIFY_REG(syscfg->BKREG3, SYSCFG_BKREG3_BKREG3_MSK, (bkreg3<BKREG3, SYSCFG_BKREG3_BKREG3_MSK)>>SYSCFG_BKREG3_BKREG3_POSS); -} - -/** - * @} MD_SYSCFG_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_SYSCFG_Public_Functions SYSCFG Public Functions - * @{ - */ - -/** @defgroup MD_SYSCFG_PF_Basic_Configuration Basic Configuration - * @{ - */ - -/** - * @} MD_SYSCFG_PF_Basic_Configuration - */ - -/** @defgroup MD_SYSCFG_PF_Data_Access Data Access - * @{ - */ - -/** - * @} MD_SYSCFG_PF_Data_Access - */ - -/** @defgroup MD_SYSCFG_PF_Init Initialization and de-initialization functions - * @{ - */ - -/** - * @} MD_SYSCFG_PF_Init - */ - -/** - * @} MD_SYSCFG_Public_Functions - */ - -#endif - -/** - * @} SYSCFG - */ - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} - -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_tick.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_tick.h deleted file mode 100644 index f8570471e9..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_tick.h +++ /dev/null @@ -1,433 +0,0 @@ -/** - ****************************************************************************** - * @file md_TICK.h - * @brief ES32F0271 TICK HEAD File. - * - * @version V1.00.01 - * @date 11/20/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_TICK_H__ -#define __MD_TICK_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_tick.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (TICK) - -/** @defgroup TICK TICK - * @brief TICK micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ - -/** - * @brief MD TICK Parameter Structure definition - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_TICK_Public_Constants TICK Public Constants - * @{ - */ - -/** - * @} MD_TICK_Public_Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_TICK_Public_Macros TICK Public Macros - * @{ - */ - -/** @defgroup MD_TICK_PM_WRITE_READ Common write and read registers Macros - * @{ - */ - -/** - * @brief Write a value in TICK register - * @param __INSTANCE__ TICK Instance - * @param __REG__ Register to be written - * @param __VALUE__ Value to be written in the register - * @retval None - */ -#define MD_TICK_WRITEREG(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) - -/** - * @brief Read a value in TICK register - * @param __INSTANCE__ TICK Instance - * @param __REG__ Register to be read - * @retval Register value - */ -#define MD_TICK_READREG(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) - -/** - * @brief Modify value in TICK register - * @param __INSTANCE__ TICK Instance - * @param __REG__ Register to be written - * @param __MASK__ Mask value to be written in the register - * @param __VALUE__ Value to be written in the register - * @retval None - */ -#define MD_TICK_MODIFYREG(__INSTANCE__, __REG__, __MASK__, __VALUE__) MODIFY_REG(__INSTANCE__->__REG__, __MASK__, (__VALUE__)) - -/** - * @brief Set bit value in TICK register - * @param __INSTANCE__ TICK Instance - * @param __REG__ Register to be read - * @param __MASK__ Mask value to be set in the register - * @retval None - */ -#define MD_TICK_SET_BIT(__INSTANCE__, __REG__, __MASK__) SET_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @brief Clear bit value in TICK register - * @param __INSTANCE__ TICK Instance - * @param __REG__ Register to be read - * @param __MASK__ Mask value to be cleased in the register - * @retval None - */ -#define MD_TICK_CLEAR_BIT(__INSTANCE__, __REG__, __MASK__) CLEAR_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @brief Read bit value in TICK register - * @param __INSTANCE__ TICK Instance - * @param __REG__ Register to be read - * @param __MASK__ Mask value to be read in the register - * @retval Register bit value - */ -#define MD_TICK_READBIT(__INSTANCE__, __REG__, __MASK__) READ_BIT(__INSTANCE__->__REG__, __MASK__) - -/** - * @} MD_TICK_PM_WRITE_READ - */ - -/** @defgroup MD_TICK_Macro_Drivers TICK Public Macro Drivers - * @{ - */ - -/** - * @brief Set TICK CSR - * @param @arg Max Value 0x7 - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_tick_set_csr(uint32_t U32) -{ - MD_TICK_WRITEREG(TICK, CSR, U32); -} - -/** - * @brief Get TICK CSR - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x10007 - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_tick_get_csr(void) -{ - return (MD_TICK_READREG(TICK, CSR)); -} - -/** - * @brief Get TICK CSR Count Flag - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint8_t md_tick_is_active_csr_countflag(void) -{ - return (MD_TICK_READBIT(TICK, CSR, TICK_CSR_COUNTFLAG_MSK)>>TICK_CSR_COUNTFLAG_POS); -} - -/** - * @brief Set TICK CSR Clock Source - * @param @arg Max Value 0x1 - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_tick_set_csr_clksource(uint32_t ClkSource) -{ - MD_TICK_MODIFYREG(TICK, CSR, TICK_CSR_CLKSOURCE_MSK, (ClkSource<>TICK_CSR_CLKSOURCE_POS); -} - -/** - * @brief Enable TICK CSR Tick Interrupt - * @param None - * @retval None - */ -__STATIC_INLINE void md_tick_enable_csr_tickint(void) -{ - MD_TICK_SET_BIT(TICK, CSR, TICK_CSR_TICKINT_MSK); -} - -/** - * @brief Disable TICK CSR Tick Interrupt - * @param None - * @retval None - */ -__STATIC_INLINE void md_tick_disable_csr_tickint(void) -{ - MD_TICK_CLEAR_BIT(TICK, CSR, TICK_CSR_TICKINT_MSK); -} - -/** - * @brief is TICK CSR Tick Interrupt Enabled - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint8_t md_tick_is_enabled_csr_tickint(void) -{ - return (MD_TICK_READBIT(TICK, CSR, TICK_CSR_TICKINT_MSK)>>TICK_CSR_TICKINT_POS); -} - -/** - * @brief Enable TICK CSR Enable - * @param None - * @retval None - */ -__STATIC_INLINE void md_tick_enable_csr_enable(void) -{ - MD_TICK_SET_BIT(TICK, CSR, TICK_CSR_ENABLE_MSK); -} - -/** - * @brief Disable TICK CSR Enable - * @param None - * @retval None - */ -__STATIC_INLINE void md_tick_disable_csr_enable(void) -{ - MD_TICK_CLEAR_BIT(TICK, CSR, TICK_CSR_ENABLE_MSK); -} - -/** - * @brief is TICK CSR Enable Enabled - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint8_t md_tick_is_enabled_csr_enable(void) -{ - return (MD_TICK_READBIT(TICK, CSR, TICK_CSR_ENABLE_MSK)>>TICK_CSR_ENABLE_POS); -} - -/** - * @brief Set TICK RVR - * @param @arg Max Value 0xffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_tick_set_rvr(uint32_t U32) -{ - MD_TICK_WRITEREG(TICK, RVR, U32); -} - -/** - * @brief Get TICK RVR - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_tick_get_rvr(void) -{ - return (MD_TICK_READREG(TICK, RVR)); -} - -/** - * @brief Set TICK RVR Reload - * @param @arg Max Value 0xfffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_tick_set_rvr_reload(uint32_t Reload) -{ - MD_TICK_MODIFYREG(TICK, RVR, TICK_RVR_RELOAD_MSK, (Reload<>TICK_RVR_RELOAD_POSS); -} - -/** - * @brief Set TICK CVR - * @param @arg Max Value 0xffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_tick_set_cvr(uint32_t U32) -{ - MD_TICK_WRITEREG(TICK, CVR, U32); -} - -/** - * @brief Get TICK CVR - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_tick_get_cvr(void) -{ - return (MD_TICK_READREG(TICK, CVR)); -} - -/** - * @brief Set TICK CVR Current - * @param @arg Max Value 0xfffffff - * @arg Min Value 0x0 - * @retval None - */ -__STATIC_INLINE void md_tick_set_cvr_current(uint32_t Current) -{ - MD_TICK_MODIFYREG(TICK, CVR, TICK_CVR_CURRENT_MSK, (Current<>TICK_CVR_CURRENT_POSS); -} - -/** - * @brief Get TICK CALIB - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xffffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_tick_get_calib(void) -{ - return (MD_TICK_READREG(TICK, CALIB)); -} - -/** - * @brief Get TICK CALIB NOREF - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint8_t md_tick_get_calib_noref(void) -{ - return (MD_TICK_READBIT(TICK, CALIB, TICK_CALIB_NOREF_MSK)>>TICK_CALIB_NOREF_POS); -} - -/** - * @brief Get TICK CALIB SKEW - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0x1 - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint8_t md_tick_get_calib_skew(void) -{ - return (MD_TICK_READBIT(TICK, CALIB, TICK_CALIB_SKEW_MSK)>>TICK_CALIB_SKEW_POS); -} - -/** - * @brief Get TICK CALIB 10ms Value - * @param None - * @retval The retval can be one of the following values: - * @arg Max Value 0xfffffff - * @arg Min Value 0x0 - */ -__STATIC_INLINE uint32_t md_tick_get_calib_tenms(void) -{ - return (MD_TICK_READBIT(TICK, CALIB, TICK_CALIB_TENMS_MSK)>>TICK_CALIB_TENMS_POSS); -} - - -/** - * @} MD_TICK_Macro_Drivers - */ - -/** - * @} MD_TICK_Public_Macros - */ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_TICK_Public_Functions TICK Public Functions - * @{ - */ -void md_tick_init(void); -uint32_t md_tick_get_mscnt(void); -uint32_t md_tick_get_100uscnt(void); -uint32_t md_tick_get_10uscnt(void); -void md_tick_waitms(uint8_t Unit, uint16_t msCnt); -void md_tick_wait100us(uint16_t Unit, uint16_t usCnt); -void md_tick_wait10us(uint16_t Unit, uint16_t usCnt); -/** - * @} MD_TICK_Public_Functions - */ - -#endif - -/** - * @} TICK - */ - -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_uart.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_uart.h deleted file mode 100644 index e638ab0a7a..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_uart.h +++ /dev/null @@ -1,2874 +0,0 @@ -/** - ****************************************************************************** - * @file md_UART.h - * @brief ES32F0271 UART Header File. - * - * @version V1.00.01 - * @date 04/12/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_UART_H__ -#define __MD_UART_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include -#include "es32f0271.h" -#include "reg_uart.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (UART1) | defined (UART2) | defined (UART3) | defined (SUART1) | defined (SUART2) - -/** @defgroup UART UART - * @brief UART micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public types ---------------------------------------------------------------*/ -/** @defgroup MD_UART_Public_Types UART Public Init Type - * @{ - */ - -typedef struct -{ - uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate.*/ - - uint32_t BitOrder; /*!< Specifies the MSB of data bits will be transmitted or received first. - This parameter can be a value of @ref MD_UART_LCON_MSB_FIRST.*/ - - uint32_t Parity; /*!< Specifies the parity mode. - This parameter can be a value of @ref MD_UART_LCON_PS_EVEN.*/ - - uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. - This parameter can be a value of @ref MD_UART_LCON_STOP_1.*/ - - uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame. - This parameter can be a value of @ref MD_UART_LCON_DLS_8.*/ - -} md_uart_init_typedef; - -/** - * @} MD_UART_Public_Types - */ - -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/* Public functions -----------------------------------------------------------*/ -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_UART_Public_Constants UART Public Constants - * @{ - */ - -/** @defgroup UART_BAUDRATE UART Baudrate Definitation - * @{ - */ -#define MD_UART_BAUDRATE_1200 (1200U) /* baud rate=1200 bps */ -#define MD_UART_BAUDRATE_2400 (2400U) /* baud rate=2400 bps */ -#define MD_UART_BAUDRATE_4800 (4800U) /* baud rate=4800 bps */ -#define MD_UART_BAUDRATE_9600 (9600U) /* baud rate=9600 bps */ -#define MD_UART_BAUDRATE_19200 (19200U) /* baud rate=19200 bps */ -#define MD_UART_BAUDRATE_38400 (38400U) /* baud rate=38400 bps */ -#define MD_UART_BAUDRATE_57600 (57600U) /* baud rate=57600 bps */ -#define MD_UART_BAUDRATE_115200 (115200U) /* baud rate=115200 bps */ -#define MD_UART_BAUDRATE_230400 (230400U) /* baud rate=230400 bps */ -#define MD_UART_BAUDRATE_460800 (460800U) /* baud rate=460800 bps */ -#define MD_UART_BAUDRATE_512000 (512000U) /* baud rate=512000 bps */ -#define MD_UART_BAUDRATE_921600 (921600U) /* baud rate=921600 bps */ -/** - * @} UART_BAUDRATE UART Baudrate Definitation - */ - -/** @defgroup UART_LCON UART_LCON Register - * @{ - */ -#define MD_UART_LCON_MSB_FIRST (1U) /** @brief data Most significant bit first */ -#define MD_UART_LCON_LSB_FIRST (0U) /** @brief data Least significant bit first */ -#define MD_UART_LCON_PS_EVEN (1U) /** @brief data Even parity bit selection */ -#define MD_UART_LCON_PS_ODD (0U) /** @brief data Odd parity bit selection */ -#define MD_UART_LCON_STOP_2 (1U) /** @brief data 2(1.5) Stop bit */ -#define MD_UART_LCON_STOP_1 (0U) /** @brief data 2(1.5) Stop bit */ -#define MD_UART_LCON_DLS_8 (0U) /** @brief data Date length 8 */ -#define MD_UART_LCON_DLS_7 (1U) /** @brief data Date length 7 */ -#define MD_UART_LCON_DLS_6 (2U) /** @brief data Date length 6 */ -#define MD_UART_LCON_DLS_5 (3U) /** @brief data Date length 5 */ -/** - * @} UART_LCON UART_LCON Register - */ - -/** @defgroup UART_MCON UART_MCON Register - * @{ - */ -#define MD_UART_MCON_ABRMOD_0 (0U) /** @brief data Receiver DMA disable */ -#define MD_UART_MCON_ABRMOD_1 (1U) /** @brief data Repeat auto-baud rate detection after timeout enable */ -#define MD_UART_MCON_ABRMOD_2 (2U) /** @brief data Repeat auto-baud rate detection after timeout disable */ -#define MD_UART_MCON_RTSSET_LOW (1U) /** @brief data RTSn set control bit RTSn level is 0 */ -#define MD_UART_MCON_RTSSET_HIGH (0U) /** @brief data RTSn set control bit RTSn level is 1 */ -/** - * @} UART_MCON UART_MCON Register - */ - -/** @defgroup UART_MCON UART_MCON Register - * @{ - */ -#define MD_UART_RS485_AADINV_LOW (0U) /** @brief data Low : Transfering data, High: Idle */ -#define MD_UART_RS485_AADINV_HIGH (1U) /** @brief data High: Transfering data, Low : Idle */ -/** - * @} UART_MCON UART_MCON Register - */ - -/** @defgroup UART_FCON UART_FCON Register - * @{ - */ -#define MD_UART_FCON_TXTH_0 (0U) /** @brief data Transmit FIFO trigger threshold: FIFO empty */ -#define MD_UART_FCON_TXTH_2 (1U) /** @brief data Transmit FIFO trigger threshold: 2 characters in the FIFO */ -#define MD_UART_FCON_TXTH_4 (2U) /** @brief data Transmit FIFO trigger threshold: 4 characters in the FIFO */ -#define MD_UART_FCON_TXTH_8 (3U) /** @brief data Transmit FIFO trigger threshold: 8 characters in the FIFO */ -#define MD_UART_FCON_TFRST (1U) /** @brief data Transmitter FIFO reset */ -#define MD_UART_FCON_RXTH_1 (0U) /** @brief data Receive FIFO trigger threshold: 1 character in the FIFO */ -#define MD_UART_FCON_RXTH_4 (1U) /** @brief data Receive FIFO trigger threshold: 4 characters in the FIFO */ -#define MD_UART_FCON_RXTH_8 (2U) /** @brief data Receive FIFO trigger threshold: 8 characters in the FIFO */ -#define MD_UART_FCON_RXTH_14 (3U) /** @brief data Receive FIFO trigger threshold: 14 characters in the FIFO */ -#define MD_UART_FCON_RFRST (1U) /** @brief data Receive FIFO reset */ -/** - * @} UART_FCON UART_FCON Register - */ - -/** - * @} MD_UART_Public_Constants UART Public Constants - */ - -/* Public macro ---------------------------------------------------------------*/ -/** @defgroup MD_UART_Public_Macros UART Public Macros - * @{ - */ - -/** - * @brief Read Receiver Buffer Register - * @note Contains the received data character. - * The RXBR register provides the parallel interface between the - * input shift register and the internal bus. - * When receiving with the parity enabled, the value read in the - * MSB bit is the received parity bit. - * @param UARTx UART Instance - * @retval RxData Value between Min_Data=0x00 and Max_Data=0x1FF - */ -__STATIC_INLINE uint16_t md_uart_get_rxbuf(UART_TypeDef *UARTx) -{ - return (uint16_t) ((READ_REG(UARTx->RXBUF))>>UART_RXBUF_RXBUF_POSS); -} - -/** - * @brief Write Transmit buffer register - * @note Contains the data character to be transmitted. - * The TXBR register provides the parallel interface between the - * internal bus and the output shift register. - * When transmitting with the parity enabled the value written in - * the MSB (bit 7 or bit 8 depending on the data length) has no - * effect because it is replaced by the parity. - * @param UARTx UART Instance - * @param TxData Value between Min_Data=0x00 and Max_Data=0xFF - * @retval None - */ -__STATIC_INLINE void md_uart_send_txbuf(UART_TypeDef *UARTx, uint8_t TxData) -{ - WRITE_REG (UARTx->TXBUF, (uint8_t)TxData); -} - -/** - * @brief Set UARTx Baud rate register. - * @note This bits can only be written when the UART is disabled. - * (RXEN and TXEN=0 in the LCR register). - * @param UARTx UART Instance. - * @param UART buad rate value. - * @retval None - */ -__STATIC_INLINE void md_uart_set_brr(UART_TypeDef *UARTx, uint32_t baudrate) -{ - WRITE_REG(UARTx->BRR, baudrate); -} - -/** - * @brief Get UARTx baud rate. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @retval UARTx Baudrate. - */ -__STATIC_INLINE uint32_t md_uart_get_brr(UART_TypeDef *UARTx) -{ - return (uint32_t) (READ_REG(UARTx->BRR)>>UART_BRR_BRR_POSS); -} - -/** - * @brief UARTx Transmitter enable. - * @note This bit enables the transmitter. It is set and cleared by - * software. - * @param UARTx UART Instance - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lcon_txen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_TXEN_MSK); -} - -/** - * @brief UARTx Transmitter disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lcon_txen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_TXEN_MSK); -} - -/** - * @brief Check if UART Transmitter is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_tx(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_TXEN_MSK) == (UART_LCON_TXEN_MSK)); -} - -/** - * @brief UARTx Receiver enable - * @note This bit enables the receiver. It is set and cleared by software. - * @param UARTx UART Instance - * @retval None - */ -__STATIC_INLINE void md_uart_enable_lcon_rxen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_RXEN_MSK); -} - -/** - * @brief UARTx Receiver Disable - * @param UARTx UART Instance - * @retval None - */ -__STATIC_INLINE void md_uart_disable_lcon_rxen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_RXEN_MSK); -} - -/** - * @brief Check if UARTx Receiver is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_rxen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_RXEN_MSK) == (UART_LCON_RXEN_MSK)); -} - -/** - * @brief UARTx Debounce Enable. - * @note This bit enables the debounce. It is set and cleared by software. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lcon_decen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_DBCEN_MSK); -} - -/** - * @brief UART Debounce Disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lcon_dbcen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_DBCEN_MSK); -} - -/** - * @brief Check if UART Debounce is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_dbcen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_DBCEN_MSK) == (UART_LCON_DBCEN_MSK)); -} - -/** - * @brief Enable UARTx Break control bit. - * @note This is used to cause a break condition to be transmitted to the - * receiving device. The serial data output (Tx) is forced to the - * Spacing State (logic 0). - * This bit can only be written when the UART is disabled. - * (RXENand TXEN=0). - * @param UARTx UART Instance - * @retval None - */ -__STATIC_INLINE void md_uart_enable_lcon_break(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_BREAK_MSK); -} - -/** - * @brief Disable UARTx Break control bit. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lcon_break(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_BREAK_MSK); -} - -/** - * @brief Check if UARTx Break control bit is enabled. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_break(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_BREAK_MSK) == (UART_LCON_BREAK_MSK)); -} - -/** - * @brief UARTx Swap TX/RX pins. - * @note This allows to work in the case of a cross-wired connection to another UART. - * This bit can only be written when the UART is disabled (RXEN and TXEN=0). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lcon_swap(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_SWAP_MSK); -} - -/** - * @brief UARTx Swap TX/RX pins disabl. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_disable_lcon_swap(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_SWAP_MSK); -} - -/** - * @brief Check if UART Swap TX/RX pins is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_swap(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_SWAP_MSK) == (UART_LCON_SWAP_MSK)); -} - -/** - * @brief UARTx TX pin active level inversion. - * @note This allows the use of an external inverter on the TX line. - * This bit can only be written when the UART is disabled (RXEN and TXEN=0). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lcon_txinv(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_TXINV_MSK); -} - -/** - * @brief UARTx TX pin active level inversion disable. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lcon_txinv(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_TXINV_MSK); -} - -/** - * @brief Check if UARTx TX pin active level is inverted. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_txinv(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_TXINV_MSK) == (UART_LCON_TXINV_MSK)); -} - -/** - * @brief UARTx RX pin active level inversion. - * @note This allows the use of an external inverter on the RX line. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lcon_rxinv(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_RXINV_MSK); -} - -/** - * @brief UARTx RX pin active level inversion disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lcon_rxinv(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_RXINV_MSK); -} - -/** - * @brief Check if UART RX pin active level is inverted. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_rxinv(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_RXINV_MSK) == (UART_LCON_RXINV_MSK)); -} - -/** - * @brief UARTx Binary data inversion. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * The parity bit is also inverted. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lcon_datainv(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_RXINV_MSK); -} - -/** - * @brief UARTx Binary data inverted disable. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lcon_datainv(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_RXINV_MSK); -} - -/** - * @brief Check if UARTx Binary data is inverted. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_datainv(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_DATAINV_MSK) == (UART_LCON_DATAINV_MSK)); -} - -/** - * @brief Set UARTx Most significant bit first. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @param msb This parameter can be one of the following values: - * @arg @ref MD_UART_LCON_LSB_FIRST - * @arg @ref MD_UART_LCON_MSB_FIRST - * @retval None - */ -__STATIC_INLINE void md_uart_set_lcon_msb(UART_TypeDef *UARTx, uint32_t msb) -{ - MODIFY_REG(UARTx->LCON, UART_LCON_MSB_MSK, msb<LCON, UART_LCON_MSB_MSK))>>UART_LCON_MSB_POS); -} - -/** - * @brief UARTx Parity bit selection. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @param parity This parameter can be one of the following values: - * @arg @ref MD_UART_LCON_PS_ODD - * @arg @ref MD_UART_LCON_PS_EVEN - * @retval None - */ -__STATIC_INLINE void md_uart_set_lcon_ps(UART_TypeDef *UARTx, uint32_t parity) -{ - MODIFY_REG(UARTx->LCON, UART_LCON_PS_MSK, parity<LCON, UART_LCON_PS_MSK))>>UART_LCON_PS_POS); -} - -/** - * @brief UARTx Parity enable. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lcon_pe(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_LCON_PE_MSK); -} - -/** - * @brief UARTx Parity disable. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lcon_pe(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_LCON_PE_MSK); -} - -/** - * @brief Check if UARTx Parity is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lcon_pe(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LCON, UART_LCON_PE_MSK) == (UART_LCON_PE_MSK)); -} - -/** - * @brief Set UARTx Stop bit. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0) - * @param UARTx UART Instance. - * @param stop This parameter can be one of the following values: - * @arg @ref MD_UART_LCON_STOP_1 - * @arg @ref MD_UART_LCON_STOP_2 - * @retval None - */ -__STATIC_INLINE void md_uart_set_lcon_stop(UART_TypeDef *UARTx, uint32_t stop) -{ - MODIFY_REG(UARTx->LCON, UART_LCON_STOP_MSK, stop<LCON, UART_LCON_STOP_MSK))>>UART_LCON_STOP_POS); -} - -/** - * @brief UARTx Date length selection. - * @note This bit can only be written when UART is disabled(TXEN and RXEN=0). - * @param UARTx UART Instance. - * @param width This parameter can be one of the following values: - * @arg @ref MD_UART_LCON_DLS_8 - * @arg @ref MD_UART_LCON_DLS_7 - * @arg @ref MD_UART_LCON_DLS_6 - * @arg @ref MD_UART_LCON_DLS_5 - * @retval None - */ -__STATIC_INLINE void md_uart_set_lcon_dls(UART_TypeDef *UARTx, uint32_t width) -{ - MODIFY_REG(UARTx->LCON, UART_LCON_DLS_MSK, width<LCON, UART_LCON_DLS_MSK))>>UART_LCON_DLS_POSS); -} - -/** - * @brief UARTx Transmitter DMA enable. - * @note This bit is set and cleared by software. This bit enables the DMA transmitter. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_txdmaen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->MCON, UART_MCON_TXDMAEN_MSK); -} - -/** - * @brief UARTx Transmitter DMA enable disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_txdmaen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->MCON, UART_MCON_TXDMAEN_MSK); -} - -/** - * @brief Check if UARTx Transmitter DMA is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_txdmaen(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->MCON, UART_MCON_TXDMAEN_MSK) == (UART_MCON_TXDMAEN_MSK)); -} - -/** - * @brief UARTx Receiver DMA enable. - * @note This bit is set and cleared by software. This bit enables the DMA Receiver. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_rxdmaen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->MCON, UART_MCON_RXDMAEN_MSK); -} - -/** - * @brief UARTx Receiver DMA disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_rxdmaen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->MCON, UART_MCON_RXDMAEN_MSK); -} - -/** - * @brief Check if UARTx UARTx Receiver DMA is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_rxdmaen(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->MCON, UART_MCON_RXDMAEN_MSK) == (UART_MCON_RXDMAEN_MSK)); -} - -/** - * @brief UARTx Auto baud rate detection repeat enable. - * @note This bit is set to enable baud rate detection repeat one more time - * after the first failure of auto-baud rate detection. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_abrrept(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_MCON_ABRREPT_MSK); -} - -/** - * @brief UARTx Auto baud rate detection repeat disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_abrrept(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_MCON_ABRREPT_MSK); -} - -/** - * @brief Check if UARTx Auto baud rate detection repeat is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_abrrept(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->MCON, UART_MCON_ABRREPT_MSK) == (UART_MCON_ABRREPT_MSK)); -} - -/** - * @brief Set UARTx Auto baud rate mode. - * @note MD_UART_MCON_ABRMOD_0: Mode 0 detect falling edge to second falling edge (detect 2 Bps). - * MD_UART_MCON_ABRMOD_1: Mode 1 detect falling edge to first rising edge (detect 1 Bps). - * MD_UART_MCON_ABRMOD_2: Mode 2 detect falling edge to first rising edge (detect 2 Bps). - * @param UARTx UART Instance. - * @param mode This parameter can be one of the following values: - * @arg @ref MD_UART_MCON_ABRMOD_0 - * @arg @ref MD_UART_MCON_ABRMOD_1 - * @arg @ref MD_UART_MCON_ABRMOD_2 - * @retval None - */ -__STATIC_INLINE void md_uart_set_mcon_abrmod(UART_TypeDef *UARTx, uint32_t mode) -{ - MODIFY_REG(UARTx->MCON, UART_MCON_ABRMOD_MSK, mode<MCON, UART_MCON_ABRMOD_MSK))>>UART_MCON_ABRMOD_POSS); -} - -/** - * @brief UARTx Auto baud rate enable. - * @note This bit is set by software and cleared by hardware after the - * auto-baud rate finish. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_abren(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LCON, UART_MCON_ABREN_MSK); -} - -/** - * @brief UARTx Auto baud rate disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_abren(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LCON, UART_MCON_ABREN_MSK); -} - -/** - * @brief Check if UARTx Auto baud rate is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_abren(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->MCON, UART_MCON_ABREN_MSK) == (UART_MCON_ABREN_MSK)); -} - -/** - * @brief UARTx break request enable. - * @note This bit is set by software and automatically cleared by - * hardware in the next clock cycle. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_bkreq(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->MCON, UART_MCON_BKREQ_MSK); -} - -/** - * @brief UARTx break request disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_bkreq(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->MCON, UART_MCON_BKREQ_MSK); -} - -/** - * @brief Check if UARTx break request is enabled - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_bkreq(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->MCON, UART_MCON_BKREQ_MSK) == (UART_MCON_BKREQ_MSK)); -} - -/** - * @brief UARTx Half-duplex enable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_hden(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->MCON, UART_MCON_HDEN_MSK); -} - -/** - * @brief UARTx Half-duplex disable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_hden(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->MCON, UART_MCON_HDEN_MSK); -} - -/** - * @brief Check if UARTx Half-duplex is enabled. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_hden(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->MCON, UART_MCON_HDEN_MSK) == (UART_MCON_HDEN_MSK)); -} - -/** - * @brief UARTx IrDA mode enable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_iren(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->MCON, UART_MCON_IREN_MSK); -} - -/** - * @brief UARTx IrDA mode disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_iren(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->MCON, UART_MCON_IREN_MSK); -} - -/** - * @brief Check if UARTx IrDA mode is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_iren(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->MCON, UART_MCON_IREN_MSK) == (UART_MCON_IREN_MSK)); -} - -/** - * @brief UARTx Auto flow control enable. - * @param UARTx UART Instance - * @retval None - */ -__STATIC_INLINE void md_uart_enable_mcon_afcen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->MCON, UART_MCON_AFCEN_MSK); -} - -/** - * @brief UARTx Auto flow control disable. - * @param UARTx UART Instance - * @retval None - */ -__STATIC_INLINE void md_uart_disable_mcon_afcen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->MCON, UART_MCON_AFCEN_MSK); -} - -/** - * @brief Check if Auto flow control is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_mcon_afcen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->MCON, UART_MCON_AFCEN_MSK) == (UART_MCON_AFCEN_MSK)); -} - -/** - * @brief Set UARTx RTSn set control bit. - * @note If Auto flow control disable, user can control RTSn output level by this bit. - * MD_UART_MCON_RTSSET_LOW : RTSn level is 0 - * MD_UART_MCON_RTSSET_HIGH: RTSn level is 1 - * @param UARTx UART Instance. - * @param This parameter can be one of the following values: - * @arg @ref MD_UART_MCON_RTSSET_LOW - * @arg @ref MD_UART_MCON_RTSSET_HIGH - * @retval None - */ -__STATIC_INLINE void md_uart_set_mcon_rtsset(UART_TypeDef *UARTx, uint32_t level) -{ - MODIFY_REG(UARTx->MCON, UART_MCON_RTSSET_MSK, level<MCON, UART_MCON_RTSSET_MSK))>>UART_MCON_RTSSET_POS); -} - -/** - * @brief UARTx LoopBack enable. - * @note This is used to put the UART into a diagnostic mode for test purpose. - * If operating in UART mode, data on the TXD line is held high, - * while serial data output is looped back to the RXD line, internally. - * In this mode, all the interrupts are fully functional. - * If operating in infrared mode, data on the TXD with IrDA line is held low, - * while serial data output is inverted and looped back to the RXD line. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_mcon_lpbken(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->MCON, UART_MCON_LPBKEN_MSK); -} - -/** - * @brief UARTx LoopBack disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_mcon_lpbken(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->MCON, UART_MCON_LPBKEN_MSK); -} - -/** - * @brief Check if UARTx LoopBack is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lpbken(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->MCON, UART_MCON_LPBKEN_MSK) == (UART_MCON_LPBKEN_MSK)); -} - -/** - * @brief Set UARTx Delay value. - * @note Contains a direction control RTSn Delay value. This register - * works in conjunction with an 8-bit counter in terms of number of - * DIVISOR bit duration. - * @param UARTx UART Instance. - * @param UARTx Delay value. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_rs485_dly(UART_TypeDef *UARTx, uint32_t delay) -{ - MODIFY_REG(UARTx->RS485, UART_RS485_DLY_MSK, delay<RS485, UART_RS485_DLY_MSK))>>UART_RS485_DLY_POSS); -} - -/** - * @brief Set UARTx Address match value. - * @param UARTx UART Instance. - * @param UARTx Address match value. - * @retval None - */ -__STATIC_INLINE void md_uart_set_rs485_addr(UART_TypeDef *UARTx, uint32_t address) -{ - MODIFY_REG(UARTx->RS485, UART_RS485_ADDR_MSK, address<RS485, UART_RS485_ADDR_MSK))>>UART_RS485_ADDR_POSS); -} - -/** - * @brief Set UARTx Automatic address detection invert. - * @note This bit retains the DE(RTSn) polarity direction control signal on pin. - * @param UARTx UART Instance. - * @param aadinv can be one of the following value: - * @arg @ref MD_UART_RS485_AADINV_LOW (Low : Transfering data, High: Idle) - * @arg @ref MD_UART_RS485_AADINV_HIGH (High: Transfering data, Low : Idle) - * @retval None - */ -__STATIC_INLINE void md_uart_set_rs485_aadinv(UART_TypeDef *UARTx, uint32_t aadinv) -{ - MODIFY_REG(UARTx->RS485, UART_RS485_AADINV_MSK, aadinv<RS485, UART_RS485_AADINV_MSK))>>UART_RS485_AADINV_POS); -} - -/** - * @brief UARTx Automatic address detection auto-control enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_rs485_aadacen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->RS485, UART_RS485_AADACEN_MSK); -} - -/** - * @brief UARTx Automatic address detection auto-control disable - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_rs485_aadacen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->RS485, UART_RS485_AADACEN_MSK); -} - -/** - * @brief Check if UARTx Automatic address detection auto-control is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_rs485_aadacen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->RS485, UART_RS485_AADACEN_MSK) == (UART_RS485_AADACEN_MSK)); -} - -/** - * @brief UARTx Automatic address detection normal mode enable. - * @note Note that it can be active with RS-485 AAD operation mode. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_rs485_aadnen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->RS485, UART_RS485_AADNEN_MSK); -} - -/** - * @brief UARTx Automatic address detection normal mode disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_rs485_aadnen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->RS485, UART_RS485_AADNEN_MSK); -} - -/** - * @brief Check if Automatic address detection normal mode is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_rs485_aadnen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->RS485, UART_RS485_AADNEN_MSK) == (UART_RS485_AADNEN_MSK)); -} - -/** - * @brief UARTx Automatic address detection operation mode enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_rs485_aaden(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->RS485, UART_RS485_AADEN_MSK); -} - -/** - * @brief UARTx Automatic address detection operation mode disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_rs485_aaden(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->RS485, UART_RS485_AADEN_MSK); -} - -/** - * @brief Check if UARTx Automatic address detection operation mode is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_rs485_aaden(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->RS485, UART_RS485_AADEN_MSK) == (UART_RS485_AADEN_MSK)); -} - -/** - * @brief Set UARTx Block Length (Only UART). - * @note This bit-field gives the Block length in Smartcard T=1 - * Reception. Its value equals the number of information - * characters + the length of the Epilogue Field (1-LEC/2-CRC) - 1. - * This bit-field can be used also in other modes. In this case, the - * Block length counter is reset when RXEN=0 (receiver disabled). - * @param UARTx UART Instance. - * @param Block Length. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_scard_blen(UART_TypeDef *UARTx, uint32_t blocklength) -{ - MODIFY_REG(UARTx->SCARD, UART_SCARD_BLEN_MSK, blocklength<SCARD, UART_SCARD_BLEN_MSK))>>UART_SCARD_BLEN_POSS); -} - -/** - * @brief Set UARTx Guard time value(Only UART). - * @param UARTx UART Instance. - * @param Guard time value. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_scard_gt(UART_TypeDef *UARTx, uint32_t guardtime) -{ - MODIFY_REG(UARTx->SCARD, UART_SCARD_GT_MSK, guardtime<SCARD, UART_SCARD_GT_MSK))>>UART_SCARD_GT_POSS); -} - -/** - * @brief Set UARTx Prescaler value (Only UART). - * @note In IrDA Low-power and normal IrDA mode: - * Used for programming the prescaler for dividing the UART - * source clock to achieve the low-power frequency. - * The source clock is divided by the value given in the register (8 - * significant bits) - * In Smartcard mode: - * Used for programming the prescaler for dividing the UART - * source clock to provide the Smartcard clock. - * The value given in the register (5 significant bits) is multiplied by - * 2 to give the division factor of the source clock frequency. - * @param UARTx UART Instance. - * @param Prescaler value. - * @retval None - */ -__STATIC_INLINE void md_uart_set_scard_psc(UART_TypeDef *UARTx, uint32_t prescaler) -{ - MODIFY_REG(UARTx->SCARD, UART_SCARD_PSC_MSK, prescaler<SCARD, UART_SCARD_PSC_MSK))>>UART_SCARD_PSC_POSS); -} - -/** - * @brief Set UARTx Smartcard auto-retry count (Only UART). - * @note This bit-field specifies the number of retries in transmit and - * receive, in Smartcard mode. - * In transmission mode, it specifies the number of automatic - * retransmission retries, before generating a transmission error - * (FE bit set). - * In reception mode, it specifies the number or erroneous - * reception trials, before generating a reception error (RXNE and - * PE bits set). - * @param UARTx UART Instance. - * @param smartcard auto-retry count Min_Value=0x00 Max_Value=0x07. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_scard_sccnt(UART_TypeDef *UARTx, uint32_t count) -{ - MODIFY_REG(UARTx->SCARD, UART_SCARD_SCCNT_MSK, count<SCARD, UART_SCARD_SCCNT_MSK))>>UART_SCARD_SCCNT_POSS); -} - -/** - * @brief Smartcard clock enable(Only UART). - * @note This bit allows the user to enable the SCK pin. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_scard_sclken(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->SCARD, UART_SCARD_SCLKEN_MSK); -} - -/** - * @brief Smartcard clock disable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_scard_sclken(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->SCARD, UART_SCARD_SCLKEN_MSK); -} - -/** - * @brief Check if Smartcard clock is enable. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_scard_sclken(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->SCARD, UART_SCARD_SCLKEN_MSK) == (UART_SCARD_SCLKEN_MSK)); -} - -/** - * @brief Smartcard NACK enable(Only UART). - * @note This bit allows the user to enable nack detection. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_scard_scnack(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->SCARD, UART_SCARD_SCNACK_MSK); -} - -/** - * @brief Smartcard NACK disable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_scard_scnack(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->SCARD, UART_SCARD_SCNACK_MSK); -} - -/** - * @brief Check if Smartcard NACK is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_scard_scnack(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->SCARD, UART_SCARD_SCNACK_MSK) == (UART_SCARD_SCNACK_MSK)); -} - -/** - * @brief Smartcard mode enable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_scard_scen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->SCARD, UART_SCARD_SCEN_MSK); -} - -/** - * @brief Smartcard mode disable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_scard_scen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->SCARD, UART_SCARD_SCEN_MSK); -} - -/** - * @brief Check if Smartcard mode is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_scard_scen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->SCARD, UART_SCARD_SCEN_MSK) == (UART_SCARD_SCEN_MSK)); -} - -/** - * @brief Enable LIN mode break request. - * @note This bit is set by software and automatically cleared by - * hardware in the next clock cycle. - * Writing 1 to this bit sets request to send a BREAK on the line, as - * soon as the transmit machine is available. - * It generates 13 bits rate low pulse in Lin mode. - * @param UARTx UART Instance - * @retval None - */ -__STATIC_INLINE void md_uart_enable_lin_linbkreq(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LIN, UART_LIN_LINBKREQ_MSK); -} - -/** - * @brief Disable LIN mode break request. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_linbkreq(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LIN, UART_LIN_LINBKREQ_MSK); -} - -/** - * @brief Check if LIN break is enabled - * @param None - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enable_linbkreq(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->LIN, UART_LIN_LINBKREQ_MSK) == (UART_LIN_LINBKREQ_MSK)); -} - -/** - * @brief UARTx LIN mode enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_lin_linen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->LIN, UART_LIN_LINEN_MSK); -} - -/** - * @brief UART LIN mode disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_lin_linen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->LIN, UART_LIN_LINEN_MSK); -} - -/** - * @brief Check if UARTx LIN mode is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_lin_linen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->LIN, UART_LIN_LINEN_MSK) == (UART_LIN_LINEN_MSK)); -} - -/** - * @brief UARTx receive timeout enable. - * @note When this feature is enabled, the RTOIF flag in the UART_RIF - * register is set if the RX line is idle (no reception) for the duration - * programmed in the RTOR (receiver timeout register). - * @param UARTx UART Instance - * @retval None - */ -__STATIC_INLINE void md_uart_enable_rtor_rtoen(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->RTOR, UART_RTOR_RTOEN_MSK); -} - -/** - * @brief UARTx receive timeout disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_rtor_rtoen(UART_TypeDef *UARTx) -{ - CLEAR_BIT(UARTx->RTOR, UART_RTOR_RTOEN_MSK); -} - -/** - * @brief Check if UARTx receive timeout is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_rtor_rtoen(UART_TypeDef *UARTx) -{ - return (uint32_t)(READ_BIT(UARTx->RTOR, UART_RTOR_RTOEN_MSK) == (UART_RTOR_RTOEN_MSK)); -} - -/** - * @brief Set UARTx receiver timeout value. - * @note This bit-field gives the Receiver timeout value in terms of number of bit duration. - * In standard mode: - * the RTOF flag is set if, after the last received character, - * no new start bit is detected for more than the RTO value. - * In Smartcard mode: - * this value is used to implement the CWT and BWT. See Smartcard section for more details. - * In this case, the timeout measurement is done starting from the Stop Bit of the last - * received character. - * @param UARTx UART Instance. - * @param timeout UART timeout value. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_rtor_rto(UART_TypeDef *UARTx, uint32_t timeout) -{ - MODIFY_REG(UARTx->RTOR, UART_RTOR_RTO_MSK, timeout<RTOR, UART_RTOR_RTO_MSK))>>UART_RTOR_RTO_POSS); -} - -/** - * @brief Set UARTx Transmit FIFO level. - * @note This is used to indicate the number of data entries in the Transmit FIFO. - * It's value from 0 to 16. - * @param UARTx UART Instance. - * @param Value between Min_Data=0x00 and Max_Data=0x010. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_fcon_txfl(UART_TypeDef *UARTx, uint32_t level) -{ - MODIFY_REG(UARTx->FCON, UART_FCON_TXFL_MSK, level<FCON, UART_FCON_TXFL_MSK))>>UART_FCON_TXFL_POSS); -} - -/** - * @brief Set UARTx Transmit FIFO trigger threshold. - * @note This is used to select the threshold level in the transmit FIFO at - * which the Transmit FIFO trigger threshold flag is generated. - * @param UARTx UART Instance - * @param level This parameter can be one of the following values: - * @arg @ref MD_UART_FCON_TXTH_0 - * @arg @ref MD_UART_FCON_TXTH_2 - * @arg @ref MD_UART_FCON_TXTH_4 - * @arg @ref MD_UART_FCON_TXTH_8 - * @retval None - */ -__STATIC_INLINE void md_uart_set_fcon_txth(UART_TypeDef *UARTx, uint32_t level) -{ - MODIFY_REG(UARTx->FCON, UART_FCON_TXTH_MSK, level<FCON, UART_FCON_TXTH_MSK))>>UART_FCON_TXTH_POSS); -} - -/** - * @brief Transmit FIFO reset. - * @note When FIFO is set, all the byte in the transmit FIFO are cleared - * and treats the FIFO as empty. Note that this bit will return to 0 in - * the next clock cycle. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_fcon_tfrst(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->FCON, UART_FCON_TFRST_MSK); -} - -/** - * @brief Set UARTx Receive FIFO level. - * @note This bit is set by hardware. This is used to indicate the number - * of data entries in the Receive FIFO. It's value from 0 to 16. - * @param UARTx UART Instance. - * @param Value between Min_Data=0x00 and Max_Data=0x010. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_fcon_rxfl(UART_TypeDef *UARTx, uint32_t level) -{ - MODIFY_REG(UARTx->FCON, UART_FCON_RXFL_MSK, level<FCON, UART_FCON_RXFL_MSK))>>UART_FCON_TXFL_POSS); -} - -/** - * @brief Set UARTx Receive FIFO trigger threshold. - * @note This is used to select the threshold level in the receiver FIFO at - * which the Receive FIFO trigger threshold flag is generated. - * @param UARTx UART Instance. - * @param level This parameter can be one of the following values: - * @arg @ref MD_UART_FCON_RXTH_1 - * @arg @ref MD_UART_FCON_RXTH_4 - * @arg @ref MD_UART_FCON_RXTH_8 - * @arg @ref MD_UART_FCON_RXTH_14 - * @retval None - */ -__STATIC_INLINE void md_uart_set_fcon_rxth(UART_TypeDef *UARTx, uint32_t level) -{ - MODIFY_REG(UARTx->FCON, UART_FCON_RXTH_MSK, level<FCON, UART_FCON_RXTH_MSK))>>UART_FCON_RXTH_POSS); -} - -/** - * @brief Receive FIFO reset - * @note When FIFO is set, all the byte in the receiver FIFO are cleared - * and treats the FIFO as empty. Note that this bit will return to 0 in - * the next clock cycle. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_set_fcon_rfrst(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->FCON, UART_FCON_RFRST_MSK); -} - -/** - * @brief Check if Transmit FIFO overrun error. - * @note This bit is set and cleared by hardware Tx line start transmit - * data. An overrun error occurs when the FIFO is full and a new - * character write at the Transmit. The data in the FIFO is retained - * and the data in the TXBR register is lost. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_tfoerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_TFOERR_MSK) == (UART_STAT_TFOERR_MSK)); -} - -/** - * @brief Check if Transmit FIFO full. - * @note This bit is set and cleared by hardware when the TX FIFO is no - * longer full. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_tffull(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_TFFULL_MSK) == (UART_STAT_TFFULL_MSK)); -} - -/** - * @brief Check if Transmit FIFO empty. - * @note This bit is set and cleared by hardware when the TX FIFO is no - * longer empty. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_tfempty(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_TFEMPTY_MSK) == (UART_STAT_TFEMPTY_MSK)); -} - -/** - * @brief Check if Transmit FIFO trigger threshold flag. - * @note This bit is set and cleared by hardware when transmit FIFO - * arrived threshold level in the FCR register. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_tfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_TFTH_MSK) == (UART_STAT_TFTH_MSK)); -} - -/** - * @brief Check if Transmit shift register busy. - * @note This bit is cleared by hardware. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_tsbsy(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_TSBUSY_MSK) == (UART_STAT_TSBUSY_MSK)); -} - -/** - * @brief Check if Receive FIFO underrun error. - * @note This bit is set and cleared by hardware when receive a new - * data. An underrun error occurs when the FIFO is empty at the - * receive. The data in the FIFO is read 0 in the RXBR register. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_rfuerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_RFUERR_MSK) == (UART_STAT_RFUERR_MSK)); -} - -/** - * @brief Check if Receive FIFO overrun error. - * @note This bit is set and cleared by hardware when read data in the - * RXBR register. An overrun error occurs when the FIFO is full - * and a new character arrives at the receiver. The data in the - * FIFO is retained and the data in the RXBR register is lost. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_rfoerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_RFOERR_MSK) == (UART_STAT_RFOERR_MSK)); -} - -/** - * @brief Check if Receive FIFO full. - * @note This bit is set and cleared by hardware when the RX FIFO is no - * longer full. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_rffull(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_RFFULL_MSK) == (UART_STAT_RFFULL_MSK)); -} - -/** - * @brief Check if Receive FIFO empty. - * @note This bit is cleared when the RX FIFO is no longer empty. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_rfempty(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_RFEMPTY_MSK) == (UART_STAT_RFEMPTY_MSK)); -} - -/** - * @brief Check if Receive FIFO trigger threshold flag. - * @note This bit is set and cleared by hardware when receive FIFO - * arrived threshold level in the FCR register. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_rfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_RFTH_MSK) == (UART_STAT_RFTH_MSK)); -} - -/** - * @brief Check if Receive shiftregister busy. - * @note This bit is set and cleared by hardware. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_rsbsy(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_RSBUSY_MSK) == (UART_STAT_RSBUSY_MSK)); -} - -/** - * @brief Get UARTx Clear to send status. - * @note This bit is the complement of CTSn. When CTSn is asserted, it - * is an indication that the modem or data set is ready to exchange - * data with UART. - * @param ADCx ADC Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_get_stat_ctssta(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_CTSSTA_MSK)>>UART_STAT_CTSSTA_POS); -} - -/** - * @brief Check if Break error. - * @note This bit is used to indicate the detection of a break sequence on - * the serial input data. - * This error is associated with the character at the top of the FIFO. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_bkerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_BKERR_MSK) == (UART_STAT_BKERR_MSK)); -} - -/** - * @brief Check if Framing Error. - * @note When the received characters stop bit is a logic 0(i.e. the - * receiver did not have a valid stop bit), a framing error occurs. - * This error is associated with the character at the top of the FIFO. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_ferr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_FERR_MSK) == (UART_STAT_FERR_MSK)); -} - -/** - * @brief Check if Parity Error. - * @note When the receive character does not have correct parity - * information and is suspect, a parity error occurs. - * This error is associated with the character at the top of the FIFO. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_stat_perr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->STAT, UART_STAT_PERR_MSK) == (UART_STAT_PERR_MSK)); -} - -/** - * @brief Transmit FIFO overrun interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_tfover(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_TFOVER_MSK); -} - -/** - * @brief Transmit FIFO empty interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_tfempty(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_TFEMPTY_MSK); -} - -/** - * @brief Transmit FIFO trigger threshold interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_tfth(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_TFTH_MSK); -} - -/** - * @brief Transmission byte complete enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_tbc(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_TBC_MSK); -} - -/** - * @brief Receive FIFO underrun interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_rfuerr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_RFUERR_MSK); -} - -/** - * @brief Receive FIFO overrun interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_rfoerr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_RFOERR_MSK); -} - -/** - * @brief Receive FIFO full interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_rffull(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_RFFULL_MSK); -} - -/** - * @brief Receive FIFO trigger threshold interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_rfth(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_RFTH_MSK); -} - -/** - * @brief Bit Noise detection enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_noise(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_NOISE_MSK); -} - -/** - * @brief End of block interrupt enable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_eob(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_EOB_MSK); -} - -/** - * @brief LINBK: LIN break detection interrupt enable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_linbk(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_LINBK_MSK); -} - -/** - * @brief Address match interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_addrm(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_ADDRM_MSK); -} - -/** - * @brief Receiver Timeout interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_rxto(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_RXTO_MSK); -} - -/** - * @brief Delta CTS status interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_dcts(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_DCTS_MSK); -} - -/** - * @brief Auto-Baud rate detection Timeout interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_abto(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_ABTO_MSK); -} - -/** - * @brief Auto-Baud rate detection End interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_abend(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_ABEND_MSK); -} - -/** - * @brief Receiver byte error interrupt enable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_enable_ier_rxberr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IER, UART_IER_RXBERR_MSK); -} - -/** - * @brief Transmit FIFO overrun interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_tfover(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_TFOVER_MSK); -} - -/** - * @brief Transmit FIFO empty interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_tfempty(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_TFEMPTY_MSK); -} - -/** - * @brief Transmit FIFO trigger threshold interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_tfth(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_TFTH_MSK); -} - -/** - * @brief Transmission byte complete interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_tbc(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_TBC_MSK); -} - -/** - * @brief Receive FIFO underrun interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_rfuerr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_RFUERR_MSK); -} - -/** - * @brief Receive FIFO overrun interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_rfoerr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_RFOERR_MSK); -} - -/** - * @brief Receive FIFO full interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_rffull(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_RFFULL_MSK); -} - -/** - * @brief Receive FIFO trigger threshold interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_rfth(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_RFTH_MSK); -} - -/** - * @brief Bit Noise detection disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_noise(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_NOISE_MSK); -} - -/** - * @brief End of block interrupt disable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_eob(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_EOB_MSK); -} - -/** - * @brief LIN break detection interrupt disable(Only UART). - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_linbk(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_LINBK_MSK); -} - -/** - * @brief Address match interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_addrm(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_ADDRM_MSK); -} - -/** - * @brief Receiver Timeout interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_rxto(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_RXTO_MSK); -} - -/** - * @brief Delta CTS status interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_dcts(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_DCTS_MSK); -} - -/** - * @brief Auto-Baud rate detection Timeout interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_abto(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_ABTO_MSK); -} - -/** - * @brief Auto-Baud rate detection End interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_abend(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_ABEND_MSK); -} - -/** - * @brief Receiver byte error interrupt disable. - * @param UARTx UART Instance. - * @retval None. - */ -__STATIC_INLINE void md_uart_disable_idr_rxberr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->IDR, UART_IDR_RXBERR_MSK); -} - -/** - * @brief Check if Tx FIFO overrun interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_tfover(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_TFOVER_MSK) == (UART_IVS_TFOVER_MSK)); -} - -/** - * @brief Check if Tx FIFO empty interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_tfempty(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_TFEMPTY_MSK) == (UART_IVS_TFEMPTY_MSK)); -} - -/** - * @brief Check if Tx FIFO trigger threshold interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_tfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_TFTH_MSK) == (UART_IVS_TFTH_MSK)); -} - -/** - * @brief Check if Tx complete interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_tbc(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_TBC_MSK) == (UART_IVS_TBC_MSK)); -} - -/** - * @brief Check if Rx FIFO underrun interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_rfuerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_RFUERR_MSK) == (UART_IVS_RFUERR_MSK)); -} - -/** - * @brief Check if Rx FIFO overrun interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_rfoerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_RFOERR_MSK) == (UART_IVS_RFOERR_MSK)); -} - -/** - * @brief Check if Rx FIFO full interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_rffull(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_RFFULL_MSK) == (UART_IVS_RFFULL_MSK)); -} - -/** - * @brief Check if Rx FIFO trigger threshold interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_rfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_RFTH_MSK) == (UART_IVS_RFTH_MSK)); -} - -/** - * @brief Check if noise detection interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_noise(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_NOISE_MSK) == (UART_IVS_NOISE_MSK)); -} - -/** - * @brief Check if end of block detection interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_eob(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_EOB_MSK) == (UART_IVS_EOB_MSK)); -} - -/** - * @brief Check if LIN break detection interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_linbk(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_LINBK_MSK) == (UART_IVS_LINBK_MSK)); -} - -/** - * @brief Check if address match interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_addrm(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_ADDRM_MSK) == (UART_IVS_ADDRM_MSK)); -} - -/** - * @brief Check if RX timeout interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_rxto(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_RXTO_MSK) == (UART_IVS_RXTO_MSK)); -} - -/** - * @brief Check if delta CTS status interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_dcts(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_DCTS_MSK) == (UART_IVS_DCTS_MSK)); -} - -/** - * @brief Check if auto-baud rate detection interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_abto(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_ABTO_MSK) == (UART_IVS_ABTO_MSK)); -} - -/** - * @brief Check if auto-baud rate detection end interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_abend(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_ABEND_MSK) == (UART_IVS_ABEND_MSK)); -} - -/** - * @brief Check if RX byte error interrupt is enabled. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_enabled_ivs_rxberr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IVS, UART_IVS_RXBERR_MSK) == (UART_IVS_RXBERR_MSK)); -} - -/** - * @brief Get Transmit FIFO overrun interrupt flag. - * @note This bit is set by hardware when an overrun error occurs that - * the FIFO is full and a new character write at the Transmit. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_tfover(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_TFOVER_MSK) == (UART_RIF_TFOVER_MSK)); -} - -/** - * @brief Get Transmit FIFO empty interrupt flag. - * @note This bit is set by hardware when transmit FIFO is empty from - * have data to empty. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_txempty(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_TFEMPTY_MSK) == (UART_RIF_TFEMPTY_MSK)); -} - -/** - * @brief Get Transmit FIFO trigger threshold interrupt flag - * @note This bit is set by hardware when transmit FIFO arrived - * threshold level in the FCR register. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_tfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_TFTH_MSK) == (UART_RIF_TFTH_MSK)); -} - -/** - * @brief Get Transmission byte complete interrupt flag. - * @note This bit is set by hardware when transmission byte complete. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_tbc(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_TBC_MSK) == (UART_RIF_TBC_MSK)); -} - -/** - * @brief Get Receive FIFO underrun interrupt flag - * @note This bit is set by hardware when an underrun error occurs that - * the FIFO is empty and a new character read at the Receive. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_rfuerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_RFUERR_MSK) == (UART_RIF_RFUERR_MSK)); -} - -/** - * @brief Get Receive FIFO overrun interrupt flag. - * @note This bit is set by hardware when an overrun error occurs that - * the FIFO is full and a new character arrive at the Receive. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_rfoerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_RFOERR_MSK) == (UART_RIF_RFOERR_MSK)); -} - -/** - * @brief Get Receive FIFO full interrupt flag. - * @note This bit is set by hardware when receive FIFO is full. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_rffull(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_RFFULL_MSK) == (UART_RIF_RFFULL_MSK)); -} - -/** - * @brief Get Receive FIFO trigger threshold interrupt flag. - * @note This bit is set by hardware when receive FIFO arrived threshold - * level in the FCR register. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_rfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_RFTH_MSK) == (UART_RIF_RFTH_MSK)); -} - -/** - * @brief Get Bit Noise detection interrupt flag. - * @note This bit is set by hardware when START bit Noise is detected. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_noise(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_NOISE_MSK) == (UART_RIF_NOISE_MSK)); -} - -/** - * @brief Get End of block interrupt flag(Only UART). - * @note This bit is set by hardware when blcok length value equals the - * number of data byte. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_eob(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_EOB_MSK) == (UART_RIF_EOB_MSK)); -} - -/** - * @brief Get LIN break detection interrupt flag(Only UART). - * @note This bit is set by hardware when lin break is detected. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_linbk(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_LINBK_MSK) == (UART_RIF_LINBK_MSK)); -} - -/** - * @brief Get Address match interrupt flag. - * @note This bit is set by hardware when the data in the RXBR register - * defined by ADD[7:0] in the RS485 register is received. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_addrm(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_ADDRM_MSK) == (UART_RIF_ADDRM_MSK)); -} - -/** - * @brief Get Receiver Timeout interrupt flag. - * @note This bit is set by hardware when the timeout value, - * programmed in the RTOR register has lapsed, without any - * communication. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_rxto(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_RXTO_MSK) == (UART_RIF_RXTO_MSK)); -} - -/** - * @brief Get Delta CTS status interrupt flag. - * @note This bit is set by hardware when the CTS input toggles. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_dcts(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_DCTS_MSK) == (UART_RIF_DCTS_MSK)); -} - -/** - * @brief Get Auto-Baud rate detection timeout interrupt flag. - * @note This bit is set by hardware when the baud rate detection timeout. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_abto(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_ABTO_MSK) == (UART_RIF_ABTO_MSK)); -} - -/** - * @brief Get Auto-Baud rate detection end interrupt flag. - * @note This bit is set by hardware when the baud rate detection end. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_abend(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_ABEND_MSK) == (UART_RIF_ABEND_MSK)); -} - -/** - * @brief Get Receiver byte error flag. - * @note This bit is set by hardware when a parity error or frame error - * occurs in receiver. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_rif_rxberr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_RIF_RXBERR_MSK) == (UART_RIF_RXBERR_MSK)); -} - -/** - * @brief Get Transmit FIFO overrun interrupt flag masked. - * @note This bit is set by hardware when an overrun error occurs that - * the FIFO is full and a new character write at the Transmit. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_tfover(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_TFOVER_MSK) == (UART_IFM_TFOVER_MSK)); -} - -/** - * @brief Get Transmit FIFO empty interrupt flag masked. - * @note This bit is set by hardware when transmit FIFO is empty from - * have data to empty. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_txempty(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_TFEMPTY_MSK) == (UART_IFM_TFEMPTY_MSK)); -} - -/** - * @brief Get Transmit FIFO trigger threshold interrupt flag masked. - * @note This bit is set by hardware when transmit FIFO arrived - * threshold level in the FCR register. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_tfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_TFTH_MSK) == (UART_IFM_TFTH_MSK)); -} - -/** - * @brief Get Transmission byte complete interrupt flag masked. - * @note This bit is set by hardware when transmission byte complete. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_tbc(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_TBC_MSK) == (UART_IFM_TBC_MSK)); -} - -/** - * @brief Get Receive FIFO underrun interrupt flag masked. - * @note This bit is set by hardware when an underrun error occurs that - * the FIFO is empty and a new character read at the Receive. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_rfuerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_RFUERR_MSK) == (UART_IFM_RFUERR_MSK)); -} - -/** - * @brief Get Receive FIFO overrun interrupt flag masked. - * @note This bit is set by hardware when an overrun error occurs that - * the FIFO is full and a new character arrive at the Receive. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_rfoerr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_RFOERR_MSK) == (UART_IFM_RFOERR_MSK)); -} - -/** - * @brief Get Receive FIFO full interrupt flag masked. - * @note This bit is set by hardware when receive FIFO is full. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_rffull(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_RFFULL_MSK) == (UART_IFM_RFFULL_MSK)); -} - -/** - * @brief Get Receive FIFO trigger threshold interrupt flag masked. - * @note This bit is set by hardware when receive FIFO arrived threshold - * level in the FCR register. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_rfth(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_RFTH_MSK) == (UART_IFM_RFTH_MSK)); -} - -/** - * @brief Get Bit Noise detection interrupt flag masked. - * @note This bit is set by hardware when START bit Noise is detected. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_noise(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_NOISE_MSK) == (UART_IFM_NOISE_MSK)); -} - -/** - * @brief Get End of block interrupt flag masked(Only UART). - * @note This bit is set by hardware when block length value equals the - * number of data byte. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_eob(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_EOB_MSK) == (UART_IFM_EOB_MSK)); -} - -/** - * @brief Get LIN break detection interrupt flag masked(Only UART). - * @note This bit is set by hardware when lin break is detected. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_linbk(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_LINBK_MSK) == (UART_IFM_LINBK_MSK)); -} - -/** - * @brief Get Address match interrupt flag masked. - * @note This bit is set by hardware when the data in the RXBR register - * defined by ADD[7:0] in the RS485 register is received. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_addrm(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_ADDRM_MSK) == (UART_IFM_ADDRM_MSK)); -} - -/** - * @brief Get Receiver Timeout interrupt flag masked. - * @note This bit is set by hardware when the timeout value, - * programmed in the RTOR register has lapsed, without any - * communication. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_rxto(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_RXTO_MSK) == (UART_IFM_RXTO_MSK)); -} - -/** - * @brief Get Delta CTS status interrupt flag masked. - * @note This bit is set by hardware when the CTS input toggles. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_dcts(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->IFM, UART_RIF_DCTS_MSK) == (UART_IFM_DCTS_MSK)); -} - -/** - * @brief Get Auto-Baud rate detection timeout interrupt flag masked. - * @note This bit is set by hardware when the baud rate detection timeout. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_abto(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_ABTO_MSK) == (UART_IFM_ABTO_MSK)); -} - -/** - * @brief Get Auto-Baud rate detection end interrupt flag masked. - * @note This bit is set by hardware when the baud rate detection end. - * @param UARTx UART Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_abend(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_ABEND_MSK) == (UART_IFM_ABEND_MSK)); -} - -/** - * @brief Get Receiver byte error interrupt flag masked. - * @note This bit is set by hardware when a parity error, frame error or - * break error occurs in receiver. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_uart_is_active_flag_ifm_rxberr(UART_TypeDef *UARTx) -{ - return (READ_BIT(UARTx->RIF, UART_IFM_RXBERR_MSK) == (UART_IFM_RXBERR_MSK)); -} - -/** - * @brief Transmit FIFO overrun interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_txover(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_TFOVER_MSK); -} - -/** - * @brief Transmit FIFO empty interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_txempty(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_TFEMPTY_MSK); -} - -/** - * @brief Transmit FIFO trigger threshold interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_tfth(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_TFTH_MSK); -} - -/** - * @brief Transmission byte complete interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_tbc(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_TBC_MSK); -} - -/** - * @brief Receive FIFO underrun interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_rfuerr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_RFUERR_MSK); -} - -/** - * @brief Receive FIFO overrun interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_rfoerr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_RFOERR_MSK); -} - -/** - * @brief Receive FIFO full interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_rffull(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_RFFULL_MSK); -} - -/** - * @brief Receive FIFO trigger threshold interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_rfth(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_RFTH_MSK); -} - -/** - * @brief Bit Noise detection interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_noise(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_NOISE_MSK); -} - -/** - * @brief End of block interrupt flag clear(Only UART). - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_eob(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_EOB_MSK); -} - -/** - * @brief LIN break detection interrupt flag clear(Only UART). - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_linbk(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_LINBK_MSK); -} - -/** - * @brief Address match interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_addrm(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_ADDRM_MSK); -} - -/** - * @brief Receiver Timeout interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_rxto(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_RXTO_MSK); -} - -/** - * @brief Delta CTS status interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_dcts(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_DCTS_MSK); -} - -/** - * @brief Auto-Baud rate detection timeout interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_abto(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_ABTO_MSK); -} - -/** - * @brief Auto-Baud rate detection end interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_abend(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_ABEND_MSK); -} - -/** - * @brief Receiver byte error interrupt flag clear. - * @param UARTx UART Instance. - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE void md_uart_clear_flag_rxberr(UART_TypeDef *UARTx) -{ - SET_BIT(UARTx->ICR, UART_ICR_RXBERR_MSK); -} - -/** - * @} MD_UART_Public_Macros UART Public Macros - */ - -/* Public functions -----------------------------------------------------------*/ -void md_uart_set_baudrate (UART_TypeDef *UARTx, uint32_t baudrate); -void md_uart_init(UART_TypeDef *UARTx, md_uart_init_typedef *UART_InitStruct); -void md_uart_send (UART_TypeDef *UARTx, uint8_t ch); -uint8_t md_uart_recv (UART_TypeDef *UARTx); -uint32_t md_uart_get_baudrate (UART_TypeDef *UARTx); - -/** - * @} UART - */ - -#endif - -/** - * @} Micro_Driver - */ - - -#ifdef __cplusplus -} - -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_wwdt.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_wwdt.h deleted file mode 100644 index f2f1a86a29..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/md_wwdt.h +++ /dev/null @@ -1,382 +0,0 @@ -/** - ****************************************************************************** - * @file md_wwdt.h - * @brief ES32F0271 WWDT HEAD File. - * - * @version V0.01 - * @date 4/12/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __MD_WWDT_H__ -#define __MD_WWDT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Includes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "reg_wwdt.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (WWDT) -/** @defgroup WWDT WWDT - * @brief WWDT micro driver - * @{ - */ - -/* Public Init Structure ------------------------------------------------------*/ -/** @defgroup MD_WWDT_PT_INIT WWDT Public Init Structure - * @brief WWDT Init Structure. - * @{ - */ -typedef struct -{ - uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDT. - This parameter can be a value of @ref WWDT_Prescaler */ - - uint32_t Window; /*!< Specifies the WWDT window value to be compared to the downcounter. - This parameter must be a number a minimum, 0x40 and a maximum, 0x7F */ - - uint32_t Counter; /*!< Specifies the WWDT free-running downcounter value. - This parameter must be a number between a minimum, 0x40 and a maximum, 0x7F */ - - uint32_t EWIMode ; /*!< Specifies if WWDT Early Wakeup Interupt is enable or not. - This parameter can be a value of @ref WWDT_EWI_Mode */ - -} md_wwdt_inittypedef; -/** - * @} MD_WWDT_PT_INIT - */ - -/* Public constants -----------------------------------------------------------*/ -/** @defgroup MD_WWDT_PUBLIC_CONSTANTS WWDT Public Constants - * @{ - */ - -/** @defgroup MD_WWDT_Prescaler WWDT Prescaler - * @{ - */ -#define WWDT_PRESCALER_1 0x00000000U /*!< WWDT counter clock = (PCLK1/4096)/1 */ -#define WWDT_PRESCALER_2 1U<CON, Reg_Value); -} - -/** - * @brief Get the WWDT_CON value - * @note None. - * @param WWD WWDT Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_wwdt_get_con(WWDT_TypeDef *WWD) -{ - return (uint32_t) (READ_REG(WWD->CON)); -} - -/** - * @brief WWDT WDG Enable - * @note This bit is set by software and only cleared by hardware after a reset. - * A write of 0 has no effect. When WDGA=1, the watchdog can generate a reset. - * @param WWD WWDT Instance - * @retval None - */ -__STATIC_INLINE void md_wwdt_enable_con_wdga(WWDT_TypeDef *WWD) -{ - SET_BIT(WWD->CON, WWDT_CON_WDGA_MSK); -} - -/** - * @brief Indicate if WWDT WDG is enabled - * @note This bit is set by software and only cleared by hardware after a reset. - * A write of 0 has no effect. When WDGA=1, the watchdog can generate a reset. - * @param WWD WWDT Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_wwdt_is_enabled_wdga(WWDT_TypeDef *WWD) -{ - return (uint32_t)(READ_BIT(WWD->CON, WWDT_CON_WDGA_MSK) == (WWDT_CON_WDGA_MSK)); -} - -/** - * @brief Set WWDT T 7-bit counter - * @note These bits contain the value of the watchdog counter. - * It is decremented every (4096 x 2^WDGTB[1:0]) PCLK cycles. - * A reset is produced when it is decremented from 0x40 to 0x3F(T6 becomes cleared), - * and when it is renewed on the condition the value is more than the window value and the WDGA bit is enabled. - * @param WWD WWDT Instance - * @param counter is a 7-bit number - * @arg Max Value 0x7F - * @arg Min Value 0x40 - * @retval None - */ -__STATIC_INLINE void md_wwdt_set_con_t(WWDT_TypeDef *WWD, uint32_t counter) -{ - MODIFY_REG(WWD->CON, WWDT_CON_T_MSK, counter); -} - -/** - * @brief Get WWDT T 7-bit counter - * @note These bits contain the value of the watchdog counter. - * It is decremented every (4096 x 2^WDGTB[1:0]) PCLK cycles. - * A reset is produced when it is decremented from 0x40 to 0x3F(T6 becomes cleared), - * and when it is renewed on the condition the value is more than the window value and the WDGA bit is enabled. - * @param WWD WWDT Instance - * @retval The retval can be a value of the area: - * @arg Max Value 0x7F - * @arg Min Value 0x40 - */ -__STATIC_INLINE uint32_t md_wwdt_get_con_t(WWDT_TypeDef *WWD) -{ - return (READ_BIT(WWD->CON, WWDT_CON_T_MSK)>>WWDT_CON_T_POSS); -} - -/** - * @brief Set the WWDT_CFG value - * @note None. - * @param WWD WWDT Instance - * @param Reg_Value is a 32-bit value - * @retval None - */ -__STATIC_INLINE void md_wwdt_set_cfg(WWDT_TypeDef *WWD, uint32_t Reg_Value) -{ - WRITE_REG(WWD->CFG, Reg_Value); -} - -/** - * @brief Get the WWDT_CFG value - * @note None. - * @param WWD WWDT Instance - * @retval a 32-bit value - */ -__STATIC_INLINE uint32_t md_wwdt_get_cfg(WWDT_TypeDef *WWD) -{ - return (uint32_t) (READ_REG(WWD->CFG)); -} - -/** - * @brief Set WWDT WDGTB 2-bit prescaler value - * @note The time base of the prescaler can be modified as follows: - * 00: CK Counter Clock (PCLK div 4096) div 1 - * 01: CK Counter Clock (PCLK div 4096) div 2 - * 10: CK Counter Clock (PCLK div 4096) div 4 - * 11: CK Counter Clock (PCLK div 4096) div 8 - * @param WWD WWDT Instance - * @param prescaler is a 2-bit number - * @arg @ref WWDT_PRESCALER_1 - * @arg @ref WWDT_PRESCALER_2 - * @arg @ref WWDT_PRESCALER_4 - * @arg @ref WWDT_PRESCALER_8 - * @retval None - */ -__STATIC_INLINE void md_wwdt_set_cfg_wdgtb(WWDT_TypeDef *WWD, uint32_t prescaler) -{ - MODIFY_REG(WWD->CFG, WWDT_CFG_WDGTB_MSK, prescaler); -} - -/** - * @brief Get WWDT WDGTB 2-bit prescaler value - * @note The time base of the prescaler can be modified as follows: - 00: CK Counter Clock (PCLK div 4096) div 1 - 01: CK Counter Clock (PCLK div 4096) div 2 - 10: CK Counter Clock (PCLK div 4096) div 4 - 11: CK Counter Clock (PCLK div 4096) div 8 - * @param WWD WWDT Instance - * @retval The retval can be one of the following values: - * @arg @ref WWDT_PRESCALER_1 - * @arg @ref WWDT_PRESCALER_2 - * @arg @ref WWDT_PRESCALER_4 - * @arg @ref WWDT_PRESCALER_8 - */ -__STATIC_INLINE uint32_t md_wwdt_get_cfg_wdgtb(WWDT_TypeDef *WWD) -{ - return (READ_BIT(WWD->CFG, WWDT_CFG_WDGTB_MSK)>>WWDT_CFG_WDGTB_POSS); -} - -/** - * @brief Set WWDT W 7-bit window - * @note These bits contain the window value to be compared to the downcounter. - * @param WWD WWDT Instance - * @param window is a 7-bit number - * @arg Max Value 0x7F - * @arg Min Value 0x40 - * @retval None - */ -__STATIC_INLINE void md_wwdt_set_cfg_w(WWDT_TypeDef *WWD, uint32_t window) -{ - MODIFY_REG(WWD->CFG, WWDT_CFG_W_MSK, window); -} - -/** - * @brief Get WWDT W 7-bit window - * @note These bits contain the window value to be compared to the downcounter. - * @param WWD WWDT Instance - * @retval The retval can be a value of the area: - * @arg Max Value 0x7F - * @arg Min Value 0x40 - */ -__STATIC_INLINE uint32_t md_wwdt_get_cfg_w(WWDT_TypeDef *WWD) -{ - return (READ_BIT(WWD->CFG, WWDT_CFG_W_MSK)>>WWDT_CFG_W_POSS); -} - -/** - * @brief WWDT Early wakeup interrupt Enable - * @note A write of 1 in IER to enable this interrupt. - * @param WWD WWDT Instance - * @retval None - */ -__STATIC_INLINE void md_wwdt_enable_ier_ewis(WWDT_TypeDef *WWD) -{ - SET_BIT(WWD->IER, WWDT_IER_EWIS_MSK); -} - -/** - * @brief WWDT Early wakeup interrupt Disable - * @note A write of 1 in IDR to disable this interrupt. - * @param WWD WWDT Instance - * @retval None - */ -__STATIC_INLINE void md_wwdt_disable_idr_ewis(WWDT_TypeDef *WWD) -{ - SET_BIT(WWD->IDR, WWDT_IDR_EWIS_MSK); -} - -/** - * @brief Indicate if WWDT EWI is enabled - * @note To check EWI enable or not. - * @param WWD WWDT Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_wwdt_is_enabled_ivs_ewis(WWDT_TypeDef *WWD) -{ - return (uint32_t) (READ_BIT(WWD->IVS, WWDT_IVS_EWIS_MSK) == (WWDT_IVS_EWIS_MSK)); -} - -/** - * @brief Get the early wakeup interrupt flag status - * @note This bit is set by hardware when the counter has reached the value 0x40. - It can be cleared by software by writing 1 in WWDT_ICR. This bit is - also set if the interrupt is not enabled. - * @param WWD WWDT Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_wwdt_is_active_rif_ewif(WWDT_TypeDef *WWD) -{ - return (uint32_t) (READ_BIT(WWD->RIF, WWDT_RIF_EWIF_MSK) == (WWDT_RIF_EWIF_MSK)); -} - -/** - * @brief Get the early wakeup interrupt flag masked status - * @note This bit is set by hardware when the counter has reached the value 0x40 - and the interrupt is enabled. - * @param WWD WWDT Instance - * @retval State of bit (1 or 0). - */ -__STATIC_INLINE uint32_t md_wwdt_is_active_ifm_ewim(WWDT_TypeDef *WWD) -{ - return (uint32_t) (READ_BIT(WWD->IFM, WWDT_IFM_EWIM_MSK) == (WWDT_IFM_EWIM_MSK)); -} - -/** - * @brief Clear the early wakeup interrupt flag - * @param WWD WWDT Instance - * @retval None - */ -__STATIC_INLINE void md_wwdt_clear_icr_ewic(WWDT_TypeDef *WWD) -{ - SET_BIT(WWD->ICR, WWDT_ICR_EWIC_MSK); -} - -/** - * @} MD_WWDT_Public_Macros - */ - -/** @defgroup MD_WWDT_PF_Init WWDT Init Function - * @{ - */ -void md_wwdt_init(WWDT_TypeDef *WWD, md_wwdt_inittypedef *WWDT_InitStruct); -/** - * @} MD_WWDT_PF_Init - */ - -#endif - -/* Private macros ------------------------------------------------------------*/ - -/** @defgroup MD_WWDT_Private_Macros WWDG Private Macros - * @{ - */ -#define IS_MD_WWDT_ALL_INSTANCE(__INSTANCE__) (__INSTANCE__ == WWDT) - -#define IS_MD_WWDT_PRESCALER(__VALUE__) (((__VALUE__) == WWDT_PRESCALER_1) \ - || ((__VALUE__) == WWDT_PRESCALER_2) \ - || ((__VALUE__) == WWDT_PRESCALER_4) \ - || ((__VALUE__) == WWDT_PRESCALER_8)) - -#define IS_MD_WWDT_WINDOW(__VALUE__) (((__VALUE__) >= 0x40) && ((__VALUE__) <= 0x7F)) - -#define IS_MD_WWDT_COUNTER(__VALUE__) (((__VALUE__) >= 0x40) && ((__VALUE__) <= 0x7F)) - -#define IS_MD_WWDT_EWI_MODE(__VALUE__) (((__VALUE__) == WWDT_EWI_ENABLE) \ - || ((__VALUE__) == WWDT_EWI_DISABLE)) -/** - * @} MD_WWDT_Private_Macros - */ - -/** - * @} WWDT - */ -/** - * @} Micro_Driver - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/usb_lowlayer_api.h b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/usb_lowlayer_api.h deleted file mode 100644 index 5fee2e973e..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Include/usb_lowlayer_api.h +++ /dev/null @@ -1,728 +0,0 @@ -/** - ************************************************************************************** - * @file usb_lowlayer_api.h - * @brief USB library lower layer api - * @data 11/9/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -/* Includes-------------------------------------------------------------------*/ -#include "stdint.h" -#include - -#ifndef __USB_LOWLAYER_API_H__ -#define __USB_LOWLAYER_API_H__ - - -/** - * If building with a C++ compiler, make all of the definitions in this header - * have a C binding. - */ -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Public constants -----------------------------------------------------------*/ - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_int_enable() and -// md_usb_hosdev_int_disable() as the ui32Flags parameter, and are returned from -// md_usb_hosdev_int_status(). -// -//***************************************************************************** -#define USB_INTCTRL_ALL 0x000003FF // All control interrupt sources -#define USB_INTCTRL_STATUS 0x000000FF // Status Interrupts -#define USB_INTCTRL_VBUS_ERR 0x00000080 // VBUS Error -#define USB_INTCTRL_SESSION 0x00000040 // Session Start Detected -#define USB_INTCTRL_SESSION_END 0x00000040 // Session End Detected -#define USB_INTCTRL_DISCONNECT 0x00000020 // Disconnect Detected -#define USB_INTCTRL_CONNECT 0x00000010 // Device Connect Detected -#define USB_INTCTRL_SOF 0x00000008 // Start of Frame Detected -#define USB_INTCTRL_BABBLE 0x00000004 // Babble signaled -#define USB_INTCTRL_RESET 0x00000004 // Reset signaled -#define USB_INTCTRL_RESUME 0x00000002 // Resume detected -#define USB_INTCTRL_SUSPEND 0x00000001 // Suspend detected -#define USB_INTCTRL_MODE_DETECT 0x00000200 // Mode value valid -#define USB_INTCTRL_POWER_FAULT 0x00000100 // Power Fault detected - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_endpoint_int_enable() -// and md_usb_hosdev_endpoint_int_disable() as the ui32Flags parameter, and -// are returned from md_usb_hosdev_endpoint_int_status(). -// -//***************************************************************************** -#define USB_INTEP_ALL 0xFFFFFFFF // Host IN Interrupts -#define USB_INTEP_HOST_IN 0xFFFE0000 // Host IN Interrupts -#define USB_INTEP_HOST_IN_15 0x80000000 // Endpoint 15 Host IN Interrupt -#define USB_INTEP_HOST_IN_14 0x40000000 // Endpoint 14 Host IN Interrupt -#define USB_INTEP_HOST_IN_13 0x20000000 // Endpoint 13 Host IN Interrupt -#define USB_INTEP_HOST_IN_12 0x10000000 // Endpoint 12 Host IN Interrupt -#define USB_INTEP_HOST_IN_11 0x08000000 // Endpoint 11 Host IN Interrupt -#define USB_INTEP_HOST_IN_10 0x04000000 // Endpoint 10 Host IN Interrupt -#define USB_INTEP_HOST_IN_9 0x02000000 // Endpoint 9 Host IN Interrupt -#define USB_INTEP_HOST_IN_8 0x01000000 // Endpoint 8 Host IN Interrupt -#define USB_INTEP_HOST_IN_7 0x00800000 // Endpoint 7 Host IN Interrupt -#define USB_INTEP_HOST_IN_6 0x00400000 // Endpoint 6 Host IN Interrupt -#define USB_INTEP_HOST_IN_5 0x00200000 // Endpoint 5 Host IN Interrupt -#define USB_INTEP_HOST_IN_4 0x00100000 // Endpoint 4 Host IN Interrupt -#define USB_INTEP_HOST_IN_3 0x00080000 // Endpoint 3 Host IN Interrupt -#define USB_INTEP_HOST_IN_2 0x00040000 // Endpoint 2 Host IN Interrupt -#define USB_INTEP_HOST_IN_1 0x00020000 // Endpoint 1 Host IN Interrupt - -#define USB_INTEP_DEV_OUT 0xFFFE0000 // Device OUT Interrupts -#define USB_INTEP_DEV_OUT_15 0x80000000 // Endpoint 15 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_14 0x40000000 // Endpoint 14 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_13 0x20000000 // Endpoint 13 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_12 0x10000000 // Endpoint 12 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_11 0x08000000 // Endpoint 11 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_10 0x04000000 // Endpoint 10 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_9 0x02000000 // Endpoint 9 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_8 0x01000000 // Endpoint 8 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_7 0x00800000 // Endpoint 7 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_6 0x00400000 // Endpoint 6 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_5 0x00200000 // Endpoint 5 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_4 0x00100000 // Endpoint 4 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_3 0x00080000 // Endpoint 3 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_2 0x00040000 // Endpoint 2 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_1 0x00020000 // Endpoint 1 Device OUT Interrupt - -#define USB_INTEP_HOST_OUT 0x0000FFFE // Host OUT Interrupts -#define USB_INTEP_HOST_OUT_15 0x00008000 // Endpoint 15 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_14 0x00004000 // Endpoint 14 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_13 0x00002000 // Endpoint 13 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_12 0x00001000 // Endpoint 12 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_11 0x00000800 // Endpoint 11 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_10 0x00000400 // Endpoint 10 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_9 0x00000200 // Endpoint 9 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_8 0x00000100 // Endpoint 8 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_7 0x00000080 // Endpoint 7 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_6 0x00000040 // Endpoint 6 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_5 0x00000020 // Endpoint 5 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_4 0x00000010 // Endpoint 4 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_3 0x00000008 // Endpoint 3 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_2 0x00000004 // Endpoint 2 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_1 0x00000002 // Endpoint 1 Host OUT Interrupt - -#define USB_INTEP_DEV_IN 0x0000FFFE // Device IN Interrupts -#define USB_INTEP_DEV_IN_15 0x00008000 // Endpoint 15 Device IN Interrupt -#define USB_INTEP_DEV_IN_14 0x00004000 // Endpoint 14 Device IN Interrupt -#define USB_INTEP_DEV_IN_13 0x00002000 // Endpoint 13 Device IN Interrupt -#define USB_INTEP_DEV_IN_12 0x00001000 // Endpoint 12 Device IN Interrupt -#define USB_INTEP_DEV_IN_11 0x00000800 // Endpoint 11 Device IN Interrupt -#define USB_INTEP_DEV_IN_10 0x00000400 // Endpoint 10 Device IN Interrupt -#define USB_INTEP_DEV_IN_9 0x00000200 // Endpoint 9 Device IN Interrupt -#define USB_INTEP_DEV_IN_8 0x00000100 // Endpoint 8 Device IN Interrupt -#define USB_INTEP_DEV_IN_7 0x00000080 // Endpoint 7 Device IN Interrupt -#define USB_INTEP_DEV_IN_6 0x00000040 // Endpoint 6 Device IN Interrupt -#define USB_INTEP_DEV_IN_5 0x00000020 // Endpoint 5 Device IN Interrupt -#define USB_INTEP_DEV_IN_4 0x00000010 // Endpoint 4 Device IN Interrupt -#define USB_INTEP_DEV_IN_3 0x00000008 // Endpoint 3 Device IN Interrupt -#define USB_INTEP_DEV_IN_2 0x00000004 // Endpoint 2 Device IN Interrupt -#define USB_INTEP_DEV_IN_1 0x00000002 // Endpoint 1 Device IN Interrupt - -#define USB_INTEP_0 0x00000001 // Endpoint 0 Interrupt - -//***************************************************************************** -// -// The following are values that are returned from md_usb_hos_speed_get() 0r -// md_usb_dev_speed_get(). -// -//***************************************************************************** -#define USB_UNDEF_SPEED 0x80000000 // Current speed is undefined -#define USB_HIGH_SPEED 0x00000002 // Current speed is High Speed -#define USB_FULL_SPEED 0x00000001 // Current speed is Full Speed -#define USB_LOW_SPEED 0x00000000 // Current speed is Low Speed - -//***************************************************************************** -// -// The following are values that are returned from md_usb_hosdev_endpoint_status(). The -// USB_HOST_* values are used when the USB controller is in host mode and the -// USB_DEV_* values are used when the USB controller is in device mode. -// -//***************************************************************************** -#define USB_HOST_IN_STATUS 0x114F0000 // Mask of all host IN interrupts -#define USB_HOST_IN_PID_ERROR 0x10000000 // Stall on this endpoint received -#define USB_HOST_IN_NOT_COMP 0x01000000 // Device failed to respond -#define USB_HOST_IN_STALL 0x00400000 // Stall on this endpoint received -#define USB_HOST_IN_DATA_ERROR 0x00080000 // CRC or bit-stuff error -// (ISOC Mode) -#define USB_HOST_IN_NAK_TO 0x00080000 // NAK received for more than the -// specified timeout period -#define USB_HOST_IN_ERROR 0x00040000 // Failed to communicate with a -// device -#define USB_HOST_IN_FIFO_FULL 0x00020000 // RX FIFO full -#define USB_HOST_IN_PKTRDY 0x00010000 // Data packet ready -#define USB_HOST_OUT_STATUS 0x000000A7 // Mask of all host OUT interrupts -#define USB_HOST_OUT_NAK_TO 0x00000080 // NAK received for more than the -// specified timeout period -#define USB_HOST_OUT_NOT_COMP 0x00000080 // No response from device -// (ISOC mode) -#define USB_HOST_OUT_STALL 0x00000020 // Stall on this endpoint received -#define USB_HOST_OUT_ERROR 0x00000004 // Failed to communicate with a -// device -#define USB_HOST_OUT_FIFO_NE 0x00000002 // TX FIFO is not empty -#define USB_HOST_OUT_PKTPEND 0x00000001 // Transmit still being transmitted -#define USB_HOST_EP0_NAK_TO 0x00000080 // NAK received for more than the -// specified timeout period -#define USB_HOST_EP0_STATUS 0x00000040 // This was a status packet -#define USB_HOST_EP0_ERROR 0x00000010 // Failed to communicate with a -// device -#define USB_HOST_EP0_RX_STALL 0x00000004 // Stall on this endpoint received -#define USB_HOST_EP0_RXPKTRDY 0x00000001 // Receive data packet ready -#define USB_DEV_RX_PID_ERROR 0x01000000 // PID error in isochronous -// transfer -#define USB_DEV_RX_SENT_STALL 0x00400000 // Stall was sent on this endpoint -#define USB_DEV_RX_DATA_ERROR 0x00080000 // CRC error on the data -#define USB_DEV_RX_OVERRUN 0x00040000 // OUT packet was not loaded due to -// a full FIFO -#define USB_DEV_RX_FIFO_FULL 0x00020000 // RX FIFO full -#define USB_DEV_RX_PKT_RDY 0x00010000 // Data packet ready -#define USB_DEV_TX_NOT_COMP 0x00000080 // Large packet split up, more data -// to come -#define USB_DEV_TX_SENT_STALL 0x00000020 // Stall was sent on this endpoint -#define USB_DEV_TX_UNDERRUN 0x00000004 // IN received with no data ready -#define USB_DEV_TX_FIFO_NE 0x00000002 // The TX FIFO is not empty -#define USB_DEV_TX_TXPKTRDY 0x00000001 // Transmit still being transmitted -#define USB_DEV_EP0_SETUP_END 0x00000010 // Control transaction ended before -// Data End seen -#define USB_DEV_EP0_SENT_STALL 0x00000004 // Stall was sent on this endpoint -#define USB_DEV_EP0_IN_PKTPEND 0x00000002 // Transmit data packet pending -#define USB_DEV_EP0_OUT_PKTRDY 0x00000001 // Receive data packet ready - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hos_endpoint_config_set() and -// md_usb_dev_endpoint_config_set() as the ui32Flags parameter. -// -//***************************************************************************** -#define USB_EP_AUTO_SET 0x00000001 // Auto set feature enabled -#define USB_EP_AUTO_REQUEST 0x00000002 // Auto request feature enabled -#define USB_EP_AUTO_CLEAR 0x00000004 // Auto clear feature enabled -#define USB_EP_DUAL_BUFFERING 0x00000008 // Dual buffering enabled -#define USB_EP_DMA_MODE_0 0x00000008 // Enable DMA access using mode 0 -#define USB_EP_DMA_MODE_1 0x00000010 // Enable DMA access using mode 1 -#define USB_EP_DIS_NYET 0x00000020 // Disable NYET response for -// high-speed Bulk and Interrupt -// endpoints in device mode. -#define USB_EP_MODE_ISOC 0x00000000 // Isochronous endpoint -#define USB_EP_MODE_BULK 0x00000100 // Bulk endpoint -#define USB_EP_MODE_INT 0x00000200 // Interrupt endpoint -#define USB_EP_MODE_CTRL 0x00000300 // Control endpoint -#define USB_EP_MODE_MASK 0x00000300 // Mode Mask -#define USB_EP_SPEED_LOW 0x00000000 // Low Speed -#define USB_EP_SPEED_FULL 0x00001000 // Full Speed -#define USB_EP_SPEED_HIGH 0x00004000 // High Speed -#define USB_EP_HOST_IN 0x00000000 // Host IN endpoint -#define USB_EP_HOST_OUT 0x00002000 // Host OUT endpoint -#define USB_EP_DEV_IN 0x00002000 // Device IN endpoint -#define USB_EP_DEV_OUT 0x00000000 // Device OUT endpoint - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hos_pwr_config() as the -// ui32Flags parameter. -// -//***************************************************************************** -#define USB_HOST_PWRFLT_LOW 0x00000010 -#define USB_HOST_PWRFLT_HIGH 0x00000030 -#define USB_HOST_PWRFLT_EP_NONE 0x00000000 -#define USB_HOST_PWRFLT_EP_TRI 0x00000140 -#define USB_HOST_PWRFLT_EP_LOW 0x00000240 -#define USB_HOST_PWRFLT_EP_HIGH 0x00000340 -#define USB_HOST_PWREN_MAN_LOW 0x00000000 -#define USB_HOST_PWREN_MAN_HIGH 0x00000001 -#define USB_HOST_PWREN_AUTOLOW 0x00000002 -#define USB_HOST_PWREN_AUTOHIGH 0x00000003 -#define USB_HOST_PWREN_FILTER 0x00010000 - -//***************************************************************************** -// -// The following are the valid values that can be passed to the -// md_usb_hos_lpm_config() function in the ui32Config parameter. -// -//***************************************************************************** -#define USB_HOST_LPM_RMTWAKE 0x00000100 -#define USB_HOST_LPM_L1 0x00000001 - -//***************************************************************************** -// -// The following are the valid values that can be passed to the -// md_usb_dev_lpm_config() function in the ui32Config parameter. -// -//***************************************************************************** -#define USB_DEV_LPM_NAK 0x00000010 -#define USB_DEV_LPM_NONE 0x00000000 -#define USB_DEV_LPM_EN 0x0000000c -#define USB_DEV_LPM_EXTONLY 0x00000004 - -//***************************************************************************** -// -// The following are the valid values that are returned from the -// md_usb_lpm_link_state_get() function. -// -//***************************************************************************** -#define USB_DEV_LPM_LS_RMTWAKE 0x00000100 -#define USB_DEV_LPM_LS_L1 0x00000001 - -//***************************************************************************** -// -// The following are the valid values that are passed to the md_usb_lpm_int_enable() -// or md_usb_lpm_int_disable() functions or are returned from the md_usb_lpm_status() -// function. -// -//***************************************************************************** -#define USB_INTLPM_ERROR 0x00000020 -#define USB_INTLPM_RESUME 0x00000010 -#define USB_INTLPM_INCOMPLETE 0x00000008 -#define USB_INTLPM_ACK 0x00000004 -#define USB_INTLPM_NYET 0x00000002 -#define USB_INTLPM_STALL 0x00000001 - -//***************************************************************************** -// -// The following are the valid values that are passed to the md_usb_clock_enable() -// functions. -// -//***************************************************************************** -#define USB_CLOCK_INTERNAL 0x00000200 -#define USB_CLOCK_EXTERNAL 0x00000300 - -//***************************************************************************** -// -// The configuration options used with the md_usb_ulpi_config() API. -// -//***************************************************************************** -#define USB_ULPI_EXTVBUS 0x00000001 -#define USB_ULPI_EXTVBUS_IND 0x00000002 - -//***************************************************************************** -// -// The following are special values that can be passed to -// md_usb_hos_endpoint_config_set() as the ui32NAKPollInterval parameter. -// -//***************************************************************************** -#define MAX_NAK_LIMIT 31 // Maximum NAK interval -#define DISABLE_NAK_LIMIT 0 // No NAK timeouts - -//***************************************************************************** -// -// This value specifies the maximum size of transfers on endpoint 0 as 64 -// bytes. This value is fixed in hardware as the FIFO size for endpoint 0. -// -//***************************************************************************** -#define MAX_PACKET_SIZE_EP0 64 - -//***************************************************************************** -// -// These values are used to indicate which endpoint to access. -// -//***************************************************************************** -#define USB_EP_0 0x00000000 // Endpoint 0 -#define USB_EP_1 0x00000010 // Endpoint 1 -#define USB_EP_2 0x00000020 // Endpoint 2 -#define USB_EP_3 0x00000030 // Endpoint 3 -#define USB_EP_4 0x00000040 // Endpoint 4 -#define USB_EP_5 0x00000050 // Endpoint 5 -#define USB_EP_6 0x00000060 // Endpoint 6 -#define USB_EP_7 0x00000070 // Endpoint 7 -#define NUM_USB_EP 8 // Number of supported endpoints - -//***************************************************************************** -// -// These macros allow conversion between 0-based endpoint indices and the -// USB_EP_x values required when calling various USB APIs. -// -//***************************************************************************** -#define IndexToUSBEP(x) ((x) << 4) -#define USBEPToIndex(x) ((x) >> 4) - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_fifo_config_set() as the -// ui32FIFOSize parameter. -// -//***************************************************************************** -#define USB_FIFO_SZ_8 0x00000000 // 8 byte FIFO -#define USB_FIFO_SZ_16 0x00000001 // 16 byte FIFO -#define USB_FIFO_SZ_32 0x00000002 // 32 byte FIFO -#define USB_FIFO_SZ_64 0x00000003 // 64 byte FIFO -#define USB_FIFO_SZ_128 0x00000004 // 128 byte FIFO -#define USB_FIFO_SZ_256 0x00000005 // 256 byte FIFO -#define USB_FIFO_SZ_512 0x00000006 // 512 byte FIFO -#define USB_FIFO_SZ_1024 0x00000007 // 1024 byte FIFO -#define USB_FIFO_SZ_2048 0x00000008 // 2048 byte FIFO - -//***************************************************************************** -// -// This macro allow conversion from a FIFO size label as defined above to -// a number of bytes -// -//***************************************************************************** -#define USBFIFOSizeToBytes(x) (8 << (x)) - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_endpoint_data_send() -// as the ui32TransType parameter. -// -//***************************************************************************** -#define USB_TRANS_OUT 0x00000102 // Normal OUT transaction -#define USB_TRANS_IN 0x00000102 // Normal IN transaction -#define USB_TRANS_IN_LAST 0x0000010a // Final IN transaction (for -// endpoint 0 in device mode) -#define USB_TRANS_SETUP 0x0000110a // Setup transaction (for endpoint -// 0) -#define USB_TRANS_STATUS 0x00000142 // Status transaction (for endpoint -// 0) - -//***************************************************************************** -// -// The following are values are returned by the md_usb_hosdev_mode_get() function. -// -//***************************************************************************** -#define USB_DUAL_MODE_HOST 0x00000001 // Dual mode controller is in Host -// mode. -#define USB_DUAL_MODE_DEVICE 0x00000081 // Dual mode controller is in -// Device mode. -#define USB_DUAL_MODE_NONE 0x00000080 // Dual mode controller mode is not -// set. -#define USB_OTG_MODE_ASIDE_HOST 0x0000001d // OTG controller on the A side of -// the cable. -#define USB_OTG_MODE_ASIDE_NPWR 0x00000001 // OTG controller on the A side of -// the cable. -#define USB_OTG_MODE_ASIDE_SESS 0x00000009 // OTG controller on the A side of -// the cable Session Valid. -#define USB_OTG_MODE_ASIDE_AVAL 0x00000011 // OTG controller on the A side of -// the cable A valid. -#define USB_OTG_MODE_ASIDE_DEV 0x00000019 // OTG controller on the A side of -// the cable. -#define USB_OTG_MODE_BSIDE_HOST 0x0000009d // OTG controller on the B side of -// the cable. -#define USB_OTG_MODE_BSIDE_DEV 0x00000099 // OTG controller on the B side of -// the cable. -#define USB_OTG_MODE_BSIDE_NPWR 0x00000081 // OTG controller on the B side of -// the cable. -#define USB_OTG_MODE_NONE 0x00000080 // OTG controller mode is not set. - -//***************************************************************************** -// -// Channel configuration values. -// -//***************************************************************************** -#define DMA_DST_INC_8 0x00000000 -#define DMA_DST_INC_16 0x40000000 -#define DMA_DST_INC_32 0x80000000 -#define DMA_DST_INC_NONE 0xc0000000 -#define DMA_SRC_INC_8 0x00000000 -#define DMA_SRC_INC_16 0x04000000 -#define DMA_SRC_INC_32 0x08000000 -#define DMA_SRC_INC_NONE 0x0c000000 -#define DMA_SIZE_8 0x00000000 -#define DMA_SIZE_16 0x11000000 -#define DMA_SIZE_32 0x22000000 -#define DMA_DST_PROT_PRIV 0x00200000 -#define DMA_SRC_PROT_PRIV 0x00040000 -#define DMA_ARB_1 0x00000000 -#define DMA_ARB_2 0x00004000 -#define DMA_ARB_4 0x00008000 -#define DMA_ARB_8 0x0000c000 -#define DMA_ARB_16 0x00010000 -#define DMA_ARB_32 0x00014000 -#define DMA_ARB_64 0x00018000 -#define DMA_ARB_128 0x0001c000 -#define DMA_ARB_256 0x00020000 -#define DMA_ARB_512 0x00024000 -#define DMA_ARB_1024 0x00028000 -#define DMA_NEXT_USEBURST 0x00000008 - -//***************************************************************************** -// -// The values for the md_usb_dma_channel_int_enable() and md_usb_dma_channel_int_status() -// APIs. -// -//***************************************************************************** -#define USB_DMA_INT_CH8 0x00000080 -#define USB_DMA_INT_CH7 0x00000040 -#define USB_DMA_INT_CH6 0x00000020 -#define USB_DMA_INT_CH5 0x00000010 -#define USB_DMA_INT_CH4 0x00000008 -#define USB_DMA_INT_CH3 0x00000004 -#define USB_DMA_INT_CH2 0x00000002 -#define USB_DMA_INT_CH1 0x00000001 - -//***************************************************************************** -// -// The values for the md_usb_dma_channel_status() API. -// -//***************************************************************************** -#define USB_DMA_STATUS_ERROR 0x00000100 - -//***************************************************************************** -// -// The valid return values for the USBDMAModeSet() and USBDMAModeGet() APIs or -// USBDMAChannelConfig(). -// -//***************************************************************************** -#define USB_DMA_CFG_BURST_NONE 0x00000000 -#define USB_DMA_CFG_BURST_4 0x00000200 -#define USB_DMA_CFG_BURST_8 0x00000400 -#define USB_DMA_CFG_BURST_16 0x00000600 -#define USB_DMA_CFG_INT_EN 0x00000008 -#define USB_DMA_CFG_MODE_0 0x00000000 -#define USB_DMA_CFG_MODE_1 0x00000004 -#define USB_DMA_CFG_DIR_RX 0x00000000 -#define USB_DMA_CFG_DIR_TX 0x00000002 -#define USB_DMA_CFG_EN 0x00000001 - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_mode_config() as the -// ui3Mode parameter. -// -//***************************************************************************** -#define USB_MODE_HOST_VBUS 0x00000004 -#define USB_MODE_HOST 0x00000002 -#define USB_MODE_DEV_VBUS 0x00000005 -#define USB_MODE_DEV 0x00000003 -#define USB_MODE_OTG 0x00000000 - -//***************************************************************************** -// -// Flags that can be passed to DMAChannelAttributeEnable(), -// DMAChannelAttributeDisable(), and returned from DMAChannelAttributeGet(). -// -//***************************************************************************** -#define DMA_ATTR_USEBURST 0x00000001 -#define DMA_ATTR_ALTSELECT 0x00000002 -#define DMA_ATTR_HIGH_PRIORITY 0x00000004 -#define DMA_ATTR_REQMASK 0x00000008 -#define DMA_ATTR_ALL 0x0000000F - -/* Public functions -----------------------------------------------------------*/ -/** - * @{ SYSTEM API. - */ -extern void md_usb_system_int_disable(void); -extern void md_usb_system_int_enable(void); -extern void md_usb_re_config(bool Device); /* Weak defination */ -extern void md_usb_system_delayms(uint32_t delayms); /* Weak defination */ -extern void md_usb_systic_disable(void); -extern void md_usb_controller_reset(void); -extern void md_usb_controller_enable(void); -extern void md_usb_controller_disable(void); -extern void md_usb_clk_phy_enable(void); -extern void md_usb_clk_phy_disable(void); -extern uint32_t md_usb_nvic_number_get(void); -extern void md_usb_nvic_config(uint32_t NvicNum); /* Weak defination */ -extern void md_usb_nvic_enable(void); -extern void md_usb_nvic_disable(void); -/** - * @} SYSTEM API. - */ - -/** - * @{ USB basic API. - */ -/* Host Mode */ -extern void md_usb_hos_reset(bool bStart); -extern void md_usb_hos_resume(bool bStart); -extern void md_usb_hos_suspend(void); -extern void md_usb_hos_request_status(void); -extern void md_usb_hos_request_in(uint32_t ui32Endpoint); -extern void md_usb_hos_request_in_clear(uint32_t ui32Endpoint); -extern uint32_t md_usb_hos_speed_get(void); -extern uint32_t md_usb_hos_addr_get(uint32_t ui32Endpoint, uint32_t ui32Flags); -extern void md_usb_hos_addr_set(uint32_t ui32Endpoint, - uint32_t ui32Addr, - uint32_t ui32Flags); -extern uint32_t md_usb_hos_hub_addr_get(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hos_hub_addr_set(uint32_t ui32Endpoint, - uint32_t ui32Addr, - uint32_t ui32Flags); -/* Device Mode */ -extern void md_usb_dev_addr_set(uint8_t ui32Address); -extern uint8_t md_usb_dev_addr_get(void); -extern void md_usb_dev_connect(void); -extern void md_usb_dev_disconnect(void); -extern uint32_t md_usb_dev_speed_get(void); -/* Host/Device Mode */ -extern uint32_t md_usb_hosdev_frame_get(void); -extern void md_usb_hosdev_int_disable(uint32_t ui32IntFlags); -extern void md_usb_hosdev_int_enable(uint32_t ui32IntFlags); -extern uint32_t md_usb_hosdev_int_status(void); -extern uint32_t md_usb_hosdev_mode_get(void); -/* otg Mode */ -extern void md_usb_otg_session_request(bool bStart); -extern void md_usb_force_host_mode(void); -extern void md_usb_force_device_mode(void); -extern void md_usb_force_otg_mode(void); -extern void md_usb_mode_config(uint32_t ui32Mode); -/** - * @} USB basic API. - */ - -/** - * @{ USB endpoint API. - */ -/* Host Mode */ -extern void md_usb_hos_endpoint_config_set(uint32_t ui32Endpoint, - uint32_t ui32MaxPacketSize, - uint32_t ui32NAKPollInterval, - uint32_t ui32TargetEndpoint, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_data_ack(uint32_t ui32Endpoint); -extern void md_usb_hos_endpoint_data_toggle(uint32_t ui32Endpoint, - bool bDataToggle, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_status_clear(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_speed(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_ping(uint32_t ui32Endpoint, - bool bEnable); -/* Device Mode */ -extern void md_usb_dev_endpoint_config_set(uint32_t ui32Endpoint, - uint32_t ui32MaxPacketSize, - uint32_t ui32Flags); -extern void md_usb_dev_endpoint_config_get(uint32_t ui32Endpoint, - uint32_t *pui32MaxPacketSize, - uint32_t *pui32Flags); -extern void md_usb_dev_endpoint_ack(uint32_t ui32Endpoint, - bool bIsLastPacket); -extern void md_usb_dev_endpoint_stall(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dev_endpoint_stall_clear(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dev_endpoint_status_clear(uint32_t ui32Endpoint, - uint32_t ui32Flags); -/* Host/Device Mode */ -extern uint32_t md_usb_hosdev_endpoint_datavai(uint32_t ui32Endpoint); -extern int32_t md_usb_hosdev_endpoint_data_get(uint32_t ui32Endpoint, - uint8_t *pui8Data, uint32_t *pui32Size); -extern int32_t md_usb_hosdev_endpoint_data_put(uint32_t ui32Endpoint, - uint8_t *pui8Data, - uint32_t ui32Size); -extern int32_t md_usb_hosdev_endpoint_data_send(uint32_t ui32Endpoint, - uint32_t ui32TransType); -extern void md_usb_hosdev_endpoint_data_togglec(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hosdev_endpoint_pkcount_set(uint32_t ui32Endpoint, - uint32_t ui32Count); -extern uint32_t md_usb_hosdev_endpoint_status(uint32_t ui32Endpoint); -extern void md_usb_hosdev_endpoint_int_disable(uint32_t ui32IntFlags); -extern void md_usb_hosdev_endpoint_int_enable(uint32_t ui32IntFlags); -extern uint32_t md_usb_hosdev_endpoint_int_status(void); -extern uint32_t md_usb_endpoint_number_get(void); -/** - * @} USB endpoint API. - */ - -/** - * @{ USB FIFO API. - */ -extern uint32_t md_usb_hosdev_fifo_addr_get(uint32_t ui32Endpoint); -extern void md_usb_hosdev_fifo_config_get(uint32_t ui32Endpoint, uint32_t *pui32FIFOAddress, - uint32_t *pui32FIFOSize, uint32_t ui32Flags); -extern void md_usb_hosdev_fifo_config_set(uint32_t ui32Endpoint, uint32_t ui32FIFOAddress, - uint32_t ui32FIFOSize, uint32_t ui32Flags); -extern void md_usb_hosdev_fifo_flush(uint32_t ui32Endpoint, uint32_t ui32Flags); -/** - * @} USB FIFO API. - */ - -/** - * @{ USB PWR API.it is not supported by es32f0271. - */ -extern void md_usb_hos_pwr_disable(void); -extern void md_usb_hos_pwr_enable(void); -extern void md_usb_hos_pwr_config(uint32_t ui32Flags); -extern void md_usb_hos_pwrfault_disable(void); -extern void md_usb_hos_pwrfault_enable(void); -/** - * @} USB PWR API. - */ - -/** - * @{ USB LPM API.it is not supported by es32f0271. - */ -extern void md_usb_hos_lpm_send(uint32_t ui32Address, - uint32_t uiEndpoint); -extern void md_usb_hos_lpm_config(uint32_t ui32ResumeTime, - uint32_t ui32Config); -extern bool md_usb_lpm_remotewake_is_enabled(void); -extern void md_usb_hos_lpm_resume(void); -extern void md_usb_dev_lpm_remotewake(void); -extern void md_usb_dev_lpm_config(uint32_t ui32Config); -extern void md_usb_dev_lpm_enable(void); -extern void md_usb_dev_lpm_disable(void); -extern uint32_t md_usb_lpm_link_state_get(void); -extern uint32_t md_usb_lpm_endpoint_get(void); -extern uint32_t md_usb_lpm_status(void); -extern void md_usb_lpm_int_disable(uint32_t ui32Ints); -extern void md_usb_lpm_int_enable(uint32_t ui32Ints); -/** - * @} USB LPM API. - */ - -/** - * @{ USB ULPI API.it is not supported by es32f0271. - */ -extern void md_usb_ulpi_config(uint32_t ui32Config); -extern void md_usb_ulpi_enable(void); -extern void md_usb_ulpi_disable(void); -extern uint8_t md_usb_ulpi_reg_read(uint8_t ui8Reg); -extern void md_usb_ulpi_reg_write(uint8_t ui8Reg, - uint8_t ui8Data); -/** - * @} USB ULPI API. - */ - -/** - * @{ USB DMA API.it is not supported by es32f0271. - */ -extern void md_usb_dma_endpoint_channel_set(uint32_t ui32Endpoint, - uint32_t ui32Channel); -extern void md_usb_dma_endpoint_enable(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dma_endpoint_disable(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dma_endpoint_config(uint32_t ui32Endpoint, - uint32_t ui32Config); -extern void md_usb_dma_channel_config(uint32_t ui32Channel, - uint32_t ui32Endpoint, - uint32_t ui32Config); -extern void md_usb_dma_channel_address_set(uint32_t ui32Channel, - void *pvAddress); -extern void *md_usb_dma_channel_address_get(uint32_t ui32Channel); -extern void md_usb_dma_channel_count_set(uint32_t ui32Count, - uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_count_get(uint32_t ui32Channel); -extern void md_usb_dma_channel_int_enable(uint32_t ui32Channel); -extern void md_usb_dma_channel_int_disable(uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_int_status(void); -extern void md_usb_dma_channel_enable(uint32_t ui32Channel); -extern void md_usb_dma_channel_disable(uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_isenabled(uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_status(uint32_t ui32Channel); -extern void md_usb_dma_channel_status_clear(uint32_t ui32Channel, - uint32_t ui32Status); -/** - * @} USB DMA API. - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics Co., Ltd. *** END OF FILE ****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/ReleaseNote.html b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/ReleaseNote.html deleted file mode 100644 index de5a1aada3..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/ReleaseNote.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - -ReleaseNote -

ES32F0271 MD Release Note

-

V1.00 2019-1-4

-

初版发布

-

V1.01 2019-5-7

-

1.修改USB MD库相关接口

-

V1.03 2019-09-23

-
    -
  1. 增加ADC校準函數
  2. - -
- - \ No newline at end of file diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_adc.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_adc.c deleted file mode 100644 index d8571b0912..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_adc.c +++ /dev/null @@ -1,298 +0,0 @@ -/** - ****************************************************************************** - * @file md_adc.c - * @brief ES32F0271 ADC Source File. - * - * @version V1.00.01 - * @data 7/01/2019 - * @author Taipei AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - - -/* Includes -------------------------------------------------------------------*/ -#include "md_adc.h" -#include "md_syscfg.h" -#include - - -/** @addtogroup Micro_Driver - * @{ - */ - - -/** @defgroup ADC ADC - * @brief ADC micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -#define Reference_V1 1 //First reference point -#define Reference_V2 2 //Second reference point - -double Ideal_V1; -double Ideal_V2; -double Reference_V1_ADCValue ; -double Reference_V2_ADCValue ; - -/* Private function prototypes ------------------------------------------------*/ -void (*md_adc_SS0_sample[])(ADC_TypeDef *, uint32_t) = -{ - md_adc_set_ss0_mux0_mux0, - md_adc_set_ss0_mux0_mux1, - md_adc_set_ss0_mux0_mux2, - md_adc_set_ss0_mux0_mux3, - md_adc_set_ss0_mux0_mux4, - md_adc_set_ss0_mux0_mux5, - md_adc_set_ss0_mux0_mux6, - md_adc_set_ss0_mux0_mux7, - md_adc_set_ss0_mux1_mux8, - md_adc_set_ss0_mux1_mux9, - md_adc_set_ss0_mux1_mux10, - md_adc_set_ss0_mux1_mux11, - md_adc_set_ss0_mux1_mux12, - md_adc_set_ss0_mux1_mux13, - md_adc_set_ss0_mux1_mux14, - md_adc_set_ss0_mux1_mux15 -}; - -void (*md_adc_SS1_sample[])(ADC_TypeDef *, uint32_t) = -{ - md_adc_set_ss0_mux0_mux0, - md_adc_set_ss0_mux0_mux1, - md_adc_set_ss0_mux0_mux2, - md_adc_set_ss0_mux0_mux3, - md_adc_set_ss0_mux0_mux4, - md_adc_set_ss0_mux0_mux5, - md_adc_set_ss0_mux0_mux6, - md_adc_set_ss0_mux0_mux7, -}; - -void (*md_adc_SS2_sample[])(ADC_TypeDef *, uint32_t) = -{ - md_adc_set_ss0_mux0_mux0, - md_adc_set_ss0_mux0_mux1, - md_adc_set_ss0_mux0_mux2, - md_adc_set_ss0_mux0_mux3, -}; - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup ADC_PUB_FUNC ADC Public Functions - * @brief ADC Public Functions - * @{ - */ -/** - * @brief ADC Initialization Function. - * @param ADC Instance. - * @param channel - * @retval None - */ -void md_adc_init(ADC_TypeDef *ADCx, md_adc_inittypedef *ADC_InitStruct, uint8_t *channel) -{ - uint8_t i = 0; - - md_syscfg_enable_cfg_currgen(SYSCFG); - md_syscfg_set_cfg_vlrs(SYSCFG, ADC_InitStruct->VRLS); - md_syscfg_enable_cfg_vrefen(SYSCFG); - - if (ADC_InitStruct->SSx == 0) - { - md_adc_set_ss0_con_sel(ADC, ADC_InitStruct->Sel); - md_adc_set_ss0_con_type(ADC, ADC_InitStruct->Type); - - md_adc_set_srate_cntini(ADC, ADC_InitStruct->Cntini); - md_adc_set_srate_cnt(ADC, ADC_InitStruct->Cnt); - md_adc_set_frf_ffrst(ADC); - - - for (i = 0; i < 16; i++) - md_adc_SS0_sample[i](ADC, channel[i]); - - md_adc_enable_ier_ss0ie(ADC); - md_adc_set_ss0_end_end(ADC, ADC_InitStruct->End); - md_adc_enable_ss0_end_ie15(ADC); - md_adc_set_gainh_ch8pga(ADC, MD_ADC_GAIN_CHPGA_X1); - - - md_adc_set_srate(ADC, (ADC_InitStruct->Ckdiv) | ADC_SRATE_CKEN_MSK); - md_adc_enable_ssen_ss0en(ADC); - } - else if (ADC_InitStruct->SSx == 1) - { - md_adc_set_ss1_con_sel(ADC, ADC_InitStruct->Sel); - md_adc_set_ss1_con_type(ADC, ADC_InitStruct->Type); - - md_adc_set_srate_cntini(ADC, ADC_InitStruct->Cntini); - md_adc_set_srate_cnt(ADC, ADC_InitStruct->Cnt); - md_adc_set_frf_ffrst(ADC); - - for (i = 0; i < 8; i++) - md_adc_SS1_sample[i](ADC, channel[i]); - - md_adc_enable_ier_ss1ie(ADC); - md_adc_set_ss1_end_end(ADC, ADC_InitStruct->End); - md_adc_enable_ss1_end_ie7(ADC); - md_adc_set_gainh_ch8pga(ADC, MD_ADC_GAIN_CHPGA_X1); - - md_adc_set_srate(ADC, (ADC_InitStruct->Ckdiv) | ADC_SRATE_CKEN_MSK); - md_adc_enable_ssen_ss1en(ADC); - } - else if (ADC_InitStruct->SSx == 2) - { - md_adc_set_ss2_con_sel(ADC, ADC_InitStruct->Sel); - md_adc_set_ss2_con_type(ADC, ADC_InitStruct->Type); - - md_adc_set_srate_cntini(ADC, ADC_InitStruct->Cntini); - md_adc_set_srate_cnt(ADC, ADC_InitStruct->Cnt); - md_adc_set_frf_ffrst(ADC); - - for (i = 0; i < 4; i++) - md_adc_SS2_sample[i](ADC, channel[i]); - - md_adc_enable_ier_ss2ie(ADC); - md_adc_set_ss2_end_end(ADC, ADC_InitStruct->End); - md_adc_enable_ss2_end_ie3(ADC); - md_adc_set_gainh_ch8pga(ADC, MD_ADC_GAIN_CHPGA_X1); - - md_adc_set_srate(ADC, (ADC_InitStruct->Ckdiv) | ADC_SRATE_CKEN_MSK); - md_adc_enable_ssen_ss2en(ADC); - } - else - { - md_adc_set_ss3_con_sel(ADC, ADC_InitStruct->Sel); - md_adc_set_ss3_con_type(ADC, ADC_InitStruct->Type); - - md_adc_set_srate_cntini(ADC, ADC_InitStruct->Cntini); - md_adc_set_srate_cnt(ADC, ADC_InitStruct->Cnt); - md_adc_set_frf_ffrst(ADC); - - MODIFY_REG(ADC->SS3_MUX0, ADC_SS3_MUX0_MUX0_MSK, MD_ADC_SS_MUX_ADIN8 << ADC_SS3_MUX0_MUX0_POSS); - - md_adc_enable_ier_ss3ie(ADC); - md_adc_set_ss3_end_end(ADC, ADC_InitStruct->End); - md_adc_enable_ss3_end_ie0(ADC); - md_adc_set_gainh_ch8pga(ADC, MD_ADC_GAIN_CHPGA_X1); - - md_adc_set_srate(ADC, (ADC_InitStruct->Ckdiv) | ADC_SRATE_CKEN_MSK); - md_adc_enable_ssen_ss3en(ADC); - } -} - - -/** - * @brief Get the ADC calibration offset data - * @param vref: reference v - * @param vdd: external v - * @param offset: Get Offset - * @param coefficient: Get Coefficient - * @retval None - */ -void md_adc_calibration_data(double vdd, double vref,double *offset,double *coefficient) -{ - Ideal_V1 = Reference_V1 / vref * 4096; - Ideal_V2 = Reference_V2 / vref * 4096; - if (vdd == 5 && vref == 5) - { - if ((FC->ADCTRIM_VDD5V_VREF5V >> 24) == 0xA5) - { - Reference_V1_ADCValue = FC->ADCTRIM_VDD5V_VREF5V & 0xFFF; - Reference_V2_ADCValue = (FC->ADCTRIM_VDD5V_VREF5V >> 12) & 0xFFF; - } - } - else if (vdd == 3.3 && vref == 3.3) - { - if ((FC->ADCTRIM_VDD3V3_VREF3V3 >> 24) == 0xA5) - { - Reference_V1_ADCValue = FC->ADCTRIM_VDD3V3_VREF3V3 & 0xFFF; - Reference_V2_ADCValue = (FC->ADCTRIM_VDD3V3_VREF3V3 >> 12) & 0xFFF; - } - } - else if ((vdd == 5 && vref == 2.5) || (vdd == 3.3 && vref == 2.5)) - { - if ((FC->ADCTRIM_VDD5V_VREF2V5 >> 24) == 0xA5) - { - Reference_V1_ADCValue = FC->ADCTRIM_VDD5V_VREF2V5 & 0xFFF; - Reference_V2_ADCValue = (FC->ADCTRIM_VDD5V_VREF2V5 >> 12) & 0xFFF; - } - } - else - { - - } - -// Reference_V1_ADCValue = 115 ; -// Reference_V2_ADCValue = 365 ; - - printf("Ideal_V1:%.2f\r\n", Ideal_V1); - printf("Ideal_V2:%.2f\r\n", Ideal_V2); - printf("Reference_V1_ADCValue:%.2f\r\n", Reference_V1_ADCValue); - printf("Reference_V2_ADCValue:%.2f\r\n", Reference_V2_ADCValue); - - *offset = (Reference_V2 * Reference_V1_ADCValue - Reference_V1 * Reference_V2_ADCValue) / (Reference_V2 - Reference_V1); - printf("Offset=%.2f\r\n", *offset); - *coefficient = Ideal_V1 / (Reference_V1_ADCValue - *offset); - printf("Coefficient=%.2f\r\n", *coefficient); -} - -/** - * @brief Get the ADC fixed data - * @param SSx: Sequence SSx - * @param offset:input offset - * @param coefficient: input coefficient - * @param calibration :get calibration result - * @retval None - */ - -void md_adc_get_data(uint8_t SSx,double offset,double coefficient, uint16_t *calibration) -{ - uint16_t i, data, s_times; - double calibration_value = 0; - - if (SSx == 0) - s_times = 16; - else if (SSx == 1) - s_times = 8; - else if (SSx == 2) - s_times = 4; - else - s_times = 1; - - for (i = 0; i < s_times; i++) - { - if(SSx == 0) - data = md_adc_get_ss0_data(ADC); - else if(SSx == 1) - data = md_adc_get_ss1_data(ADC); - else if(SSx == 2) - data = md_adc_get_ss2_data(ADC); - else - data = md_adc_get_ss3_data(ADC); - if(data >= 4095) - data = 4095; - printf("data = %4d\r\n",data); - calibration_value = (data - offset) * coefficient; - if (calibration_value >= 4095) - calibration_value = 4095; - *calibration++=(uint16_t)calibration_value; - } -} -/** - * @} ADC_PUB_FUNC ADC Public Functions - */ - -/** - * @} ADC - */ - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_fc.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_fc.c deleted file mode 100644 index ce5d644209..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_fc.c +++ /dev/null @@ -1,300 +0,0 @@ -/** - ****************************************************************************** - * @file md_fc.c - * @brief ES32F0271 FC Source File. - * - * @version V1.00.01 - * @date day/mon/year - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "md_syscfg.h" -#include "md_fc.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (FC) - -/** @defgroup FC FC - * @brief FC micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Private constants ----------------------------------------------------------*/ -/** @defgroup MD_FC_Private_Constants FC Private Constants - * @{ - */ - -#define REMAPDATA_BASE (( uint32_t)0x00000000) /* FLASH Main (64K Bytes) */ -#define REMAPINFO_BASE (( uint32_t)0x00000000) /* FLASH Info ( 6K Bytes) - Boot Loader Memory */ - -#define EFOPT_PAGE6_OFFSET (MD_FC_PC_EF_IPAGESZ*6) -#define EFOPT_PAGE7_OFFSET (MD_FC_PC_EF_IPAGESZ*7) -#define EFOPT_PL1_OFFSET (MD_FC_PC_EF_IPAGESZ*7+0x0) -#define EFOPT_PL2_OFFSET (MD_FC_PC_EF_IPAGESZ*6+0x28) -#define EFOPT_REMAP_OFFSET (MD_FC_PC_EF_IPAGESZ*7+0x8) - -/** - * @} MD_FC_Private_Constants - */ - -/* Private function prototypes ------------------------------------------------*/ - -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_FC_Public_Functions FC Public Functions - * @{ - */ - -/** - * @brief FC main erase. - * @note To prevent unexpected code branch, the main erase function must specify a dedicated main erase ID - * @param MEraseID Key for main erase, must be 0xA5A5AA55 - * @retval An ErrorStatus enumeration value: - * - SUCCESS: Main flash erased - * - ERROR: Main erase ID mismatch - */ -ErrorStatus md_fc_merase(uint32_t MEraseID) -{ - ErrorStatus status = ERROR; - - /* Check the ID */ - if (MEraseID != MD_FC_PC_EF_MERASEID) - return status; - - /* Write MERASE to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_MACRO_ERASE); - - status = SUCCESS; - return status; -} - -/** - * @brief FC Sector Erase - * @note To prevent unexpected code branch, the page erase function must specify the complement start address - * @param pSErasePara Pointer to structure md_fc_ControlTypeDef - * @retval An ErrorStatus enumeration value. - * - SUCCESS: Specified page address erased - * - ERROR: Complement of start address mismatch - */ -ErrorStatus md_fc_serase(md_fc_ControlTypeDef *pSErasePara) -{ - ErrorStatus status = ERROR; - - /* Check the start address and complement of start address*/ - if (pSErasePara->SAddr & pSErasePara->SAddrC) - return status; - - /* Write sector address to PA*/ - md_fc_set_pa_prog_addr(pSErasePara->SAddr); - /* Write SERASE to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_SECTOR_ERASE); - - status = SUCCESS; - return status; -} - -/** - * @brief FC Page Program - * @note To prevent unexpected code branch, the page program function must specify the complement start address - * @param pProgramPara Pointer to structure md_fc_ControlTypeDef - * @retval An ErrorStatus enumeration value. - * - SUCCESS: Data in data buffer programed to specified page address - * - ERROR: Complement of start address mismatch - */ -ErrorStatus md_fc_program(md_fc_ControlTypeDef *pProgramPara) -{ - ErrorStatus status = ERROR; - uint16_t BCnt; - - md_fc_set_pa_pcnt(pProgramPara->BCnt); - md_fc_set_pa_prog_addr(pProgramPara->SAddr); - BCnt = pProgramPara->BCnt; - BCnt >>= 3; - - while (BCnt--) - { - /* Check the start address and complement of start address*/ - if (pProgramPara->SAddr & pProgramPara->SAddrC) - return status; - - /* Write lower 32bit program data to PLD*/ - md_fc_set_pld(*pProgramPara->pU32Buf++); - /* Write higher 32bit program data to PHD*/ - md_fc_set_phd(*pProgramPara->pU32Buf++); - /* Write PROGRAM to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_PROG_EFLASH); - } - - status = SUCCESS; - return status; -} - -/** - * @brief FC Page Read - * @param pReadPara Pointer to structure md_fc_ControlTypeDef - * @retval Always return SUCCESS - * - Data in specified page address read to data buffer - */ -ErrorStatus md_fc_read(md_fc_ControlTypeDef *pReadPara) -{ - ErrorStatus status = SUCCESS; - uint32_t *EFAddr; - uint16_t BCnt; - - if (md_syscfg_get_remap_memmod(SYSCFG) == MD_SYSCFG_MEMMOD_MAIN) /* Reamp from Main */ - EFAddr = (uint32_t *)(REMAPDATA_BASE + pReadPara->SAddr); - else - EFAddr = (uint32_t *)(FLASH_BASE + pReadPara->SAddr); - - BCnt = pReadPara->BCnt; - BCnt >>= 2; - - while (BCnt--) - *pReadPara->pU32Buf++ = *EFAddr++; - - return status; -} - -/** - * @brief FC Update Protect Level 1 Setting - * @param pUpdPL1Para Pointer to structure md_fc_UpdProtTypeDdef - * @retval Always return SUCCESS - */ -ErrorStatus md_fc_updprotl1(md_fc_UpdProtTypeDef *pUpdPL1Para) -{ - ErrorStatus status = SUCCESS; - uint32_t EFProtL1L, EFProtL1H; - - EFProtL1L = FC->OP_PRT1L; - EFProtL1H = FC->OP_PRT1H; - - if ((EFProtL1L == 0xffffffffUL) && (EFProtL1H == 0xffffffffUL)) /* First Time to Set Level1 */ - { - /* Write offset address to PA*/ - md_fc_set_pa_prog_addr(EFOPT_PL1_OFFSET); - md_fc_enable_pa_ifren(); - /* Write lower 32bit update data to PLD*/ - md_fc_set_pld(pUpdPL1Para->UpdateL); - /* Write higher 32bit update data to PHD*/ - md_fc_set_phd(pUpdPL1Para->UpdateH); - - /* Write PROGRAM to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_PROG_EFLASH); - } - else - { - /* Write lower 32bit clear data to PLD*/ - md_fc_set_pld(pUpdPL1Para->ClearL); - /* Write higher 32bit clear data to PHD*/ - md_fc_set_phd(pUpdPL1Para->ClearH); - - /* Write lower 32bit data to UPL*/ - md_fc_set_upl(pUpdPL1Para->UpdateL); - /* Write higher 32bit data to UPH*/ - md_fc_set_uph(pUpdPL1Para->UpdateH); - - /* Write UPDPL1 to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_UPDATE_LV1_PROTECT); - } - - return status; -} - -/** - * @brief FC Update Protect Level 2 Setting - * @param pUpdPL2Para Pointer to structure md_fc_UpdProtTypeDdef - * @retval Always return SUCCESS - */ -ErrorStatus md_fc_updprotl2(md_fc_UpdProtTypeDef *pUpdPL2Para) -{ - ErrorStatus status = SUCCESS; - uint32_t EFProtL2L, EFProtL2H; - - EFProtL2L = FC->OP_PRT2L; - EFProtL2H = FC->OP_PRT2H; - - if ((EFProtL2L == 0xffffffffUL) && (EFProtL2H == 0xffffffffUL)) /* First Time to Set Level2 */ - { - /* Write offset address to PA*/ - md_fc_set_pa_prog_addr(EFOPT_PL2_OFFSET); - md_fc_enable_pa_ifren(); - /* Write lower 32bit update data to PLD*/ - md_fc_set_pld(pUpdPL2Para->UpdateL); - /* Write higher 32bit update data to PHD*/ - md_fc_set_phd(pUpdPL2Para->UpdateH); - - /* Write PROGRAM to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_PROG_EFLASH); - } - else - { - /* Write lower 32bit clear data to PLD*/ - md_fc_set_pld(pUpdPL2Para->ClearL); - /* Write higher 32bit clear data to PHD*/ - md_fc_set_phd(pUpdPL2Para->ClearH); - - /* Write lower 32bit data to UPL*/ - md_fc_set_upl(pUpdPL2Para->UpdateL); - /* Write higher 32bit data to UPH*/ - md_fc_set_uph(pUpdPL2Para->UpdateH); - - /* Write UPDPL2 to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_UPDATE_LV2_PROTECT); - } - - return status; -} - -/** - * @brief FC Update Remap Option - * @param UpdRemap New remap setting value (remap address=valus(0x0~0xf)*0x1000, 0x10=BootLoader) - * @retval Always return SUCCESS - */ -ErrorStatus md_fc_updremap(uint8_t UpdRemap) -{ - ErrorStatus status = SUCCESS; - - /* Write sector address to PA*/ - md_fc_enable_pa_ifren(); - md_fc_set_pa_prog_addr(EFOPT_PAGE7_OFFSET); - /* Write SERASE to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_SECTOR_ERASE); - /* Write remap offset address to PA*/ - md_fc_set_pa_prog_addr(EFOPT_REMAP_OFFSET); - md_fc_enable_pa_ifren(); - /* Write lower 32bit remap data to PLD*/ - md_fc_set_pld(0xffffff00UL | UpdRemap); - /* Write higher 32bit remap data to PHD*/ - md_fc_set_phd(0xffffffffUL); - /* Write PROGRAM to CMD*/ - md_fc_set_fc_cmd(MD_FC_PC_CMD_PROG_EFLASH); - - return status; -} - -/** - * @} MD_FC_Public_Functions - */ - -/** - * @} FC - */ -#endif - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_gpio.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_gpio.c deleted file mode 100644 index 0fa1126bab..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_gpio.c +++ /dev/null @@ -1,215 +0,0 @@ -/** - ****************************************************************************** - * @file md_gpio.c - * @brief ES32F0271 GPIO Source File. - * - * @version V1.00.01 - * @data day/mon/year - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "md_rcu.h" -#include "md_gpio.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) - -/** @defgroup GPIO GPIO - * @brief GPIO micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/** @defgroup MD_GPIO_Private_Macros GPIO Private Macros - * @{ - */ -#define IS_MD_GPIO_ALL_INSTANCE(__INSTANCE__) ((__INSTANCE__ == GPIOA) \ - || (__INSTANCE__ == GPIOB)) \ -|| (__INSTANCE__ == GPIOC)) \ -|| (__INSTANCE__ == GPIOD)) - -#define IS_MD_GPIO_PIN(__VALUE__) (((__VALUE__) == MD_GPIO_PIN_0) \ - || ((__VALUE__) == MD_GPIO_PIN_1) \ - || ((__VALUE__) == MD_GPIO_PIN_2) \ - || ((__VALUE__) == MD_GPIO_PIN_3) \ - || ((__VALUE__) == MD_GPIO_PIN_4) \ - || ((__VALUE__) == MD_GPIO_PIN_5) \ - || ((__VALUE__) == MD_GPIO_PIN_6) \ - || ((__VALUE__) == MD_GPIO_PIN_7) \ - || ((__VALUE__) == MD_GPIO_PIN_8) \ - || ((__VALUE__) == MD_GPIO_PIN_9) \ - || ((__VALUE__) == MD_GPIO_PIN_10) \ - || ((__VALUE__) == MD_GPIO_PIN_11) \ - || ((__VALUE__) == MD_GPIO_PIN_12) \ - || ((__VALUE__) == MD_GPIO_PIN_13) \ - || ((__VALUE__) == MD_GPIO_PIN_14) \ - || ((__VALUE__) == MD_GPIO_PIN_15)) \ - -#define IS_MD_GPIO_MODE(__VALUE__) (((__VALUE__) == MD_GPIO_MODE_INPUT) \ - || ((__VALUE__) == MD_GPIO_MODE_OUTPUT) \ - || ((__VALUE__) == MD_GPIO_MODE_FUNCTION) \ - || ((__VALUE__) == MD_GPIO_MODE_ANALOG)) - -#define IS_MD_GPIO_OUTPUT_TYPE(__VALUE__) (((__VALUE__) == MD_GPIO_OUTPUT_PUSHPULL) \ - || ((__VALUE__) == MD_GPIO_OUTPUT_OPENDRAIN)) - -#define IS_MD_GPIO_PULL(__VALUE__) (((__VALUE__) == MD_GPIO_PULL_FLOATING) \ - || ((__VALUE__) == MD_GPIO_PULL_UP) \ - || ((__VALUE__) == MD_GPIO_PULL_DOWN) - -#define IS_MD_GPIO_DS(__VALUE__) (((__VALUE__) == MD_GPIO_DS_8mA) \ - || ((__VALUE__) == MD_GPIO_DS_16mA)) - -#define IS_MD_GPIO_FUNCTION(__VALUE__) (((__VALUE__) == MD_GPIO_AF0) \ - || ((__VALUE__) == MD_GPIO_AF1) \ - || ((__VALUE__) == MD_GPIO_AF2) \ - || ((__VALUE__) == MD_GPIO_AF3) \ - || ((__VALUE__) == MD_GPIO_AF4) \ - || ((__VALUE__) == MD_GPIO_AF5) \ - || ((__VALUE__) == MD_GPIO_AF6) \ - || ((__VALUE__) == MD_GPIO_AF7)) - -#define IS_MD_GPIO_IST(__VALUE__) (((__VALUE__) == MD_GPIO_IST_TTL) \ - || ((__VALUE__) == MD_GPIO_IST_CMOS)) - -/** - * @} MD_GPIO_Private_Macros - */ - -/* Private function prototypes ------------------------------------------------*/ - -/* Public functions -----------------------------------------------------------*/ -/** @addtogroup MD_GPIO_Public_Functions GPIO Public Functions - * @{ - */ - -/** @addtogroup MD_GPIO_PF_Init GPIO Public Init Functions - * @{ - */ - -/** - * @brief De-initialize the GPIO registers to their default reset values. - * @param GPIOx GPIO Instance - * @retval An ErrorStatus enumeration value: - * - SUCCESS: GPIO registers are de-initialized - * - ERROR: GPIO registers are not de-initialized - */ -ErrorStatus md_gpio_deinit(GPIO_TypeDef *GPIOx) -{ - ErrorStatus status = ERROR; - - /* Check the parameters */ - assert_param(IS_MD_GPIO_ALL_INSTANCE(GPIOx)); - - /* Force reset of GPIO clock */ - if (GPIOx == GPIOA) - { - md_rcu_enable_ahbrst_gpaen(RCU); - } - else if (GPIOx == GPIOB) - { - md_rcu_enable_ahbrst_gpben(RCU); - } - else if (GPIOx == GPIOC) - { - md_rcu_enable_ahbrst_gpcen(RCU); - } - else /* if(GPIOx==GPIOD) */ - { - md_rcu_enable_ahbrst_gpden(RCU); - } - - status = SUCCESS; - - return status; -} - -/** - * @brief Initialize the GPIO registers according to the specified parameters in GPIO_InitStruct. - * @note As some bits in GPIO configuration registers can only be written when the GPIO is disabled (GPIO_CR1_SPE bit =0), - * GPIO IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned. - * @param GPIOx GPIO Instance - * @param GPIO_InitStruct pointer to a @ref md_gpio_inittypedef structure - * @retval An ErrorStatus enumeration value. (Return always SUCCESS) - */ -ErrorStatus md_gpio_init(GPIO_TypeDef *GPIOx, md_gpio_inittypedef *GPIO_InitStruct) -{ - ErrorStatus status = ERROR; - - /* Check the GPIO Instance GPIOx*/ - assert_param(IS_MD_GPIO_ALL_INSTANCE(GPIOx)); - - /* Check the GPIO parameters from GPIO_InitStruct*/ - assert_param(IS_MD_GPIO_PIN(GPIO_InitStruct->Pin)); - assert_param(IS_MD_GPIO_MODE(GPIO_InitStruct->Mode)); - assert_param(IS_MD_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType)); - assert_param(IS_MD_GPIO_PULL(GPIO_InitStruct->Pull)); - assert_param(IS_MD_GPIO_DS(GPIO_InitStruct->OutDrive)); - assert_param(IS_MD_GPIO_FUNCTION(GPIO_InitStruct->Function)); - - if (POSITION_VAL(GPIO_InitStruct->Pin) <= 7) - { - md_gpio_set_function0_7(GPIOx, GPIO_InitStruct->Pin, GPIO_InitStruct->Function); - } - else - { - md_gpio_set_function8_15(GPIOx, GPIO_InitStruct->Pin, GPIO_InitStruct->Function); - } - - md_gpio_set_mode(GPIOx, GPIO_InitStruct->Pin, GPIO_InitStruct->Mode); - md_gpio_set_output_type(GPIOx, GPIO_InitStruct->Pin, GPIO_InitStruct->OutputType); - md_gpio_set_pull(GPIOx, GPIO_InitStruct->Pin, GPIO_InitStruct->Pull); - md_gpio_set_ds(GPIOx, GPIO_InitStruct->Pin, GPIO_InitStruct->OutDrive); - - status = SUCCESS; - - return status; -} - -/** - * @brief Set each @ref md_gpio_inittypedef field to default value. - * @param GPIO_InitStruct pointer to a @ref md_gpio_inittypedef structure - * whose fields will be set to default values. - * @retval None - */ -void md_gpio_struct_init(md_gpio_inittypedef *GPIO_InitStruct) -{ - /* Set GPIO_InitStruct fields to default values */ - GPIO_InitStruct->Function = MD_GPIO_AF0; - GPIO_InitStruct->Mode = MD_GPIO_MODE_ANALOG; - GPIO_InitStruct->OutDrive = MD_GPIO_DS_8mA; - GPIO_InitStruct->OutputType = MD_GPIO_OUTPUT_PUSHPULL; - GPIO_InitStruct->Pull = MD_GPIO_PULL_FLOATING; - GPIO_InitStruct->Pin = MD_GPIO_PIN_ALL; -} - -/** - * @} MD_GPIO_PF_Init - */ - -/** - * @} MD_GPIO_Public_Functions - */ - -/** - * @} GPIO - */ -#endif - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_i2c.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_i2c.c deleted file mode 100644 index e2dab7dc57..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_i2c.c +++ /dev/null @@ -1,245 +0,0 @@ -/** - ****************************************************************************** - * @file md_i2c.c - * @brief ES32F0271 I2C Source File. - * - * @version V1.00.01 - * @date 4/12/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "md_i2c.h" -#include "md_rcu.h" -#include -#include "stdint.h" -/** @addtogroup Micro_Driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/** - * @brief Initialize the I2C registers according to the specified parameters in I2C_InitStruct. - * @note The parameters in md_i2c_init should be expected values. Otherwise, ERROR result will be returned. - * @param I2Cx I2C Instance - * @param I2C_InitStruct pointer to a @ref md_i2c_inittypedef structure - * @retval An ErrorStatus enumeration value. (Return always SUCCESS) - */ -ErrorStatus md_i2c_init(I2C_TypeDef *I2Cx, md_i2c_inittypedef *I2C_InitStruct) -{ - ErrorStatus status = ERROR; - uint8_t pllmulnow; - - /* Check the I2C Instance I2Cx */ - assert_param(IS_MD_I2C_ALL_INSTANCE(I2Cx)); - - /* Check the I2C parameters from I2C_InitStruct */ - assert_param(IS_MD_I2C_TIMING(I2C_InitStruct->Timing)); - assert_param(IS_MD_I2C_ADDRSIZE(I2C_InitStruct->AddrSize)); - assert_param(IS_MD_I2C_ADDRESS1(I2C_InitStruct->Address1)); - assert_param(IS_MD_I2C_DUALADDRESSMODE(I2C_InitStruct->DualAddressMode)); - assert_param(IS_MD_I2C_ADDRESS2(I2C_InitStruct->Address2)); - assert_param(IS_MD_I2C_ADDRESS2MASKS(I2C_InitStruct->Address2Masks)); - /* Check the PLL clock, if not corrt, modify it */ - pllmulnow = md_rcu_get_cfg_pllmul(RCU); - - if (pllmulnow != (uint8_t)((I2C_InitStruct->Timing) >> 28)) - { - md_rcu_pllreinit((uint8_t)((I2C_InitStruct->Timing) >> 28)); - } - - md_i2c_disable_con1_pe(I2Cx); - md_i2c_set_timingr_presc(I2Cx, ((I2C_InitStruct->Timing) >> 24) & 0xF); - md_i2c_set_timingr_scll(I2Cx, ((I2C_InitStruct->Timing) >> 16) & 0xFF); - md_i2c_set_timingr_sclh(I2Cx, ((I2C_InitStruct->Timing) >> 8) & 0xFF); - md_i2c_set_timingr_sdadel(I2Cx, ((I2C_InitStruct->Timing) >> 4) & 0xF); - md_i2c_set_timingr_scldel(I2Cx, (I2C_InitStruct->Timing) & 0xF); - md_i2c_enable_con1_pe(I2Cx); - - md_i2c_disable_addr1_oa1en(I2Cx); - md_i2c_set_addr1_oa1(I2Cx, I2C_InitStruct->Address1); - - if (I2C_InitStruct->AddrSize == MD_I2C_OA1_10BIT) - md_i2c_set_addr1_oa1mode(I2Cx, MD_I2C_OA1_10BIT); - else - md_i2c_set_addr1_oa1mode(I2Cx, MD_I2C_OA1_7BIT); - - md_i2c_enable_addr1_oa1en(I2Cx); - - if (I2C_InitStruct->DualAddressMode == MD_I2C_DUALADDRESS_ENABLE) - { - md_i2c_disable_addr2_oa2en(I2Cx); - md_i2c_set_addr2_oa2mask(I2Cx, I2C_InitStruct->Address2Masks); - md_i2c_set_addr2_oa2(I2Cx, I2C_InitStruct->Address2); - md_i2c_enable_addr2_oa2en(I2Cx); - } - - status = SUCCESS; - - return status; -} - -/** - * @brief Set each @ref md_i2c_inittypedef field to default value. - * @param UART_InitStruct pointer to a @ref md_i2c_inittypedef structure - * whose fields will be set to default values. - * @retval None - */ -void md_i2c_struct_init(md_i2c_inittypedef *I2C_InitStruct) -{ - /* Set UART_InitStruct fields to default values */ - I2C_InitStruct->Timing = CLK100kHz48M; - I2C_InitStruct->AddrSize = MD_I2C_ADDRESSINGMODE_7BIT; - I2C_InitStruct->Address1 = 0x50 << 1; - I2C_InitStruct->DualAddressMode = MD_I2C_DUALADDRESS_DISABLE; - I2C_InitStruct->Address2 = 0x70 << 1; - I2C_InitStruct->Address2Masks = MD_I2C_ADDR2_NOMASK; -} - -/** - * @brief Transmits in master mode an amount of data in blocking mode. - * @param I2Cx I2C Instance - * @param The number of bytes to be transmitted - * @param Enable/Disable 10-bit addressing mode - * @param Device(slave) address - * @param The pointer to a data buffer - * @retval None - */ -void md_i2c_master_send(I2C_TypeDef *I2Cx, uint8_t Nbyte, uint32_t addr10, uint16_t DevAddr, uint8_t *txbuf) -{ - uint8_t index; - - /* Config Device(slave) address */ - if (addr10 == MD_I2C_ADDRESSINGMODE_10BIT) - md_i2c_set_con2_add10(I2Cx, MD_I2C_ADDRESSINGMODE_10BIT); - else - md_i2c_set_con2_add10(I2Cx, MD_I2C_ADDRESSINGMODE_7BIT); - - md_i2c_set_con2_sadd(I2Cx, DevAddr); - md_i2c_set_con2_nbytes(I2Cx, Nbyte); - md_i2c_set_fcon_txfrst(I2Cx, MD_I2C_TXFIFO_RESET); - md_i2c_set_con2_rd_wrn(I2Cx, MD_I2C_MASTER_WRITE); - md_i2c_set_con2_reload(I2Cx, MD_I2C_NORELOAD_MODE); - /* When NBYTES is matched, the communication will be automatically stop */ - md_i2c_set_con2_autoend(I2Cx, MD_I2C_AUTOEND_MODE); - - if (Nbyte <= 8) - { - for (index = 0; index < Nbyte; index++) - md_i2c_send(I2Cx, *txbuf++); - - Nbyte = 0; - } - else - { - for (index = 0; index < 8; index++) - md_i2c_send(I2Cx, *txbuf++); - - Nbyte -= 8; - } - - /* Start the I2C communication */ - md_i2c_set_con2_start(I2Cx, MD_I2C_START_GENERATION); - - while (Nbyte > 0) - { - while (md_i2c_is_active_stat_txf(I2Cx)); - - md_i2c_send(I2Cx, *txbuf++); - Nbyte--; - } -} - -/** - * @brief Receives in master mode an amount of data in blocking mode. - * @param I2Cx I2C Instance - * @param The number of bytes to be received - * @param Enable/Disable 10-bit addressing mode - * @param Device(slave) address - * @param The pointer to a data buffer - * @retval None - */ -void md_i2c_master_rece(I2C_TypeDef *I2Cx, uint8_t Nbyte, uint32_t addr10, uint16_t DevAddr, uint8_t *rxbuf) -{ - /* Config Device(slave) address */ - if (addr10 == MD_I2C_ADDRESSINGMODE_10BIT) - md_i2c_set_con2_add10(I2Cx, MD_I2C_ADDRESSINGMODE_10BIT); - else - md_i2c_set_con2_add10(I2Cx, MD_I2C_ADDRESSINGMODE_7BIT); - - md_i2c_set_con2_sadd(I2Cx, DevAddr); - md_i2c_set_con2_nbytes(I2Cx, Nbyte); - md_i2c_set_fcon_rxfrst(I2Cx, MD_I2C_RXFIFO_RESET); - md_i2c_set_con2_rd_wrn(I2Cx, MD_I2C_MASTER_READ); - md_i2c_set_con2_reload(I2Cx, MD_I2C_NORELOAD_MODE); - /* When NBYTES is matched, the communication will be automatically stop */ - md_i2c_set_con2_autoend(I2Cx, MD_I2C_AUTOEND_MODE); - /* Start the I2C communication */ - md_i2c_set_con2_start(I2Cx, MD_I2C_START_GENERATION); - - while (Nbyte > 0) - { - /* Wait Rx FIFO non-empty */ - while (md_i2c_is_active_stat_rxe(I2Cx)); - - *rxbuf++ = md_i2c_recv(I2Cx); - Nbyte--; - } -} - -/** - * @brief Transmits in slave mode an amount of data in blocking mode. - * @param I2Cx I2C Instance - * @param The number of bytes to be transmitted, not for NBYTES - * @param The pointer to a data buffer - * @retval None - */ -void md_i2c_slave_send(I2C_TypeDef *I2Cx, uint8_t Num, uint8_t *txbuf) -{ - md_i2c_set_fcon_txfrst(I2Cx, MD_I2C_TXFIFO_RESET); - - while (!(md_i2c_is_active_stat_busy(I2Cx))); - - while (Num > 0) - { - while (md_i2c_is_active_stat_txf(I2Cx)); - - md_i2c_send(I2Cx, *txbuf++); - Num--; - } -} - -/** - * @brief Receives in slave mode an amount of data in blocking mode. - * @param I2Cx I2C Instance - * @param The number of bytes to be transmitted, not for NBYTES - * @param The pointer to a data buffer - * @retval None - */ -void md_i2c_slave_rece(I2C_TypeDef *I2Cx, uint8_t Num, uint8_t *rxbuf) -{ - md_i2c_set_fcon_rxfrst(I2Cx, MD_I2C_RXFIFO_RESET); - - while (!(md_i2c_is_active_stat_busy(I2Cx))); - - while (Num > 0) - { - while (md_i2c_is_active_stat_rxe(I2Cx)); - - *rxbuf++ = md_i2c_recv(I2Cx); - Num--; - } -} - -/** - * @} Micro_Driver - */ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_rcu.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_rcu.c deleted file mode 100644 index 99ac22cf91..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_rcu.c +++ /dev/null @@ -1,378 +0,0 @@ -/** - ****************************************************************************** - * @file md_rcu.c - * @brief ES32F0271 RCU Source File. - * - * @version V1.00.01 - * @data 6/12/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "md_rcu.h" -#include "md_fc.h" -#include "system_es32f027x.h" - -/** @addtogroup Micro_Driver - * @{ - */ - - -/** @defgroup RCU RCU - * @brief RCU micro driver - * @{ - */ - - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/** @defgroup MD_RCU_Private_Macros RCU Private Macros - * @{ - */ - - -/** - * @} MD_RCU_Private_Macros - */ - -/* Private function prototypes ------------------------------------------------*/ - -/* Public functions -----------------------------------------------------------*/ -/** @addtogroup MD_RCU_Public_Functions RCU Public Functions - * @{ - */ - -/** @addtogroup MD_RCU_PF_Init RCU Public Init Functions - * @{ - */ - -/** - * @brief - * @param - * @retval None - */ -void md_rcu_init(void) -{ - uint8_t pllmux; - - md_fc_set_con_wait(3); - - md_rcu_set_cfg_mpre(RCU, 0UL); - md_rcu_set_cfg_msw(RCU, MD_RCU_MCO_DISABLE); - md_rcu_set_cfg_pllmul(RCU, 12 - 1); - md_rcu_set_cfg_pllsrc(RCU, MD_RCU_PLL_SRC_HRC); - md_rcu_set_cfg_hoscdiv(RCU, 2 - 1); - md_rcu_set_cfg_ppre(RCU, MD_RCU_PPRE_HCLK_DIV_1); - md_rcu_set_cfg_hpre(RCU, MD_RCU_HPRE_SYSCLK_DIV_1); - md_rcu_set_cfg_sw(RCU, MD_RCU_SYSCLK_PLL0); - - md_rcu_disable_con_csson(RCU); - md_rcu_disable_con_pll1on(RCU); - md_rcu_enable_con_pll0on(RCU); - md_rcu_disable_con_loscon(RCU); - md_rcu_disable_con_lrcon(RCU); - md_rcu_disable_con_hoscon(RCU); - md_rcu_enable_con_hrcon(RCU); - - md_rcu_set_cfg_ckcfg(RCU); - - /* while(md_rcu_get_con_hoscrdy(RCU)==0) {} */ - - /* while(md_rcu_get_con_pll0rdy(RCU)==0) {} */ - - - if (RCU->CON & RCU_CON_HRCON_MSK) /* if HRC enbale */ - while (md_rcu_get_con_hrcrdy(RCU) == 0); /* Wait for HRCRDY = 1 (HRC is ready)*/ - - - if (RCU->CON & RCU_CON_HOSCON_MSK) /* if HOSC enbale */ - while (md_rcu_get_con_hoscrdy(RCU) == 0); /* Wait for HOSCRDY = 1 (HOSC is ready)*/ - - - if (RCU->CON & RCU_CON_LRCON_MSK) /* if LRC enbale */ - while (md_rcu_get_con_lrcrdy(RCU) == 0); /* Wait for LRCRDY = 1 (LRC is ready)*/ - - - if (RCU->CON & RCU_CON_LOSCON_MSK) /* if LOSC enbale */ - while (md_rcu_get_con_loscrdy(RCU) == 0); /* Wait for LOSCRDY = 1 (LOSC is ready)*/ - - if (RCU->CON & RCU_CON_PLL0ON_MSK) /* if PLL enbale */ - while (md_rcu_get_con_pll0rdy(RCU) == 0); /* Wait for PLLRDY = 1 (PLL is ready)*/ - - - - /* PLL Reference Clock Source*/ - if (md_rcu_get_cfg_pllsrc(RCU)) - PLL0Frequency = (uint32_t)(__HOSC / (md_rcu_get_cfg_pllsrc(RCU) + 1)); - else - PLL0Frequency = (uint32_t)(__HRC); - - /* System Frequency */ - switch (md_rcu_get_cfg_sw(RCU)) /* System clock switch(SYSCLK) */ - { - case 0: /*================= HRC selected as system clock*/ - SystemCoreClock = (uint32_t)(__HRC); - break; - - case 1: /*================= HOSC selected as system clock*/ - SystemCoreClock = (uint32_t)(__HOSC); - break; - - case 2: /*================= LRC selected as system clock*/ - SystemCoreClock = (uint32_t)(__LRC); - break; - - case 3: /*================= LOSC selected as system clock*/ - SystemCoreClock = (uint32_t)(__LOSC); - break; - - case 4: /*================= PLL selected as system clock*/ - pllmux = md_rcu_get_cfg_pllmul(RCU) + 1; - - if (pllmux >= 18) pllmux = 18; - - SystemCoreClock = (uint32_t)(PLL0Frequency * pllmux); - break; - - default: - SystemCoreClock = (uint32_t)(__HRC); - break; - } - - /* Core Frequency */ - if (md_rcu_get_cfg_hpre(RCU)) - SystemFrequency_SysClk = SystemCoreClock >> ((md_rcu_get_cfg_hpre(RCU) & 0x07) + 1); - else - SystemFrequency_SysClk = SystemCoreClock; - - /* AHB Frequency */ - SystemFrequency_AHBClk = SystemFrequency_SysClk; - - /* APB Frequency */ - if (md_rcu_get_cfg_ppre(RCU)) - SystemFrequency_APBClk = SystemFrequency_SysClk >> ((md_rcu_get_cfg_ppre(RCU) & 0x03) + 1); - else - SystemFrequency_APBClk = SystemFrequency_SysClk; - - - if (SystemFrequency_AHBClk / 1000000 > 72) - md_fc_set_con_wait(3); - else if (SystemFrequency_AHBClk / 1000000 > 48) - md_fc_set_con_wait(2); - else if (SystemFrequency_AHBClk / 1000000 > 24) - md_fc_set_con_wait(1); - else - md_fc_set_con_wait(0); -} - -void md_rcu_init_set(RCU_TypeDef *rcu, md_rcu_init_typedef *RCU_InitStruct) -{ - uint8_t pllmux; - - md_fc_set_con_wait(3); - - md_rcu_set_cfg_mpre(rcu, RCU_InitStruct->Mpre); - md_rcu_set_cfg_msw(rcu, RCU_InitStruct->Msw); - md_rcu_set_cfg_pllmul(rcu, (RCU_InitStruct->PllMul) - 1); - md_rcu_set_cfg_pllsrc(rcu, RCU_InitStruct->PllSrc); - md_rcu_set_cfg_hoscdiv(rcu, (RCU_InitStruct->HoscDiv) - 1); - md_rcu_set_cfg_ppre(rcu, RCU_InitStruct->Ppre); - md_rcu_set_cfg_hpre(rcu, RCU_InitStruct->Hpre); - md_rcu_set_cfg_sw(rcu, RCU_InitStruct->Sw); - - if(RCU_InitStruct->SysClock & RCU_CON_CSSON_MSK) - md_rcu_enable_con_csson(rcu); - else - md_rcu_disable_con_csson(rcu); - - if(RCU_InitStruct->SysClock & RCU_CON_PLL1ON_MSK) - md_rcu_enable_con_pll1on(rcu); - else - md_rcu_disable_con_pll1on(rcu); - - if(RCU_InitStruct->SysClock & RCU_CON_PLL0ON_MSK) - md_rcu_enable_con_pll0on(rcu); - else - md_rcu_disable_con_pll0on(rcu); - - if(RCU_InitStruct->SysClock & RCU_CON_LOSCON_MSK) - md_rcu_enable_con_loscon(rcu); - else - md_rcu_disable_con_loscon(rcu); - - if(RCU_InitStruct->SysClock & RCU_CON_LRCON_MSK) - md_rcu_enable_con_lrcon(rcu); - else - md_rcu_disable_con_lrcon(rcu); - - if(RCU_InitStruct->SysClock & RCU_CON_HOSCON_MSK) - md_rcu_enable_con_hoscon(rcu); - else - md_rcu_disable_con_hoscon(rcu); - - if(RCU_InitStruct->SysClock & RCU_CON_HRCON_MSK) - md_rcu_enable_con_hrcon(rcu); - else - md_rcu_disable_con_hrcon(rcu); - - md_rcu_set_cfg_ckcfg(rcu); - - /* while(md_rcu_get_con_hoscrdy(RCU)==0) {} */ - - /* while(md_rcu_get_con_pll0rdy(RCU)==0) {} */ - - - if (RCU->CON & RCU_CON_HRCON_MSK) /* if HRC enbale */ - while (md_rcu_get_con_hrcrdy(rcu) == 0); /* Wait for HRCRDY = 1 (HRC is ready)*/ - - - if (RCU->CON & RCU_CON_HOSCON_MSK) /* if HOSC enbale */ - while (md_rcu_get_con_hoscrdy(rcu) == 0); /* Wait for HOSCRDY = 1 (HOSC is ready)*/ - - - if (RCU->CON & RCU_CON_LRCON_MSK) /* if LRC enbale */ - while (md_rcu_get_con_lrcrdy(rcu) == 0); /* Wait for LRCRDY = 1 (LRC is ready)*/ - - - if (RCU->CON & RCU_CON_LOSCON_MSK) /* if LOSC enbale */ - while (md_rcu_get_con_loscrdy(rcu) == 0); /* Wait for LOSCRDY = 1 (LOSC is ready)*/ - - if (RCU->CON & RCU_CON_PLL0ON_MSK) /* if PLL enbale */ - while (md_rcu_get_con_pll0rdy(rcu) == 0); /* Wait for PLLRDY = 1 (PLL is ready)*/ - - - - /* PLL Reference Clock Source*/ - if (md_rcu_get_cfg_pllsrc(rcu)) - PLL0Frequency = (uint32_t)(__HOSC / (md_rcu_get_cfg_pllsrc(rcu) + 1)); - else - PLL0Frequency = (uint32_t)(__HRC); - - /* System Frequency */ - switch (md_rcu_get_cfg_sw(rcu)) /* System clock switch(SYSCLK) */ - { - case 0: /*================= HRC selected as system clock*/ - SystemCoreClock = (uint32_t)(__HRC); - break; - - case 1: /*================= HOSC selected as system clock*/ - SystemCoreClock = (uint32_t)(__HOSC); - break; - - case 2: /*================= LRC selected as system clock*/ - SystemCoreClock = (uint32_t)(__LRC); - break; - - case 3: /*================= LOSC selected as system clock*/ - SystemCoreClock = (uint32_t)(__LOSC); - break; - - case 4: /*================= PLL selected as system clock*/ - pllmux = md_rcu_get_cfg_pllmul(rcu) + 1; - - if (pllmux >= 18) pllmux = 18; - - SystemCoreClock = (uint32_t)(PLL0Frequency * pllmux); - break; - - default: - SystemCoreClock = (uint32_t)(__HRC); - break; - } - - /* Core Frequency */ - if (md_rcu_get_cfg_hpre(rcu)) - SystemFrequency_SysClk = SystemCoreClock >> ((md_rcu_get_cfg_hpre(rcu) & 0x07) + 1); - else - SystemFrequency_SysClk = SystemCoreClock; - - /* AHB Frequency */ - SystemFrequency_AHBClk = SystemFrequency_SysClk; - - /* APB Frequency */ - if (md_rcu_get_cfg_ppre(rcu)) - SystemFrequency_APBClk = SystemFrequency_SysClk >> ((md_rcu_get_cfg_ppre(rcu) & 0x03) + 1); - else - SystemFrequency_APBClk = SystemFrequency_SysClk; - - - if (SystemFrequency_AHBClk / 1000000 > 72) - md_fc_set_con_wait(3); - else if (SystemFrequency_AHBClk / 1000000 > 48) - md_fc_set_con_wait(2); - else if (SystemFrequency_AHBClk / 1000000 > 24) - md_fc_set_con_wait(1); - else - md_fc_set_con_wait(0); -} - - -/** - * @brief - * @param - * @retval None - */ -void md_rcu_pllreinit(uint8_t pllmul) -{ - md_rcu_set_cfg_pllmul(RCU, pllmul); - md_rcu_set_cfg_ckcfg(RCU); - - /* PLL Reference Clock Source */ - if (md_rcu_get_cfg_pllsrc(RCU)) - PLL0Frequency = (uint32_t)(__HOSC / (md_rcu_get_cfg_pllsrc(RCU) + 1)); - else - PLL0Frequency = (uint32_t)(__HRC); - - SystemCoreClock = (uint32_t)(PLL0Frequency * (pllmul + 1)); - - /* Core Frequency */ - if (md_rcu_get_cfg_hpre(RCU)) - SystemFrequency_SysClk = SystemCoreClock >> ((md_rcu_get_cfg_hpre(RCU) & 0x07) + 1); - else - SystemFrequency_SysClk = SystemCoreClock; - - /* AHB Frequency */ - SystemFrequency_AHBClk = SystemFrequency_SysClk; - - /* APB Frequency */ - if (md_rcu_get_cfg_ppre(RCU)) - SystemFrequency_APBClk = SystemFrequency_SysClk >> ((md_rcu_get_cfg_ppre(RCU) & 0x03) + 1); - else - SystemFrequency_APBClk = SystemFrequency_SysClk; - - md_fc_set_con_wait(3); - - if (SystemFrequency_AHBClk / 1000000 > 72) - md_fc_set_con_wait(3); - else if (SystemFrequency_AHBClk / 1000000 > 48) - md_fc_set_con_wait(2); - else if (SystemFrequency_AHBClk / 1000000 > 24) - md_fc_set_con_wait(1); - else - md_fc_set_con_wait(0); -} - -/** - * @} MD_RCU_PF_Init - */ - -/** - * @} MD_RCU_Public_Functions - */ - -/** - * @} RCU - */ - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_spi.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_spi.c deleted file mode 100644 index c29bb54be6..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_spi.c +++ /dev/null @@ -1,108 +0,0 @@ -/** - ****************************************************************************** - * @file md_spi.c - * @brief ES32F0271 I2C Source File. - * - * @version V1.00.01 - * @date 4/12/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "md_spi.h" -#include "md_rcu.h" -#include -#include "stdint.h" -/** @addtogroup Micro_Driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/** - * @brief Initialize the SPI registers according to the specified parameters in SPI_initStruct. - * @note The parameters in md_spi_init should be expected values. Otherwise, ERROR result will be returned. - * @param SPIx SPI Instance - * @param SPI_initStruct pointer to a @ref SPI_initStruct structure - * @retval An ErrorStatus enumeration value. (Return always SUCCESS) - */ -void md_spi_struct_init(md_spi_inittypedef *SPI_initStruct) -{ - SPI_initStruct->Mode = MD_SPI_MODE_MASTER; - SPI_initStruct->ClockPhase = MD_SPI_PHASE_1EDGE; - SPI_initStruct->ClockPolarity = MD_SPI_POLARITY_LOW; - SPI_initStruct->BaudRate = MD_SPI_BAUDRATEPRESCALER_DIV256; - SPI_initStruct->BitOrder = MD_SPI_MSB_FIRST; - SPI_initStruct->TransferDirection = MD_SPI_FULL_DUPLEX; - SPI_initStruct->DataWidth = MD_SPI_FRAME_FORMAT_8BIT; - SPI_initStruct->CRCCalculation = MD_SPI_CRCCALCULATION_DISABLE; - SPI_initStruct->CRCPoly = 0x7; - SPI_initStruct->NSS = MD_SPI_NSS_HARD; -} - -/** - * @brief Initialize the SPI registers according to the specified parameters in SPI_initStruct. - * @note The parameters in md_i2c_init should be expected values. Otherwise, ERROR result will be returned. - * @param SPIx SPI Instance - * @param SPI_initStruct pointer to a @ref SPI_initStruct structure - * @retval An ErrorStatus enumeration value. (Return always SUCCESS) - */ -ErrorStatus md_spi_init(SPI_TypeDef *SPIx, md_spi_inittypedef *SPI_InitStruct) -{ - ErrorStatus status = ERROR; - - md_spi_disable_con1_spien(SPIx); - - md_spi_set_con1_mstren(SPIx, SPI_InitStruct->Mode); - md_spi_set_con1_cpha(SPIx, SPI_InitStruct->ClockPhase); - md_spi_set_con1_cpol(SPIx, SPI_InitStruct->ClockPolarity); - md_spi_set_con1_baud(SPIx, SPI_InitStruct->BaudRate); - md_spi_set_con1_lsbfirst(SPIx, SPI_InitStruct->BitOrder); - md_spi_set_con1_bidimode(SPIx, SPI_InitStruct->TransferDirection); - md_spi_set_con1_ssout(SPIx, SPI_InitStruct->NSS); - md_spi_enable_con2_ssoe(SPIx); - - md_spi_enable_con1_spien(SPIx); - - status = SUCCESS; - - return status; -} - -/** - * @brief use to receive single one byte data. - * @note SPI Slave receive data - * @param SPIx SPI Instance - */ -uint8_t SPISSingleRd(SPI_TypeDef *SPIx) -{ - while (md_spi_is_active_flag_stat_rxe(SPIx)); - - return (md_spi_recv_data8(SPIx)); -} - - -/** - * @brief use to send single one byte data. - * @note SPI receive data - * @param SPIx SPI Instance - * @param data SPI send one byte data. - */ -void SPISingleWr(SPI_TypeDef *SPIx, uint8_t data) -{ - while (md_spi_is_active_flag_stat_txf(SPIx)); - - md_spi_send_data8(SPIx, data); -} - -/** - * @} Micro_Driver - */ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_tick.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_tick.c deleted file mode 100644 index f1420c6eb3..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_tick.c +++ /dev/null @@ -1,207 +0,0 @@ -/** - ****************************************************************************** - * @file md_tick.c - * @brief ES32F0271 TICK Source File. - * - * @version V1.00.01 - * @date day/mon/year - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "md_rcu.h" -#include "md_tick.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (TICK) - -/** @addtogroup TICK TICK - * @brief TICK micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Private function prototypes ------------------------------------------------*/ - -#define HDIVON 0 - -/* Private variables ----------------------------------------------------------*/ -/** @defgroup MD_TICK_Private_Variables TICK Private Variables - * @{ - */ -static uint32_t TICKms; -static uint32_t TICK100us; -static uint32_t TICK10us; - -/** - * @} MD_TICK_Private_Variables - */ -/* Public functions -----------------------------------------------------------*/ -/** @defgroup MD_TICK_Public_Functions TICK Public Functions - * @{ - */ - -/** - * @brief Tick Initialization - * @note This function set the maximun load and enable TICK counter - * @note This function also calculate ms, 100us ans 10us counter - * @param None - * @retval None - */ -void md_tick_init(void) -{ -#if HDIVON - HDIV->DIVIDEND = SystemFrequency_SysClk; - HDIV->DIVISOR = 1000; - TICKms = HDIV->QUOTIENT; - HDIV->DIVISOR = 10000; - TICK100us = HDIV->QUOTIENT; - HDIV->DIVISOR = 100000; - TICK10us = HDIV->QUOTIENT; -#else - TICKms = SystemFrequency_SysClk / 1000; - TICK100us = SystemFrequency_SysClk / 10000; - TICK10us = SystemFrequency_SysClk / 100000; -#endif - - md_tick_set_rvr_reload((1 << 24) - 1); /* Maximun ReLoad */ - md_tick_set_cvr_current(0); /* Reset CVR */ - md_tick_set_csr_clksource(1); /* MCU Clock */ - md_tick_enable_csr_enable(); /* Counter Enable */ -} - -/** - * @brief Retrive the TICK counter and converted to millisecond - * @param None - * @retval The ms value converted by TICK counter - */ -uint32_t md_tick_get_mscnt(void) -{ -#if HDIVON - HDIV->DIVIDEND = md_tick_get_cvr_current(); - HDIV->DIVISOR = TICKms; - return (HDIV->QUOTIENT); -#else - return (md_tick_get_cvr_current() / TICKms); -#endif -} - -/** - * @brief Retrive the TICK counter and converted to 100 microseconds - * @param None - * @retval The 100 microseconds value converted by TICK counter - */ -uint32_t md_tick_get_100uscnt(void) -{ -#if HDIVON - HDIV->DIVIDEND = md_tick_get_cvr_current(); - HDIV->DIVISOR = TICK100us; - return (HDIV->QUOTIENT); -#else - return (md_tick_get_cvr_current() / TICK100us); -#endif -} - -/** - * @brief Retrive the TICK counter and converted to 10 microseconds - * @param None - * @retval The 10 microseconds value converted by TICK counter - */ -uint32_t md_tick_get_10uscnt(void) -{ -#if HDIVON - HDIV->DIVIDEND = md_tick_get_cvr_current(); - HDIV->DIVISOR = TICK10us; - return (HDIV->QUOTIENT); -#else - return (md_tick_get_cvr_current() / TICK10us); -#endif -} - -/** - * @brief Delay based on milliseconds - * @param Unit The number of ms in one delay period - * @param msCnt The counter of delay period - * @etVal None - */ -void md_tick_waitms(uint8_t Unit, uint16_t msCnt) -{ - uint32_t mstime; - - mstime = (1 << 24) - (Unit * TICKms); - - while (msCnt--) - { - md_tick_set_cvr_current((1 << 24) - 1); /* Reset CVR */ - - while (md_tick_get_cvr_current() > mstime); - } -} - -/** - * @brief Delay based on 100 microseconds - * @param Unit The number of 100 microseconds in one delay period - * @param msCnt The counter of delay period - * @etVal None - */ -void md_tick_wait100us(uint16_t Unit, uint16_t usCnt) -{ - uint32_t ustime; - - ustime = (1 << 24) - (Unit * TICK100us); - - while (usCnt--) - { - md_tick_set_cvr_current((1 << 24) - 1); /* Reset CVR */ - - while (md_tick_get_cvr_current() > ustime); - } -} - -/** - * @brief Delay based on 10 microseconds - * @param Unit The number of 10 microseconds in one delay period - * @param msCnt The counter of delay period - * @etVal None - */ -void md_tick_wait10us(uint16_t Unit, uint16_t usCnt) -{ - uint32_t ustime; - - ustime = (1 << 24) - (Unit * TICK10us); - - while (usCnt--) - { - md_tick_set_cvr_current((1 << 24) - 1); /* Reset CVR */ - - while (md_tick_get_cvr_current() > ustime); - } -} - - -/** - * @} MD_TICK_Public_Functions - */ - -/** - * @} TICK - */ -#endif - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_uart.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_uart.c deleted file mode 100644 index 5ec9ccf3af..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_uart.c +++ /dev/null @@ -1,127 +0,0 @@ -/** - ****************************************************************************** - * @file md_uart.c - * @brief ES32F0271 UART Source File. - * - * @version V1.00.01 - * @date 04/12/2018 - * @author Eastsoft AE Team - * @note UART Public Functions - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "system_es32f027x.h" -#include "md_uart.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -/** @defgroup UART UART - * @brief UART micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ -/* Private function prototypes ------------------------------------------------*/ - -/* Public functions -----------------------------------------------------------*/ - -/** @defgroup UART_PUB_FUNC UART Public Functions - * @brief UART Public Functions - * @{ - */ -/** - * @brief Set UART1 baudrate. - * @param UARTx UART Instance. - * @param Baudrate - * @retval None. - */ -void md_uart_set_baudrate(UART_TypeDef *UARTx, uint32_t baudrate) -{ - uint32_t brr; - brr = ((SystemFrequency_APBClk + (baudrate >> 1)) / baudrate); - md_uart_set_brr(UARTx, brr); -} - -/** - * @brief UART Initialization - * @param UART Init Structure - * @retval None - */ -void md_uart_init(UART_TypeDef *UARTx, md_uart_init_typedef *UART_InitStruct) -{ - /* Check the UART_InitStruct */ - assert_param((UART_InitStruct != NULL)); - - md_uart_set_baudrate(UARTx, MD_UART_BAUDRATE_115200); - md_uart_disable_lcon_txen(UARTx); - md_uart_disable_lcon_rxen(UARTx); - md_uart_set_lcon_dls(UARTx, UART_InitStruct->DataWidth); - md_uart_set_lcon_stop(UARTx, UART_InitStruct->StopBits); - md_uart_set_lcon_ps(UARTx, UART_InitStruct->Parity); - md_uart_enable_lcon_pe(UARTx); - md_uart_set_fcon_tfrst(UARTx); - md_uart_set_fcon_rfrst(UARTx); - md_uart_enable_lcon_txen(UARTx); - md_uart_enable_lcon_rxen(UARTx); -} - -/** - * @brief UART1 send character - * @param Character - * @retval None - */ -void md_uart_send(UART_TypeDef *UARTx, uint8_t ch) -{ - while (md_uart_is_active_flag_stat_tffull(UARTx)); // Tx FIFO full - - md_uart_send_txbuf(UART1, ch); // Sent byte -} - -/** - * @brief UART1 receive character. - * @param UART_TypeDef *UARTx. - * @retval unsigned char. - */ -uint8_t md_uart_recv(UART_TypeDef *UARTx) -{ - while (md_uart_is_active_flag_stat_rfempty(UART1)); // Rx FIFO empty - - return (md_uart_get_rxbuf(UART1)); -} - -/** - * @brief Get UARTx baudrate. - * @param UART_TypeDef *UARTx. - * @retval Baudrate. - */ -uint32_t md_uart_get_baudrate(UART_TypeDef *UARTx) -{ - uint32_t brr, baudrate; - - brr = md_uart_get_brr(UARTx); - baudrate = SystemFrequency_APBClk / brr; - return baudrate; -} - - -/** - * @} UART_PUB_FUNC UART Public Functions - */ - -/** - * @} UART - */ - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_usb.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_usb.c deleted file mode 100644 index b3ae9ce6d5..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_usb.c +++ /dev/null @@ -1,3804 +0,0 @@ -/** - ************************************************************************************** - * @file md_usb.c - * @brief USB Source File of MD Library. - * @data 03/12/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -/* Incudes -------------------------------------------------------------------*/ -#include "es32f0271.h" -#include "stdint.h" -#include -#include "usblib\drivers\usb_lowlayer_api.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (USB) - -/** @defgroup USB USB - * @brief USB micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -#define INTERRUPT_MASK_HOST 0x7e -#define INTERRUPT_MASK_DEV 0x6f - -/* Private macros -------------------------------------------------------------*/ -/* Private function prototypes ------------------------------------------------*/ - -/* Public functions -----------------------------------------------------------*/ -/** @addtogroup USB_MD_Public_Functions USB Public Functions - * @{ - */ - -/** @addtogroup USB_MD_PF_SYS USB Public System Functions - * @{ - */ - -/** - * @brief Mask all interrupts except NMI and Hardfault. - * @param None. - * @retval None. - */ -void md_usb_system_int_disable(void) -{ - __set_PRIMASK(1); -} - -/** - * @brief Enable all interrupts. - * @param None. - * @retval None. - */ -void md_usb_system_int_enable(void) -{ - __set_PRIMASK(0); -} - -/** - * @brief Reconfig USB. - * - * This config USB clock to xx MHz as the default configuration. - * If user want to change the clock,just redefine the - * md_usb_re_config() function. - * @param Device Chose device is in device mode or host mode. - * @retval None. - */ -__weak void md_usb_re_config(bool Device) -{ - // - // Config FIFO size of endpoint 0. - // No configuration required for ES32F0271. - // - - // - // For ES32F0271,full-speed is supported in device mode, - // Both full-speeed and low-speed is supported in host mode. - // - if (Device == true) - { - // - // DP pin pull up, in full-speed mode. - // - USB->DPDMCTRL |= (0X01 << USB_DPDMCTL_DPPUD_POSS); - - // - // Enable CID hardware control. - // - USB->SWCID &= ~USB_SWCID_CIDCTRL_MSK; - } - else - { - // - // DM\DP pin pull down, in host mode. - // Connect USN PHY power. - // - USB->DPDMCTRL = (0X02 << USB_DPDMCTL_DPPUD_POSS) | - (0X02 << USB_DPDMCTL_DMPUD_POSS) | - (USB_DPDMCTL_PHYPWREN_MSK); - // - // Enable CID hardware control. - // - USB->SWCID &= ~USB_SWCID_HOST_MSK; - - // - // Enable CID hardware control. - // - USB->SWCID &= ~USB_SWCID_CIDCTRL_MSK; - } -} - -/** - * @brief Delay ticks ms. - * @param ticks The delay ticks. - * @retval None. - */ -__weak void md_usb_system_delayms(uint32_t ticks) -{ - -} - -/** - * @brief Disable systic. - * @param None. - * @retval None. - */ -void md_usb_systic_disable(void) -{ - SysTick->CTRL &= (~SysTick_CTRL_ENABLE_Msk); -} - -/** - * @brief Reset colck of USB controller. - * @param None. - * @retval None. - */ -void md_usb_controller_reset(void) -{ - RCU->AHBRST |= RCU_AHBRST_USBEN_MSK; - RCU->AHBRST &= ~RCU_AHBRST_USBEN_MSK; -} - -/** - * @brief Enable colck of USB controller. - * @param None. - * @retval None. - */ -void md_usb_controller_enable(void) -{ - RCU->AHBEN |= RCU_AHBEN_USBEN_MSK; -} - -/** - * @brief Disable colck of USB controller. - * @param None. - * @retval None. - */ -void md_usb_controller_disable(void) -{ - RCU->AHBEN &= ~RCU_AHBEN_USBEN_MSK; -} - -/** - * @brief Enable phy colck of USB controller. - * - * This function enables clock of USB.To use USB,first, - * open its clock,then enable USB peripheral by clock - * clock manage peripheral. - * - * @param None. - * @retval None. - */ -void md_usb_clk_phy_enable(void) -{ - // - // Make sure the PLL1 has not been enabled. - // - if ((RCU->CON & RCU_CON_PLL1RDY_MSK) - && (RCU->CON & RCU_CON_PLL1ON_MSK)) - { - return; - } - - // - //Open PLL1 and wait it is ready. - // - RCU->CON |= RCU_CON_PLL1ON_MSK; - - while ((RCU->CON & RCU_CON_PLL1RDY_MSK) == 0); -} - -/** - * @brief Disable phy colck of USB controller. - * @param None. - * @retval None. - */ -void md_usb_clk_phy_disable(void) -{ - // - // Close PLL1. - // - RCU->CON &= ~RCU_CON_PLL1ON_MSK; -} - -/** - * @brief Get the USB interrupt number of NVIC. - * @param None. - * @retval None. - */ -uint32_t md_usb_nvic_number_get(void) -{ - return (uint32_t)USB_IRQn; -} - -/** - * @brief Config the USB interrupt of NVIC. - * @note The default priority is 1. - * @param None. - * @retval None. - */ -__weak void md_usb_nvic_config(uint32_t NvicNum) -{ - NVIC_SetPriority((IRQn_Type)NvicNum, 1); -} - -/** - * @brief Enable the USB interrupt of NVIC. - * @param None. - * @retval None. - */ -void md_usb_nvic_enable(void) -{ - NVIC_EnableIRQ((IRQn_Type)USB_IRQn); -} - -/** - * @brief Disable the USB interrupt of NVIC. - * @param None. - * @retval None. - */ -void md_usb_nvic_disable(void) -{ - NVIC_DisableIRQ((IRQn_Type)USB_IRQn); -} - -/** - * @} USB_MD_PF_SYS - */ - -/** @addtogroup USB_MD_PF_BASIC USB Public Basic Functions - * @{ - */ - -/** - * @brief Handles the USB bus reset condition. - * - * When this function is called with the \e bStart parameter set to \b true, - * this function causes the start of a reset condition on the USB bus. - * The caller must then delay at least 20ms before calling this function - * again with the \e bStart parameter set to \b false. - * - * @param bStart specifies whether to start or stop signaling reset on the USB - * bus. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_reset(bool bStart) -{ - // - // Send a reset signal to the bus. - // - if (bStart) - { - USB->POWER |= USB_POWER_RESET_MSK; - } - else - { - USB->POWER &= ~USB_POWER_RESET_MSK; - } -} - -/** - * @brief Handles the USB bus resume condition. - * - * When in device mode, this function brings the USB controller out of the - * suspend state. This call must first be made with the \e bStart parameter - * set to \b true to start resume signaling. The device application must - * then delay at least 10ms but not more than 15ms before calling this - * function with the \e bStart parameter set to \b false. - * - * When in host mode, this function signals devices to leave the suspend - * state. This call must first be made with the \e bStart parameter set to - * \b true to start resume signaling. The host application must then delay - * at least 20ms before calling this function with the \e bStart parameter set - * to \b false. This action causes the controller to complete the resume - * signaling on the USB bus. - * - * @param bStart specifies if the USB controller is entering or leaving the - * resume signaling state. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_resume(bool bStart) -{ - // - // Send a resume signal to the bus. - // - if (bStart) - { - USB->POWER |= USB_POWER_RESUME_MSK; - } - else - { - USB->POWER &= ~USB_POWER_RESUME_MSK; - } -} - -/** - * @brief Puts the USB bus in a suspended state. - * - * When used in host mode, this function puts the USB bus in the suspended - * state. - * - * @note This function must only be called in host mode. - * @retval Returns one of the following: \b USB_LOW_SPEED, \b USB_FULL_SPEED, - * \b USB_HIGH_SPEED, or \b USB_UNDEF_SPEED. - */ -void md_usb_hos_suspend(void) -{ - // - // Send the suspend signaling to the USB bus. - // - USB->POWER |= USB_POWER_SUSPEND_MSK; -} - -/** - * @brief Issues a request for a status IN transaction on endpoint zero. - * - * This function is used to cause a request for a status IN transaction from - * a device on endpoint zero. This function can only be used with endpoint - * zero as that is the only control endpoint that supports this ability. This - * function is used to complete the last phase of a control transaction to a - * device and an interrupt is signaled when the status packet has been - * received. - * - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_request_status(void) -{ - // - // Set the request for a status IN transaction. - // - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_REQPKT_MSK | USB_CSR0L_TXCSRL_STATUSPKT_MSK; -} - -/** - * @brief Schedules a request for an IN transaction on an endpoint in host mode. - * - * This function schedules a request for an IN transaction. When the USB - * device being communicated with responds with the data, the data can be - * retrieved by calling md_usb_hosdev_endpoint_data_get() or via a DMA - * transfer. - * - * @note This function must only be called in host mode and only for IN - * endpoints. - * @param ui32Endpoint is the endpoint to access. - * @retval None. - */ -void md_usb_hos_request_in(uint32_t ui32Endpoint) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - if (ui32Endpoint == USB_EP_0) - { - // - // Set the request for an IN transaction. - // - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_REQPKT_MSK; - } - else - { - // - // Set the request for an IN transaction. - // - USB->RXCSR1 |= USB_RXCSRL_REQPKT_MSK; - } -} - -/** - * @brief Clears a scheduled IN transaction for an endpoint in host mode. - * - * This function clears a previously scheduled IN transaction if it is still - * pending. This function is used to safely disable any scheduled IN - * transactions if the endpoint specified by \e ui32Endpoint is reconfigured - * for communications with other devices. - * - * @note This function must only be called in host mode and only for IN - * endpoints. - * @param ui32Endpoint is the endpoint to access. - * @retval None. - */ -void md_usb_hos_request_in_clear(uint32_t ui32Endpoint) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Set the request for an IN transaction. - // For es32f0271,setup packet is only supported by endpoint0. - // - USB->CSR0L_TXCSRL &= ~USB_CSR0L_TXCSRL_REQPKT_MSK; -} - -/** - * @brief Returns the current speed of the USB device connected. - * - * This function returns the current speed of the USB bus in host mode. - * - * @note This function must only be called in host mode. - * @retval Returns one of the following: \b USB_LOW_SPEED, \b USB_FULL_SPEED, - * \b USB_HIGH_SPEED, or \b USB_UNDEF_SPEED. - */ -uint32_t md_usb_hos_speed_get(void) -{ - // - // If the Full Speed device bit is set, then this is a full speed device. - // - if (USB->DEVCTRL & USB_DEVCTRL_FSDEV_MSK) - { - return (USB_FULL_SPEED); - } - - // - // If the Low Speed device bit is set, then this is a low speed device. - // - if (USB->DEVCTRL & USB_DEVCTRL_LSDEV_MSK) - { - return (USB_LOW_SPEED); - } - - // - // The device speed is not known. - // - return (USB_UNDEF_SPEED); -} - -/** - * @brief Gets the current functional device address for an endpoint. - * - * This function returns the current functional address that an endpoint is - * using to communicate with a device. The \e ui32Flags parameter determines - * if the IN or OUT endpoint's device address is returned. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags determines if this is an IN or an OUT endpoint. - * @note This function must only be called in host mode. - * @retval Returns the current function address being used by an endpoint. - */ -uint32_t md_usb_hos_addr_get(uint32_t ui32Endpoint, uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Because es32f0271 can not read device function address, - // the return value can always be 0. - // - - // - // See if the transmit or receive address is returned. - // - if (ui32Flags & USB_EP_HOST_OUT) - { - // - // Return this endpoint's transmit address. - // - return (USB->FADDR); - } - else - { - // - // Return this endpoint's receive address. - // - return (USB->FADDR); - } -} - -/** - * @brief Sets the functional address for the device that is connected to an - * endpoint in host mode. - * - * This function configures the functional address for a device that is using - * this endpoint for communication. This \e ui32Addr parameter is the address - * of the target device that this endpoint is communicating with. The - * \e ui32Flags parameter indicates if the IN or OUT endpoint is set. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags determines if this is an IN or an OUT endpoint. - * @param ui32Addr is the functional address for the controller to use for - * this endpoint. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_addr_set(uint32_t ui32Endpoint, - uint32_t ui32Addr, uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - -// USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // See if the transmit or receive address is set. - // - if (ui32Flags & USB_EP_HOST_OUT) - { - // - // Set the transmit address. - // - USB->FADDR = ui32Addr; - } - else - { - // - // Set the receive address. - // - USB->FADDR = ui32Addr; - } -} - -/** - * @brief Gets the current device hub address for this endpoint. - * - * This function returns the current hub address that an endpoint is using - * to communicate with a device. The \e ui32Flags parameter determines if the - * device address for the IN or OUT endpoint is returned. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags determines if this is an IN or an OUT endpoint. - * @note This function must only be called in host mode. - * @retval None. - */ -uint32_t md_usb_hos_hub_addr_get(uint32_t ui32Endpoint, uint32_t ui32Flags) -{ - // - // es32f0271 does not support - // - return 0; -} - -/** - * @brief Sets the hub address for the device that is connected to an endpoint. - * - * This function configures the hub address for a device that is using this - * endpoint for communication. The \e ui32Flags parameter determines if the - * device address for the IN or the OUT endpoint is configured by this call - * and sets the speed of the downstream device. Valid values are one of - * \b USB_EP_HOST_OUT or \b USB_EP_HOST_IN optionally ORed with - * \b USB_EP_SPEED_LOW. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags determines if this is an IN or an OUT endpoint. - * @param ui32Addr is the hub address and port for the device using this - * endpoint. The hub address must be defined in bits 0 through 6 with the - * port number in bits 8 through 14. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_hub_addr_set(uint32_t ui32Endpoint, - uint32_t ui32Addr, uint32_t ui32Flags) -{ - // - // es32f0271 does not support - // -} - -/** - * @brief Get USB address. - * @param None. - * @retval USB address. - */ -uint8_t md_usb_dev_addr_get(void) -{ - return (USB->FADDR); -} - -/** - * @brief Set USB address. - * @param ui8Address USB address. - * @retval None. - */ -void md_usb_dev_addr_set(uint8_t ui8Address) -{ - USB->FADDR = ui8Address; -} - -/** - * @brief USB soft connect. - * @param None. - * @retval None. - */ -void md_usb_dev_connect(void) -{ - // - // Enable connection to the USB bus. - // - USB->DPDMCTRL |= USB_DPDMCTL_PHYPWREN_MSK; -} - -/** - * @brief USB soft disconnect. - * @param None. - * @retval None. - */ -void md_usb_dev_disconnect(void) -{ - // - // Disable connection to the USB bus. - // - USB->DPDMCTRL &= ~USB_DPDMCTL_PHYPWREN_MSK; -} - -/** - * @brief Returns the current speed of the USB device connected. - * - * This function returns the current speed of the USB bus in device mode. - * - * @note This function must only be called in device mode. - * @retval Returns one of the following: \b USB_LOW_SPEED, \b USB_FULL_SPEED, - * \b USB_HIGH_SPEED, or \b USB_UNDEF_SPEED. - */ -uint32_t md_usb_dev_speed_get(void) -{ - if (USB->DPDMCTRL & USB_DPDMCTL_DPPUD_MSK) - return USB_FULL_SPEED; - else if (USB->DPDMCTRL & USB_DPDMCTL_DMPUD_MSK) - return USB_LOW_SPEED; - - return USB_UNDEF_SPEED; -} - -/** - * @brief Gets the current frame number. - * - * This function returns the last frame number received. - * - * @param None. - * @retval The last frame number received. - */ -uint32_t md_usb_hosdev_frame_get(void) -{ - uint8_t temp = USB->FRAME1 & 0xff; - return (temp | (uint32_t)((USB->FRAME2 & 0x07) << 8)); -} - -/** - * @brief Disables control interrupts on a specified USB controller. - * - * This function disables the control interrupts for the USB controller - * specified by the \e ui32Base parameter. The \e ui32Flags parameter - * specifies which control interrupts to disable. The flags passed in the - * \e ui32Flags parameters must be the definitions that start with - * \b USB_INTCTRL_* and not any other \b USB_INT flags. - * - * @param ui32IntFlags specifies which control interrupts to disable. - * @retval None. - */ -void md_usb_hosdev_int_disable(uint32_t ui32IntFlags) -{ - // - // Check the arguments. - // - assert_param((ui32IntFlags & ~(USB_INTCTRL_ALL)) == 0); - - // - // If any general interrupts were disabled then write the general interrupt - // settings out to the hardware. - // - if (ui32IntFlags & USB_INTCTRL_STATUS) - { - USB->IDR &= ~(ui32IntFlags & USB_INTCTRL_STATUS); - } -} - -/** - * @brief Enables control interrupts on a specified USB controller. - * - * This function Enables the control interrupts for the USB controller - * specified by the \e ui32Base parameter. The \e ui32Flags parameter - * specifies which control interrupts to disable. The flags passed in the - * \e ui32Flags parameters must be the definitions that start with - * \b USB_INTCTRL_* and not any other \b USB_INT flags. - * - * @param ui32IntFlags specifies which control interrupts to Enable. - * @retval None. - */ -void md_usb_hosdev_int_enable(uint32_t ui32IntFlags) -{ - // - // Check the arguments. - // - assert_param((ui32IntFlags & ~(USB_INTCTRL_ALL)) == 0); - - // - // If any general interrupts were disabled then write the general interrupt - // settings out to the hardware. - // - if (ui32IntFlags & USB_INTCTRL_STATUS) - { - USB->IER |= ui32IntFlags & USB_INTCTRL_STATUS; - } -} - -/** - * @brief Returns the control interrupt status on a specified USB controller. - * - * This function reads control interrupt status for a USB controller. This - * call returns the current status for control interrupts only, the endpoint - * interrupt status is retrieved by calling md_usb_hosdev_endpoint_int_status(). - * The bit values returned are compared against the \b USB_INTCTRL_* values. - * - * The following are the meanings of all \b USB_INCTRL_ flags and the modes - * for which they are valid. These values apply to any calls to - * md_usb_hosdev_int_status(), md_usb_hosdev_int_enable(), - * and md_usb_hosdev_int_disable(). - * Some of these flags are only valid in the following modes as indicated in - * the parentheses: Host, Device, and OTG. - * - * - \b USB_INTCTRL_ALL - A full mask of all control interrupt sources. - * - \b USB_INTCTRL_VBUS_ERR - A VBUS error has occurred (Host Only). - * - \b USB_INTCTRL_SESSION - Session Start Detected on A-side of cable - * (OTG Only). - * - \b USB_INTCTRL_SESSION_END - Session End Detected (Device Only) - * - \b USB_INTCTRL_DISCONNECT - Device Disconnect Detected (Host Only) - * - \b USB_INTCTRL_CONNECT - Device Connect Detected (Host Only) - * - \b USB_INTCTRL_SOF - Start of Frame Detected. - * - \b USB_INTCTRL_BABBLE - USB controller detected a device signaling past - * the end of a frame (Host Only) - * - \b USB_INTCTRL_RESET - Reset signaling detected by device (Device Only) - * - \b USB_INTCTRL_RESUME - Resume signaling detected. - * - \b USB_INTCTRL_SUSPEND - Suspend signaling detected by device (Device - * Only) - * - \b USB_INTCTRL_MODE_DETECT - OTG cable mode detection has completed - * (OTG Only) - * - \b USB_INTCTRL_POWER_FAULT - Power Fault detected (Host Only) - * - * @param ui32IntFlags specifies which control interrupts to Enable. - * @note This call clears the source of all of the control status interrupts. - * @retval Returns the status of the control interrupts for a USB controller. - */ -uint32_t md_usb_hosdev_int_status(void) -{ - uint32_t ui32Status; - - // - // Get the general interrupt status, these bits go into the upper 8 bits - // of the returned value. - // - ui32Status = USB->RIF & 0x7F; - - // - // Clear all the general interrupt status. - // - USB->ICR = 0xff; - - // - // Return the combined interrupt status. - // - return (ui32Status); -} - -/** - * @brief Returns the current operating mode of the controller. - * - * This function returns the current operating mode on USB controllers with - * OTG or Dual mode functionality. - * - * For OTG controllers: - * - * The function returns one of the following values on OTG controllers: - * - * \b USB_OTG_MODE_ASIDE_HOST indicates that the controller is in host mode - * on the A-side of the cable. - * - * \b USB_OTG_MODE_ASIDE_DEV indicates that the controller is in device mode - * on the A-side of the cable. - * - * \b USB_OTG_MODE_BSIDE_HOST indicates that the controller is in host mode - * on the B-side of the cable. - * - * \b USB_OTG_MODE_BSIDE_DEV indicates that the controller is in device mode - * on the B-side of the cable. If an OTG session request is started with no - * cable in place, this mode is the default. - * - * \b USB_OTG_MODE_NONE indicates that the controller is not attempting to - * determine its role in the system. - * - * For Dual Mode controllers: - * - * The function returns one of the following values: - * - * \b USB_DUAL_MODE_HOST indicates that the controller is acting as a host. - * - * \b USB_DUAL_MODE_DEVICE indicates that the controller acting as a device. - * - * \b USB_DUAL_MODE_NONE indicates that the controller is not active as - * either a host or device. - * - * @param None. - * @retval Returns \b USB_OTG_MODE_ASIDE_HOST, \b USB_OTG_MODE_ASIDE_DEV, - * \b USB_OTG_MODE_BSIDE_HOST, \b USB_OTG_MODE_BSIDE_DEV, - * \b USB_OTG_MODE_NONE, \b USB_DUAL_MODE_HOST, \b USB_DUAL_MODE_DEVICE, or - * \b USB_DUAL_MODE_NONE. - */ -uint32_t md_usb_hosdev_mode_get(void) -{ - // - // It will not be called for es32f0271,because OTG is not supported. - // - // Checks the current mode in the USB_O_DEVCTL and returns the current - // mode. - // - // USB_OTG_MODE_ASIDE_HOST: USB_DEVCTL_HOST | USB_DEVCTL_SESSION - // USB_OTG_MODE_ASIDE_DEV: USB_DEVCTL_SESSION - // USB_OTG_MODE_BSIDE_HOST: USB_DEVCTL_DEV | USB_DEVCTL_SESSION | - // USB_DEVCTL_HOST - // USB_OTG_MODE_BSIDE_DEV: USB_DEVCTL_DEV | USB_DEVCTL_SESSION - // USB_OTG_MODE_NONE: USB_DEVCTL_DEV - // - return (USB->DEVCTRL & (USB_DEVCTRL_HOST_MSK | USB_DEVCTRL_SESSION_MSK)); -} - -/** - * @brief Starts or ends a session. - * - * This function is used in OTG mode to start a session request or end a - * session. If the \e bStart parameter is set to \b true, then this function - * starts a session and if it is \b false it ends a session. - * - * @param bStart specifies if this call starts or ends a session. - * @retval None. - */ -void md_usb_otg_session_request(bool bStart) -{ - // - // Start or end the session as directed. - // - if (bStart) - { - USB->DEVCTRL |= USB_DEVCTRL_SESSION_MSK; - } - else - { - USB->DEVCTRL &= ~USB_DEVCTRL_SESSION_MSK; - } -} - -/** - * @brief Change the mode of the USB controller to host. - * - * This function changes the mode of the USB controller to host mode. - * - * @note This function must only be called on microcontrollers that support - * OTG operation. - * @param None. - * @retval None. - */ -void md_usb_force_host_mode(void) -{ - unsigned int i; - // - // Force host mode. - // - USB->SWCID &= ~USB_SWCID_HOST_MSK; - USB->SWCID |= USB_SWCID_CIDCTRL_MSK; - USB->DEVCTRL = USB_DEVCTRL_HOSTREQ_MSK; - - i = 20; - - while ((!(USB->DEVCTRL & USB_DEVCTRL_HOST_MSK)) && (i != 0)) - { - i--; - } -} - -/** - * @brief Change the mode of the USB controller to device. - * - * This function changes the mode of the USB controller to device mode. - * - * @note This function must only be called on microcontrollers that support - * OTG operation. - * @param None. - * @retval None. - */ -void md_usb_force_device_mode(void) -{ - // - // Force mode in OTG parts that support forcing USB controller mode. - // This bit is not writable in USB controllers that do not support - // forcing the mode. Not setting the USB_GPCS_DEVMOD bit makes this a - // force of device mode. - // - USB->SWCID |= USB_SWCID_HOST_MSK; - USB->SWCID |= USB_SWCID_CIDCTRL_MSK; -} - -/** - * @brief Change the mode of the USB controller to OTG. - * - * This function changes the mode of the USB controller to OTG mode. - * - * @note This function must only be called on microcontrollers that support - * OTG operation. - * @param None. - * @retval None. - */ -void md_usb_force_otg_mode(void) -{ - // - // Force mode in OTG parts that support forcing USB controller mode. - // This bit is not writable in USB controllers that do not support - // forcing the mode. Not setting the USB_GPCS_DEVMOD bit makes this a - // force of OTG mode. - // - USB->SWCID |= USB_SWCID_HOST_MSK; - USB->SWCID &= ~USB_SWCID_CIDCTRL_MSK; -} - -/** - * @brief Change the operating mode of the USB controller. - * - * This function changes the operating modes of the USB controller. When - * operating in full OTG mode, the USB controller uses the VBUS and ID pins to - * detect mode and voltage changes. While these pins are primarily used in - * OTG mode, they can also affect the operation of host and device modes. In - * device mode, the USB controller can be configured to monitor or ignore - * VBUS. Monitoring VBUS allows the controller to determine if it has been - * disconnected from the host. In host mode, the USB controller uses the - * VBUS pin to detect loss of VBUS caused by excessive power draw due to a - * drop in the VBUS voltage. This call takes the place of - * md_usb_force_host_mode(),md_usb_force_device_mode(), - * and md_usb_force_otg_mode(). - * The \e ui32Mode value should be one of the following values: - * - * - \b USB_MODE_OTG enables operating in full OTG mode, VBUS and ID are - * used by the controller. - * - \b USB_MODE_HOST enables operating only as a host with no monitoring of - * VBUS or ID pins. - * - \b USB_MODE_HOST_VBUS enables operating only as a host with monitoring of - * VBUS pin. This configuration enables detection of VBUS droop while still - * forcing host mode. - * - \b USB_MODE_DEVICE enables operating only as a device with no monitoring - * of VBUS or ID pins. - * - \b USB_MODE_DEVICE_VBUS enables operating only as a device with - * monitoring of VBUS pin. This configuration enables disconnect detection - * while still forcing device mode. - * - * @note Some of the options above are not available on some ES32 devices. - * Please check the data sheet to determine if the USB controller supports a - * particular mode. - * @param ui32Mode specifies the operating mode of the USB OTG pins. - * @retval None. - */ -void md_usb_mode_config(uint32_t ui32Mode) -{ - // - // It is not supported by es32f0271. - // -} - -/** - * @} USB_MD_PF_BASIC - */ - -/** @addtogroup USB_MD_PF_ENDPOINT USB Public Endpoint Functions - * @{ - */ - -/** - * @brief Sets the base configuration for a host endpoint. - * - * This function sets the basic configuration for the transmit or receive - * portion of an endpoint in host mode. The \e ui32Flags parameter determines - * some of the configuration while the other parameters provide the rest. The - * \e ui32Flags parameter determines whether this is an IN endpoint - * (\b USB_EP_HOST_IN or \b USB_EP_DEV_IN) or an OUT endpoint - * (\b USB_EP_HOST_OUT or \b USB_EP_DEV_OUT), whether this is a Full speed - * endpoint (\b USB_EP_SPEED_FULL) or a Low speed endpoint - * (\b USB_EP_SPEED_LOW). - * - * The \b USB_EP_MODE_ flags control the type of the endpoint. - * - \b USB_EP_MODE_CTRL is a control endpoint. - * - \b USB_EP_MODE_ISOC is an isochronous endpoint. - * - \b USB_EP_MODE_BULK is a bulk endpoint. - * - \b USB_EP_MODE_INT is an interrupt endpoint. - * - * The \e ui32NAKPollInterval parameter has different meanings based on the - * \b USB_EP_MODE value and whether or not this call is being made for - * endpoint zero or another endpoint. For endpoint zero or any Bulk - * endpoints, this value always indicates the number of frames to allow a - * device to NAK before considering it a timeout. If this endpoint is an - * isochronous or interrupt endpoint, this value is the polling interval for - * this endpoint. - * - * For interrupt endpoints, the polling interval is the number of frames - * between interrupt IN requests to an endpoint and has a range of 1 to 255. - * For isochronous endpoints this value represents a polling interval of - * 2 ^ (\e ui32NAKPollInterval - 1) frames. When used as a NAK timeout, the - * \e ui32NAKPollInterval value specifies 2 ^ (\e ui32NAKPollInterval - 1) - * frames before issuing a time out. - * - * There are two special time out values that can be specified when setting - * the \e ui32NAKPollInterval value. The first is \b MAX_NAK_LIMIT, which is - * the maximum value that can be passed in this variable. The other is - * \b DISABLE_NAK_LIMIT, which indicates that there is no limit on the - * number of NAKs. - * - * The \b USB_EP_DMA_MODE_ flags determine the type of DMA access to the - * endpoint data FIFOs. The choice of the DMA mode depends on how the DMA - * controller is configured and how it is being used. See the ``Using USB - * with the DMA Controller'' or the ''Using the integrated USB DMA - * Controller'' section for more information on DMA configuration depending - * on the type of DMA that is supported by the USB controller. - * - * When configuring the OUT portion of an endpoint, the \b USB_EP_AUTO_SET bit - * is specified to cause the transmission of data on the USB bus to start - * as soon as the number of bytes specified by \e ui32MaxPayload has been - * written into the OUT FIFO for this endpoint. - * - * When configuring the IN portion of an endpoint, the \b USB_EP_AUTO_REQUEST - * bit can be specified to trigger the request for more data once the FIFO has - * been drained enough to fit \e ui32MaxPayload bytes. The - * \b USB_EP_AUTO_CLEAR bit can be used to clear the data packet ready flag - * automatically once the data has been read from the FIFO. If this option is - * not used, this flag must be manually cleared via a call to - * md_usb_dev_endpoint_status_clear() or md_usb_hos_endpoint_status_clear(). - * - * For interrupt endpoints in low or full speed mode, the polling interval - * (\e ui32NAKPollInterval) is the number of frames between interrupt IN - * requests to an endpoint and has a range of 1 to 255. For interrupt - * endpoints in high speed mode the polling interval is - * 2 ^ (\e ui32NAKPollInterval - 1) microframes between interrupt IN requests - * to an endpoint and has a range of 1 to 16. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags are the status bits that are cleared. - * @param ui32MaxPacketSize is the maximum payload for this endpoint. - * @param ui32NAKPollInterval is the either the NAK timeout limit or the - * polling interval, depending on the type of endpoint. - * @param ui32TargetEndpoint is the endpoint that the host endpoint is - * targeting. - * @param ui32Flags are used to configure other endpoint settings. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_endpoint_config_set(uint32_t ui32Endpoint, - uint32_t ui32MaxPacketSize, - uint32_t ui32NAKPollInterval, - uint32_t ui32TargetEndpoint, - uint32_t ui32Flags) -{ - uint32_t ui32Register; - - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Endpoint zero is configured differently than the other endpoints, so see - // if this is endpoint zero. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Set the NAK timeout. - // - USB->NAKLIMIT0_TXINTERVAL = (uint8_t)ui32NAKPollInterval; - - // - // Set the transfer type information. - // - - // - // Set the speed of this endpoint. - // - if (ui32Flags & USB_EP_SPEED_HIGH) - { - // - // es32f0271 does not support high sepeed - // - } - else if (ui32Flags & USB_EP_SPEED_FULL) - { - } - else - { - } - } - else - { - // - // Start with the target endpoint. - // - ui32Register = ui32TargetEndpoint; - - // - // Set the speed for the device using this endpoint. - // - if (ui32Flags & USB_EP_SPEED_HIGH) - { - // - // es32f0271 does not support high sepeed - // - } - else if (ui32Flags & USB_EP_SPEED_FULL) - { - - } - else - { - - } - - // - // Set the protocol for the device using this endpoint. - // - switch (ui32Flags & USB_EP_MODE_MASK) - { - // - // The bulk protocol is being used. - // - case USB_EP_MODE_BULK: - { - ui32Register |= 0x20; - break; - } - - // - // The isochronous protocol is being used. - // - case USB_EP_MODE_ISOC: - { - ui32Register |= 0x10; - break; - } - - // - // The interrupt protocol is being used. - // - case USB_EP_MODE_INT: - { - ui32Register |= 0x30; - break; - } - - // - // The control protocol is being used. - // - case USB_EP_MODE_CTRL: - { - ui32Register |= 0x00; - break; - } - } - - // - // See if the transmit or receive endpoint is being configured. - // - if (ui32Flags & USB_EP_HOST_OUT) - { - // - // Set the transfer type information. - // - USB->TXTYPE = ui32Register; - - // - // Set the NAK timeout or polling interval. - // - USB->NAKLIMIT0_TXINTERVAL = ui32NAKPollInterval; - - // - // Set the Maximum Payload per transaction. - // - USB->TXMAXP = ui32MaxPacketSize; - - // - // Set the transmit control value to zero. - // - ui32Register = 0; - - // - // Allow auto setting of TxPktRdy when max packet size has been - // loaded into the FIFO. - // - if (ui32Flags & USB_EP_AUTO_SET) - { - ui32Register |= USB_CSR0H_TXCSRH_AUTOSET_MSK; - } - -// // -// // Configure the DMA Mode. -// // -// if(ui32Flags & USB_EP_DMA_MODE_1) -// { -// ui32Register |= USB_TXCSRH1_DMAEN | USB_TXCSRH1_DMAMOD; -// } -// else if(ui32Flags & USB_EP_DMA_MODE_0) -// { -// ui32Register |= USB_TXCSRH1_DMAEN; -// } - - // - // Write out the transmit control value. - // - USB->CSR0H_TXCSRH = (uint8_t)ui32Register; - } - else - { - // - // Set the transfer type information. - // - USB->RXTYPE = ui32Register; - - // - // Set the NAK timeout or polling interval. - // - USB->RXINTERVAL = ui32NAKPollInterval; - - // - // Set the Maximum Payload per transaction. - // - USB->RXMAXP = ui32MaxPacketSize; - - // - // Set the receive control value to zero. - // - ui32Register = 0; - - // - // Allow auto clearing of RxPktRdy when packet of size max packet - // has been unloaded from the FIFO. - // - if (ui32Flags & USB_EP_AUTO_CLEAR) - { - ui32Register |= USB_RXCSRH_AUTOCLR_MSK; - } - - // - // Allow auto generation of DMA requests. - // - if (ui32Flags & USB_EP_AUTO_REQUEST) - { - ui32Register |= USB_RXCSRH_AUTOREQ_MSK; - } - -// // -// // Configure the DMA Mode. -// // -// if(ui32Flags & USB_EP_DMA_MODE_1) -// { -// ui32Register |= USB_RXCSRH1_DMAEN | USB_RXCSRH1_DMAMOD; -// } -// else if(ui32Flags & USB_EP_DMA_MODE_0) -// { -// ui32Register |= USB_RXCSRH1_DMAEN; -// } - - // - // Write out the receive control value. - // - USB->RXCSR2 = (uint8_t)ui32Register; - - -// USB->RXFIFO1=0x18; //Start Address=0x18 -// USB->RXFIFO2=(3<<5); //Size=64, No Double-Packet Buffering -// USB->RXCSR1|=USB_RXCSRL_FLUSH_MSK; //Flush FIFO - } - } -} - -/** - * @brief Acknowledge that data was read from the specified endpoint's FIFO in host mode. - * - * This function acknowledges that the data was read from the endpoint's FIFO. - * This call is used if processing is required between reading the data and - * acknowledging that the data has been read. - * @param ui32Endpoint is the endpoint to access. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_endpoint_data_ack(uint32_t ui32Endpoint) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Clear RxPktRdy. - // - if (ui32Endpoint == USB_EP_0) - { - USB->CSR0L_TXCSRL &= ~USB_CSR0L_TXCSRL_RXRDY_MSK; - } - else - { - USB->RXCSR1 &= ~(USB_RXCSRL_RXRDY_MSK); - } -} - -/** - * @brief Sets the value data toggle on an endpoint in host mode. - * - * This function is used to force the state of the data toggle in host mode. - * If the value passed in the \e bDataToggle parameter is \b false, then the - * data toggle is set to the DATA0 state, and if it is \b true it is set to - * the DATA1 state. The \e ui32Flags parameter can be \b USB_EP_HOST_IN or - * \b USB_EP_HOST_OUT to access the desired portion of this endpoint. The - * \e ui32Flags parameter is ignored for endpoint zero. - * @param ui32Endpoint is the endpoint to access. - * @param bDataToggle specifies whether to set the state to DATA0 or DATA1. - * @param ui32Flags specifies whether to set the IN or OUT endpoint. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_endpoint_data_toggle(uint32_t ui32Endpoint, - bool bDataToggle, uint32_t ui32Flags) -{ - // - // It is not supported by es32f0271. - // - UNUSED(ui32Endpoint); - UNUSED(bDataToggle); - UNUSED(ui32Flags); -} - -/** - * @brief Clears the status bits in this endpoint in host mode. - * - * This function clears the status of any bits that are passed in the - * \e ui32Flags parameter. The \e ui32Flags parameter can take the value - * returned from the md_usb_hosdev_endpoint_status() call. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags are the status bits that are cleared. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_endpoint_status_clear(uint32_t ui32Endpoint, - uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Clear the specified flags for the endpoint. - // - if (ui32Endpoint == USB_EP_0) - { - USB->CSR0L_TXCSRL &= ~(ui32Flags & 0xff); - } - else - { - USB->CSR0L_TXCSRL &= ~(ui32Flags & 0xff); - USB->RXCSR1 &= ~((ui32Flags >> 16) & 0xff); - } -} - -/** - * @brief Changes the speed of the connection for a host endpoint. - * - * This function sets the USB speed for an IN or OUT endpoint in host mode. - * The \e ui32Flags parameter specifies the speed using one of the following - * values: \b USB_EP_SPEED_LOW, \b USB_EP_SPEED_FULL, or \b USB_EP_SPEED_HIGH. - * The \e ui32Flags parameter also specifies which direction is set by - * adding the logical OR in either \b USB_EP_HOST_IN or \b USB_EP_HOST_OUT. - * All other flags are ignored. This function is typically only used for - * endpoint 0, but could be used with other endpoints as well. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags are used to configure other endpoint settings. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_endpoint_speed(uint32_t ui32Endpoint, - uint32_t ui32Flags) -{ - // - // For es32f0271,we can not config endpoint speed. - // - UNUSED(ui32Endpoint); - UNUSED(ui32Flags); -} - -/** - * @brief Enables or disables ping tokens for an endpoint using high-speed control - * transfers in host mode. - * - * This function configures the USB controller to either send or not send ping - * tokens during the data and status phase of high speed control transfers. - * The only supported value for \e ui32Endpoint is \b USB_EP_0 because all - * control transfers are handled using this endpoint. If the \e bEnable is - * \b true then ping tokens are enabled, if \b false then ping tokens are - * disabled. This must be used if the controller must support - * communications with devices that do not support ping tokens in high speed - * mode. - * @param ui32Endpoint specifies the endpoint to enable/disable ping tokens. - * @param bEnable specifies whether enable or disable ping tokens. - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_endpoint_ping(uint32_t ui32Endpoint, - bool bEnable) -{ - // - // It is not supported by es32f0271. - // - UNUSED(ui32Endpoint); - UNUSED(bEnable); -} - -/** - * @brief USB endpoint configuration. - * - * This function sets the basic configuration for an endpoint in device mode. - * Endpoint zero does not have a dynamic configuration, so this function - * must not be called for endpoint zero. The \e ui32Flags parameter - * determines some of the configuration while the other parameters provide the - * rest. - * - * When configuring an IN endpoint, the \b USB_EP_AUTO_SET bit can be - * specified to cause the automatic transmission of data on the USB bus as - * soon as \e ui32MaxPacketSize bytes of data are written into the FIFO for - * this endpoint. This option is commonly used with DMA as no interaction - * is required to start the transmission of data. - * - * The \b USB_EP_MODE_ flags define what the type is for the specified endpoint. - * USB_EP_MODE_CTRL is a control endpoint. - * USB_EP_MODE_ISOC is an isochronous endpoint. - * USB_EP_MODE_BULK is a bulk endpoint. - * USB_EP_MODE_INT is an interrupt endpoint. - * - * When configuring an OUT endpoint, the \b USB_EP_AUTO_REQUEST bit is - * specified to trigger the request for more data once the FIFO has been - * drained enough to receive \e ui32MaxPacketSize more bytes of data. Also - * for OUT endpoints, the \b USB_EP_AUTO_CLEAR bit can be used to clear the - * data packet ready flag automatically once the data has been read from the - * FIFO. If this option is not used, this flag must be manually cleared via a - * call to md_usb_dev_endpoint_status_clear(). Both of these settings can be - * used to remove the need for extra calls when using the controller with DMA. - * - * @param ui32Endpoint The USB endpoint. - * @param ui32MaxPacketSize is the maximum packet size for this endpoint. - * @param ui32Flags are used to configure other endpoint settings. - * @retval None. - */ -void md_usb_dev_endpoint_config_set(uint32_t ui32Endpoint, - uint32_t ui32MaxPacketSize, - uint32_t ui32Flags) -{ - uint32_t ui32Register; - - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Determine if a transmit or receive endpoint is being configured. - // - if (ui32Flags & USB_EP_DEV_IN) /*IN*/ - { - // - // Set the max packet size. - // - USB->TXMAXP = ui32MaxPacketSize; - - // - // The transmit control value is zero unless options are enabled. - // - ui32Register = 0; - - // - // Allow auto setting of TxPktRdy when max packet size has been loaded - // into the FIFO. - // - if (ui32Flags & USB_EP_AUTO_SET) - { - ui32Register |= USB_CSR0H_TXCSRH_AUTOSET_MSK; - } - - // - // Configure the DMA mode. - // - /* es32f0271 does not support DMA */ - - // - // Enable isochronous mode if requested. - // - if ((ui32Flags & USB_EP_MODE_MASK) == USB_EP_MODE_ISOC) - { - ui32Register |= USB_CSR0H_TXCSRH_ISO_MSK; - } - - // - // Write the transmit control value. - // - USB->CSR0H_TXCSRH = (uint8_t)ui32Register; - - // - // Reset the Data toggle to zero. - // - USB->CSR0L_TXCSRL = USB_CSR0L_TXCSRL_CLRDATAT_MSK; - } - else /*OUT*/ - { - // - // Set the MaxPacketSize. - // - USB->RXMAXP = ui32MaxPacketSize; - - // - // The receive control value is zero unless options are enabled. - // - ui32Register = 0; - - // - // Allow auto clearing of RxPktRdy when packet of size max packet - // has been unloaded from the FIFO. - // - if (ui32Flags & USB_EP_AUTO_CLEAR) - { - ui32Register = USB_RXCSRH_AUTOCLR_MSK; - } - -// // -// // Configure the DMA mode. -// // - -// // -// // If requested, disable NYET responses for high-speed bulk and -// // interrupt endpoints. -// // - /*es32f0271 does not support*/ - - // - // Enable isochronous mode if requested. - // - if ((ui32Flags & USB_EP_MODE_MASK) == USB_EP_MODE_ISOC) - { - ui32Register |= USB_RXCSRH_ISO_MSK; - } - - // - // Write the receive control value. - // - USB->RXCSR2 = ui32Register; - - // - // Reset the Data toggle to zero. - // - USB->RXCSR1 = USB_RXCSRL_CLRDT_MSK; - } -} - -/** - * @brief Gets the current configuration for an endpoint. - * - * This function returns the basic configuration for an endpoint in device - * mode. The values returned in \e *pui32MaxPacketSize and \e *pui32Flags are - * equivalent to the \e ui32MaxPacketSize and \e ui32Flags previously passed - * to md_usb_dev_endpoint_config_get() for this endpoint. - * - * @note This function must only be called in device mode. - * @param ui32Endpoint is the endpoint to access. - * @param pui32MaxPacketSize is a pointer which is written with the maximum - * packet size for this endpoint. - * @param pui32Flags is a pointer which is written with the current endpoint - * settings. On entry to the function, this pointer must contain either - * \b USB_EP_DEV_IN or \b USB_EP_DEV_OUT to indicate whether the IN or OUT - * endpoint is to be queried. - * @retval None. - */ -void md_usb_dev_endpoint_config_get(uint32_t ui32Endpoint, - uint32_t *pui32MaxPacketSize, - uint32_t *pui32Flags) -{ - uint32_t ui32Register; - - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Determine if a transmit or receive endpoint is being queried. - // - if (*pui32Flags & USB_EP_DEV_IN) - { - // - // Clear the flags other than the direction bit. - // - *pui32Flags = USB_EP_DEV_IN; - - // - // Get the maximum packet size. - // - *pui32MaxPacketSize = (uint32_t)USB->TXMAXP; - - // - // Get the current transmit control register value.` - // - ui32Register = (uint32_t)(USB->CSR0H_TXCSRH); - - // - // Are we allowing auto setting of TxPktRdy when max packet size has - // been loaded into the FIFO? - // - if (ui32Register & USB_CSR0H_TXCSRH_AUTOSET_MSK) - { - *pui32Flags |= USB_EP_AUTO_SET; - } - - // - // Get the DMA mode. - // - - // - // Are we in isochronous mode? - // - if (ui32Register & USB_CSR0H_TXCSRH_ISO_MSK) - { - *pui32Flags |= USB_EP_MODE_ISOC; - } - else - { - // - // The hardware doesn't differentiate between bulk, interrupt - // and control mode for the endpoint so we just set something - // that isn't isochronous. This protocol ensures that anyone - // modifying the returned flags in preparation for a call to - // USBDevEndpointConfigSet do not see an unexpected mode change. - // If they decode the returned mode, however, they may be in for - // a surprise. - // - *pui32Flags |= USB_EP_MODE_BULK; - } - } - else - { - // - // Clear the flags other than the direction bit. - // - *pui32Flags = USB_EP_DEV_OUT; - - // - // Get the MaxPacketSize. - // - *pui32MaxPacketSize = (uint32_t)USB->RXMAXP; - - // - // Get the current receive control register value. - // - ui32Register = (uint32_t)(USB->RXCSR2); - - // - // Are we allowing auto clearing of RxPktRdy when packet of size max - // packet has been unloaded from the FIFO? - // - if (ui32Register & USB_RXCSRH_AUTOCLR_MSK) - { - *pui32Flags |= USB_EP_AUTO_CLEAR; - } - - // - // Get the DMA mode. - // - - // - // Are we in isochronous mode? - // - if (ui32Register & USB_RXCSRH_ISO_MSK) - { - *pui32Flags |= USB_EP_MODE_ISOC; - } - else - { - // - // The hardware doesn't differentiate between bulk, interrupt - // and control mode for the endpoint so we just set something - // that isn't isochronous. This protocol ensures that anyone - // modifying the returned flags in preparation for a call to - // USBDevEndpointConfigSet do not see an unexpected mode change. - // If they decode the returned mode, however, they may be in for - // a surprise. - // - *pui32Flags |= USB_EP_MODE_BULK; - } - } -} - -/** - * @brief Acknowledge that data was read from the specified endpoint's FIFO in device - * mode. - * - * This function acknowledges that the data was read from the endpoint's FIFO. - * The \e bIsLastPacket parameter is set to a \b true value if this is the - * last in a series of data packets on endpoint zero. The \e bIsLastPacket - * parameter is not used for endpoints other than endpoint zero. This call - * can be used if processing is required between reading the data and - * acknowledging that the data has been read. - * @param ui32Endpoint is the endpoint to access. - * @param bIsLastPacket indicates if this packet is the last one. - * @note This function must only be called in device mode. - * @retval None. - */ -void md_usb_dev_endpoint_ack(uint32_t ui32Endpoint, - bool bIsLastPacket) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Determine which endpoint is being acked. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Clear RxPktRdy, and optionally DataEnd, on endpoint zero. - // - USB->CSR0L_TXCSRL = USB_CSR0L_TXCSRL_RXRDYC_MSK | (bIsLastPacket ? USB_CSR0L_TXCSRL_DATAEND_MSK : 0); - } - else - { - // - // Clear RxPktRdy on all other endpoints. - // - USB->RXCSR1 &= ~USB_RXCSRL_RXRDY_MSK; - } -} - -/** - * @brief Stalls the specified endpoint in device mode. - * - * This function causes the endpoint number passed in to go into a stall - * condition. If the \e ui32Flags parameter is \b USB_EP_DEV_IN, then the - * stall is issued on the IN portion of this endpoint. If the \e ui32Flags - * parameter is \b USB_EP_DEV_OUT, then the stall is issued on the OUT portion - * of this endpoint. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags specifies whether to stall the IN or OUT endpoint. - * @note This function must only be called in device mode. - * @retval None. - */ -void md_usb_dev_endpoint_stall(uint32_t ui32Endpoint, uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Determine how to stall this endpoint. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Perform a stall on endpoint zero. - // - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_RXRDYC_MSK | USB_CSR0L_TXCSRL_STALL_MSK; - } - else if (ui32Flags == USB_EP_DEV_IN) - { - // - // Perform a stall on an IN endpoint. - // - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_STALL_MSK; - } - else - { - // - // Perform a stall on an OUT endpoint. - // - USB->RXCSR1 |= USB_RXCSRL_STALL_MSK; - } -} - -/** - * @brief Clears the stall condition on the specified endpoint in device mode. - * - * This function causes the endpoint number passed in to exit the stall - * condition. If the \e ui32Flags parameter is \b USB_EP_DEV_IN, then the - * stall is cleared on the IN portion of this endpoint. If the \e ui32Flags - * parameter is \b USB_EP_DEV_OUT, then the stall is cleared on the OUT - * portion of this endpoint. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags specifies whether to stall the IN or OUT endpoint. - * @note This function must only be called in device mode. - * @retval None. - */ -void md_usb_dev_endpoint_stall_clear(uint32_t ui32Endpoint, uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Determine how to clear the stall on this endpoint. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Clear the stall on endpoint zero. - // - USB->CSR0L_TXCSRL &= ~USB_CSR0L_TXCSRL_STALLED_MSK; - } - else if (ui32Flags == USB_EP_DEV_IN) - { - // - // Clear the stall on an IN endpoint. - // - USB->CSR0L_TXCSRL &= ~(USB_CSR0L_TXCSRL_SENTSTALL_MSK | USB_CSR0L_TXCSRL_SENDSTALL_MSK); - - // - // Reset the data toggle. - // - /* @yuzr es32f0271 can not realize */ - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_CLRDATAT_MSK; - } - else - { - // - // Clear the stall on an OUT endpoint. - // -// HWREGB(ui32Base + USB_O_RXCSRL1 + EP_OFFSET(ui32Endpoint)) &= -// ~(USB_RXCSRL1_STALL | USB_RXCSRL1_STALLED); - USB->RXCSR1 &= ~(USB_RXCSRL_STALL_MSK | USB_RXCSRL_STALLED_MSK); - - // - // Reset the data toggle. - // - USB->RXCSR1 |= USB_RXCSRL_CLRDT_MSK; - } -} - -/** - * @brief Clears the status bits in this endpoint in device mode. - * - * This function clears the status of any bits that are passed in the - * \e ui32Flags parameter. The \e ui32Flags parameter can take the value - * returned from the USBEndpointStatus() call. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags are the status bits that are cleared. - * @note This function must only be called in device mode. - * @retval None. - */ -void md_usb_dev_endpoint_status_clear(uint32_t ui32Endpoint, uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // If this is endpoint 0, then the bits have different meaning and map - // into the TX memory location. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Set the Serviced RxPktRdy bit to clear the RxPktRdy. - // - if (ui32Flags & USB_DEV_EP0_OUT_PKTRDY) - { - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_RXRDYC_MSK; - } - - // - // Set the serviced Setup End bit to clear the SetupEnd status. - // - if (ui32Flags & USB_DEV_EP0_SETUP_END) - { - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_SETENDC_MSK; - } - - // - // Clear the Sent Stall status flag. - // - if (ui32Flags & USB_DEV_EP0_SENT_STALL) - { - USB->CSR0L_TXCSRL &= ~(USB_CSR0L_TXCSRL_STALLED_MSK); - } - } - else - { - // - // Clear out any TX flags that were passed in. Only - // USB_DEV_TX_SENT_STALL and USB_DEV_TX_UNDERRUN must be cleared. - // - USB->CSR0L_TXCSRL &= ~(ui32Flags & (USB_CSR0L_TXCSRL_STALL_MSK | USB_DEV_TX_UNDERRUN)); - - // - // Clear out valid RX flags that were passed in. Only - // USB_DEV_RX_SENT_STALL, USB_DEV_RX_DATA_ERROR, and USB_DEV_RX_OVERRUN - // must be cleared. - // - USB->RXCSR1 &= ~((ui32Flags & (USB_DEV_RX_SENT_STALL | USB_DEV_RX_DATA_ERROR | - USB_DEV_RX_OVERRUN)) >> 16); - } -} - -/** - * @brief Determines the number of bytes of data available in a specified endpoint's - * FIFO. - * - * This function returns the number of bytes of data currently available in the - * FIFO for the specified receive (OUT) endpoint. It may be used prior to calling - * md_usb_hosdev_endpoint_data_get() to determine the size of buffer required to - * hold the newly-received packet. - * @param ui32Endpoint is the endpoint to access. - * @retval This call returns the number of bytes available in a specified endpoint - * FIFO. - */ -uint32_t md_usb_hosdev_endpoint_datavai(uint32_t ui32Endpoint) -{ - uint8_t temp; //use to clear warning in IAR system - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Get the address of the receive status register to use, based on the - // endpoint. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Is there a packet ready in the FIFO? - // - if (USB->CSR0L_TXCSRL & USB_CSR0L_TXCSRL_RXRDY_MSK) - { - // - // Return the byte count in the FIFO. - // - return (uint32_t)(USB->RXCOUNT1); - } - - return (0); - } - else - { - // - // Is there a packet ready in the FIFO? - // - if (USB->RXCSR1 & USB_RXCSRL_RXRDY_MSK) - { - // - // Return the byte count in the FIFO. - // - temp = USB->RXCOUNT1; - return (uint32_t)(temp | USB->RXCOUNT2 << 8); - } - - return (0); - } -} - -/** - * @brief Retrieves data from the specified endpoint's FIFO. - * - * This function returns the data from the FIFO for the specified endpoint. - * The \e pui32Size parameter indicates the size of the buffer passed in - * the \e pui32Data parameter. The data in the \e pui32Size parameter is - * changed to match the amount of data returned in the \e pui8Data parameter. - * If a zero-byte packet is received, this call does not return an error but - * instead just returns a zero in the \e pui32Size parameter. The only error - * case occurs when there is no data packet available. - * @param ui32Endpoint is the endpoint to access. - * @param pui8Data is a pointer to the data area used to return the data from - * the FIFO. - * @param pui32Size is initially the size of the buffer passed into this call - * via the \e pui8Data parameter. It is set to the amount of data returned in - * the buffer. - * @retval This call returns 0, or -1 if no packet was received. - */ -int32_t md_usb_hosdev_endpoint_data_get(uint32_t ui32Endpoint, - uint8_t *pui8Data, - uint32_t *pui32Size) -{ - uint32_t ui32ByteCount, ui32FIFO; - uint8_t temp; //use to clear warning in IAR system - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Don't allow reading of data if the RxPktRdy bit is not set. - // - if (ui32Endpoint == USB_EP_0) - { - if ((USB->CSR0L_TXCSRL & USB_CSR0L_TXCSRL_RXRDY_MSK) == 0) - { - // - // Can't read the data because none is available. - // - *pui32Size = 0; - - // - // Return a failure since there is no data to read. - // - return (-1); - } - } - else - { - if ((USB->RXCSR1 & USB_RXCSRL_RXRDY_MSK) == 0) - { - // - // Can't read the data because none is available. - // - *pui32Size = 0; - - // - // Return a failure since there is no data to read. - // - return (-1); - } - } - - // - // Get the byte count in the FIFO. - // - if (ui32Endpoint == USB_EP_0) - { - ui32ByteCount = (uint32_t)(USB->RXCOUNT1); - } - else - { - temp = USB->RXCOUNT1; - ui32ByteCount = (uint32_t)(temp | (USB->RXCOUNT2 << 8)); - } - - // - // Determine how many bytes are copied. - // - ui32ByteCount = (ui32ByteCount < *pui32Size) ? ui32ByteCount : *pui32Size; - - // - // Return the number of bytes we are going to read. - // - *pui32Size = ui32ByteCount; - - // - // Calculate the FIFO address. - // - ui32FIFO = (uint32_t)(&USB->EP0FIFO) + 4 * (uint32_t)USBEPToIndex(ui32Endpoint); - - // - // Read the data out of the FIFO. - // - for (; ui32ByteCount > 0; ui32ByteCount--) - { - // - // Read a byte at a time from the FIFO. - // - *pui8Data++ = *((volatile uint8_t *)(ui32FIFO)); - } - - // - // Success. - // - return (0); -} - -/** - * @brief Puts data into the specified endpoint's FIFO. - * - * This function puts the data from the \e pui8Data parameter into the FIFO - * for this endpoint. If a packet is already pending for transmission, then - * this call does not put any of the data into the FIFO and returns -1. Care - * must be taken to not write more data than can fit into the FIFO - * allocated by the call to md_usb_dev_endpoint_config_set(). - * @param ui32Endpoint is the endpoint to access. - * @param pui8Data is a pointer to the data area used as the source for the - * data to put into the FIFO. - * @param ui32Size is the amount of data to put into the FIFO. - * @retval This call returns 0 on success, or -1 to indicate that the FIFO - * is in use and cannot be written. - */ -int32_t md_usb_hosdev_endpoint_data_put(uint32_t ui32Endpoint, - uint8_t *pui8Data, uint32_t ui32Size) -{ - uint32_t ui32FIFO; - - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Don't allow transmit of data if the TxPktRdy bit is already set. - // - if (ui32Endpoint == USB_EP_0) - { - if (USB->CSR0L_TXCSRL & USB_CSR0L_TXCSRL_TXRDY_MSK) - return (-1); - } - else - { - if (USB->CSR0L_TXCSRL & USB_CSR0L_TXCSRL_TXPKTRDY_MSK) - return (-1); - } - - // - // Calculate the FIFO address. - // - ui32FIFO = (uint32_t)(&USB->EP0FIFO) + 4 * (uint32_t)USBEPToIndex(ui32Endpoint); - - // - // Write the data to the FIFO. - // - for (; ui32Size > 0; ui32Size--) - { - *((volatile uint8_t *)(ui32FIFO)) = *pui8Data++; - } - - // - // Success. - // - return (0); -} - -/** - * @brief Starts the transfer of data from an endpoint's FIFO. - * - * This function starts the transfer of data from the FIFO for a specified - * endpoint. This function is called if the \b USB_EP_AUTO_SET bit was - * not enabled for the endpoint. Setting the \e ui32TransType parameter - * allows the appropriate signaling on the USB bus for the type of transaction - * being requested. The \e ui32TransType parameter must be one of the - * following: - * - * - \b USB_TRANS_OUT for OUT transaction on any endpoint in host mode. - * - \b USB_TRANS_IN for IN transaction on any endpoint in device mode. - * - \b USB_TRANS_IN_LAST for the last IN transaction on endpoint zero in a - * sequence of IN transactions. - * \b USB_TRANS_SETUP for setup transactions on endpoint zero. - * \b USB_TRANS_STATUS for status results on endpoint zero. - * @param ui32Endpoint is the endpoint to access. - * @param ui32TransType is set to indicate what type of data is being sent. - * @retval This call returns 0 on success, or -1 if a transmission is already - * in progress. - */ -int32_t md_usb_hosdev_endpoint_data_send(uint32_t ui32Endpoint, - uint32_t ui32TransType) -{ - uint32_t ui32TxPktRdy; - - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Get the bit position of TxPktRdy based on the endpoint. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Don't allow transmit of data if the TxPktRdy bit is already set. - // - if (USB->CSR0L_TXCSRL & USB_CSR0L_TXCSRL_TXRDY_MSK) - { - return (-1); - } - - ui32TxPktRdy = ui32TransType & 0xff; - } - else - { - // - // Don't allow transmit of data if the TxPktRdy bit is already set. - // - if (USB->CSR0L_TXCSRL & USB_CSR0L_TXCSRL_TXPKTRDY_MSK) - { - return (-1); - } - - ui32TxPktRdy = (ui32TransType >> 8) & 0xff; - } - - // - // Set TxPktRdy in order to send the data. - // - USB->CSR0L_TXCSRL = ui32TxPktRdy; - - // - // Success. - // - return (0); -} - -/** - * @brief Forces a flush of an endpoint's FIFO. - * - * This function forces the USB controller to flush out the data in the FIFO. - * The function can be called with either host or device controllers and - * requires the \e ui32Flags parameter be one of \b USB_EP_HOST_OUT, - * \b USB_EP_HOST_IN, \b USB_EP_DEV_OUT, or \b USB_EP_DEV_IN. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags specifies if the IN or OUT endpoint is accessed. - * @retval None. - */ -void md_usb_hosdev_endpoint_data_togglec(uint32_t ui32Endpoint, - uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - if (ui32Flags & (USB_EP_HOST_OUT | USB_EP_DEV_IN)) - { - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_CLRDATAT_MSK; - } - else - { - USB->RXCSR1 |= USB_RXCSRL_CLRDT_MSK; - } -} - -/** - * @brief Sets the number of packets to request when transferring multiple bulk - * packets. - * - * This function sets the number of consecutive bulk packets to request - * when transferring multiple bulk packets with DMA. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32Count is the number of packets to request. - * @retval None. - */ -void md_usb_hosdev_endpoint_pkcount_set(uint32_t ui32Endpoint, - uint32_t ui32Count) -{ - /* It's not supported by es32f0271 */ -} - -/** - * @brief Returns the current status of an endpoint. - * - * This function returns the status of a specified endpoint. If any of these - * status bits must be cleared, then the md_usb_dev_endpoint_status_clear() or the - * md_usb_hos_endpoint_status_clear() functions must be called. - * - * The following are the status flags for host mode: - * - * - \b USB_HOST_IN_PID_ERROR - PID error on the specified endpoint. - * - \b USB_HOST_IN_NOT_COMP - The device failed to respond to an IN request. - * - \b USB_HOST_IN_STALL - A stall was received on an IN endpoint. - * - \b USB_HOST_IN_DATA_ERROR - There was a CRC or bit-stuff error on an IN - * endpoint in Isochronous mode. - * - \b USB_HOST_IN_NAK_TO - NAKs received on this IN endpoint for more than - * the specified timeout period. - * - \b USB_HOST_IN_ERROR - Failed to communicate with a device using this IN - * endpoint. - * - \b USB_HOST_IN_FIFO_FULL - This IN endpoint's FIFO is full. - * - \b USB_HOST_IN_PKTRDY - Data packet ready on this IN endpoint. - * - \b USB_HOST_OUT_NAK_TO - NAKs received on this OUT endpoint for more than - * the specified timeout period. - * - \b USB_HOST_OUT_NOT_COMP - The device failed to respond to an OUT - * request. - * - \b USB_HOST_OUT_STALL - A stall was received on this OUT endpoint. - * - \b USB_HOST_OUT_ERROR - Failed to communicate with a device using this - * OUT endpoint. - * - \b USB_HOST_OUT_FIFO_NE - This endpoint's OUT FIFO is not empty. - * - \b USB_HOST_OUT_PKTPEND - The data transfer on this OUT endpoint has not - * completed. - * - \b USB_HOST_EP0_NAK_TO - NAKs received on endpoint zero for more than the - * specified timeout period. - * - \b USB_HOST_EP0_ERROR - The device failed to respond to a request on - * endpoint zero. - * - \b USB_HOST_EP0_IN_STALL - A stall was received on endpoint zero for an - * IN transaction. - * - \b USB_HOST_EP0_IN_PKTRDY - Data packet ready on endpoint zero for an IN - * transaction. - * - * The following are the status flags for device mode: - * - * - \b USB_DEV_OUT_SENT_STALL - A stall was sent on this OUT endpoint. - * - \b USB_DEV_OUT_DATA_ERROR - There was a CRC or bit-stuff error on an OUT - * endpoint. - * - \b USB_DEV_OUT_OVERRUN - An OUT packet was not loaded due to a full FIFO. - * - \b USB_DEV_OUT_FIFO_FULL - The OUT endpoint's FIFO is full. - * - \b USB_DEV_OUT_PKTRDY - There is a data packet ready in the OUT - * endpoint's FIFO. - * - \b USB_DEV_IN_NOT_COMP - A larger packet was split up, more data to come. - * - \b USB_DEV_IN_SENT_STALL - A stall was sent on this IN endpoint. - * - \b USB_DEV_IN_UNDERRUN - Data was requested on the IN endpoint and no - * data was ready. - * - \b USB_DEV_IN_FIFO_NE - The IN endpoint's FIFO is not empty. - * - \b USB_DEV_IN_PKTPEND - The data transfer on this IN endpoint has not - * completed. - * - \b USB_DEV_EP0_SETUP_END - A control transaction ended before Data End - * condition was sent. - * - \b USB_DEV_EP0_SENT_STALL - A stall was sent on endpoint zero. - * - \b USB_DEV_EP0_IN_PKTPEND - The data transfer on endpoint zero has not - * completed. - * - \b USB_DEV_EP0_OUT_PKTRDY - There is a data packet ready in endpoint - * zero's OUT FIFO. - * - * @param The current status flags for the endpoint depending on mode. - * @retval None. - */ -uint32_t md_usb_hosdev_endpoint_status(uint32_t ui32Endpoint) -{ - uint32_t ui32Status; - - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Get the TX portion of the endpoint status. - // - ui32Status = USB->CSR0L_TXCSRL; - - // - // Get the RX portion of the endpoint status. - // Return zero if ui32Endpoint is equal to USB_EP_0. - // - ui32Status |= (((ui32Endpoint == USB_EP_0) ? 0x00 : USB->RXCSR1) << 16); - - // - // Return the endpoint status. - // - return (ui32Status); -} - -/** - * @brief Disables endpoint interrupts on a specified USB controller. - * - * This function disables endpoint interrupts for the USB controller specified - * by the \e ui32Base parameter. The \e ui32Flags parameter specifies which - * endpoint interrupts to disable. The flags passed in the \e ui32Flags - * parameters must be the definitions that start with \b USB_INTEP_* and not - * any other \b USB_INT flags. - * @param ui32IntFlags specifies which endpoint interrupts to disable. - * @retval None. - */ -void md_usb_hosdev_endpoint_int_disable(uint32_t ui32IntFlags) -{ - // - // If any transmit interrupts were disabled, then write the transmit - // interrupt settings out to the hardware. - // - USB->TXIER &= - ~(ui32IntFlags & (USB_INTEP_HOST_OUT | USB_INTEP_DEV_IN | USB_INTEP_0)); - - // - // If any receive interrupts were disabled, then write the receive - // interrupt settings out to the hardware. - // - USB->RXIER &= - ~((ui32IntFlags & (USB_INTEP_HOST_IN | USB_INTEP_DEV_OUT)) >> 16); -} - -/** - * @brief Enable endpoint interrupts on a specified USB controller. - * - * This function Enable endpoint interrupts for the USB controller specified - * by the \e ui32Base parameter. The \e ui32Flags parameter specifies which - * endpoint interrupts to disable. The flags passed in the \e ui32Flags - * parameters must be the definitions that start with \b USB_INTEP_* and not - * any other \b USB_INT flags. - * @param ui32IntFlags specifies which endpoint interrupts to Enable. - * @retval None. - */ -void md_usb_hosdev_endpoint_int_enable(uint32_t ui32IntFlags) -{ - // - // If any transmit interrupts were disabled, then write the transmit - // interrupt settings out to the hardware. - // - USB->TXIER |= - ui32IntFlags & (USB_INTEP_HOST_OUT | USB_INTEP_DEV_IN | USB_INTEP_0); - - // - // If any receive interrupts were disabled, then write the receive - // interrupt settings out to the hardware. - // - USB->RXIER |= - ((ui32IntFlags & (USB_INTEP_HOST_IN | USB_INTEP_DEV_OUT)) >> 16); -} - -/** - * @brief Returns the endpoint interrupt status on a specified USB controller. - * - * This function reads endpoint interrupt status for a USB controller. This - * call returns the current status for endpoint interrupts only, the control - * interrupt status is retrieved by calling md_usb_hosdev_int_status(). The bit - * values returned are compared against the \b USB_INTEP_* values. - * These values are grouped into classes for \b USB_INTEP_HOST_* and - * \b USB_INTEP_DEV_* values to handle both host and device modes with all - * endpoints. - * @param None. - * @note This call clears the source of all of the endpoint interrupts. - * @retval Returns the status of the endpoint interrupts for a USB controller. - */ -uint32_t md_usb_hosdev_endpoint_int_status(void) -{ - uint32_t ui32Status; - - // - // Get the transmit interrupt status. - // - ui32Status = USB->TXRIF; - ui32Status |= (USB->RXRIF << 16); - - // - // Clear the transmit interrupt status. - // - USB->TXICR = 0xff; - USB->RXICR = 0xff; - - // - // Return the combined interrupt status. - // - return (ui32Status); -} - -/** - * @brief Change the mode of the USB controller to OTG. - * - * This function changes the mode of the USB controller to OTG mode. - * - * @note This function must only be called on microcontrollers that support - * OTG operation. - * @param None. - * @retval None. - */ -uint32_t md_usb_endpoint_number_get(void) -{ - return 13; -} - -/** - * @} USB_MD_PF_ENDPOINT - */ - -/** @addtogroup USB_MD_PF_FIFO USB Public FIFO Functions - * @{ - */ - -/** - * @brief Returns the absolute FIFO address for a specified endpoint. - * - * This function returns the actual physical address of the FIFO. This - * address is needed when the USB is going to be used with the DMA - * controller and the source or destination address must be set to the - * physical FIFO address for a specified endpoint. This function can also be - * used to provide the physical address to manually read data from an - * endpoints FIFO. - * - * @param ui32Endpoint specifies which endpoint's FIFO address to return. - * @retval None. - */ -uint32_t md_usb_hosdev_fifo_addr_get(uint32_t ui32Endpoint) -{ - return (uint32_t)((uint32_t)(&USB->EP0FIFO) + ((uint32_t)USBEPToIndex(ui32Endpoint) << 2)); -} - -/** - * @brief Returns the FIFO configuration for an endpoint. - * - * This function returns the starting address and size of the FIFO for a - * specified endpoint. Endpoint zero does not have a dynamically configurable - * FIFO, so this function must not be called for endpoint zero. The - * \e ui32Flags parameter specifies whether the endpoint's OUT or IN FIFO must - * be read. If in host mode, the \e ui32Flags parameter must be - * \b USB_EP_HOST_OUT or \b USB_EP_HOST_IN, and if in device mode, the - * \e ui32Flags parameter must be either \b USB_EP_DEV_OUT or - * \b USB_EP_DEV_IN. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32FIFOAddress is the starting address for the FIFO. - * @param ui32FIFOSize is the size of the FIFO specified by one of the - * USB_FIFO_SZ_ values. - * @param ui32Flags specifies what information to set in the FIFO - * configuration. - * @retval None. - */ -void md_usb_hosdev_fifo_config_get(uint32_t ui32Endpoint, uint32_t *pui32FIFOAddress, - uint32_t *pui32FIFOSize, uint32_t ui32Flags) -{ - uint8_t temp; //use to clear warning in IAR system - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // See if the transmit or receive FIFO is being configured. - // - if (ui32Flags & (USB_EP_HOST_OUT | USB_EP_DEV_IN)) - { - temp = USB->TXFIFO1 & 0xff; - // - // Get the transmit FIFO location and size for this endpoint. - // - *pui32FIFOAddress = (temp | ((USB->TXFIFO2 & 0x0f) << 8)) << 3; - *pui32FIFOSize = (USB->TXFIFO2 & 0xe0) >> USB_TXFIFO2_MAXPKTSIZE_POSS; - } - else - { - temp = USB->RXFIFO1 & 0xff; - // - // Get the receive FIFO location and size for this endpoint. - // - *pui32FIFOAddress = (temp | ((USB->TXFIFO2 & 0x0f) << 8)) << 3; - - *pui32FIFOSize = (USB->RXFIFO2 & 0xe0) >> USB_RXFIFO2_MAXPKTSIZE_POSS; - } -} - -/** - * @brief Sets the FIFO configuration for an endpoint. - * - * This function configures the starting FIFO RAM address and size of the FIFO - * for a specified endpoint. Endpoint zero does not have a dynamically - * configurable FIFO, so this function must not be called for endpoint zero. - * The \e ui32FIFOSize parameter must be one of the values in the - * \b USB_FIFO_SZ_ values. - * - * The \e ui32FIFOAddress value must be a multiple of 8 bytes and directly - * indicates the starting address in the USB controller's FIFO RAM. For - * example, a value of 64 indicates that the FIFO starts 64 bytes into - * the USB controller's FIFO memory. The \e ui32Flags value specifies whether - * the endpoint's OUT or IN FIFO must be configured. If in host mode, use - * \b USB_EP_HOST_OUT or \b USB_EP_HOST_IN, and if in device mode, use - * \b USB_EP_DEV_OUT or \b USB_EP_DEV_IN. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32FIFOAddress is the starting address for the FIFO. - * @param ui32FIFOSize is the size of the FIFO specified by one of the - * USB_FIFO_SZ_ values. - * @param ui32Flags specifies what information to set in the FIFO - * configuration. - * @retval None. - */ -void md_usb_hosdev_fifo_config_set(uint32_t ui32Endpoint, uint32_t ui32FIFOAddress, - uint32_t ui32FIFOSize, uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // See if the transmit or receive FIFO is being configured. - // - if (ui32Flags & (USB_EP_HOST_OUT | USB_EP_DEV_IN)) - { - // - // Set the transmit FIFO location and size for this endpoint. - // - USB->TXFIFO1 = (uint8_t)((ui32FIFOAddress & 0xffff) >> 3); - - USB->TXFIFO2 = (uint8_t)((((ui32FIFOAddress & 0xffff) >> 3 >> 8) & 0x0f) - | (ui32FIFOSize) << USB_TXFIFO2_MAXPKTSIZE_POSS); - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_FLUSHFIFO_MSK; - } - else - { - // - // Set the receive FIFO location and size for this endpoint. - // - USB->RXFIFO1 = (uint8_t)((ui32FIFOAddress & 0xffff) >> 3); - - USB->RXFIFO2 = (uint8_t)((((ui32FIFOAddress & 0xffff) >> 3 >> 8) & 0x0f) - | (ui32FIFOSize) << USB_RXFIFO2_MAXPKTSIZE_POSS); - USB->RXCSR1 |= USB_RXCSRL_FLUSH_MSK; - } -} - -/** - * @brief Forces a flush of an endpoint's FIFO. - * - * This function forces the USB controller to flush out the data in the FIFO. - * The function can be called with either host or device controllers and - * requires the \e ui32Flags parameter be one of \b USB_EP_HOST_OUT, - * \b USB_EP_HOST_IN, \b USB_EP_DEV_OUT, or \b USB_EP_DEV_IN. - * - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags specifies if the IN or OUT endpoint is accessed. - * @retval None. - */ -void md_usb_hosdev_fifo_flush(uint32_t ui32Endpoint, uint32_t ui32Flags) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Endpoint zero has a different register set for FIFO flushing. - // - if (ui32Endpoint == USB_EP_0) - { - // - // Nothing in the FIFO if neither of these bits are set. - // - if ((USB->CSR0L_TXCSRL - & (USB_CSR0L_TXCSRL_TXRDY_MSK | USB_CSR0L_TXCSRL_RXRDY_MSK)) != 0) - { - // - // Hit the Flush FIFO bit. - // - USB->CSR0H_TXCSRH |= USB_CSR0H_TXCSRH_FLUSH_MSK; - } - } - else - { - // - // Only reset the IN or OUT FIFO. - // - if (ui32Flags & (USB_EP_HOST_OUT | USB_EP_DEV_IN)) - { - // - // Make sure the FIFO is not empty. - // - if (USB->CSR0L_TXCSRL & USB_CSR0L_TXCSRL_TXPKTRDY_MSK) - { - // - // Hit the Flush FIFO bit. - // - USB->CSR0L_TXCSRL |= USB_CSR0L_TXCSRL_FLUSHFIFO_MSK; - } - } - else - { - // - // Make sure that the FIFO is not empty. - // - if (USB->RXCSR1 & USB_RXCSRL_RXRDY_MSK) - { - // - // Hit the Flush FIFO bit. - // - USB->RXCSR1 |= USB_RXCSRL_FLUSH_MSK; - } - } - } -} - -/** - * @} USB_MD_PF_FIFO - */ - - -/** @addtogroup USB_MD_PF_EXPWR USB Public External Power Functions - * @{ - */ - -// -// The following pwr function is not supported by es32f0271 -// -/** - * @brief Disables the external power pin. - * - * This function disables the USBnEPEN signal, which disables an external - * power supply in host mode operation. - * - * @note This function must only be called in host mode. - * @retval None. - */ -__weak void md_usb_hos_pwr_disable(void) -{ -} - -/** - * @brief Enable the external power pin. - * - * This function disables the USBnEPEN signal, which disables an external - * power supply in host mode operation. - * - * @note This function must only be called in host mode. - * @retval None. - */ -__weak void md_usb_hos_pwr_enable(void) -{ - // - // Although Vbus is not supported by es32f0271,we provide Vbus - // from outside. - // - -} - -/** - * @brief Sets the configuration for USB power fault. - * - * This function controls how the USB controller uses its external power - * control pins (USBnPFLT and USBnEPEN). The flags specify the power - * fault level sensitivity, the power fault action, and the power enable level - * and source. - * - * One of the following can be selected as the power fault level sensitivity: - * - * - \b USB_HOST_PWRFLT_LOW - An external power fault is indicated by the pin - * being driven low. - * - \b USB_HOST_PWRFLT_HIGH - An external power fault is indicated by the pin - * being driven high. - * - * One of the following can be selected as the power fault action: - * - * - \b USB_HOST_PWRFLT_EP_NONE - No automatic action when power fault - * detected. - * - \b USB_HOST_PWRFLT_EP_TRI - Automatically tri-state the USBnEPEN pin on a - * power fault. - * - \b USB_HOST_PWRFLT_EP_LOW - Automatically drive USBnEPEN pin low on a - * power fault. - * - \b USB_HOST_PWRFLT_EP_HIGH - Automatically drive USBnEPEN pin high on a - * power fault. - * - * One of the following can be selected as the power enable level and source: - * - * - \b USB_HOST_PWREN_MAN_LOW - USBnEPEN is driven low by the USB controller - * when USBHostPwrEnable() is called. - * - \b USB_HOST_PWREN_MAN_HIGH - USBnEPEN is driven high by the USB - * controller when USBHostPwrEnable() is - * called. - * - \b USB_HOST_PWREN_AUTOLOW - USBnEPEN is driven low by the USB controller - * automatically if USBOTGSessionRequest() has - * enabled a session. - * - \b USB_HOST_PWREN_AUTOHIGH - USBnEPEN is driven high by the USB - * controller automatically if - * USBOTGSessionRequest() has enabled a - * session. - * - * When using the VBUS glitch filter, the \b USB_HOST_PWREN_FILTER can be - * addded to ignore small, short drops in VBUS level caused by high power - * consumption. This feature is mainly used to avoid causing VBUS errors - * caused by devices with high in-rush current. - * - * @note This function must only be called on microcontrollers that support - * host mode or OTG operation. The \b USB_HOST_PWREN_AUTOLOW and - * \b USB_HOST_PWREN_AUTOHIGH parameters can only be specified on devices that - * support OTG operation. - * @retval None. - */ -void md_usb_hos_pwr_config(uint32_t ui32Flags) -{ -} - -/** - * @brief Disable power fault detection. - * - * This function enables power fault detection in the USB controller. If the - * USBnPFLT pin is not in use, this function must not be used. - * - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_pwrfault_disable(void) -{ -} - -/** - * @brief Enable power fault detection. - * - * This function enables power fault detection in the USB controller. If the - * USBnPFLT pin is not in use, this function must not be used. - * - * @note This function must only be called in host mode. - * @retval None. - */ -void md_usb_hos_pwrfault_enable(void) -{ -} - -/** - * @} USB_MD_PF_EXPWR - */ - -/** @addtogroup USB_MD_PF_LPM USB Public LPM Functions - * @{ - */ - -// -// LPM is not supported by es32f0271 -// - -/** - * @brief Sends an LPM request to a device at a specified address and endpoint number. - * - * This function sends an LPM request to a connected device in host mode. - * The \e ui32Address parameter specifies the device address and has a range - * of values from 1 to 127. The \e ui32Endpoint parameter specifies the - * endpoint on the device to which to send the LPM request and must be one of - * the \b USB_EP_* values. The function returns before the LPM request is - * sent, requiring the caller to poll the md_usb_lpm_status() function or wait - * for an interrupt to signal completion of the LPM transaction. This - * function must only be called after the md_usb_hos_lpm_config() has configured - * the LPM transaction settings. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param ui32Address is the target device address for the LPM request. - * @param ui32Endpoint is the target endpoint for the LPM request. - * @retval None. - */ -void md_usb_hos_lpm_send(uint32_t ui32Address, - uint32_t uiEndpoint) -{ -} - -/** - * @brief Sets the global configuration for all LPM requests. - * - * This function sets the global configuration options for LPM transactions - * and must be called at least once before ever calling md_usb_hos_lpm_send(). The - * \e ui32ResumeTime specifies the length of time that the host drives resume - * signaling on the bus in microseconds. The valid values - * for \e ui32ResumeTime are from 50us to 1175us in 75us increments. The - * remaining configuration is specified by the \e ui32Config parameter and - * includes the following options: - * - * - \b USB_HOST_LPM_RMTWAKE allows the device to signal a remote wake from - * the LPM state. - * - \b USB_HOST_LPM_L1 is the LPM mode to enter and must always be included - * in the configuration. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param ui32Address is the target device address for the LPM request. - * @param ui32Endpoint is the target endpoint for the LPM request. - * @retval None. - */ -void md_usb_hos_lpm_config(uint32_t ui32ResumeTime, - uint32_t ui32Config) -{ -} - -/** - * @brief Returns if remote wake is currently enabled. - * - * This function returns the current state of the remote wake setting for host - * or device mode operation. If the controller is acting as a host this - * returns the current setting that is sent to devices when LPM requests are - * sent to a device. If the controller is in device mode, this function - * returns the state of the last LPM request sent from the host and indicates - * if the host enabled remote wakeup. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval The \b true if remote wake is enabled or \b false if it is not. - */ -bool md_usb_lpm_remotewake_is_enabled(void) -{ - return 0; -} - -/** - * @brief Initiates resume signaling to wake a device from LPM suspend mode. - * - * In host mode, this function initiates resume signaling to wake a device - * that has entered an LPM-triggered low power mode. This LPM-triggered low - * power mode is entered when the md_usb_hos_lpm_send() is called to put a specific - * device into a low power state. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval None. - */ -void md_usb_hos_lpm_resume(void) -{ -} - -/** - * @brief Initiates remote wake signaling to request the device to leave LPM - * suspend mode. - * - * This function initiates remote wake signaling to request that the host - * wake a device that has entered an LPM-triggered low power mode. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval None. - */ -void md_usb_dev_lpm_remotewake(void) -{ -} - -/** - * @brief Configures the USB device mode response to LPM requests. - * - * This function sets the global configuration options for LPM - * transactions in device mode and must be called before ever calling - * md_usb_dev_lpm_enable() to set the configuration for LPM transactions. The - * configuration options in device mode are specified in the \e ui32Config - * parameter and include one of the following: - * - * - \b USB_DEV_LPM_NONE disables the USB controller from responding to LPM - * transactions. - * - \b USB_DEV_LPM_EN enables the USB controller to respond to LPM - * and extended transactions. - * - \b USB_DEV_LPM_EXTONLY enables the USB controller to respond to - * extended transactions, but not LPM transactions. - * - * The \e ui32Config option can also optionally include the - * \b USB_DEV_LPM_NAK value to cause the USB controller to NAK all - * transactions other than an LPM transaction once the USB controller is in - * LPM suspend mode. If this value is not included in the \e ui32Config - * parameter, the USB controller does not respond in suspend mode. - * - * The USB controller does not enter LPM suspend mode until the application - * calls the md_usb_dev_lpm_enable() function. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param ui32Config is the combination of configuration options for LPM - * transactions in device mode. - * @retval None. - */ -void md_usb_dev_lpm_config(uint32_t ui32Config) -{ -} - -/** - * @brief Enables the USB controller to respond to LPM suspend requests. - * - * This function is used to automatically respond to an LPM sleep request from - * the USB host controller. If there is no data pending in any transmit - * FIFOs, then the USB controller acknowledges the packet and enters the - * LPM L1 state and generates the \b USB_INTLPM_ACK interrupt. If the USB - * controller has pending transmit data in at least one FIFO, then the USB - * controller responds with NYET and signals the \b USB_INTLPM_INCOMPLETE or - * \b USB_INTLPM_NYET depending on if data is pending in receive or transmit - * FIFOs. A call to md_usb_dev_lpm_enable() is required after every - * LPM resume event to re-enable LPM mode. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval None. - */ -void md_usb_dev_lpm_enable(void) -{ -} - -/** - * @brief Disables the USB controller to respond to LPM suspend requests. - * - * This function disables the USB controller from responding to LPM - * transactions. When the device enters LPM L1 mode, the USB controller - * automatically disables responding to further LPM transactions. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval None. - */ -void md_usb_dev_lpm_disable(void) -{ -} - -/** - * @brief Returns the current link state setting. - * - * This function returns the current link state setting for the USB - * controller. When the controller is operating as a host, this link - * state is sent with an LPM request. When the controller is acting - * as a device, this link state was received by the last LPM transaction - * whether it was acknowledged or stalled because the requested - * LPM mode is not supported. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval The current LPM link state. - */ -uint32_t md_usb_lpm_link_state_get(void) -{ - return 0; -} - -/** - * @brief Returns the current LPM endpoint value. - * - * This function returns the current LPM endpoint value. The meaning of the - * value depends on the mode of operation of the USB controller. When in - * device mode, the value returned is the endpoint that received the last - * LPM transaction. When in host mode this is the endpoint that was last - * sent an LPM transaction, or the endpoint that is configured to be sent when - * the LPM transaction is triggered. The value returned is in the - * \b USB_EP_[0-7] value and a direct endpoint index. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval The last endpoint to receive an LPM request in device mode or the - * endpoint that the host sends an LPM request as one of the \b USB_EP_[0-7] - * values. - */ -uint32_t md_usb_lpm_endpoint_get(void) -{ - return 0; -} - -/** - * @brief Returns the current LPM interrupt status. - * - * This function returns the current LPM interrupt status for the USB - * controller. - * - * The valid interrupt status bits when the USB controller is acting as a host - * are the following: - * - * - \b USB_INTLPM_ERROR a bus error occurred in the transmission of an LPM - * transaction. - * - \b USB_INTLPM_RESUME the USB controller has resumed from the LPM low - * power state. - * - \b USB_INTLPM_INCOMPLETE the LPM transaction failed because a timeout - * occurred or there were bit errors in the response for three attempts. - * - \b USB_INTLPM_ACK the device has acknowledged an LPM transaction. - * - \b USB_INTLPM_NYET the device has responded with a NYET to an LPM - * transaction. - * - \b USB_INTLPM_STALL the device has stalled an LPM transaction. - * - * The valid interrupt status bits when the USB controller is acting as a - * device are the following: - * - * - \b USB_INTLPM_ERROR an LPM transaction was received that has an - * unsupported link state field. The transaction was stalled, but the - * requested link state can still be read using the md_usb_lpm_link_state_get() - * function. - * - \b USB_INTLPM_RESUME the USB controller has resumed from the LPM low - * power state. - * - \b USB_INTLPM_INCOMPLETE the USB controller responded to an LPM - * transaction with a NYET because data was still in the transmit FIFOs. - * - \b USB_INTLPM_ACK the USB controller acknowledged an LPM transaction and - * is now in the LPM suspend mode. - * - \b USB_INTLPM_NYET the USB controller responded to an LPM transaction - * with a NYET because LPM transactions are not yet enabled by a call to - * md_usb_dev_lpm_enable(). - * - \b USB_INTLPM_STALL the USB controller has stalled an incoming LPM - * transaction. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param None. - * @retval The \b true if remote wake is enabled or \b false if it is not. - */ -uint32_t md_usb_lpm_status(void) -{ - return 0; -} - -/** - * @brief Enables LPM interrupts. - * - * This function enables a set of LPM interrupts so that they can trigger a - * USB interrupt. The \e ui32Ints parameter specifies which of the - * \b USB_INTLPM_* to enable. - * - * The valid interrupt status bits when the USB controller is acting as a host - * are the following: - * - * - \b USB_INTLPM_ERROR a bus error occurred in the transmission of an LPM - * transaction. - * - \b USB_INTLPM_RESUME the USB controller has resumed from LPM low power - * state. - * - \b USB_INTLPM_INCOMPLETE the LPM transaction failed because a timeout - * occurred or there were bit errors in the response for three attempts. - * - \b USB_INTLPM_ACK the device has acknowledged an LPM transaction. - * - \b USB_INTLPM_NYET the device has responded with a NYET to an LPM - * transaction. - * - \b USB_INTLPM_STALL the device has stalled an LPM transaction. - * - * The valid interrupt status bits when the USB controller is acting as a - * device are the following: - * - * - \b USB_INTLPM_ERROR an LPM transaction was received that has an - * unsupported link state field. The transaction was stalled, but the - * requested link state can still be read using the md_usb_lpm_link_state_get() - * function. - * - \b USB_INTLPM_RESUME the USB controller has resumed from the LPM low - * power state. - * - \b USB_INTLPM_INCOMPLETE the USB controller responded to an LPM - * transaction with a NYET because data was still in the transmit FIFOs. - * - \b USB_INTLPM_ACK the USB controller acknowledged an LPM transaction and - * is now in the LPM suspend mode. - * - \b USB_INTLPM_NYET the USB controller responded to an LPM transaction - * with a NYET because LPM transactions are not yet enabled by a call to - * md_usb_dev_lpm_enable(). - * - \b USB_INTLPM_STALL the USB controller has stalled an incoming LPM - * transaction. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param ui32Ints specifies which LPM interrupts to enable. - * @retval None. - */ -void md_usb_lpm_int_enable(uint32_t ui32Ints) -{ -} - -/** - * @brief Disables LPM interrupts. - * - * This function disables the LPM interrupts specified in the \e ui32Ints - * parameter, preventing them from triggering a USB interrupt. - * - * The valid interrupt status bits when the USB controller is acting as a host - * are the following: - * - * - \b USB_INTLPM_ERROR a bus error occurred in the transmission of an LPM - * transaction. - * - \b USB_INTLPM_RESUME the USB controller has resumed from LPM low power - * state. - * - \b USB_INTLPM_INCOMPLETE the LPM transaction failed because a timeout - * occurred or there were bit errors in the response for three attempts. - * - \b USB_INTLPM_ACK the device has acknowledged an LPM transaction. - * - \b USB_INTLPM_NYET the device has responded with a NYET to an LPM - * transaction. - * - \b USB_INTLPM_STALL the device has stalled an LPM transaction. - * - * The valid interrupt status bits when the USB controller is acting as a - * device are the following: - * - * - \b USB_INTLPM_ERROR an LPM transaction was received that has an - * unsupported link state field. The transaction was stalled, but the - * requested link state can still be read using the md_usb_lpm_link_state_get() - * function. - * - \b USB_INTLPM_RESUME the USB controller has resumed from the LPM low - * power state. - * - \b USB_INTLPM_INCOMPLETE the USB controller responded to an LPM - * transaction with a NYET because data was still in the transmit FIFOs. - * - \b USB_INTLPM_ACK the USB controller acknowledged an LPM transaction and - * is now in the LPM suspend mode. - * - \b USB_INTLPM_NYET the USB controller responded to an LPM transaction - * with a NYET because LPM transactions are not yet enabled by a call to - * md_usb_dev_lpm_enable(). - * - \b USB_INTLPM_STALL the USB controller has stalled an incoming LPM - * transaction. - * - * @note This function must only be called in host mode. The USB LPM feature - * is not available on all ES32 devices. Please consult the data sheet for - * the ES32 device that you are using to determine if this feature is - * available. - * @param ui32Ints specifies which LPM interrupts to disable. - * @retval None. - */ -void md_usb_lpm_int_disable(uint32_t ui32Ints) -{ -} - -/** - * @} USB_MD_PF_LPM - */ - -/** @addtogroup USB_MD_PF_ULPI USB Public ULPI Functions - * @{ - */ - -// -// ULPI is not supported by es32f0271 -// - -/** - * @brief Configures the USB controller's ULPI function. - * - * This function is used to configure the USB controller's ULPI function. - * The configuration options are set in the \e ui32Config parameter and are a - * logical OR of the following values: - * - * - \b USB_ULPI_EXTVBUS enables the external ULPI PHY as the source for VBUS - * signaling. - * - \b USB_ULPI_EXTVBUS_IND enables the external ULPI PHY to detect external - * VBUS over-current condition. - * - * @note The USB ULPI feature is not available on all Tiva devices. - * Please consult the data sheet for the Tiva device that you - * are using to determine if this feature is available. - * @param ui32Config contains the configuration options. - * @retval None. - */ -void md_usb_ulpi_config(uint32_t ui32Config) -{ -} - -/** - * @brief Enables the USB controller's ULPI function. - * - * This function enables the USB controller's ULPI function and must be - * called before attempting to access an external ULPI-connected USB PHY. - * - * @note The USB ULPI feature is not available on all Tiva devices. - * Please consult the data sheet for the Tiva device that you - * are using to determine if this feature is available. - * @param None. - * @retval None. - */ -void md_usb_ulpi_enable(void) -{ -} - -/** - * @brief Disables the USB controller's ULPI function. - * - * This function Disables the USB controller's ULPI function and must be - * called before attempting to access an external ULPI-connected USB PHY. - * - * @note The USB ULPI feature is not available on all Tiva devices. - * Please consult the data sheet for the Tiva device that you - * are using to determine if this feature is available. - * @param None. - * @retval None. - */ -void md_usb_ulpi_disable(void) -{ -} - -/** - * @brief Disables the USB controller's ULPI function. - * - * This function Disables the USB controller's ULPI function and must be - * called before attempting to access an external ULPI-connected USB PHY. - * - * @note The USB ULPI feature is not available on all Tiva devices. - * Please consult the data sheet for the Tiva device that you - * are using to determine if this feature is available. - * @param None. - * @retval None. - */ -uint8_t md_usb_ulpi_reg_read(uint8_t ui8Reg) -{ - return 0; -} - -/** - * @brief Writes a value to a register on an external ULPI-connected USB PHY. - * - * This function writes the register address specified in the \e ui8Reg - * parameter with the value specified in the \e ui8Data parameter using the - * ULPI function. This function is blocking and only returns when the - * write access completes. The function does not return if there is not a - * ULPI-connected USB PHY present. - * - * @note The USB ULPI feature is not available on all Tiva devices. - * Please consult the data sheet for the Tiva device that you - * are using to determine if this feature is available. - * @param ui8Reg specifies the register address to write. - * @param ui8Data specifies the data to write. - * @retval None. - */ -void md_usb_ulpi_reg_write(uint8_t ui8Reg, - uint8_t ui8Data) -{ -} - -/** - * @} USB_MD_PF_ULPI - */ - -/** @addtogroup USB_MD_PF_DMA USB Public DMA Functions - * @{ - */ - -// -// USB DMA is not supported by es32f0271 -// - -/** - * @brief Sets the DMA channel to use for a specified endpoint. - * - * This function is used to configure which DMA channel to use with a specified - * endpoint. Receive DMA channels can only be used with receive endpoints - * and transmit DMA channels can only be used with transmit endpoints. - * - * @note This function only has an effect on microcontrollers that have the - * ability to change the DMA channel for an endpoint. Calling this function - * on other devices has no effect. - * @param ui32Endpoint specifies which endpoint's FIFO address to return. - * @param ui32Channel specifies which DMA channel to use for which endpoint. - * @retval None. - */ -void md_usb_dma_endpoint_channel_set(uint32_t ui32Endpoint, - uint32_t ui32Channel) -{ - // - // It is not supported by es32f0271 - // - return; -} - -/** - * @brief Enable DMA on a specified endpoint. - * - * This function enables DMA on a specified endpoint and configures the mode - * according to the values in the \e ui32Flags parameter. The \e ui32Flags - * parameter must have \b USB_EP_DEV_IN or \b USB_EP_DEV_OUT set. Once this - * function is called the only DMA or error interrupts are generated by the - * USB controller. - * - * @note This function only has an effect on microcontrollers that have the - * ability to change the DMA channel for an endpoint. Calling this function - * on other devices has no effect. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags specifies which direction and what mode to use when - * enabling DMA. - * @retval None. - */ -void md_usb_dma_endpoint_enable(uint32_t ui32Endpoint, - uint32_t ui32Flags) -{ - // - // It is not supported by es32f0271 - // - return; -} - -/** - * @brief Disable DMA on a specified endpoint. - * - * This function disables DMA on a specified endpoint to allow non-DMA USB - * transactions to generate interrupts normally. The \e ui32Flags parameter - * must be \b USB_EP_DEV_IN or \b USB_EP_DEV_OUT; all other bits are ignored. - * - * @note This function only has an effect on microcontrollers that have the - * ability to change the DMA channel for an endpoint. Calling this function - * on other devices has no effect. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Flags specifies which direction to disable. - * @retval None. - */ -void md_usb_dma_endpoint_disable(uint32_t ui32Endpoint, - uint32_t ui32Flags) -{ - // - // It is not supported by es32f0271 - // - return; -} - -/** - * @brief Configure the DMA settings for an endpoint. - * - * This function configures the DMA settings for a specified endpoint without - * changing other options that may already be configured. In order for the - * DMA transfer to be enabled, the md_usb_dma_endpoint_enable() function must be - * called before starting the DMA transfer. The configuration - * options are passed in the \e ui32Config parameter and can have the values - * described below. - * - * One of the following values to specify direction: - * - \b USB_EP_HOST_OUT or \b USB_EP_DEV_IN - This setting is used with - * DMA transfers from memory to the USB controller. - * - \b USB_EP_HOST_IN or \b USB_EP_DEV_OUT - This setting is used with - * DMA transfers from the USB controller to memory. - * - * One of the following values: - * - \b USB_EP_DMA_MODE_0(default) - This setting is typically used for - * transfers that do not span multiple packets or when interrupts are - * required for each packet. - * - \b USB_EP_DMA_MODE_1 - This setting is typically used for - * transfers that span multiple packets and do not require interrupts - * between packets. - * - * Values only used with \b USB_EP_HOST_OUT or \b USB_EP_DEV_IN: - * - \b USB_EP_AUTO_SET - This setting is used to allow transmit DMA transfers - * to automatically be sent when a full packet is loaded into a FIFO. - * This is needed with \b USB_EP_DMA_MODE_1 to ensure that packets go - * out when the FIFO becomes full and the DMA has more data to send. - * - * Values only used with \b USB_EP_HOST_IN or \b USB_EP_DEV_OUT: - * - \b USB_EP_AUTO_CLEAR - This setting is used to allow receive DMA - * transfers to automatically be acknowledged as they are received. This is - * needed with \b USB_EP_DMA_MODE_1 to ensure that packets continue to - * be received and acknowledged when the FIFO is emptied by the DMA - * transfer. - * - * Values only used with \b USB_EP_HOST_IN: - * - \b USB_EP_AUTO_REQUEST - This setting is used to allow receive DMA - * transfers to automatically request a new IN transaction when the - * previous transfer has emptied the FIFO. This is typically used in - * conjunction with \b USB_EP_AUTO_CLEAR so that receive DMA transfers - * can continue without interrupting the main processor. - * - * @note This function only has an effect on microcontrollers that have the - * ability to change the DMA channel for an endpoint. Calling this function - * on other devices has no effect. - * @param ui32Endpoint is the endpoint to access. - * @param ui32Config specifies the configuration options for an endpoint. - * @retval None. - */ -void md_usb_dma_endpoint_config(uint32_t ui32Endpoint, uint32_t ui32Config) -{ - // - //Chose endpoint. - // - USB->INDEX = (uint8_t)USBEPToIndex(ui32Endpoint); - - // - // Host out or device in. - // - if ((ui32Config & USB_EP_HOST_OUT) && (ui32Config & USB_EP_AUTO_SET)) - { - USB->CSR0H_TXCSRH |= USB_CSR0H_TXCSRH_AUTOSET_MSK; - } - else - { - if (ui32Config & USB_EP_AUTO_REQUEST) - { - USB->RXCSR2 |= USB_RXCSRH_AUTOREQ_MSK; - } - - if (ui32Config & USB_EP_AUTO_CLEAR) - { - USB->RXCSR2 |= USB_RXCSRH_AUTOCLR_MSK; - } - } -} - -/** - * @brief Assigns and configures an endpoint to a specified integrated USB DMA - * channel. - * - * This function assigns an endpoint and configures the settings for a - * USB DMA channel. The \e ui32Endpoint parameter is one of the - * \b USB_EP_* values and the \e ui32Channel value is a zero-based index of - * the DMA channel to configure. The \e ui32Config parameter is a combination - * of the \b USB_DMA_CFG_* values using the following guidelines. - * - * Use one of the following to set the DMA burst mode: - * - \b USB_DMA_CFG_BURST_NONE disables bursting. - * - \b USB_DMA_CFG_BURST_4 sets the DMA burst size to 4 words. - * - \b USB_DMA_CFG_BURST_8 sets the DMA burst size to 8 words. - * - \b USB_DMA_CFG_BURST_16 sets the DMA burst size to 16 words. - * - * Use one of the following to set the DMA mode: - * - \b USB_DMA_CFG_MODE_0 is typically used when only a single packet is - * being sent via DMA and triggers one completion interrupt per packet. - * - \b USB_DMA_CFG_MODE_1 is typically used when multiple packets are being - * sent via DMA and triggers one completion interrupt per transfer. - * - * Use one of the following to set the direction of the transfer: - * - \b USB_DMA_CFG_DIR_RX selects a DMA transfer from the endpoint to a - * memory location. - * - \b USB_DMA_CFG_DIR_TX selects a DMA transfer to the endpoint from a - * memory location. - * - * The following two optional settings allow an application to immediately - * enable the DMA transfer and/or DMA interrupts when configuring the DMA - * channel: - * - \b USB_DMA_CFG_INT_EN enables interrupts for this channel immediately so - * that an added call to md_usb_dma_channel_int_enable() is not necessary. - * - \b USB_DMA_CFG_EN enables the DMA channel immediately so that an added - * call to md_usb_dma_channel_enable() is not necessary. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller or if it must use the DMA controller for DMA transfers. - * @param ui32Channel specifies which DMA channel to access. - * @param ui32Endpoint is the endpoint to assign to the USB DMA channel. - * @param ui32Config is used to specify the configuration of the USB DMA channel. - * @retval None. - */ -void md_usb_dma_channel_config(uint32_t ui32Channel, - uint32_t ui32Endpoint, uint32_t ui32Config) -{ - // - // It is not supported by es32f0271 - // -} - -/** - * @brief Sets the source or destination address for an integrated USB DMA transfer - * on a specified channel. - * - * This function sets the source or destination address for the USB DMA - * channel number specified in the \e ui32Channel parameter. The - * \e ui32Channel value is a zero-based index of the USB DMA channel. The - * \e pvAddress parameter is a source address if the transfer type for the DMA - * channel is transmit and a destination address if the transfer type is - * receive. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller or if it must use the DMA controller for DMA transfers. - * @param ui32Channel specifies which DMA channel to access. - * @param pvAddress specifies the source or destination address for the USB - * DMA transfer. - * @retval None. - */ -void md_usb_dma_channel_address_set(uint32_t ui32Channel, - void *pvAddress) -{ - // - // It is not supported by es32f0271 - // - return; -} - -/** - * @brief Returns the source or destination address for the specified integrated USB - * DMA channel. - * - * This function returns the DMA address for the channel number specified - * in the \e ui32Channel parameter. The \e ui32Channel value is a zero-based - * index of the DMA channel to query. This function must not be used on - * devices that return \b USB_CONTROLLER_VER_0 from the USBControllerVersion() - * function. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller or if it must use the DMA controller for DMA transfers. - * @param ui32Channel specifies which DMA channel to access. - * @retval The current DMA address for a USB DMA channel. - */ -void *md_usb_dma_channel_address_get(uint32_t ui32Channel) -{ - // - // It is not supported by es32f0271 - // - return 0; -} - -/** - * @brief Sets the transfer count for an integrated USB DMA channel. - * - * This function sets the USB DMA transfer count in bytes for the channel - * number specified in the \e ui32Channel parameter. The \e ui32Channel - * value is a zero-based index of the DMA channel. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller or if it must use the DMA controller for DMA transfers. - * @param ui32Count specifies the number of bytes to transfer. - * @param ui32Channel specifies which DMA channel to access. - * @retval None. - */ -void md_usb_dma_channel_count_set(uint32_t ui32Count, - uint32_t ui32Channel) -{ - // - // It is not supported by es32f0271 - // - return; -} - -/** - * @brief Returns the transfer count for an integrated USB DMA channel. - * - * This function returns the USB DMA transfer count in bytes for the channel - * number specified in the \e ui32Channel parameter. The \e ui32Channel value - * is a zero-based index of the DMA channel to query. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller or if it must use the DMA controller for DMA transfers. - * @param ui32Channel specifies which DMA channel to access. - * @retval The current count for a USB DMA channel. - */ -uint32_t md_usb_dma_channel_count_get(uint32_t ui32Channel) -{ - // - // It is not supported by es32f0271 - // - return 0; -} - -/** - * @brief Returns the available number of integrated USB DMA channels. - * - * This function returns the total number of DMA channels available when using - * the integrated USB DMA controller. This function returns 0 if the - * integrated controller is not present. - * - * @note The number of integrated USB DMA channels or zero if the - * integrated USB DMA controller is not present. - * @param None. - * @retval The number of integrated USB DMA channels or zero if the - * integrated USB DMA controller is not present. - */ -uint32_t md_usb_dma_channel_number(void) -{ - // - // It is not supported by es32f0271 - // - return 0; -} - -/** - * @brief Enable interrupts for a specified integrated USB DMA channel. - * - * This function enables the USB DMA channel interrupt based on the - * \e ui32Channel parameter. The \e ui32Channel value is a zero-based - * index of the USB DMA channel. Once enabled, the md_usb_dma_channel_int_status() - * function returns if a DMA channel has generated an interrupt. - * - * @note The number of integrated USB DMA channels or zero if the - * integrated USB DMA controller is not present. - * @param ui32Channel specifies which DMA channel interrupt to enable. - * @retval None. - */ -void md_usb_dma_channel_int_enable(uint32_t ui32Channel) -{ - // - // It is not supported by es32f0271 - // -} - -/** - * @brief Return the current status of the integrated USB DMA interrupts. - * - * This function returns the current bit-mapped interrupt status for all USB - * DMA channel interrupt sources. Calling this function automatically clears - * all currently pending USB DMA interrupts. - * - * @param None. - * @retval None. - */ -uint32_t md_usb_dma_channel_int_status(void) -{ - return 0; -} - -/** - * @brief Enables USB DMA for a specified channel. - * - * This function enables the USB DMA channel passed in the \e ui32Channel - * parameter. The \e ui32Channel value is a zero-based index of the USB DMA - * channel. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller. - * @param ui32Channel specifies the USB DMA channel to enable. - * @retval None. - */ -void md_usb_dma_channel_enable(uint32_t ui32Channel) -{ - // - // DMA1 will be used by es32f0271 - // - SET_BIT(*(&DMA1->CSR0 + 4 * ui32Channel), DMA_CSR0_CHEN_MSK); -} - -/** - * @brief Disables USB DMA for a specified channel. - * - * This function Disables the USB DMA channel passed in the \e ui32Channel - * parameter. The \e ui32Channel value is a zero-based index of the USB DMA - * channel. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller. - * @param ui32Channel specifies the USB DMA channel to Disable. - * @retval None. - */ -void md_usb_dma_channel_disable(uint32_t ui32Channel) -{ - // - // DMA1 will be used by es32f0271 - // - CLEAR_BIT(*(&DMA1->CSR0 + 4 * ui32Channel), DMA_CSR0_CHEN_MSK); -} - -/** - * @brief Check if the USB channel is enabled. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller. - * @param ui32Channel specifies the USB DMA channel. - * @retval Return 1 if the channel is enabled. - */ -uint32_t md_usb_dma_channel_isenabled(uint32_t ui32Channel) -{ - if (*((uint32_t *)(&DMA1->CSR0 + ui32Channel * 4)) & DMA_CSR0_CHEN_MSK) - return 1; - - return 0; -} - -/** - * @brief Returns the current status for an integrated USB DMA channel. - * - * This function returns the current status for the USB DMA channel specified - * by the \e ui32Channel parameter. The \e ui32Channel value is a zero-based - * index of the USB DMA channel to query. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller or if it must use the DMA controller for DMA transfers. - * @param ui32Channel specifies the USB DMA channel to Disable. - * @retval Returns zero or \b USB_DMACTL0_ERR if there is a pending error - * condition on a DMA channel. - */ -uint32_t md_usb_dma_channel_status(uint32_t ui32Channel) -{ - // - // It is not supported by es32f0271 - // - return 0; -} - -/** - * @brief Clears the integrated USB DMA status for a specified channel. - * - * This function clears the USB DMA channel status for the channel specified - * by the \e ui32Channel parameter. The \e ui32Channel value is a zero-based - * index of the USB DMA channel to query. The \e ui32Status parameter - * specifies the status bits to clear and must be the valid values that are - * returned from a call to the md_usb_dma_channel_status() function. - * - * @note This feature is not available on all ES32 devices. Please - * check the data sheet to determine if the USB controller has a DMA - * controller or if it must use the DMA controller for DMA transfers. - * @param ui32Channel specifies the USB DMA channel to Disable. - * @retval None. - */ -void md_usb_dma_channel_status_clear(uint32_t ui32Channel, - uint32_t ui32Status) -{ - // - // It is not supported by es32f0271 - // -} - -/** - * @} USB_MD_PF_DMA - */ - -/** - * @} USB_MD_Public_Functions - */ - -/** - * @} USB - */ - -#endif - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics END OF MAIN.C****/ diff --git a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_wwdt.c b/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_wwdt.c deleted file mode 100644 index fdba390e17..0000000000 --- a/bsp/essemi/es32f0271/libraries/ES32F027x_MD_StdPeriph_Driver/Source/md_wwdt.c +++ /dev/null @@ -1,86 +0,0 @@ -/** - ****************************************************************************** - * @file md_wwdt.c - * @brief ES32F0271 WWDT Source File. - * - * @version V1.00.01 - * @date 4/12/2018 - * @author Eastsoft AE Team - * @note - * detailed description - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - ******************************************************************************* - */ - -/* Includes -------------------------------------------------------------------*/ -#include "md_rcu.h" -#include "md_wwdt.h" - -/** @addtogroup Micro_Driver - * @{ - */ - -#if defined (WWDT) - -/** @defgroup WWDT WWDT - * @brief WWDT micro driver - * @{ - */ - -/* Private types --------------------------------------------------------------*/ -/* Private variables ----------------------------------------------------------*/ -/* Private constants ----------------------------------------------------------*/ -/* Private macros -------------------------------------------------------------*/ - -/* Public functions -----------------------------------------------------------*/ -/** @addtogroup MD_RCU_Public_Functions RCU Public Functions - * @{ - */ -/** - * @brief De-initialize the GPIO registers to their default reset values. - * @param GPIOx GPIO Instance - * @retval An ErrorStatus enumeration value: - * - SUCCESS: GPIO registers are de-initialized - * - ERROR: GPIO registers are not de-initialized - */ -void md_wwdt_init(WWDT_TypeDef *WWD, md_wwdt_inittypedef *WWDT_InitStruct) -{ - /* Check the parameters */ - assert_param(IS_MD_WWDT_ALL_INSTANCE(WWD)); - assert_param(IS_MD_WWDT_PRESCALER(WWDT_InitStruct->Prescaler)); - assert_param(IS_MD_WWDT_WINDOW(WWDT_InitStruct->Window)); - assert_param(IS_MD_WWDT_COUNTER(WWDT_InitStruct->Counter)); - assert_param(IS_MD_WWDT_EWI_MODE(WWDT_InitStruct->EWIMode)); - - if (WWDT_InitStruct->EWIMode == WWDT_EWI_ENABLE) - md_wwdt_enable_ier_ewis(WWD); - else - md_wwdt_disable_idr_ewis(WWD); - - md_wwdt_set_con_t(WWD, WWDT_InitStruct->Counter); - md_wwdt_set_cfg_wdgtb(WWD, WWDT_InitStruct->Prescaler); - md_wwdt_set_cfg_w(WWD, WWDT_InitStruct->Window); - md_wwdt_enable_con_wdga(WWD); -} - - - - - - - - - - - -/** - * @} GPIO - */ -#endif - -/** - * @} Micro_Driver - */ - -/******************* (C) COPYRIGHT Eastsoft Microelectronics *****END OF FILE****/ diff --git a/bsp/essemi/es32f0271/libraries/SConscript b/bsp/essemi/es32f0271/libraries/SConscript deleted file mode 100644 index 00008f5fca..0000000000 --- a/bsp/essemi/es32f0271/libraries/SConscript +++ /dev/null @@ -1,32 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() - -# The set of source files associated with this SConscript file. -src = [] - -src += Glob('ES32F027x_MD_StdPeriph_Driver/Source/*.c') - -#add for startup script -if rtconfig.CROSS_TOOL == 'gcc': - src = src + ['CMSIS/Device/EastSoft/ES32F0271/Startup/gcc/startup_es32f027x.s'] -elif rtconfig.CROSS_TOOL == 'keil': - src = src + ['CMSIS/Device/EastSoft/ES32F0271/Startup/keil/startup_es32f027x.s'] -elif rtconfig.CROSS_TOOL == 'iar': - src = src + ['CMSIS/Device/EastSoft/ES32F0271/Startup/iar/startup_es32f027x.s'] - -src = src + ['CMSIS/Device/EastSoft/ES32F0271/System/system_es32f027x.c'] - -path = [cwd + '/CMSIS/Device/EastSoft/ES32F0271/Include', - cwd + '/CMSIS/Device/EastSoft/ES32F0271/Include/ES32F0271', - cwd + '/CMSIS/Device/EastSoft/ES32F0271/System', - cwd + '/CMSIS/Include', - cwd + '/', - cwd + '/ES32F027x_MD_StdPeriph_Driver/Include'] - -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) - -Return('group') diff --git a/bsp/essemi/es32f0271/libraries/usblib/drivers/type.h b/bsp/essemi/es32f0271/libraries/usblib/drivers/type.h deleted file mode 100644 index 3d6a812bf6..0000000000 --- a/bsp/essemi/es32f0271/libraries/usblib/drivers/type.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - ************************************************************************************** - * @file type.h - * @brief Common types and macros. - * @data 12/21/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -#ifndef __TYPES_H__ -#define __TYPES_H__ - -//***************************************************************************** -// -// Macros for hardware access. -// -//***************************************************************************** -#define HWREG(x) \ - (*((volatile uint32_t *)(x))) -#define HWREGH(x) \ - (*((volatile uint16_t *)(x))) -#define HWREGB(x) \ - (*((volatile uint8_t *)(x))) -#define HWREGBITW(x, b) \ - HWREG(((uint32_t)(x) & 0xF0000000) | 0x02000000 | \ - (((uint32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) -#define HWREGBITH(x, b) \ - HWREGH(((uint32_t)(x) & 0xF0000000) | 0x02000000 | \ - (((uint32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) -#define HWREGBITB(x, b) \ - HWREGB(((uint32_t)(x) & 0xF0000000) | 0x02000000 | \ - (((uint32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) - - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics Co., Ltd. *** END OF FILE ****/ diff --git a/bsp/essemi/es32f0271/libraries/usblib/drivers/usb_lowlayer_api.h b/bsp/essemi/es32f0271/libraries/usblib/drivers/usb_lowlayer_api.h deleted file mode 100644 index 5fee2e973e..0000000000 --- a/bsp/essemi/es32f0271/libraries/usblib/drivers/usb_lowlayer_api.h +++ /dev/null @@ -1,728 +0,0 @@ -/** - ************************************************************************************** - * @file usb_lowlayer_api.h - * @brief USB library lower layer api - * @data 11/9/2018 - * @author Eastsoft AE Team - * @note - * - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. ALL rights reserved. - * - ************************************************************************************** - */ - -/* Includes-------------------------------------------------------------------*/ -#include "stdint.h" -#include - -#ifndef __USB_LOWLAYER_API_H__ -#define __USB_LOWLAYER_API_H__ - - -/** - * If building with a C++ compiler, make all of the definitions in this header - * have a C binding. - */ -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Public constants -----------------------------------------------------------*/ - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_int_enable() and -// md_usb_hosdev_int_disable() as the ui32Flags parameter, and are returned from -// md_usb_hosdev_int_status(). -// -//***************************************************************************** -#define USB_INTCTRL_ALL 0x000003FF // All control interrupt sources -#define USB_INTCTRL_STATUS 0x000000FF // Status Interrupts -#define USB_INTCTRL_VBUS_ERR 0x00000080 // VBUS Error -#define USB_INTCTRL_SESSION 0x00000040 // Session Start Detected -#define USB_INTCTRL_SESSION_END 0x00000040 // Session End Detected -#define USB_INTCTRL_DISCONNECT 0x00000020 // Disconnect Detected -#define USB_INTCTRL_CONNECT 0x00000010 // Device Connect Detected -#define USB_INTCTRL_SOF 0x00000008 // Start of Frame Detected -#define USB_INTCTRL_BABBLE 0x00000004 // Babble signaled -#define USB_INTCTRL_RESET 0x00000004 // Reset signaled -#define USB_INTCTRL_RESUME 0x00000002 // Resume detected -#define USB_INTCTRL_SUSPEND 0x00000001 // Suspend detected -#define USB_INTCTRL_MODE_DETECT 0x00000200 // Mode value valid -#define USB_INTCTRL_POWER_FAULT 0x00000100 // Power Fault detected - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_endpoint_int_enable() -// and md_usb_hosdev_endpoint_int_disable() as the ui32Flags parameter, and -// are returned from md_usb_hosdev_endpoint_int_status(). -// -//***************************************************************************** -#define USB_INTEP_ALL 0xFFFFFFFF // Host IN Interrupts -#define USB_INTEP_HOST_IN 0xFFFE0000 // Host IN Interrupts -#define USB_INTEP_HOST_IN_15 0x80000000 // Endpoint 15 Host IN Interrupt -#define USB_INTEP_HOST_IN_14 0x40000000 // Endpoint 14 Host IN Interrupt -#define USB_INTEP_HOST_IN_13 0x20000000 // Endpoint 13 Host IN Interrupt -#define USB_INTEP_HOST_IN_12 0x10000000 // Endpoint 12 Host IN Interrupt -#define USB_INTEP_HOST_IN_11 0x08000000 // Endpoint 11 Host IN Interrupt -#define USB_INTEP_HOST_IN_10 0x04000000 // Endpoint 10 Host IN Interrupt -#define USB_INTEP_HOST_IN_9 0x02000000 // Endpoint 9 Host IN Interrupt -#define USB_INTEP_HOST_IN_8 0x01000000 // Endpoint 8 Host IN Interrupt -#define USB_INTEP_HOST_IN_7 0x00800000 // Endpoint 7 Host IN Interrupt -#define USB_INTEP_HOST_IN_6 0x00400000 // Endpoint 6 Host IN Interrupt -#define USB_INTEP_HOST_IN_5 0x00200000 // Endpoint 5 Host IN Interrupt -#define USB_INTEP_HOST_IN_4 0x00100000 // Endpoint 4 Host IN Interrupt -#define USB_INTEP_HOST_IN_3 0x00080000 // Endpoint 3 Host IN Interrupt -#define USB_INTEP_HOST_IN_2 0x00040000 // Endpoint 2 Host IN Interrupt -#define USB_INTEP_HOST_IN_1 0x00020000 // Endpoint 1 Host IN Interrupt - -#define USB_INTEP_DEV_OUT 0xFFFE0000 // Device OUT Interrupts -#define USB_INTEP_DEV_OUT_15 0x80000000 // Endpoint 15 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_14 0x40000000 // Endpoint 14 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_13 0x20000000 // Endpoint 13 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_12 0x10000000 // Endpoint 12 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_11 0x08000000 // Endpoint 11 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_10 0x04000000 // Endpoint 10 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_9 0x02000000 // Endpoint 9 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_8 0x01000000 // Endpoint 8 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_7 0x00800000 // Endpoint 7 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_6 0x00400000 // Endpoint 6 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_5 0x00200000 // Endpoint 5 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_4 0x00100000 // Endpoint 4 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_3 0x00080000 // Endpoint 3 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_2 0x00040000 // Endpoint 2 Device OUT Interrupt -#define USB_INTEP_DEV_OUT_1 0x00020000 // Endpoint 1 Device OUT Interrupt - -#define USB_INTEP_HOST_OUT 0x0000FFFE // Host OUT Interrupts -#define USB_INTEP_HOST_OUT_15 0x00008000 // Endpoint 15 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_14 0x00004000 // Endpoint 14 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_13 0x00002000 // Endpoint 13 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_12 0x00001000 // Endpoint 12 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_11 0x00000800 // Endpoint 11 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_10 0x00000400 // Endpoint 10 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_9 0x00000200 // Endpoint 9 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_8 0x00000100 // Endpoint 8 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_7 0x00000080 // Endpoint 7 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_6 0x00000040 // Endpoint 6 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_5 0x00000020 // Endpoint 5 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_4 0x00000010 // Endpoint 4 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_3 0x00000008 // Endpoint 3 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_2 0x00000004 // Endpoint 2 Host OUT Interrupt -#define USB_INTEP_HOST_OUT_1 0x00000002 // Endpoint 1 Host OUT Interrupt - -#define USB_INTEP_DEV_IN 0x0000FFFE // Device IN Interrupts -#define USB_INTEP_DEV_IN_15 0x00008000 // Endpoint 15 Device IN Interrupt -#define USB_INTEP_DEV_IN_14 0x00004000 // Endpoint 14 Device IN Interrupt -#define USB_INTEP_DEV_IN_13 0x00002000 // Endpoint 13 Device IN Interrupt -#define USB_INTEP_DEV_IN_12 0x00001000 // Endpoint 12 Device IN Interrupt -#define USB_INTEP_DEV_IN_11 0x00000800 // Endpoint 11 Device IN Interrupt -#define USB_INTEP_DEV_IN_10 0x00000400 // Endpoint 10 Device IN Interrupt -#define USB_INTEP_DEV_IN_9 0x00000200 // Endpoint 9 Device IN Interrupt -#define USB_INTEP_DEV_IN_8 0x00000100 // Endpoint 8 Device IN Interrupt -#define USB_INTEP_DEV_IN_7 0x00000080 // Endpoint 7 Device IN Interrupt -#define USB_INTEP_DEV_IN_6 0x00000040 // Endpoint 6 Device IN Interrupt -#define USB_INTEP_DEV_IN_5 0x00000020 // Endpoint 5 Device IN Interrupt -#define USB_INTEP_DEV_IN_4 0x00000010 // Endpoint 4 Device IN Interrupt -#define USB_INTEP_DEV_IN_3 0x00000008 // Endpoint 3 Device IN Interrupt -#define USB_INTEP_DEV_IN_2 0x00000004 // Endpoint 2 Device IN Interrupt -#define USB_INTEP_DEV_IN_1 0x00000002 // Endpoint 1 Device IN Interrupt - -#define USB_INTEP_0 0x00000001 // Endpoint 0 Interrupt - -//***************************************************************************** -// -// The following are values that are returned from md_usb_hos_speed_get() 0r -// md_usb_dev_speed_get(). -// -//***************************************************************************** -#define USB_UNDEF_SPEED 0x80000000 // Current speed is undefined -#define USB_HIGH_SPEED 0x00000002 // Current speed is High Speed -#define USB_FULL_SPEED 0x00000001 // Current speed is Full Speed -#define USB_LOW_SPEED 0x00000000 // Current speed is Low Speed - -//***************************************************************************** -// -// The following are values that are returned from md_usb_hosdev_endpoint_status(). The -// USB_HOST_* values are used when the USB controller is in host mode and the -// USB_DEV_* values are used when the USB controller is in device mode. -// -//***************************************************************************** -#define USB_HOST_IN_STATUS 0x114F0000 // Mask of all host IN interrupts -#define USB_HOST_IN_PID_ERROR 0x10000000 // Stall on this endpoint received -#define USB_HOST_IN_NOT_COMP 0x01000000 // Device failed to respond -#define USB_HOST_IN_STALL 0x00400000 // Stall on this endpoint received -#define USB_HOST_IN_DATA_ERROR 0x00080000 // CRC or bit-stuff error -// (ISOC Mode) -#define USB_HOST_IN_NAK_TO 0x00080000 // NAK received for more than the -// specified timeout period -#define USB_HOST_IN_ERROR 0x00040000 // Failed to communicate with a -// device -#define USB_HOST_IN_FIFO_FULL 0x00020000 // RX FIFO full -#define USB_HOST_IN_PKTRDY 0x00010000 // Data packet ready -#define USB_HOST_OUT_STATUS 0x000000A7 // Mask of all host OUT interrupts -#define USB_HOST_OUT_NAK_TO 0x00000080 // NAK received for more than the -// specified timeout period -#define USB_HOST_OUT_NOT_COMP 0x00000080 // No response from device -// (ISOC mode) -#define USB_HOST_OUT_STALL 0x00000020 // Stall on this endpoint received -#define USB_HOST_OUT_ERROR 0x00000004 // Failed to communicate with a -// device -#define USB_HOST_OUT_FIFO_NE 0x00000002 // TX FIFO is not empty -#define USB_HOST_OUT_PKTPEND 0x00000001 // Transmit still being transmitted -#define USB_HOST_EP0_NAK_TO 0x00000080 // NAK received for more than the -// specified timeout period -#define USB_HOST_EP0_STATUS 0x00000040 // This was a status packet -#define USB_HOST_EP0_ERROR 0x00000010 // Failed to communicate with a -// device -#define USB_HOST_EP0_RX_STALL 0x00000004 // Stall on this endpoint received -#define USB_HOST_EP0_RXPKTRDY 0x00000001 // Receive data packet ready -#define USB_DEV_RX_PID_ERROR 0x01000000 // PID error in isochronous -// transfer -#define USB_DEV_RX_SENT_STALL 0x00400000 // Stall was sent on this endpoint -#define USB_DEV_RX_DATA_ERROR 0x00080000 // CRC error on the data -#define USB_DEV_RX_OVERRUN 0x00040000 // OUT packet was not loaded due to -// a full FIFO -#define USB_DEV_RX_FIFO_FULL 0x00020000 // RX FIFO full -#define USB_DEV_RX_PKT_RDY 0x00010000 // Data packet ready -#define USB_DEV_TX_NOT_COMP 0x00000080 // Large packet split up, more data -// to come -#define USB_DEV_TX_SENT_STALL 0x00000020 // Stall was sent on this endpoint -#define USB_DEV_TX_UNDERRUN 0x00000004 // IN received with no data ready -#define USB_DEV_TX_FIFO_NE 0x00000002 // The TX FIFO is not empty -#define USB_DEV_TX_TXPKTRDY 0x00000001 // Transmit still being transmitted -#define USB_DEV_EP0_SETUP_END 0x00000010 // Control transaction ended before -// Data End seen -#define USB_DEV_EP0_SENT_STALL 0x00000004 // Stall was sent on this endpoint -#define USB_DEV_EP0_IN_PKTPEND 0x00000002 // Transmit data packet pending -#define USB_DEV_EP0_OUT_PKTRDY 0x00000001 // Receive data packet ready - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hos_endpoint_config_set() and -// md_usb_dev_endpoint_config_set() as the ui32Flags parameter. -// -//***************************************************************************** -#define USB_EP_AUTO_SET 0x00000001 // Auto set feature enabled -#define USB_EP_AUTO_REQUEST 0x00000002 // Auto request feature enabled -#define USB_EP_AUTO_CLEAR 0x00000004 // Auto clear feature enabled -#define USB_EP_DUAL_BUFFERING 0x00000008 // Dual buffering enabled -#define USB_EP_DMA_MODE_0 0x00000008 // Enable DMA access using mode 0 -#define USB_EP_DMA_MODE_1 0x00000010 // Enable DMA access using mode 1 -#define USB_EP_DIS_NYET 0x00000020 // Disable NYET response for -// high-speed Bulk and Interrupt -// endpoints in device mode. -#define USB_EP_MODE_ISOC 0x00000000 // Isochronous endpoint -#define USB_EP_MODE_BULK 0x00000100 // Bulk endpoint -#define USB_EP_MODE_INT 0x00000200 // Interrupt endpoint -#define USB_EP_MODE_CTRL 0x00000300 // Control endpoint -#define USB_EP_MODE_MASK 0x00000300 // Mode Mask -#define USB_EP_SPEED_LOW 0x00000000 // Low Speed -#define USB_EP_SPEED_FULL 0x00001000 // Full Speed -#define USB_EP_SPEED_HIGH 0x00004000 // High Speed -#define USB_EP_HOST_IN 0x00000000 // Host IN endpoint -#define USB_EP_HOST_OUT 0x00002000 // Host OUT endpoint -#define USB_EP_DEV_IN 0x00002000 // Device IN endpoint -#define USB_EP_DEV_OUT 0x00000000 // Device OUT endpoint - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hos_pwr_config() as the -// ui32Flags parameter. -// -//***************************************************************************** -#define USB_HOST_PWRFLT_LOW 0x00000010 -#define USB_HOST_PWRFLT_HIGH 0x00000030 -#define USB_HOST_PWRFLT_EP_NONE 0x00000000 -#define USB_HOST_PWRFLT_EP_TRI 0x00000140 -#define USB_HOST_PWRFLT_EP_LOW 0x00000240 -#define USB_HOST_PWRFLT_EP_HIGH 0x00000340 -#define USB_HOST_PWREN_MAN_LOW 0x00000000 -#define USB_HOST_PWREN_MAN_HIGH 0x00000001 -#define USB_HOST_PWREN_AUTOLOW 0x00000002 -#define USB_HOST_PWREN_AUTOHIGH 0x00000003 -#define USB_HOST_PWREN_FILTER 0x00010000 - -//***************************************************************************** -// -// The following are the valid values that can be passed to the -// md_usb_hos_lpm_config() function in the ui32Config parameter. -// -//***************************************************************************** -#define USB_HOST_LPM_RMTWAKE 0x00000100 -#define USB_HOST_LPM_L1 0x00000001 - -//***************************************************************************** -// -// The following are the valid values that can be passed to the -// md_usb_dev_lpm_config() function in the ui32Config parameter. -// -//***************************************************************************** -#define USB_DEV_LPM_NAK 0x00000010 -#define USB_DEV_LPM_NONE 0x00000000 -#define USB_DEV_LPM_EN 0x0000000c -#define USB_DEV_LPM_EXTONLY 0x00000004 - -//***************************************************************************** -// -// The following are the valid values that are returned from the -// md_usb_lpm_link_state_get() function. -// -//***************************************************************************** -#define USB_DEV_LPM_LS_RMTWAKE 0x00000100 -#define USB_DEV_LPM_LS_L1 0x00000001 - -//***************************************************************************** -// -// The following are the valid values that are passed to the md_usb_lpm_int_enable() -// or md_usb_lpm_int_disable() functions or are returned from the md_usb_lpm_status() -// function. -// -//***************************************************************************** -#define USB_INTLPM_ERROR 0x00000020 -#define USB_INTLPM_RESUME 0x00000010 -#define USB_INTLPM_INCOMPLETE 0x00000008 -#define USB_INTLPM_ACK 0x00000004 -#define USB_INTLPM_NYET 0x00000002 -#define USB_INTLPM_STALL 0x00000001 - -//***************************************************************************** -// -// The following are the valid values that are passed to the md_usb_clock_enable() -// functions. -// -//***************************************************************************** -#define USB_CLOCK_INTERNAL 0x00000200 -#define USB_CLOCK_EXTERNAL 0x00000300 - -//***************************************************************************** -// -// The configuration options used with the md_usb_ulpi_config() API. -// -//***************************************************************************** -#define USB_ULPI_EXTVBUS 0x00000001 -#define USB_ULPI_EXTVBUS_IND 0x00000002 - -//***************************************************************************** -// -// The following are special values that can be passed to -// md_usb_hos_endpoint_config_set() as the ui32NAKPollInterval parameter. -// -//***************************************************************************** -#define MAX_NAK_LIMIT 31 // Maximum NAK interval -#define DISABLE_NAK_LIMIT 0 // No NAK timeouts - -//***************************************************************************** -// -// This value specifies the maximum size of transfers on endpoint 0 as 64 -// bytes. This value is fixed in hardware as the FIFO size for endpoint 0. -// -//***************************************************************************** -#define MAX_PACKET_SIZE_EP0 64 - -//***************************************************************************** -// -// These values are used to indicate which endpoint to access. -// -//***************************************************************************** -#define USB_EP_0 0x00000000 // Endpoint 0 -#define USB_EP_1 0x00000010 // Endpoint 1 -#define USB_EP_2 0x00000020 // Endpoint 2 -#define USB_EP_3 0x00000030 // Endpoint 3 -#define USB_EP_4 0x00000040 // Endpoint 4 -#define USB_EP_5 0x00000050 // Endpoint 5 -#define USB_EP_6 0x00000060 // Endpoint 6 -#define USB_EP_7 0x00000070 // Endpoint 7 -#define NUM_USB_EP 8 // Number of supported endpoints - -//***************************************************************************** -// -// These macros allow conversion between 0-based endpoint indices and the -// USB_EP_x values required when calling various USB APIs. -// -//***************************************************************************** -#define IndexToUSBEP(x) ((x) << 4) -#define USBEPToIndex(x) ((x) >> 4) - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_fifo_config_set() as the -// ui32FIFOSize parameter. -// -//***************************************************************************** -#define USB_FIFO_SZ_8 0x00000000 // 8 byte FIFO -#define USB_FIFO_SZ_16 0x00000001 // 16 byte FIFO -#define USB_FIFO_SZ_32 0x00000002 // 32 byte FIFO -#define USB_FIFO_SZ_64 0x00000003 // 64 byte FIFO -#define USB_FIFO_SZ_128 0x00000004 // 128 byte FIFO -#define USB_FIFO_SZ_256 0x00000005 // 256 byte FIFO -#define USB_FIFO_SZ_512 0x00000006 // 512 byte FIFO -#define USB_FIFO_SZ_1024 0x00000007 // 1024 byte FIFO -#define USB_FIFO_SZ_2048 0x00000008 // 2048 byte FIFO - -//***************************************************************************** -// -// This macro allow conversion from a FIFO size label as defined above to -// a number of bytes -// -//***************************************************************************** -#define USBFIFOSizeToBytes(x) (8 << (x)) - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_hosdev_endpoint_data_send() -// as the ui32TransType parameter. -// -//***************************************************************************** -#define USB_TRANS_OUT 0x00000102 // Normal OUT transaction -#define USB_TRANS_IN 0x00000102 // Normal IN transaction -#define USB_TRANS_IN_LAST 0x0000010a // Final IN transaction (for -// endpoint 0 in device mode) -#define USB_TRANS_SETUP 0x0000110a // Setup transaction (for endpoint -// 0) -#define USB_TRANS_STATUS 0x00000142 // Status transaction (for endpoint -// 0) - -//***************************************************************************** -// -// The following are values are returned by the md_usb_hosdev_mode_get() function. -// -//***************************************************************************** -#define USB_DUAL_MODE_HOST 0x00000001 // Dual mode controller is in Host -// mode. -#define USB_DUAL_MODE_DEVICE 0x00000081 // Dual mode controller is in -// Device mode. -#define USB_DUAL_MODE_NONE 0x00000080 // Dual mode controller mode is not -// set. -#define USB_OTG_MODE_ASIDE_HOST 0x0000001d // OTG controller on the A side of -// the cable. -#define USB_OTG_MODE_ASIDE_NPWR 0x00000001 // OTG controller on the A side of -// the cable. -#define USB_OTG_MODE_ASIDE_SESS 0x00000009 // OTG controller on the A side of -// the cable Session Valid. -#define USB_OTG_MODE_ASIDE_AVAL 0x00000011 // OTG controller on the A side of -// the cable A valid. -#define USB_OTG_MODE_ASIDE_DEV 0x00000019 // OTG controller on the A side of -// the cable. -#define USB_OTG_MODE_BSIDE_HOST 0x0000009d // OTG controller on the B side of -// the cable. -#define USB_OTG_MODE_BSIDE_DEV 0x00000099 // OTG controller on the B side of -// the cable. -#define USB_OTG_MODE_BSIDE_NPWR 0x00000081 // OTG controller on the B side of -// the cable. -#define USB_OTG_MODE_NONE 0x00000080 // OTG controller mode is not set. - -//***************************************************************************** -// -// Channel configuration values. -// -//***************************************************************************** -#define DMA_DST_INC_8 0x00000000 -#define DMA_DST_INC_16 0x40000000 -#define DMA_DST_INC_32 0x80000000 -#define DMA_DST_INC_NONE 0xc0000000 -#define DMA_SRC_INC_8 0x00000000 -#define DMA_SRC_INC_16 0x04000000 -#define DMA_SRC_INC_32 0x08000000 -#define DMA_SRC_INC_NONE 0x0c000000 -#define DMA_SIZE_8 0x00000000 -#define DMA_SIZE_16 0x11000000 -#define DMA_SIZE_32 0x22000000 -#define DMA_DST_PROT_PRIV 0x00200000 -#define DMA_SRC_PROT_PRIV 0x00040000 -#define DMA_ARB_1 0x00000000 -#define DMA_ARB_2 0x00004000 -#define DMA_ARB_4 0x00008000 -#define DMA_ARB_8 0x0000c000 -#define DMA_ARB_16 0x00010000 -#define DMA_ARB_32 0x00014000 -#define DMA_ARB_64 0x00018000 -#define DMA_ARB_128 0x0001c000 -#define DMA_ARB_256 0x00020000 -#define DMA_ARB_512 0x00024000 -#define DMA_ARB_1024 0x00028000 -#define DMA_NEXT_USEBURST 0x00000008 - -//***************************************************************************** -// -// The values for the md_usb_dma_channel_int_enable() and md_usb_dma_channel_int_status() -// APIs. -// -//***************************************************************************** -#define USB_DMA_INT_CH8 0x00000080 -#define USB_DMA_INT_CH7 0x00000040 -#define USB_DMA_INT_CH6 0x00000020 -#define USB_DMA_INT_CH5 0x00000010 -#define USB_DMA_INT_CH4 0x00000008 -#define USB_DMA_INT_CH3 0x00000004 -#define USB_DMA_INT_CH2 0x00000002 -#define USB_DMA_INT_CH1 0x00000001 - -//***************************************************************************** -// -// The values for the md_usb_dma_channel_status() API. -// -//***************************************************************************** -#define USB_DMA_STATUS_ERROR 0x00000100 - -//***************************************************************************** -// -// The valid return values for the USBDMAModeSet() and USBDMAModeGet() APIs or -// USBDMAChannelConfig(). -// -//***************************************************************************** -#define USB_DMA_CFG_BURST_NONE 0x00000000 -#define USB_DMA_CFG_BURST_4 0x00000200 -#define USB_DMA_CFG_BURST_8 0x00000400 -#define USB_DMA_CFG_BURST_16 0x00000600 -#define USB_DMA_CFG_INT_EN 0x00000008 -#define USB_DMA_CFG_MODE_0 0x00000000 -#define USB_DMA_CFG_MODE_1 0x00000004 -#define USB_DMA_CFG_DIR_RX 0x00000000 -#define USB_DMA_CFG_DIR_TX 0x00000002 -#define USB_DMA_CFG_EN 0x00000001 - -//***************************************************************************** -// -// The following are values that can be passed to md_usb_mode_config() as the -// ui3Mode parameter. -// -//***************************************************************************** -#define USB_MODE_HOST_VBUS 0x00000004 -#define USB_MODE_HOST 0x00000002 -#define USB_MODE_DEV_VBUS 0x00000005 -#define USB_MODE_DEV 0x00000003 -#define USB_MODE_OTG 0x00000000 - -//***************************************************************************** -// -// Flags that can be passed to DMAChannelAttributeEnable(), -// DMAChannelAttributeDisable(), and returned from DMAChannelAttributeGet(). -// -//***************************************************************************** -#define DMA_ATTR_USEBURST 0x00000001 -#define DMA_ATTR_ALTSELECT 0x00000002 -#define DMA_ATTR_HIGH_PRIORITY 0x00000004 -#define DMA_ATTR_REQMASK 0x00000008 -#define DMA_ATTR_ALL 0x0000000F - -/* Public functions -----------------------------------------------------------*/ -/** - * @{ SYSTEM API. - */ -extern void md_usb_system_int_disable(void); -extern void md_usb_system_int_enable(void); -extern void md_usb_re_config(bool Device); /* Weak defination */ -extern void md_usb_system_delayms(uint32_t delayms); /* Weak defination */ -extern void md_usb_systic_disable(void); -extern void md_usb_controller_reset(void); -extern void md_usb_controller_enable(void); -extern void md_usb_controller_disable(void); -extern void md_usb_clk_phy_enable(void); -extern void md_usb_clk_phy_disable(void); -extern uint32_t md_usb_nvic_number_get(void); -extern void md_usb_nvic_config(uint32_t NvicNum); /* Weak defination */ -extern void md_usb_nvic_enable(void); -extern void md_usb_nvic_disable(void); -/** - * @} SYSTEM API. - */ - -/** - * @{ USB basic API. - */ -/* Host Mode */ -extern void md_usb_hos_reset(bool bStart); -extern void md_usb_hos_resume(bool bStart); -extern void md_usb_hos_suspend(void); -extern void md_usb_hos_request_status(void); -extern void md_usb_hos_request_in(uint32_t ui32Endpoint); -extern void md_usb_hos_request_in_clear(uint32_t ui32Endpoint); -extern uint32_t md_usb_hos_speed_get(void); -extern uint32_t md_usb_hos_addr_get(uint32_t ui32Endpoint, uint32_t ui32Flags); -extern void md_usb_hos_addr_set(uint32_t ui32Endpoint, - uint32_t ui32Addr, - uint32_t ui32Flags); -extern uint32_t md_usb_hos_hub_addr_get(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hos_hub_addr_set(uint32_t ui32Endpoint, - uint32_t ui32Addr, - uint32_t ui32Flags); -/* Device Mode */ -extern void md_usb_dev_addr_set(uint8_t ui32Address); -extern uint8_t md_usb_dev_addr_get(void); -extern void md_usb_dev_connect(void); -extern void md_usb_dev_disconnect(void); -extern uint32_t md_usb_dev_speed_get(void); -/* Host/Device Mode */ -extern uint32_t md_usb_hosdev_frame_get(void); -extern void md_usb_hosdev_int_disable(uint32_t ui32IntFlags); -extern void md_usb_hosdev_int_enable(uint32_t ui32IntFlags); -extern uint32_t md_usb_hosdev_int_status(void); -extern uint32_t md_usb_hosdev_mode_get(void); -/* otg Mode */ -extern void md_usb_otg_session_request(bool bStart); -extern void md_usb_force_host_mode(void); -extern void md_usb_force_device_mode(void); -extern void md_usb_force_otg_mode(void); -extern void md_usb_mode_config(uint32_t ui32Mode); -/** - * @} USB basic API. - */ - -/** - * @{ USB endpoint API. - */ -/* Host Mode */ -extern void md_usb_hos_endpoint_config_set(uint32_t ui32Endpoint, - uint32_t ui32MaxPacketSize, - uint32_t ui32NAKPollInterval, - uint32_t ui32TargetEndpoint, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_data_ack(uint32_t ui32Endpoint); -extern void md_usb_hos_endpoint_data_toggle(uint32_t ui32Endpoint, - bool bDataToggle, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_status_clear(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_speed(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hos_endpoint_ping(uint32_t ui32Endpoint, - bool bEnable); -/* Device Mode */ -extern void md_usb_dev_endpoint_config_set(uint32_t ui32Endpoint, - uint32_t ui32MaxPacketSize, - uint32_t ui32Flags); -extern void md_usb_dev_endpoint_config_get(uint32_t ui32Endpoint, - uint32_t *pui32MaxPacketSize, - uint32_t *pui32Flags); -extern void md_usb_dev_endpoint_ack(uint32_t ui32Endpoint, - bool bIsLastPacket); -extern void md_usb_dev_endpoint_stall(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dev_endpoint_stall_clear(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dev_endpoint_status_clear(uint32_t ui32Endpoint, - uint32_t ui32Flags); -/* Host/Device Mode */ -extern uint32_t md_usb_hosdev_endpoint_datavai(uint32_t ui32Endpoint); -extern int32_t md_usb_hosdev_endpoint_data_get(uint32_t ui32Endpoint, - uint8_t *pui8Data, uint32_t *pui32Size); -extern int32_t md_usb_hosdev_endpoint_data_put(uint32_t ui32Endpoint, - uint8_t *pui8Data, - uint32_t ui32Size); -extern int32_t md_usb_hosdev_endpoint_data_send(uint32_t ui32Endpoint, - uint32_t ui32TransType); -extern void md_usb_hosdev_endpoint_data_togglec(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_hosdev_endpoint_pkcount_set(uint32_t ui32Endpoint, - uint32_t ui32Count); -extern uint32_t md_usb_hosdev_endpoint_status(uint32_t ui32Endpoint); -extern void md_usb_hosdev_endpoint_int_disable(uint32_t ui32IntFlags); -extern void md_usb_hosdev_endpoint_int_enable(uint32_t ui32IntFlags); -extern uint32_t md_usb_hosdev_endpoint_int_status(void); -extern uint32_t md_usb_endpoint_number_get(void); -/** - * @} USB endpoint API. - */ - -/** - * @{ USB FIFO API. - */ -extern uint32_t md_usb_hosdev_fifo_addr_get(uint32_t ui32Endpoint); -extern void md_usb_hosdev_fifo_config_get(uint32_t ui32Endpoint, uint32_t *pui32FIFOAddress, - uint32_t *pui32FIFOSize, uint32_t ui32Flags); -extern void md_usb_hosdev_fifo_config_set(uint32_t ui32Endpoint, uint32_t ui32FIFOAddress, - uint32_t ui32FIFOSize, uint32_t ui32Flags); -extern void md_usb_hosdev_fifo_flush(uint32_t ui32Endpoint, uint32_t ui32Flags); -/** - * @} USB FIFO API. - */ - -/** - * @{ USB PWR API.it is not supported by es32f0271. - */ -extern void md_usb_hos_pwr_disable(void); -extern void md_usb_hos_pwr_enable(void); -extern void md_usb_hos_pwr_config(uint32_t ui32Flags); -extern void md_usb_hos_pwrfault_disable(void); -extern void md_usb_hos_pwrfault_enable(void); -/** - * @} USB PWR API. - */ - -/** - * @{ USB LPM API.it is not supported by es32f0271. - */ -extern void md_usb_hos_lpm_send(uint32_t ui32Address, - uint32_t uiEndpoint); -extern void md_usb_hos_lpm_config(uint32_t ui32ResumeTime, - uint32_t ui32Config); -extern bool md_usb_lpm_remotewake_is_enabled(void); -extern void md_usb_hos_lpm_resume(void); -extern void md_usb_dev_lpm_remotewake(void); -extern void md_usb_dev_lpm_config(uint32_t ui32Config); -extern void md_usb_dev_lpm_enable(void); -extern void md_usb_dev_lpm_disable(void); -extern uint32_t md_usb_lpm_link_state_get(void); -extern uint32_t md_usb_lpm_endpoint_get(void); -extern uint32_t md_usb_lpm_status(void); -extern void md_usb_lpm_int_disable(uint32_t ui32Ints); -extern void md_usb_lpm_int_enable(uint32_t ui32Ints); -/** - * @} USB LPM API. - */ - -/** - * @{ USB ULPI API.it is not supported by es32f0271. - */ -extern void md_usb_ulpi_config(uint32_t ui32Config); -extern void md_usb_ulpi_enable(void); -extern void md_usb_ulpi_disable(void); -extern uint8_t md_usb_ulpi_reg_read(uint8_t ui8Reg); -extern void md_usb_ulpi_reg_write(uint8_t ui8Reg, - uint8_t ui8Data); -/** - * @} USB ULPI API. - */ - -/** - * @{ USB DMA API.it is not supported by es32f0271. - */ -extern void md_usb_dma_endpoint_channel_set(uint32_t ui32Endpoint, - uint32_t ui32Channel); -extern void md_usb_dma_endpoint_enable(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dma_endpoint_disable(uint32_t ui32Endpoint, - uint32_t ui32Flags); -extern void md_usb_dma_endpoint_config(uint32_t ui32Endpoint, - uint32_t ui32Config); -extern void md_usb_dma_channel_config(uint32_t ui32Channel, - uint32_t ui32Endpoint, - uint32_t ui32Config); -extern void md_usb_dma_channel_address_set(uint32_t ui32Channel, - void *pvAddress); -extern void *md_usb_dma_channel_address_get(uint32_t ui32Channel); -extern void md_usb_dma_channel_count_set(uint32_t ui32Count, - uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_count_get(uint32_t ui32Channel); -extern void md_usb_dma_channel_int_enable(uint32_t ui32Channel); -extern void md_usb_dma_channel_int_disable(uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_int_status(void); -extern void md_usb_dma_channel_enable(uint32_t ui32Channel); -extern void md_usb_dma_channel_disable(uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_isenabled(uint32_t ui32Channel); -extern uint32_t md_usb_dma_channel_status(uint32_t ui32Channel); -extern void md_usb_dma_channel_status_clear(uint32_t ui32Channel, - uint32_t ui32Status); -/** - * @} USB DMA API. - */ - -#ifdef __cplusplus -} -#endif - -#endif - -/******************* (C) COPYRIGHT Eastsoft Microelectronics Co., Ltd. *** END OF FILE ****/ diff --git a/bsp/essemi/es32f0271/project.uvoptx b/bsp/essemi/es32f0271/project.uvoptx deleted file mode 100644 index bd379df962..0000000000 --- a/bsp/essemi/es32f0271/project.uvoptx +++ /dev/null @@ -1,797 +0,0 @@ - - - - 1.0 - -
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj; *.o - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - 0 - - - - 0 - 0 - - - - rt-thread - 0x4 - ARM-ADS - - 12000000 - - 1 - 1 - 0 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 0 - 0 - 1 - - 255 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 3 - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0ES32F0271 -FL010000 -FS00 -FP0($$Device:ES32F0271LT$Flash\ES32F0271.FLM) - - - 0 - CMSIS_AGDI - -X"" -O206 -S0 -C0 -P00 -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0ES32F0271.FLM -FS00 -FL010000 -FP0($$Device:ES32F0271LT$Flash\ES32F0271.FLM) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - 0 - 0 - 0 - - - - - - - - - - - - - Kernel - 0 - 0 - 0 - 0 - - 1 - 1 - 1 - 0 - 0 - 0 - ..\..\..\src\clock.c - clock.c - 0 - 0 - - - 1 - 2 - 1 - 0 - 0 - 0 - ..\..\..\src\components.c - components.c - 0 - 0 - - - 1 - 3 - 1 - 0 - 0 - 0 - ..\..\..\src\device.c - device.c - 0 - 0 - - - 1 - 4 - 1 - 0 - 0 - 0 - ..\..\..\src\idle.c - idle.c - 0 - 0 - - - 1 - 5 - 1 - 0 - 0 - 0 - ..\..\..\src\ipc.c - ipc.c - 0 - 0 - - - 1 - 6 - 1 - 0 - 0 - 0 - ..\..\..\src\irq.c - irq.c - 0 - 0 - - - 1 - 7 - 1 - 0 - 0 - 0 - ..\..\..\src\kservice.c - kservice.c - 0 - 0 - - - 1 - 8 - 1 - 0 - 0 - 0 - ..\..\..\src\mem.c - mem.c - 0 - 0 - - - 1 - 9 - 1 - 0 - 0 - 0 - ..\..\..\src\mempool.c - mempool.c - 0 - 0 - - - 1 - 10 - 1 - 0 - 0 - 0 - ..\..\..\src\object.c - object.c - 0 - 0 - - - 1 - 11 - 1 - 0 - 0 - 0 - ..\..\..\src\scheduler.c - scheduler.c - 0 - 0 - - - 1 - 12 - 1 - 0 - 0 - 0 - ..\..\..\src\signal.c - signal.c - 0 - 0 - - - 1 - 13 - 1 - 0 - 0 - 0 - ..\..\..\src\thread.c - thread.c - 0 - 0 - - - 1 - 14 - 1 - 0 - 0 - 0 - ..\..\..\src\timer.c - timer.c - 0 - 0 - - - - - Applications - 0 - 0 - 0 - 0 - - 2 - 15 - 1 - 0 - 0 - 0 - applications\main.c - main.c - 0 - 0 - - - - - Drivers - 0 - 0 - 0 - 0 - - 3 - 16 - 1 - 0 - 0 - 0 - drivers\board.c - board.c - 0 - 0 - - - 3 - 17 - 1 - 0 - 0 - 0 - drivers\drv_gpio.c - drv_gpio.c - 0 - 0 - - - 3 - 18 - 1 - 0 - 0 - 0 - drivers\drv_uart.c - drv_uart.c - 0 - 0 - - - - - Libraries - 0 - 0 - 0 - 0 - - 4 - 19 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_adc.c - md_adc.c - 0 - 0 - - - 4 - 20 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_fc.c - md_fc.c - 0 - 0 - - - 4 - 21 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_gpio.c - md_gpio.c - 0 - 0 - - - 4 - 22 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_i2c.c - md_i2c.c - 0 - 0 - - - 4 - 23 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_rcu.c - md_rcu.c - 0 - 0 - - - 4 - 24 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_spi.c - md_spi.c - 0 - 0 - - - 4 - 25 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_tick.c - md_tick.c - 0 - 0 - - - 4 - 26 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_uart.c - md_uart.c - 0 - 0 - - - 4 - 27 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_usb.c - md_usb.c - 0 - 0 - - - 4 - 28 - 1 - 0 - 0 - 0 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_wwdt.c - md_wwdt.c - 0 - 0 - - - 4 - 29 - 2 - 0 - 0 - 0 - libraries\CMSIS\Device\EastSoft\ES32F0271\Startup\keil\startup_es32f027x.s - startup_es32f027x.s - 0 - 0 - - - 4 - 30 - 1 - 0 - 0 - 0 - libraries\CMSIS\Device\EastSoft\ES32F0271\System\system_es32f027x.c - system_es32f027x.c - 0 - 0 - - - - - cpu - 0 - 0 - 0 - 0 - - 5 - 31 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\backtrace.c - backtrace.c - 0 - 0 - - - 5 - 32 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\div0.c - div0.c - 0 - 0 - - - 5 - 33 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\showmem.c - showmem.c - 0 - 0 - - - 5 - 34 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\cortex-m0\cpuport.c - cpuport.c - 0 - 0 - - - 5 - 35 - 2 - 0 - 0 - 0 - ..\..\..\libcpu\arm\cortex-m0\context_rvds.S - context_rvds.S - 0 - 0 - - - - - DeviceDrivers - 0 - 0 - 0 - 0 - - 6 - 36 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\misc\pin.c - pin.c - 0 - 0 - - - 6 - 37 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\serial\serial.c - serial.c - 0 - 0 - - - 6 - 38 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\completion.c - completion.c - 0 - 0 - - - 6 - 39 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\dataqueue.c - dataqueue.c - 0 - 0 - - - 6 - 40 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\pipe.c - pipe.c - 0 - 0 - - - 6 - 41 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\ringblk_buf.c - ringblk_buf.c - 0 - 0 - - - 6 - 42 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\ringbuffer.c - ringbuffer.c - 0 - 0 - - - 6 - 43 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\waitqueue.c - waitqueue.c - 0 - 0 - - - 6 - 44 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\workqueue.c - workqueue.c - 0 - 0 - - - - - finsh - 0 - 0 - 0 - 0 - - 7 - 45 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\shell.c - shell.c - 0 - 0 - - - 7 - 46 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\cmd.c - cmd.c - 0 - 0 - - - 7 - 47 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\msh.c - msh.c - 0 - 0 - - - -
diff --git a/bsp/essemi/es32f0271/project.uvprojx b/bsp/essemi/es32f0271/project.uvprojx deleted file mode 100644 index 664a6e8f02..0000000000 --- a/bsp/essemi/es32f0271/project.uvprojx +++ /dev/null @@ -1,662 +0,0 @@ - - - - 2.1 - -
### uVision Project, (C) Keil Software
- - - - rt-thread - 0x4 - ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC - 0 - - - ES32F0271LT - Eastsoft - Eastsoft.ES32_DFP.1.0.4 - http://www.essemi.com - IRAM(0x20000000,0x00002000) IROM(0x00000000,0x00010000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F0271 -FS00 -FL010000 -FP0($$Device:ES32F0271LT$Flash\ES32F0271.FLM)) - 0 - $$Device:ES32F0271LT$Device\Include\es32f027x.h - - - - - - - - - - $$Device:ES32F0271LT$SVD\es32f027x.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\ - rtthread - 1 - 0 - 0 - 1 - 1 - .\build\keil\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - - 0 - 0 - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -MPU - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - -MPU - TARMCM1.DLL - -pCM0 - - - - 1 - 0 - 0 - 0 - 16 - - - - - 1 - 0 - 0 - 1 - 1 - 4096 - - 1 - BIN\UL2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M0" - - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 0 - 3 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x2000 - - - 1 - 0x0 - 0x10000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x10000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x2000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 3 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - - - - .;..\..\..\include;applications;.;drivers;libraries\CMSIS\Device\EastSoft\ES32F0271\Include;libraries\CMSIS\Device\EastSoft\ES32F0271\Include\ES32F0271;libraries\CMSIS\Device\EastSoft\ES32F0271\System;libraries\CMSIS\Include;libraries;libraries\ES32F027x_MD_StdPeriph_Driver\Include;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m0;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\common - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x08000000 - 0x20000000 - - - - - - - - - - - - - Kernel - - - clock.c - 1 - ..\..\..\src\clock.c - - - components.c - 1 - ..\..\..\src\components.c - - - device.c - 1 - ..\..\..\src\device.c - - - idle.c - 1 - ..\..\..\src\idle.c - - - ipc.c - 1 - ..\..\..\src\ipc.c - - - irq.c - 1 - ..\..\..\src\irq.c - - - kservice.c - 1 - ..\..\..\src\kservice.c - - - mem.c - 1 - ..\..\..\src\mem.c - - - mempool.c - 1 - ..\..\..\src\mempool.c - - - object.c - 1 - ..\..\..\src\object.c - - - scheduler.c - 1 - ..\..\..\src\scheduler.c - - - signal.c - 1 - ..\..\..\src\signal.c - - - thread.c - 1 - ..\..\..\src\thread.c - - - timer.c - 1 - ..\..\..\src\timer.c - - - - - Applications - - - main.c - 1 - applications\main.c - - - - - Drivers - - - board.c - 1 - drivers\board.c - - - drv_gpio.c - 1 - drivers\drv_gpio.c - - - drv_uart.c - 1 - drivers\drv_uart.c - - - - - Libraries - - - md_adc.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_adc.c - - - md_fc.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_fc.c - - - md_gpio.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_gpio.c - - - md_i2c.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_i2c.c - - - md_rcu.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_rcu.c - - - md_spi.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_spi.c - - - md_tick.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_tick.c - - - md_uart.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_uart.c - - - md_usb.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_usb.c - - - md_wwdt.c - 1 - libraries\ES32F027x_MD_StdPeriph_Driver\Source\md_wwdt.c - - - startup_es32f027x.s - 2 - libraries\CMSIS\Device\EastSoft\ES32F0271\Startup\keil\startup_es32f027x.s - - - system_es32f027x.c - 1 - libraries\CMSIS\Device\EastSoft\ES32F0271\System\system_es32f027x.c - - - - - cpu - - - backtrace.c - 1 - ..\..\..\libcpu\arm\common\backtrace.c - - - div0.c - 1 - ..\..\..\libcpu\arm\common\div0.c - - - showmem.c - 1 - ..\..\..\libcpu\arm\common\showmem.c - - - cpuport.c - 1 - ..\..\..\libcpu\arm\cortex-m0\cpuport.c - - - context_rvds.S - 2 - ..\..\..\libcpu\arm\cortex-m0\context_rvds.S - - - - - DeviceDrivers - - - pin.c - 1 - ..\..\..\components\drivers\misc\pin.c - - - serial.c - 1 - ..\..\..\components\drivers\serial\serial.c - - - completion.c - 1 - ..\..\..\components\drivers\src\completion.c - - - dataqueue.c - 1 - ..\..\..\components\drivers\src\dataqueue.c - - - pipe.c - 1 - ..\..\..\components\drivers\src\pipe.c - - - ringblk_buf.c - 1 - ..\..\..\components\drivers\src\ringblk_buf.c - - - ringbuffer.c - 1 - ..\..\..\components\drivers\src\ringbuffer.c - - - waitqueue.c - 1 - ..\..\..\components\drivers\src\waitqueue.c - - - workqueue.c - 1 - ..\..\..\components\drivers\src\workqueue.c - - - - - finsh - - - shell.c - 1 - ..\..\..\components\finsh\shell.c - - - cmd.c - 1 - ..\..\..\components\finsh\cmd.c - - - msh.c - 1 - ..\..\..\components\finsh\msh.c - - - - - - - - - - - - - -
diff --git a/bsp/essemi/es32f0271/rtconfig.h b/bsp/essemi/es32f0271/rtconfig.h deleted file mode 100644 index 4a0cf3306a..0000000000 --- a/bsp/essemi/es32f0271/rtconfig.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef RT_CONFIG_H__ -#define RT_CONFIG_H__ - -/* Automatically generated file; DO NOT EDIT. */ -/* RT-Thread 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 100 -#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_DEBUG -#define RT_DEBUG_COLOR - -/* 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 0x40002 - -/* RT-Thread Components */ - -#define RT_USING_COMPONENTS_INIT -#define RT_USING_USER_MAIN -#define RT_MAIN_THREAD_STACK_SIZE 256 -#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 2048 -#define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT -#define FINSH_USING_MSH_ONLY -#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 */ - - -/* peripheral libraries and drivers */ - - -/* miscellaneous packages */ - - -/* samples: kernel and components samples */ - -#define SOC_ES32F0271LT - -/* Hardware Drivers Config */ - -/* On-chip Peripheral Drivers */ - -/* PIN Drivers */ - -#define BSP_USING_GPIO - -/* UART Drivers */ - -#define BSP_USING_UART1 - -/* SPI Drivers */ - - -/* I2C Drivers */ - - -/* HWtimer Drivers */ - - -/* PWM Drivers */ - - -/* RTC Drivers */ - - -/* ADC Drivers */ - - -/* Onboard Peripheral Drivers */ - -/* Offboard Peripheral Drivers */ - - -#endif diff --git a/bsp/essemi/es32f0271/rtconfig.py b/bsp/essemi/es32f0271/rtconfig.py deleted file mode 100644 index eb371bf3a7..0000000000 --- a/bsp/essemi/es32f0271/rtconfig.py +++ /dev/null @@ -1,135 +0,0 @@ -import os -import sys - -# toolchains options -CROSS_TOOL = 'keil' - -if os.getenv('RTT_CC'): - CROSS_TOOL = os.getenv('RTT_CC') - -# device options -ARCH = 'arm' -CPU = 'cortex-m0' - -# cross_tool provides the cross compiler -# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR -if CROSS_TOOL == 'gcc': # not support gcc yet - PLATFORM = 'gcc' - EXEC_PATH = 'C:/GCC' - -elif CROSS_TOOL == 'keil': - PLATFORM = 'armcc' - EXEC_PATH = 'C:/Keil' - -elif CROSS_TOOL == 'iar': # not support iar yet - PLATFORM = 'iar' - EXEC_PATH = 'C:/IAR' - -if os.getenv('RTT_EXEC_PATH'): - EXEC_PATH = os.getenv('RTT_EXEC_PATH') - -BUILD = 'debug' -#BUILD = 'release' - -if PLATFORM == 'gcc': - # toolchains - PREFIX = 'arm-none-eabi-' - CC = PREFIX + 'gcc' - CXX = PREFIX + 'g++' - AS = PREFIX + 'gcc' - AR = PREFIX + 'ar' - LINK = PREFIX + 'gcc' - TARGET_EXT = 'elf' - SIZE = PREFIX + 'size' - OBJDUMP = PREFIX + 'objdump' - OBJCPY = PREFIX + 'objcopy' - DEVICE = ' -mcpu=' + CPU + ' -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE - AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb' - LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T drivers/linker_scripts/link.lds' - - CPATH = '' - LPATH = '' - - if BUILD == 'debug': - CFLAGS += ' -O0 -gdwarf-2 -g' - AFLAGS += ' -gdwarf-2' - else: - CFLAGS += ' -O2' - - POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + OBJCPY + ' -O ihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n' -elif PLATFORM == 'armcc': - # toolchains - CC = 'armcc' - AS = 'armasm' - AR = 'armar' - LINK = 'armlink' - TARGET_EXT = 'axf' - - DEVICE = ' --device DARMSTM' - CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' - AFLAGS = DEVICE + ' --apcs=interwork ' - LFLAGS = DEVICE + ' --scatter "drivers/linker_scripts/link.sct" --info sizes --info totals --info unused --info veneers --list rtthread.map --strict' - - CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include' - LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/ARMCC/lib' - - CFLAGS += ' -D__MICROLIB ' - AFLAGS += ' --pd "__MICROLIB SETA 1" ' - LFLAGS += ' --library_type=microlib ' - EXEC_PATH += '/ARM/ARMCC/bin' - - 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 = '-Dewarm' - - 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 += ' --silent' - - AFLAGS = DEVICE - AFLAGS += ' -s+' - AFLAGS += ' -w+' - AFLAGS += ' -r' - AFLAGS += ' --cpu Cortex-M0' - AFLAGS += ' --fpu None' - AFLAGS += ' -S' - - LFLAGS = ' --config "drivers\linker_scripts\link.icf"' - LFLAGS += ' --redirect _Printf=_PrintfTiny' - LFLAGS += ' --redirect _Scanf=_ScanfSmall' - if BUILD == 'debug': - CFLAGS += ' --debug' - CFLAGS += ' -On' - else: - CFLAGS += ' -Oh' - - LFLAGS += ' --entry __iar_program_start' - EXEC_PATH = EXEC_PATH + '/arm/bin/' - POST_ACTION = '' diff --git a/bsp/essemi/es32f0271/template.uvoptx b/bsp/essemi/es32f0271/template.uvoptx deleted file mode 100644 index bb8cce6ff2..0000000000 --- a/bsp/essemi/es32f0271/template.uvoptx +++ /dev/null @@ -1,177 +0,0 @@ - - - - 1.0 - -
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj; *.o - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - 0 - - - - 0 - 0 - - - - rt-thread - 0x4 - ARM-ADS - - 12000000 - - 1 - 1 - 0 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 0 - 0 - 1 - - 255 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 3 - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0ES32F0271 -FL010000 -FS00 -FP0($$Device:ES32F0271LT$Flash\ES32F0271.FLM) - - - 0 - CMSIS_AGDI - -X"" -O206 -S0 -C0 -P00 -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0ES32F0271.FLM -FS00 -FL010000 -FP0($$Device:ES32F0271LT$Flash\ES32F0271.FLM) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - 0 - 0 - 0 - - - - - - - - - - - -
diff --git a/bsp/essemi/es32f0271/template.uvprojx b/bsp/essemi/es32f0271/template.uvprojx deleted file mode 100644 index ce19e112f5..0000000000 --- a/bsp/essemi/es32f0271/template.uvprojx +++ /dev/null @@ -1,389 +0,0 @@ - - - - 2.1 - -
### uVision Project, (C) Keil Software
- - - - rt-thread - 0x4 - ARM-ADS - 0 - - - ES32F0271LT - Eastsoft - Eastsoft.ES32_DFP.1.0.4 - http://www.essemi.com - IRAM(0x20000000,0x00002000) IROM(0x00000000,0x00010000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F0271 -FS00 -FL010000 -FP0($$Device:ES32F0271LT$Flash\ES32F0271.FLM)) - 0 - $$Device:ES32F0271LT$Device\Include\es32f027x.h - - - - - - - - - - $$Device:ES32F0271LT$SVD\es32f027x.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\ - rtthread - 1 - 0 - 0 - 1 - 1 - .\build\keil\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - - 0 - 0 - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -MPU - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - -MPU - TARMCM1.DLL - -pCM0 - - - - 1 - 0 - 0 - 0 - 16 - - - - - 1 - 0 - 0 - 1 - 1 - 4096 - - 1 - BIN\UL2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M0" - - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 0 - 3 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x2000 - - - 1 - 0x0 - 0x10000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x10000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x2000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 3 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x08000000 - 0x20000000 - - - - - - - - - - - - - - - - - - - -
diff --git a/bsp/essemi/es32f0334/.config b/bsp/essemi/es32f0334/.config deleted file mode 100644 index aaa2042085..0000000000 --- a/bsp/essemi/es32f0334/.config +++ /dev/null @@ -1,533 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# RT-Thread 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=100 -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 is not set -CONFIG_RT_DEBUG=y -CONFIG_RT_DEBUG_COLOR=y -# 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_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_VER_NUM=0x40003 -# CONFIG_RT_USING_CPU_FFS is not set -# 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=2048 -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=4096 -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=y -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=y -# CONFIG_RT_USING_CPUTIME is not set -CONFIG_RT_USING_I2C=y -# CONFIG_RT_I2C_DEBUG is not set -CONFIG_RT_USING_I2C_BITOPS=y -# CONFIG_RT_I2C_BITOPS_DEBUG is not set -CONFIG_RT_USING_PIN=y -CONFIG_RT_USING_ADC=y -# CONFIG_RT_USING_DAC is not set -CONFIG_RT_USING_PWM=y -# CONFIG_RT_USING_MTD_NOR is not set -# CONFIG_RT_USING_MTD_NAND is not set -CONFIG_RT_USING_PM=y -CONFIG_RT_USING_RTC=y -# CONFIG_RT_USING_ALARM is not set -# CONFIG_RT_USING_SOFT_RTC is not set -# CONFIG_RT_USING_SDIO is not set -CONFIG_RT_USING_SPI=y -# CONFIG_RT_USING_QSPI is not set -# CONFIG_RT_USING_SPI_MSD is not set -# CONFIG_RT_USING_SFUD is not set -# CONFIG_RT_USING_ENC28J60 is not set -# CONFIG_RT_USING_SPI_WIFI 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 - -# -# 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 - -# -# 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_ONNX_PARSER is not set -# CONFIG_PKG_USING_ONNX_BACKEND 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 - -# -# 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_HELIX 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_RDB is not set -# CONFIG_PKG_USING_QRCODE is not set -# CONFIG_PKG_USING_ULOG_EASYFLASH 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_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 - -# -# system packages -# -# CONFIG_PKG_USING_GUIENGINE is not set -# CONFIG_PKG_USING_CAIRO is not set -# CONFIG_PKG_USING_PIXMAN is not set -# CONFIG_PKG_USING_LWEXT4 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_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_UCOSIII_WRAPPER is not set -# CONFIG_PKG_USING_PPOOL 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_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_ROSSERIAL 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 - -# -# 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_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_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_NNOM is not set -# CONFIG_PKG_USING_LIBANN is not set -# CONFIG_PKG_USING_ELAPACK is not set -# CONFIG_PKG_USING_ARMv7M_DWT is not set -# CONFIG_PKG_USING_VT100 is not set -# CONFIG_PKG_USING_TETRIS is not set -# CONFIG_PKG_USING_ULAPACK is not set -# CONFIG_PKG_USING_UKAL is not set -# CONFIG_PKG_USING_CRCLIB is not set -# CONFIG_PKG_USING_THREES is not set -# CONFIG_PKG_USING_2048 is not set -# CONFIG_PKG_USING_LWGPS is not set -# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set - -# -# Hardware Drivers Config -# - -# -# On-chip Peripheral Drivers -# -CONFIG_BSP_USING_GPIO=y - -# -# UART Drivers -# -# CONFIG_BSP_USING_UART0 is not set -CONFIG_BSP_USING_UART1=y - -# -# SPI Drivers -# -# CONFIG_BSP_USING_SPI0 is not set -# CONFIG_BSP_USING_SPI1 is not set - -# -# I2C Drivers -# -# CONFIG_BSP_USING_I2C0 is not set -# CONFIG_BSP_USING_I2C1 is not set - -# -# PWM Drivers -# -# CONFIG_BSP_USING_PWM0 is not set -# CONFIG_BSP_USING_PWM1 is not set -# CONFIG_BSP_USING_PWM2 is not set -# CONFIG_BSP_USING_PWM3 is not set - -# -# HWtimer Drivers -# -# CONFIG_BSP_USING_HWTIMER0 is not set -# CONFIG_BSP_USING_HWTIMER1 is not set -# CONFIG_BSP_USING_HWTIMER2 is not set -# CONFIG_BSP_USING_HWTIMER3 is not set - -# -# RTC Drivers -# -# CONFIG_BSP_USING_RTC is not set - -# -# PM Drivers -# -# CONFIG_BSP_USING_PM is not set - -# -# ADC Drivers -# -# CONFIG_BSP_USING_ADC is not set - -# -# Onboard Peripheral Drivers -# -# CONFIG_BSP_USING_SPI_FLASH is not set - -# -# Offboard Peripheral Drivers -# - -# -# Peripheral Drivers test example -# -# CONFIG_BSP_USING_EXAMPLE_ADC_VOL is not set -# CONFIG_BSP_USING_EXAMPLE_HWTIMER is not set -# CONFIG_BSP_USING_EXAMPLE_I2C is not set -# CONFIG_BSP_USING_EXAMPLE_LED_BLINK is not set -# CONFIG_BSP_USING_EXAMPLE_PIN_BEEP is not set -# CONFIG_BSP_USING_EXAMPLE_PWM_LED is not set -# CONFIG_BSP_USING_EXAMPLE_RTC is not set -# CONFIG_BSP_USING_EXAMPLE_SPI is not set -# CONFIG_BSP_USING_EXAMPLE_UART is not set -# CONFIG_BSP_USING_EXAMPLE_PM is not set -CONFIG_SOC_ES32F0334LT=y diff --git a/bsp/essemi/es32f0334/Kconfig b/bsp/essemi/es32f0334/Kconfig deleted file mode 100644 index 87abf157f5..0000000000 --- a/bsp/essemi/es32f0334/Kconfig +++ /dev/null @@ -1,26 +0,0 @@ -mainmenu "RT-Thread 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 "drivers/Kconfig" - -config SOC_ES32F0334LT - bool - select RT_USING_COMPONENTS_INIT - select RT_USING_USER_MAIN - default y diff --git a/bsp/essemi/es32f0334/README.md b/bsp/essemi/es32f0334/README.md deleted file mode 100644 index ac98561868..0000000000 --- a/bsp/essemi/es32f0334/README.md +++ /dev/null @@ -1,118 +0,0 @@ -# ES-PDS-ES32F0334 开发板 BSP 说明 -标签: EastSoft、国产MCU、Cortex-M0、ES32F0334LT - -## 1. 简介 - -本文档为上海东软载波微电子开发团队为 ES-PDS-ES32F0334 开发板提供的 BSP (板级支持包) 说明。 -通过阅读本文档,开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。 - -### 1.1 开发板介绍 - -主要内容如下: -ES-PDS-ES32F0334 是东软载波微电子官方推出的一款基于 ARM Cortex-M0 内核的开发板,最高主频为 48MHz,可满足基础功能测试及高端功能扩展等开发需求。 - -开发板外观如下图所示: - -ES-PDS-ES32F0334-V1.1 - -![ES32F0334](figures/ES-PDS-ES32F0334-V1.1.jpg) - -该开发板常用 **板载资源** 如下: - -- MCU:ES32F0334LT,主频 48MHz,32KB SRAM,256KB FLASH,54 GPIOs -- 外部模块:SPI FLASH (MX25L64,8MB)、I2C EEPROM (M24C04,512B) -- 常用外设 - - LED:2个,(PA12/PC12) - - 液晶屏:1个 - - 可调电阻:1个 - - 按键:3个,K1(PF00),K2(PF01),RESET(MRST) -- 常用接口:GPIO、UART、SPI、I2C -- 调试接口,ESLinkⅡ(EastSoft 官方推出的开发工具,有标准版和mini版两种版本,均自带 CDC 串口功能) SWD 下载 - -外设支持: - -本 BSP 目前对外设的支持情况如下: - -| **板载外设** | **支持情况** | **备注** | -| :---------------- | :----------: | :------------------------------------| -| SPI FLASH | 支持 | SPI0 | -| **片上外设** | **支持情况** | **备注** | -| GPIO | 支持 | 54 GPIOs | -| UART | 支持 | UART0/1 | -| SPI | 支持 | SPI0/1 | -| I2C | 支持 | I2C0/1 | -| PWM | 支持 | PWM0/1/2/3 | -| TIMER | 支持 | TIMER0/1/2/3 | -| RTC | 支持 | RTC | -| PM | 支持 | Power Management | -| ADC | 支持 | ADC0 | - -更多详细信息请咨询[上海东软载波微电子技术支持](http://www.essemi.com/) - -## 2. 快速上手 - -本 BSP 为开发者提供 MDK5 工程。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 - -### 硬件连接 - -使用 ESLinkⅡ (自带 CDC 串口)或 Jlink 等调试工具连接开发板到 PC,拨动开关选择使用调试工具供电或使用外部电源供电。若使用 Jlink 等调试工具,还需要将 UART1_TX(PC10)、UART1_RX(PC11)、GND 接到串口工具上。 - -使用ESlinkⅡ(mini)连接开发板如下图所示: - -ESLinkⅡ(mini) + ES-PDS-ES32F0334-V1.1 - -![ESLinkII](figures/ESLinkII-mini.jpg) - -### 编译下载 - -双击 project.uvprojx 文件,打开 MDK5 工程,工程默认配置使用 JLink 下载程序,在通过 JLink 连接开发板的基础上,点击下载按钮即可下载程序到开发板,如果使用 ESLinkⅡ,则选择 "CMSIS-DAP Debugger",连接正常后即可编译并下载程序到开发板。 - -### 运行结果 - -下载程序成功之后,系统会自动运行,观察串口输出的信息,同时开发板LED闪烁。 - -```bash - \ | / -- RT - Thread Operating System - / | \ 4.0.0 build Jan 28 2019 - 2006 - 2018 Copyright by rt-thread team -msh > -``` -## 3. 进阶使用 - -此 BSP 默认只开启了 GPIO 和 uart1 的功能,如果需使用 Flash 等更多高级功能,需要利用 ENV 工具对 BSP 进行配置,步骤如下: - -1. 在 bsp 下打开 env 工具。 - -2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 - - a)如果需要使用内核用例,先配置rt-thread内核,如图: - - ![kernel_config](figures/k_conf.jpg) - - 然后配置内核用例,如图: - - ![kernel_samples](figures/k_ex.jpg) - - b)如果需要使用驱动用例:先使能驱动,如图: - - ![driver_config](figures/drv_conf.jpg) - - 然后配置驱动用例,如图: - - ![driver_sample](figures/drv_ex.jpg) - -3. 输入`pkgs --update`命令更新软件包。 - -4. 输入`scons --target=mdk5/iar` 命令重新生成工程。 - -更多 Env 工具的详细介绍请参考 [RT-Thread 文档中心](https://www.rt-thread.org/document/site/) - -## 4. 联系人信息 - -- [liuhongyan](https://gitee.com/liuhongyan98) - -## 5. 参考 - -- [ EastSoft 官网](http://www.essemi.com) - diff --git a/bsp/essemi/es32f0334/SConscript b/bsp/essemi/es32f0334/SConscript deleted file mode 100644 index 468297b6a9..0000000000 --- a/bsp/essemi/es32f0334/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# for module compiling -import os -Import('RTT_ROOT') - -objs = [] -cwd = str(Dir('#')) -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/essemi/es32f0334/SConstruct b/bsp/essemi/es32f0334/SConstruct deleted file mode 100644 index e75d75371b..0000000000 --- a/bsp/essemi/es32f0334/SConstruct +++ /dev/null @@ -1,40 +0,0 @@ -import os -import sys -import rtconfig - -if os.getenv('RTT_ROOT'): - RTT_ROOT = os.getenv('RTT_ROOT') -else: - RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..') - -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 = 'rtthread.' + 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 -objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) - -# make a building -DoBuilding(TARGET, objs) diff --git a/bsp/essemi/es32f0334/applications/SConscript b/bsp/essemi/es32f0334/applications/SConscript deleted file mode 100644 index e0c84e8f14..0000000000 --- a/bsp/essemi/es32f0334/applications/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -Import('RTT_ROOT') -Import('rtconfig') -from building import * - -cwd = os.path.join(str(Dir('#')), 'applications') -src = Glob('*.c') - -CPPPATH = [cwd, str(Dir('#'))] -group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') diff --git a/bsp/essemi/es32f0334/applications/main.c b/bsp/essemi/es32f0334/applications/main.c deleted file mode 100644 index fbf34fb9af..0000000000 --- a/bsp/essemi/es32f0334/applications/main.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-01 wangyq the first version - */ - -#include -#include - -#define LED_PIN 53 - -int main(void) -{ - int count = 1; - /* set PC12 pin mode to output */ - rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT); - - while (count++) - { - rt_pin_write(LED_PIN, PIN_HIGH); - rt_thread_mdelay(500); - rt_pin_write(LED_PIN, PIN_LOW); - rt_thread_mdelay(500); - } - return RT_EOK; -} diff --git a/bsp/essemi/es32f0334/drivers/Kconfig b/bsp/essemi/es32f0334/drivers/Kconfig deleted file mode 100644 index 05c29ef313..0000000000 --- a/bsp/essemi/es32f0334/drivers/Kconfig +++ /dev/null @@ -1,176 +0,0 @@ -menu "Hardware Drivers Config" - - menu "On-chip Peripheral Drivers" - config BSP_USING_GPIO - bool "Enable GPIO" - select RT_USING_PIN - default y - - menu "UART Drivers" - config BSP_USING_UART0 - bool "Enable UART0 PB10/PB11(T/R)" - select RT_USING_SERIAL - default n - - config BSP_USING_UART1 - bool "Enable UART1 PC10/PC11(T/R)" - select RT_USING_SERIAL - default y - - endmenu - - menu "SPI Drivers" - config BSP_USING_SPI0 - bool "Enable SPI0 BUS PB03/PB04/PB05(CLK/MISO/MOSI)" - select RT_USING_SPI - select RT_USING_PIN - default n - - config BSP_USING_SPI1 - bool "Enable SPI1 BUS PB13/PB14/PB15(CLK/MISO/MOSI)" - select RT_USING_SPI - select RT_USING_PIN - default n - endmenu - - menu "I2C Drivers" - config BSP_USING_I2C0 - bool "Enable I2C0 BUS PB08/PB09(SCL/SDA)" - select RT_USING_I2C - default n - config BSP_USING_I2C1 - bool "Enable I2C1 BUS PB10/PB11(SCL/SDA)" - select RT_USING_I2C - default n - endmenu - - menu "PWM Drivers" - config BSP_USING_PWM0 - bool "Using PWM0 PA08/PA09/PA10/PA11" - select RT_USING_PWM - default n - - config BSP_USING_PWM1 - bool "Using PWM1 PB06/PB07/PB08" - select RT_USING_PWM - default n - - config BSP_USING_PWM2 - bool "Using PWM2 PA00/PA01" - select RT_USING_PWM - default n - - config BSP_USING_PWM3 - bool "Using PWM3 PC06/PC07" - select RT_USING_PWM - default n - endmenu - - menu "HWtimer Drivers" - config BSP_USING_HWTIMER0 - bool "Using timer0" - select RT_USING_HWTIMER - default n - - config BSP_USING_HWTIMER1 - bool "Using timer1" - select RT_USING_HWTIMER - default n - - config BSP_USING_HWTIMER2 - bool "Using timer2" - select RT_USING_HWTIMER - default n - - config BSP_USING_HWTIMER3 - bool "Using timer3" - select RT_USING_HWTIMER - default n - endmenu - - menu "RTC Drivers" - config BSP_USING_RTC - bool "Using RTC" - select RT_USING_RTC - default n - endmenu - - menu "PM Drivers" - config BSP_USING_PM - bool "Using PM" - select RT_USING_PM - default n - endmenu - - menu "ADC Drivers" - config BSP_USING_ADC - bool "Using ADC" - select RT_USING_ADC - default n - endmenu - - endmenu - - menu "Onboard Peripheral Drivers" - - config BSP_USING_SPI_FLASH - bool "Enable SPI FLASH (W25Q64 spi0)" - select BSP_USING_SPI - select BSP_USING_SPI0 - select RT_USING_SFUD - select RT_SFUD_USING_SFDP - default n - - endmenu - - menu "Offboard Peripheral Drivers" - - endmenu - - - menu "Peripheral Drivers test example" - - config BSP_USING_EXAMPLE_ADC_VOL - bool "BSP_USING_EXAMPLE_ADC_VOL" - default n - - config BSP_USING_EXAMPLE_HWTIMER - bool "BSP_USING_EXAMPLE_HWTIMER" - default n - - config BSP_USING_EXAMPLE_I2C - bool "BSP_USING_EXAMPLE_I2C" - default n - - config BSP_USING_EXAMPLE_LED_BLINK - bool "BSP_USING_EXAMPLE_LED_BLINK" - default y - - config BSP_USING_EXAMPLE_PIN_BEEP - bool "BSP_USING_EXAMPLE_PIN_BEEP" - default y - - config BSP_USING_EXAMPLE_PWM_LED - bool "BSP_USING_EXAMPLE_PWM_LED" - default n - - config BSP_USING_EXAMPLE_RTC - bool "BSP_USING_EXAMPLE_RTC" - default n - - config BSP_USING_EXAMPLE_SPI - bool "BSP_USING_EXAMPLE_SPI" - default n - - config BSP_USING_EXAMPLE_UART - bool "BSP_USING_EXAMPLE_UART" - default y - - config BSP_USING_EXAMPLE_PM - bool "BSP_USING_EXAMPLE_PM" - default n - - - endmenu - -endmenu diff --git a/bsp/essemi/es32f0334/drivers/SConscript b/bsp/essemi/es32f0334/drivers/SConscript deleted file mode 100644 index 78bd814312..0000000000 --- a/bsp/essemi/es32f0334/drivers/SConscript +++ /dev/null @@ -1,94 +0,0 @@ -from building import * - -cwd = GetCurrentDir() - -objs = [] - -# add the general drivers. -src = Split(''' -board.c -''') - -# add gpio code -if GetDepend('RT_USING_PIN'): - src += ['drv_gpio.c'] - -# add serial driver code -if GetDepend('BSP_USING_UART0') or GetDepend('BSP_USING_UART1'): - src += ['drv_uart.c'] - -# add spi driver code -if GetDepend('BSP_USING_SPI0') or GetDepend('BSP_USING_SPI1'): - src += ['drv_spi.c'] - -# add i2c driver code -if GetDepend('BSP_USING_I2C0') or GetDepend('BSP_USING_I2C1'): - src += ['drv_i2c.c'] - -# add spi flash driver code -if GetDepend('BSP_USING_SPI_FLASH'): - src += ['drv_spiflash.c'] - -# add pwm driver code -if GetDepend('BSP_USING_PWM0') or GetDepend('BSP_USING_PWM1') or GetDepend('BSP_USING_PWM2') or GetDepend('BSP_USING_PWM3'): - src += ['drv_pwm.c'] - -# add hwtimer driver code -if GetDepend('BSP_USING_HWTIMER0') or GetDepend('BSP_USING_HWTIMER1') or GetDepend('BSP_USING_HWTIMER2') or GetDepend('BSP_USING_HWTIMER3'): - src += ['drv_hwtimer.c'] - -# add rtc driver code -if GetDepend(['BSP_USING_RTC']): - src += ['drv_rtc.c'] - -# add pm driver code -if GetDepend(['BSP_USING_PM']): - src += ['drv_pm.c'] - src += ['drv_lptim.c'] - -# add adc driver code -if GetDepend(['BSP_USING_ADC']): - src += ['drv_adc.c'] - -CPPPATH = [cwd] -group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) -objs = objs + group - -src = [] -cwd = GetCurrentDir() -include_path = [cwd] - -if GetDepend('BSP_USING_EXAMPLE_ADC_VOL'): - src += ['bsp_driver_example/adc_vol_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_HWTIMER'): - src += ['bsp_driver_example/hwtimer_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_I2C'): - src += ['bsp_driver_example/i2c_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_LED_BLINK'): - src += ['bsp_driver_example/led_blink_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_PIN_BEEP'): - src += ['bsp_driver_example/pin_beep_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_PWM_LED'): - src += ['bsp_driver_example/pwm_led_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_RTC'): - src += ['bsp_driver_example/rtc_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_UART'): - src += ['bsp_driver_example/uart_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_SPI'): - src += ['bsp_driver_example/spi_sample.c'] - -if GetDepend('BSP_USING_EXAMPLE_PM'): - src += ['bsp_driver_example/pm_sample.c'] - -group = DefineGroup('bsp-drivers-test-samples', src, depend = [''], CPPPATH = include_path) - -objs = objs + group -Return('objs') \ No newline at end of file diff --git a/bsp/essemi/es32f0334/drivers/board.c b/bsp/essemi/es32f0334/drivers/board.c deleted file mode 100644 index f41a66fbb2..0000000000 --- a/bsp/essemi/es32f0334/drivers/board.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-01 wangyq the first version - */ - -#include -#include -#include "board.h" -#include "drv_uart.h" -#include "drv_gpio.h" -#include -#include - -/** - * @addtogroup es32f0 - */ - -/*@{*/ - -/******************************************************************************* -* Function Name : NVIC_Configuration -* Description : Configures Vector Table base location. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void NVIC_Configuration(void) -{ -} - -/******************************************************************************* - * Function Name : SystemClock_Configuration - * Description : Configures the System Clock. - * Input : None - * Output : None - * Return : None - *******************************************************************************/ -void SystemClock_Config(void) -{ - /* hosc 12MHz, from hosc/3 pll to 48MHz */ - ald_cmu_pll1_config(CMU_PLL1_INPUT_HOSC_3, CMU_PLL1_OUTPUT_48M); - - /* MCLK 48MHz */ - ald_cmu_clock_config(CMU_CLOCK_PLL1, 48000000); -} - -/******************************************************************************* - * Function Name : SysTick_Configuration - * Description : Configures the SysTick for OS tick. - * Input : None - * Output : None - * Return : None - *******************************************************************************/ -void SysTick_Configuration(void) -{ - /* ticks = sysclk / RT_TICK_PER_SECOND */ - SysTick_Config(ald_cmu_get_sys_clock() / 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 initial ES32F0 board. - */ -void rt_hw_board_init(void) -{ - /* NVIC Configuration */ - NVIC_Configuration(); - - /*System Clock Configuration */ - SystemClock_Config(); - - /* 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 -} - -/** - * This function will delay for some us. - * - * @param us the delay time of us - */ -void rt_hw_us_delay(rt_uint32_t us) -{ - unsigned int start, now, delta, reload, us_tick; - start = SysTick->VAL; - reload = SysTick->LOAD; - us_tick = ald_cmu_get_sys_clock() / 1000000UL; - do - { - now = SysTick->VAL; - delta = start > now ? start - now : reload + start - now; - } - while (delta < us_tick * us); -} diff --git a/bsp/essemi/es32f0334/drivers/board.h b/bsp/essemi/es32f0334/drivers/board.h deleted file mode 100644 index 5df26393eb..0000000000 --- a/bsp/essemi/es32f0334/drivers/board.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-01 wangyq the first version - */ - -// <<< Use Configuration Wizard in Context Menu >>> -#ifndef __BOARD_H__ -#define __BOARD_H__ - -#include -#include - -#define ES32F0_SRAM_SIZE 0x8000 -#define ES32F0_SRAM_END (0x20000000 + ES32F0_SRAM_SIZE) - -#if defined(__CC_ARM) || defined(__CLANG_ARM) - extern int Image$$RW_IRAM1$$ZI$$Limit; - #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) -#elif __ICCARM__ - #pragma section="HEAP" - #define HEAP_BEGIN (__segment_end("HEAP")) -#else - extern int __bss_end; - #define HEAP_BEGIN ((void *)&__bss_end) -#endif - -#define HEAP_END ES32F0_SRAM_END - -void rt_hw_board_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/.gitignore b/bsp/essemi/es32f0334/drivers/bsp_driver_example/.gitignore deleted file mode 100644 index c6127b38c1..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/.gitignore +++ /dev/null @@ -1,52 +0,0 @@ -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/README.md b/bsp/essemi/es32f0334/drivers/bsp_driver_example/README.md deleted file mode 100644 index 80f12e1949..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# 外设驱动测试用例 - -## 1、介绍 - -这个软件包包含一些外设设备操作的例程。 - -### 1.1 例程说明 - -| 文件 | 说明 | -| ---------------- | ------------------------------- | -| adc_vol_sample.c | 使用 ADC 设备转换电压数据 | -| can_sample.c | 通过 CAN 设备发送一帧,并创建一个线程接收数据然后打印输出。 | -| hwtimer_sample.c | 使用 硬件定时器定时 | -| i2c_sample.c | 使用 i2c 设备进行读写 | -| pm.c | 反复进入不同程度的睡眠。 | -| led_blink_sample.c | 使用 pin 设备控制 LED 闪烁 | -| pin_beep_sample.c | 使用 pin 设备控制蜂鸣器 | -| pwm_led_sample.c | 使用 pwm 设备控制 LED 的亮度 | -| rtc_sample.c | 使用 rtc 设备设置年月日时分秒信息 | -| spi_sample.c | 使用 spi 设备进行读写 | -| uart_sample.c | 使用 serial 设备中断接收及轮询发送模式收发数据 | - -### 1.2 依赖 - -依赖设备管理模块提供的设备驱动。 - -## 2、如何打开 外设驱动测试用例 - -使用 外设驱动测试用例 需要在 RT-Thread 的menuconfig中选择它,具体路径如下: - -``` -Hardware Driver Config ---> - Peripheral Driver test example---> -``` - -## 3、使用 外设驱动测试用例 - -在打开 Peripheral Driver test example 后,当进行 BSP 编译时,选择的软件包相关源代码会被加入到 BSP 工程中进行编译。 - -## 4、注意事项 - -暂无。 - -## 5、联系方式 & 感谢 - -* 维护:[misonyo](https://github.com/misonyo) -* 主页:https://github.com/RT-Thread-packages/peripheral-sample diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/adc_vol_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/adc_vol_sample.c deleted file mode 100644 index 19eed3f35d..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/adc_vol_sample.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-11-29 misonyo first implementation. - */ -/* - * 程序清单: ADC 设备使用例程 - * 例程导出了 adc_sample 命令到控制终端 - * 命令调用格式:adc_sample - * 程序功能:通过 ADC 设备采样电压值并转换为数值。 - * 示例代码参考电压为3.3V,转换位数为12位。 -*/ - -#include -#include - -#define ADC_DEV_NAME "adc0" /* ADC 设备名称 */ -#define ADC_DEV_CHANNEL 5 /* PA1 ADC 通道 */ -#define REFER_VOLTAGE 330 /* 参考电压 3.3V,数据精度乘以100保留2位小数*/ -#define CONVERT_BITS (1 << 12) /* 转换位数为12位 */ - -static int adc_vol_sample(int argc, char *argv[]) -{ - rt_adc_device_t adc_dev; - rt_uint32_t value, vol; - rt_err_t ret = RT_EOK; - - /* 查找设备 */ - adc_dev = (rt_adc_device_t)rt_device_find(ADC_DEV_NAME); - if (adc_dev == RT_NULL) - { - rt_kprintf("adc sample run failed! can't find %s device!\n", ADC_DEV_NAME); - return RT_ERROR; - } - - /* 使能设备 */ - ret = rt_adc_enable(adc_dev, ADC_DEV_CHANNEL); - - /* 读取采样值 */ - value = rt_adc_read(adc_dev, ADC_DEV_CHANNEL); - rt_kprintf("the value is :%d \n", value); - - /* 转换为对应电压值 */ - vol = value * REFER_VOLTAGE / CONVERT_BITS; - rt_kprintf("the voltage is :%d.%02d \n", vol / 100, vol % 100); - - /* 关闭通道 */ - ret = rt_adc_disable(adc_dev, ADC_DEV_CHANNEL); - - return ret; -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(adc_vol_sample, adc voltage convert sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/can_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/can_sample.c deleted file mode 100644 index e63b11451d..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/can_sample.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-06-25 misonyo first implementation. - */ -/* - * 程序清单:这是一个 CAN 设备使用例程 - * 例程导出了 can_sample 命令到控制终端 - * 命令调用格式:can_sample can2 - * 命令解释:命令第二个参数是要使用的 CAN 设备名称,为空则使用默认的 CAN 设备 - * 程序功能:通过 CAN 设备发送一帧,并创建一个线程接收数据然后打印输出。 -*/ - -#include -#include "rtdevice.h" - -#define CAN_DEV_NAME "can2" /* CAN 设备名称 */ - -static struct rt_semaphore rx_sem; /* 用于接收消息的信号量 */ -static rt_device_t can_dev; /* CAN 设备句柄 */ - -/* 接收数据回调函数 */ -static rt_err_t can_rx_call(rt_device_t dev, rt_size_t size) -{ - /* CAN 接收到数据后产生中断,调用此回调函数,然后发送接收信号量 */ - rt_sem_release(&rx_sem); - - return RT_EOK; -} - -static void can_rx_thread(void *parameter) -{ - int i; - struct rt_can_msg rxmsg = {0}; - - /* 设置接收回调函数 */ - rt_device_set_rx_indicate(can_dev, can_rx_call); - -#ifdef RT_CAN_USING_HDR - - rt_err_t res; - - struct rt_can_filter_item items[5] = - { - RT_CAN_FILTER_ITEM_INIT(0x100, 0, 0, 0, 0x700, RT_NULL, RT_NULL), /* std,match ID:0x100~0x1ff,hdr为-1,设置默认过滤表 */ - RT_CAN_FILTER_ITEM_INIT(0x300, 0, 0, 0, 0x700, RT_NULL, RT_NULL), /* std,match ID:0x300~0x3ff,hdr为-1 */ - RT_CAN_FILTER_ITEM_INIT(0x211, 0, 0, 0, 0x7ff, RT_NULL, RT_NULL), /* std,match ID:0x211,hdr为-1 */ - RT_CAN_FILTER_STD_INIT(0x486, RT_NULL, RT_NULL), /* std,match ID:0x486,hdr为-1 */ - {0x555, 0, 0, 0, 0x7ff, 7,} /* std,match ID:0x555,hdr为7,指定设置7号过滤表 */ - }; - struct rt_can_filter_config cfg = {5, 1, items}; /* 一共有5个过滤表 */ - /* 设置硬件过滤表 */ - res = rt_device_control(can_dev, RT_CAN_CMD_SET_FILTER, &cfg); - RT_ASSERT(res == RT_EOK); -#endif - - while (1) - { - /* hdr值为-1,表示直接从uselist链表读取数据 */ - rxmsg.hdr = -1; - /* 阻塞等待接收信号量 */ - rt_sem_take(&rx_sem, RT_WAITING_FOREVER); - /* 从CAN读取一帧数据 */ - rt_device_read(can_dev, 0, &rxmsg, sizeof(rxmsg)); - /* 打印数据ID及内容 */ - rt_kprintf("ID:%x ", rxmsg.id); - for (i = 0; i < 8; i++) - { - rt_kprintf("%2x ", rxmsg.data[i]); - } - - rt_kprintf("\n"); - } -} - -int can_sample(int argc, char *argv[]) -{ - struct rt_can_msg msg = {0}; - rt_err_t res; - rt_size_t size; - rt_thread_t thread; - char can_name[RT_NAME_MAX]; - - if (argc == 2) - { - rt_strncpy(can_name, argv[1], RT_NAME_MAX); - } - else - { - rt_strncpy(can_name, CAN_DEV_NAME, RT_NAME_MAX); - } - - can_dev = rt_device_find(can_name); - if (!can_dev) - { - rt_kprintf("find %s failed!\n", can_name); - return RT_ERROR; - } - - /* 初始化CAN接收信号量 */ - rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO); - - /* 以中断接收及发送方式打开CAN设备 */ - res = rt_device_open(can_dev, RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_INT_RX); - RT_ASSERT(res == RT_EOK); - - thread = rt_thread_create("can_rx", can_rx_thread, RT_NULL, 1024, 25, 10); - if (thread != RT_NULL) - { - rt_thread_startup(thread); - } - else - { - rt_kprintf("create can_rx thread failed!\n"); - } - - msg.id = 0x78; /* ID为0x78 */ - msg.ide = RT_CAN_STDID; /* 标准格式 */ - msg.rtr = RT_CAN_DTR; /* 数据帧 */ - msg.len = 8; /* 数据长度为8 */ - /* 待发送的8字节数据 */ - msg.data[0] = 0x00; - msg.data[1] = 0x11; - msg.data[2] = 0x22; - msg.data[3] = 0x33; - msg.data[4] = 0x44; - msg.data[5] = 0x55; - msg.data[6] = 0x66; - msg.data[7] = 0x77; - /* 发送一帧CAN数据 */ - size = rt_device_write(can_dev, 0, &msg, sizeof(msg)); - if (size == 0) - { - rt_kprintf("can dev write data failed!\n"); - } - - return res; -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(can_sample, can device sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/hwtimer_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/hwtimer_sample.c deleted file mode 100644 index e2e39664f3..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/hwtimer_sample.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-11-30 misonyo first implementation. - */ -/* - * 程序清单:这是一个 hwtimer 设备使用例程 - * 例程导出了 hwtimer_sample 命令到控制终端 - * 命令调用格式:hwtimer_sample - * 程序功能:硬件定时器超时回调函数周期性的打印当前tick值,2次tick值之差换算为时间等同于定时时间值。 -*/ - -#include -#include - -#define HWTIMER_DEV_NAME "timer0" /* 定时器名称 */ - -/* 定时器超时回调函数 */ -static rt_err_t timeout_cb(rt_device_t dev, rt_size_t size) -{ - rt_kprintf("tick is :%d !\n", rt_tick_get()); - - return 0; -} - -static int hwtimer_sample(int argc, char *argv[]) -{ - rt_err_t ret = RT_EOK; - rt_hwtimerval_t timeout_s; /* 定时器超时值 */ - rt_device_t hw_dev = RT_NULL; /* 定时器设备句柄 */ - rt_hwtimer_mode_t mode; /* 定时器模式 */ - - /* 查找定时器设备 */ - hw_dev = rt_device_find(HWTIMER_DEV_NAME); - if (hw_dev == RT_NULL) - { - rt_kprintf("hwtimer sample run failed! can't find %s device!\n", HWTIMER_DEV_NAME); - return RT_ERROR; - } - - /* 以读写方式打开设备 */ - ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR); - if (ret != RT_EOK) - { - rt_kprintf("open %s device failed!\n", HWTIMER_DEV_NAME); - return ret; - } - - /* 设置超时回调函数 */ - rt_device_set_rx_indicate(hw_dev, timeout_cb); - - /* 设置模式为周期性定时器 */ - mode = HWTIMER_MODE_PERIOD; - ret = rt_device_control(hw_dev, HWTIMER_CTRL_MODE_SET, &mode); - if (ret != RT_EOK) - { - rt_kprintf("set mode failed! ret is :%d\n", ret); - return ret; - } - - /* 设置定时器超时值为5s并启动定时器 */ - timeout_s.sec = 5; /* 秒 */ - timeout_s.usec = 0; /* 微秒 */ - - if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s)) - { - rt_kprintf("set timeout value failed\n"); - return RT_ERROR; - } - - /* 延时3500ms */ - rt_thread_mdelay(3500); - - /* 读取定时器当前值 */ - rt_device_read(hw_dev, 0, &timeout_s, sizeof(timeout_s)); - rt_kprintf("Read: Sec = %d, Usec = %d\n", timeout_s.sec, timeout_s.usec); - - return ret; -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(hwtimer_sample, hwtimer sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/i2c_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/i2c_sample.c deleted file mode 100644 index 2d386433c6..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/i2c_sample.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-12-15 liuhy first implementation. - */ -/* - * 程序清单:这是一个 I2C 设备使用例程 - * 例程导出了 i2c_io_sample 命令到控制终端 - * 命令调用格式:i2c_io_sample - * 命令解释:使用默认的I2C总线设备 - * 程序功能:通过 I2C 设备接收数据并打印,然后将接收的字符加1输出。 -*/ - -#include -#include - -#define I2C_BUS_NAME "i2c1" /* I2C总线设备名称 */ -#define SLAVE_ADDR 0x2D /* 从机地址 */ -#define STR_LEN 16 /* 接收发送的数据长度 */ - -static void i2c_io_sample(int argc, char *argv[]) -{ - - struct rt_i2c_bus_device *i2c_bus = RT_NULL; /* I2C总线设备句柄 */ - struct rt_i2c_msg temp_msg; /* I2C消息 */ - rt_uint8_t buffer[STR_LEN] = { 0U }; - rt_uint32_t i,num_msg; - rt_size_t s_stat; - - i2c_bus = (struct rt_i2c_bus_device *)rt_device_find(I2C_BUS_NAME); /* 通过名字获取I2C总线设备的句柄 */ - - if( i2c_bus == RT_NULL) - { - rt_kprintf("can't find i2c device :%s !\n",I2C_BUS_NAME); - - return; - } - - /*初始化消息*/ - temp_msg.addr = SLAVE_ADDR; /* 从机地址 */ - temp_msg.len = STR_LEN; /* 传输的数据长度 */ - temp_msg.buf = buffer; /* 读写缓存器 */ - - num_msg = 1; /* 传输一条消息 */ - - temp_msg.flags = RT_I2C_RD; /* I2C读 */ - s_stat = rt_i2c_transfer(i2c_bus,&temp_msg,num_msg); /* 传输消息 */ - - rt_thread_mdelay(400); - - if( s_stat == num_msg ) - { - rt_kprintf("receive successful. \n receive messege : %s \n:",buffer); - - for( i = 0 ; i < STR_LEN ; i++) - rt_kprintf(" %x",(unsigned int)buffer[i]); - - rt_kprintf("\n"); - } - else - { - rt_kprintf("device s% recieve fail \n buffer : s%\n",I2C_BUS_NAME,buffer); - return; - } - - for( i = 0 ; i < STR_LEN ; i++) - buffer[i]++; - - temp_msg.flags = RT_I2C_WR; /* I2C写 */ - s_stat = rt_i2c_transfer(i2c_bus,&temp_msg,num_msg); /* 传输一条 */ - - rt_thread_mdelay(400); - - if( s_stat == num_msg ) - { - rt_kprintf(" send successful \n messege : %s \n:",buffer); - - for( i = 0 ; i < STR_LEN ; i++) - rt_kprintf(" %x",(unsigned int)buffer[i]); - - rt_kprintf("\n"); - } - else - { - rt_kprintf("device s% send fail \n",I2C_BUS_NAME); - return; - } - - return; - -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(i2c_io_sample, i2c io sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/led_blink_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/led_blink_sample.c deleted file mode 100644 index c073b5e5a7..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/led_blink_sample.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-09-25 misonyo first edition. - */ -/* - * 程序清单:这是一个通过PIN脚控制LED亮灭的使用例程 - * 例程导出了 led_sample 命令到控制终端 - * 命令调用格式:led_sample - * 命令解释:命令第二个参数是要使用的PIN脚编号,为空则使用例程默认的引脚编号。 - * 程序功能:程序创建一个led线程,线程每隔1000ms改变PIN脚状态,达到控制led灯 - * 亮灭的效果。 -*/ - -#include -#include -#include - -/* PIN脚编号,查看驱动文件drv_gpio.c确定 */ -#define LED_PIN_NUM 45 /*PA12*/ -static int pin_num; - -static void led_entry(void *parameter) -{ - int count = 0; - /* 设置PIN脚模式为输出 */ - rt_pin_mode(pin_num, PIN_MODE_OUTPUT); - - while (1) - { - count++; - rt_kprintf("thread run count : %d\r\n", count); - /* 拉低PIN脚 */ - rt_pin_write(pin_num, PIN_LOW); - rt_kprintf("led on!\r\n"); - /* 延时1000ms */ - rt_thread_mdelay(1000); - - /* 拉高PIN脚 */ - rt_pin_write(pin_num, PIN_HIGH); - rt_kprintf("led off!\r\n"); - rt_thread_mdelay(1000); - } -} - -static int led_sample(int argc, char *argv[]) -{ - rt_thread_t tid; - rt_err_t ret = RT_EOK; - - /* 判断命令行参数是否给定了PIN脚编号 */ - if (argc == 2) - { - pin_num = atoi(argv[1]); - } - else - { - pin_num = LED_PIN_NUM; - } - - tid = rt_thread_create("led", - led_entry, - RT_NULL, - 512, - RT_THREAD_PRIORITY_MAX / 3, - 20); - if (tid != RT_NULL) - { - rt_thread_startup(tid); - } - else - { - ret = RT_ERROR; - } - - return ret; -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(led_sample, led sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/pin_beep_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/pin_beep_sample.c deleted file mode 100644 index 911a0c800e..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/pin_beep_sample.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-08-15 misonyo first implementation. - */ -/* - * 程序清单:这是一个 PIN 设备使用例程 - * 例程导出了 pin_beep_sample 命令到控制终端 - * 命令调用格式:pin_beep_sample - * 程序功能:通过按键控制蜂鸣器对应引脚的电平状态控制蜂鸣器 -*/ - -#include -#include - -/* 引脚编号,通过查看驱动文件drv_gpio.c确定 */ -#ifndef BEEP_PIN_NUM - #define BEEP_PIN_NUM 45 /* PA12 */ -#endif -#ifndef KEY0_PIN_NUM - #define KEY0_PIN_NUM 18 /* PF0 */ -#endif -#ifndef KEY1_PIN_NUM - #define KEY1_PIN_NUM 19 /* PF1 */ -#endif - -void beep_on(void *args) -{ - rt_kprintf("turn on beep!\n"); - - rt_pin_write(BEEP_PIN_NUM, PIN_HIGH); -} - -void beep_off(void *args) -{ - rt_kprintf("turn off beep!\n"); - - rt_pin_write(BEEP_PIN_NUM, PIN_LOW); -} - -static void pin_beep_sample(void) -{ - /* 蜂鸣器引脚为输出模式 */ - rt_pin_mode(BEEP_PIN_NUM, PIN_MODE_OUTPUT); - /* 默认低电平 */ - rt_pin_write(BEEP_PIN_NUM, PIN_LOW); - - /* 按键0引脚为输入模式 */ - rt_pin_mode(KEY0_PIN_NUM, PIN_MODE_INPUT_PULLUP); - /* 绑定中断,下降沿模式,回调函数名为beep_on */ - rt_pin_attach_irq(KEY0_PIN_NUM, PIN_IRQ_MODE_FALLING, beep_on, RT_NULL); - /* 使能中断 */ - rt_pin_irq_enable(KEY0_PIN_NUM, PIN_IRQ_ENABLE); - - /* 按键1引脚为输入模式 */ - rt_pin_mode(KEY1_PIN_NUM, PIN_MODE_INPUT_PULLUP); - /* 绑定中断,下降沿模式,回调函数名为beep_off */ - rt_pin_attach_irq(KEY1_PIN_NUM, PIN_IRQ_MODE_FALLING, beep_off, RT_NULL); - /* 使能中断 */ - rt_pin_irq_enable(KEY1_PIN_NUM, PIN_IRQ_ENABLE); -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(pin_beep_sample, pin beep sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/pm_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/pm_sample.c deleted file mode 100644 index 08258b1650..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/pm_sample.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-12-15 liuhy first implementation. - */ -/* - * 程序清单:这是一个 pm睡眠唤醒的使用例程 - * 例程导出了 pm_sample 命令到控制终端 - * 命令调用格式:pm_sample - * 命令解释:进入不同的睡眠模式,然后用按键唤醒 - * 程序功能:通过串口输出字符串,告知进入睡眠和唤醒睡眠的情况。 -*/ - -#include -#include - -#define PM_NAME "pm" /* 设备名称 */ -#define WAKE_UP_PIN 18 /* 唤醒源 */ -#define SLEEP_TIMES 12 /* 进入睡眠次数,轮流进入不同的睡眠模式,包括无睡眠模式 */ - -struct pm_callback_t -{ - volatile int in_fun_times; /*进入函数的次数*/ - volatile char flag; /*标志*/ - volatile int mode; /*需要打印的模式*/ -}; - -volatile struct pm_callback_t g_pm_data; - -/*进入睡眠前,睡眠唤醒后,都会进入。*/ -/*函数打印睡眠相关的信息*/ -void sleep_in_out_callback(rt_uint8_t event, rt_uint8_t mode, void *data) -{ - /*没有标志,不处理*/ - if(!(g_pm_data.flag)) - { - return; - } - - /*标志不正常,清空标志*/ - if((g_pm_data.flag) > 2) - { - (g_pm_data.flag) = 0; - return; - } - - /*模式不匹配*/ - if(g_pm_data.mode != mode ) - { - return; - } - - /*进入的事件*/ - switch(event) - { - /*进入睡眠前*/ - case RT_PM_ENTER_SLEEP: g_pm_data.flag = 1; - rt_kprintf("\n\r##%d : ENTER ",g_pm_data.in_fun_times); - g_pm_data.in_fun_times++; /*进入睡眠次数+1*/ - break; - /*睡眠唤醒后*/ - case RT_PM_EXIT_SLEEP: g_pm_data.flag = 0; /*睡眠唤醒后*/ - rt_kprintf("\n\rEXIT\n\r"); - rt_pm_release(mode); /*释放休眠模式*/ - return; - - default: break; - - }; - - /*当前的睡眠模式*/ - switch(mode) - { - case PM_SLEEP_MODE_NONE: rt_kprintf("PM_SLEEP_MODE_NONE\n\r"); - break; - case PM_SLEEP_MODE_IDLE: rt_kprintf("PM_SLEEP_MODE_IDLE\n\r"); - break; - case PM_SLEEP_MODE_LIGHT: rt_kprintf("PM_SLEEP_MODE_LIGHT\n\r"); - break; - case PM_SLEEP_MODE_DEEP: rt_kprintf("PM_SLEEP_MODE_DEEP\n\r"); - break; - case PM_SLEEP_MODE_STANDBY: rt_kprintf("PM_SLEEP_MODE_STANDBY\n\r"); - break; - case PM_SLEEP_MODE_SHUTDOWN: rt_kprintf("PM_SLEEP_MODE_SHUTDOWN\n\r"); - break; - case PM_SLEEP_MODE_MAX: rt_kprintf("PM_SLEEP_MODE_MAX\n\r"); - break; - default: break; - } - -} - -/* pm测试函数 */ -static void pm_test(void *parameter) -{ - int in_mode[7],i = 0; - - g_pm_data.in_fun_times = 0; - g_pm_data.flag = 0; - - in_mode[0] = PM_SLEEP_MODE_NONE; - in_mode[1] = PM_SLEEP_MODE_IDLE; - in_mode[2] = PM_SLEEP_MODE_LIGHT; - in_mode[3] = PM_SLEEP_MODE_DEEP; - in_mode[4] = PM_SLEEP_MODE_STANDBY; - in_mode[5] = PM_SLEEP_MODE_SHUTDOWN; - in_mode[6] = PM_SLEEP_MODE_MAX; - - /*设置回调函数和私有数据*/ - rt_pm_notify_set(sleep_in_out_callback,RT_NULL); - - while(i < SLEEP_TIMES) - { - - g_pm_data.mode = in_mode[i%6]; - - /*无休眠模式,不赋予标志*/ - if(g_pm_data.mode != PM_SLEEP_MODE_NONE) - { - g_pm_data.flag = 2; - - } - - /*请求选择的休眠模式*/ - rt_pm_request(in_mode[i%6]); - - rt_thread_mdelay(500); - - /*无休眠模式,不需要额外的等待*/ - while(( g_pm_data.flag != 0 )&&(g_pm_data.mode != PM_SLEEP_MODE_NONE)) - { - rt_thread_mdelay(500); - } - - /*释放选择的休眠模式*/ - rt_pm_release(in_mode[i%6]); - - i++; - - } - /*清除回调函数和私有数据*/ - rt_pm_notify_set(RT_NULL,RT_NULL); - rt_kprintf("thread pm_test close\n\r"); -} - -/*按键唤醒的回调函数*/ -void wake_by_pin(void *args) -{ - -} - -static int pm_sample(int argc, char *argv[]) -{ - rt_thread_t thread; - - /* 按键引脚为输入模式 */ - rt_pin_mode(WAKE_UP_PIN, PIN_MODE_INPUT_PULLUP); - - /* 绑定中断,下降沿模式,回调函数名为wake_by_pin */ - rt_pin_attach_irq(WAKE_UP_PIN, PIN_IRQ_MODE_RISING, wake_by_pin, RT_NULL); - /* 使能中断 */ - rt_pin_irq_enable(WAKE_UP_PIN, PIN_IRQ_ENABLE); - - thread = rt_thread_create("pm_test", pm_test, RT_NULL, 1024, 25, 10); - - if (thread != RT_NULL) - { - rt_thread_startup(thread); - } - else - { - rt_kprintf("create pm_test thread failed!\n\r"); - } - - return RT_EOK; -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(pm_sample, pm sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/pwm_led_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/pwm_led_sample.c deleted file mode 100644 index 1ac2361445..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/pwm_led_sample.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-11-25 misonyo first implementation. - */ -/* - * 程序清单:这是一个 PWM 设备使用例程 - * 例程导出了 pwm_led_sample 命令到控制终端 - * 命令调用格式:pwm_led_sample - * 程序功能:通过 PWM 设备控制 LED 灯的亮度,可以看到LED不停的由暗变到亮,然后又从亮变到暗。 -*/ - -#include -#include - -#define LED_PIN_NUM 45 /* PA12 LED PIN脚编号,查看驱动文件drv_gpio.c确定 */ -#define PWM_DEV_NAME "pwm0" /* PWM设备名称 */ -#define PWM_DEV_CHANNEL 2 /* PA9 PWM通道 */ - -struct rt_device_pwm *pwm_dev; /* PWM设备句柄 */ - -static int pwm_led_sample(int argc, char *argv[]) -{ - rt_uint32_t period, pulse, dir; - - period = 500000; /* 周期为0.5ms,单位为纳秒ns */ - dir = 1; /* PWM脉冲宽度值的增减方向 */ - pulse = 0; /* PWM脉冲宽度值,单位为纳秒ns */ - - /* 查找设备 */ - pwm_dev = (struct rt_device_pwm *)rt_device_find(PWM_DEV_NAME); - if (pwm_dev == RT_NULL) - { - rt_kprintf("pwm sample run failed! can't find %s device!\n", PWM_DEV_NAME); - return RT_ERROR; - } - - /* 设置PWM周期和脉冲宽度默认值 */ - rt_pwm_set(pwm_dev, PWM_DEV_CHANNEL, period, pulse); - /* 使能设备 */ - rt_pwm_enable(pwm_dev, PWM_DEV_CHANNEL); - - while (1) - { - rt_thread_mdelay(50); - if (dir) - { - pulse += 5000; /* 从0值开始每次增加5000ns */ - } - else - { - pulse -= 5000; /* 从最大值开始每次减少5000ns */ - } - if (pulse >= period) - { - dir = 0; - } - if (0 == pulse) - { - dir = 1; - } - - /* 设置PWM周期和脉冲宽度 */ - rt_pwm_set(pwm_dev, PWM_DEV_CHANNEL, period, pulse); - } -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(pwm_led_sample, pwm sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/rtc_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/rtc_sample.c deleted file mode 100644 index 711a3a0ebb..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/rtc_sample.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-11-30 misonyo first implementation. - */ -/* - * 程序清单:这是一个 RTC 设备使用例程 - * 例程导出了 rtc_sample 命令到控制终端 - * 命令调用格式:rtc_sample - * 程序功能:设置RTC设备的日期和时间,延时一段时间后获取当前时间并打印显示。 -*/ - -#include -#include - -static int rtc_sample(int argc, char *argv[]) -{ - rt_err_t ret = RT_EOK; - time_t now; - - /* 设置日期 */ - ret = set_date(2018, 12, 3); - if (ret != RT_EOK) - { - rt_kprintf("set RTC date failed\n"); - return ret; - } - - /* 设置时间 */ - ret = set_time(11, 15, 50); - if (ret != RT_EOK) - { - rt_kprintf("set RTC time failed\n"); - return ret; - } - - /* 延时3秒 */ - rt_thread_mdelay(3000); - - /* 获取时间 */ - now = time(RT_NULL); - rt_kprintf("%s\n", ctime(&now)); - - return ret; -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(rtc_sample, rtc sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/spi_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/spi_sample.c deleted file mode 100644 index 994888cdb0..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/spi_sample.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2020-12-15 liuhy first implementation. - */ -/* - * 程序清单:这是一个 SPI 设备使用例程 - * 例程导出了 spi_io_sample 命令到控制终端 - * 命令调用格式:spi_io_sample - * 程序功能:通过SPI设备先读取数据,然后每个字符加1后输出。 -*/ - -#include -#include - -#define SPI_DEVICE_NAME "spi00" -#define BUF_LEN 16 - -static void spi_io_sample(int argc, char *argv[]) -{ - struct rt_spi_device * spi_dev; /* spi设备的句柄 */ - struct rt_spi_configuration spi_config; - rt_uint8_t i,buffer[BUF_LEN] = { 0U }; - rt_err_t s_stat; - rt_err_t result; - - /* 查找 spi设备 获取spi设备句柄 */ - spi_dev = (struct rt_spi_device *)rt_device_find(SPI_DEVICE_NAME); - - if (spi_dev == RT_NULL) - { - rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_DEVICE_NAME); - return; - } - - - /* 清空配置结构体 */ - rt_memset(&spi_config,0,sizeof(struct rt_spi_configuration)); - - spi_config.mode &= ~RT_SPI_SLAVE; /* 主机模式 */ - spi_config.mode &= ~RT_SPI_3WIRE; /* 4线,双向传输 */ - spi_config.mode |= RT_SPI_CPHA; /* 第二边沿采样 */ - spi_config.mode |= RT_SPI_CPOL; /* 空闲高电平 */ - spi_config.mode |= RT_SPI_NO_CS; /* 禁用软件从机选择管理 */ - spi_config.mode |= RT_SPI_MSB; /* 高位在前 */ - - spi_config.data_width = 8; /* 数据长度:8 */ - - spi_config.max_hz = 2000000; /* 最快时钟频率 */ - - /* 配置SPI设备 */ - s_stat = rt_spi_configure(spi_dev,&spi_config); - - if(s_stat != RT_EOK) - { - rt_kprintf(" spi config fail !\n "); - return; - } - - - /* 获取总线 ,防止总线被多个线程同时使用 */ - result = rt_spi_take_bus(spi_dev); - - if (result != RT_EOK) - { - rt_kprintf(" %s take spi bus failed! \n", SPI_DEVICE_NAME); - return; - } - - /* 选中片选 */ - result = rt_spi_take(spi_dev); - - if (result != RT_EOK) - { - rt_kprintf(" %s take spi cs failed! \n", SPI_DEVICE_NAME); - return; - } - - - /*接收一次数据*/ - result = rt_spi_recv(spi_dev,buffer,BUF_LEN); - - if(result != BUF_LEN) - { - rt_kprintf("receive fail. \n buffer is : %s \n:",buffer); - - for( i = 0 ; i < BUF_LEN ; i++) - rt_kprintf(" %x",(unsigned int)buffer[i]); - - rt_kprintf("\n"); - - return; - } - - rt_kprintf("receive successful. \n buffer is : %s \n:",buffer); - - for( i = 0 ; i < BUF_LEN ; i++) - rt_kprintf(" %x",(unsigned int)buffer[i]); - - rt_kprintf("\n"); - - /* 将接收到的数据加1 */ - for( i = 0 ; i < BUF_LEN ; i++) - buffer[i]++; - - /*发送数据*/ - result = rt_spi_send(spi_dev,buffer,BUF_LEN); - - if(result != BUF_LEN) - { - rt_kprintf("send fail. \n buffer is : %s \n:",buffer); - - for( i = 0 ; i < BUF_LEN ; i++) - rt_kprintf(" %x",(unsigned int)buffer[i]); - - rt_kprintf("\n"); - - return; - } - - rt_kprintf("send successful. \n buffer is : %s \n:",buffer); - - for( i = 0 ; i < BUF_LEN ; i++) - rt_kprintf(" %x",(unsigned int)buffer[i]); - - rt_kprintf("\n"); - - /* 释放片选 */ - result = rt_spi_release(spi_dev); - - if (result != RT_EOK) - { - rt_kprintf(" %s release spi cs failed! \n", SPI_DEVICE_NAME); - return; - } - - /* 释放总线 */ - result = rt_spi_release_bus(spi_dev); - - if (result != RT_EOK) - { - rt_kprintf(" %s release spi bus failed! \n", SPI_DEVICE_NAME); - return; - } - -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(spi_io_sample, spi sample); diff --git a/bsp/essemi/es32f0334/drivers/bsp_driver_example/uart_sample.c b/bsp/essemi/es32f0334/drivers/bsp_driver_example/uart_sample.c deleted file mode 100644 index cbfd6bccef..0000000000 --- a/bsp/essemi/es32f0334/drivers/bsp_driver_example/uart_sample.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2018-08-15 misonyo first implementation. - */ -/* - * 程序清单:这是一个 串口 设备使用例程 - * 例程导出了 uart_sample 命令到控制终端 - * 命令调用格式:uart_sample uart2 - * 命令解释:命令第二个参数是要使用的串口设备名称,为空则使用默认的串口设备 - * 程序功能:通过串口输出字符串"hello RT-Thread!",然后错位输出输入的字符 -*/ - -#include - -#define SAMPLE_UART_NAME "uart1" /* 串口设备名称 */ - -/* 用于接收消息的信号量 */ -static struct rt_semaphore rx_sem; -static rt_device_t serial; - -/* 接收数据回调函数 */ -static rt_err_t uart_input(rt_device_t dev, rt_size_t size) -{ - /* 串口接收到数据后产生中断,调用此回调函数,然后发送接收信号量 */ - rt_sem_release(&rx_sem); - - return RT_EOK; -} - -static void serial_thread_entry(void *parameter) -{ - char ch; - - while (1) - { - /* 从串口读取一个字节的数据,没有读取到则等待接收信号量 */ - while (rt_device_read(serial, -1, &ch, 1) != 1) - { - /* 阻塞等待接收信号量,等到信号量后再次读取数据 */ - rt_sem_take(&rx_sem, RT_WAITING_FOREVER); - } - /* 读取到的数据通过串口错位输出 */ - ch = ch + 1; - rt_device_write(serial, 0, &ch, 1); - } -} - -static int uart_sample(int argc, char *argv[]) -{ - rt_err_t ret = RT_EOK; - char uart_name[RT_NAME_MAX]; - char str[] = "hello RT-Thread!\r\n"; - - if (argc == 2) - { - rt_strncpy(uart_name, argv[1], RT_NAME_MAX); - } - else - { - rt_strncpy(uart_name, SAMPLE_UART_NAME, RT_NAME_MAX); - } - - /* 查找串口设备 */ - serial = rt_device_find(uart_name); - if (!serial) - { - rt_kprintf("find %s failed!\n", uart_name); - return RT_ERROR; - } - - /* 初始化信号量 */ - rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO); - /* 以中断接收及轮询发送方式打开串口设备 */ - rt_device_open(serial, RT_DEVICE_FLAG_INT_RX); - /* 设置接收回调函数 */ - rt_device_set_rx_indicate(serial, uart_input); - /* 发送字符串 */ - rt_device_write(serial, 0, str, (sizeof(str) - 1)); - - /* 创建 serial 线程 */ - rt_thread_t thread = rt_thread_create("serial", serial_thread_entry, RT_NULL, 1024, 25, 10); - /* 创建成功则启动线程 */ - if (thread != RT_NULL) - { - rt_thread_startup(thread); - } - else - { - ret = RT_ERROR; - } - - return ret; -} -/* 导出到 msh 命令列表中 */ -MSH_CMD_EXPORT(uart_sample, uart device sample); diff --git a/bsp/essemi/es32f0334/drivers/drv_adc.c b/bsp/essemi/es32f0334/drivers/drv_adc.c deleted file mode 100644 index d9f1e5b899..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_adc.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-04-08 wangyq the first version - * 2019-11-01 wangyq update libraries - */ - -#include -#include -#include -#include "board.h" -#include "drv_adc.h" -#include -#include - -#ifdef RT_USING_ADC - -/* define adc instance */ -static struct rt_adc_device _device_adc0; - -/* enable or disable adc */ -static rt_err_t es32f0_adc_enabled(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled) -{ - adc_handle_t *_hadc = (adc_handle_t *)device->parent.user_data; - - RT_ASSERT(device != RT_NULL); - - if (enabled) - { - ADC_ENABLE(_hadc); - } - else - { - ADC_DISABLE(_hadc); - } - - return RT_EOK; -} - -static adc_channel_t es32f0_adc_get_channel(rt_uint32_t channel) -{ - adc_channel_t es32f0_channel; - gpio_init_t gpio_initstruct; - - /* Initialize ADC pin */ - gpio_initstruct.mode = GPIO_MODE_INPUT; - gpio_initstruct.pupd = GPIO_FLOATING; - gpio_initstruct.odrv = GPIO_OUT_DRIVE_NORMAL; - gpio_initstruct.flt = GPIO_FILTER_DISABLE; - gpio_initstruct.type = GPIO_TYPE_CMOS; - gpio_initstruct.func = GPIO_FUNC_0; - - /* select gpio pin as adc function */ - switch (channel) - { - case 0: - es32f0_channel = ADC_CHANNEL_0; - ald_gpio_init(GPIOC, GPIO_PIN_0, &gpio_initstruct); - break; - case 1: - es32f0_channel = ADC_CHANNEL_1; - ald_gpio_init(GPIOC, GPIO_PIN_1, &gpio_initstruct); - break; - case 2: - es32f0_channel = ADC_CHANNEL_2; - ald_gpio_init(GPIOC, GPIO_PIN_2, &gpio_initstruct); - break; - case 3: - es32f0_channel = ADC_CHANNEL_3; - ald_gpio_init(GPIOC, GPIO_PIN_3, &gpio_initstruct); - break; - case 4: - es32f0_channel = ADC_CHANNEL_4; - ald_gpio_init(GPIOA, GPIO_PIN_0, &gpio_initstruct); - break; - case 5: - es32f0_channel = ADC_CHANNEL_5; - ald_gpio_init(GPIOA, GPIO_PIN_1, &gpio_initstruct); - break; - case 6: - es32f0_channel = ADC_CHANNEL_6; - ald_gpio_init(GPIOA, GPIO_PIN_2, &gpio_initstruct); - break; - case 7: - es32f0_channel = ADC_CHANNEL_7; - ald_gpio_init(GPIOA, GPIO_PIN_3, &gpio_initstruct); - break; - case 8: - es32f0_channel = ADC_CHANNEL_8; - ald_gpio_init(GPIOA, GPIO_PIN_4, &gpio_initstruct); - break; - case 9: - es32f0_channel = ADC_CHANNEL_9; - ald_gpio_init(GPIOA, GPIO_PIN_5, &gpio_initstruct); - break; - case 10: - es32f0_channel = ADC_CHANNEL_10; - ald_gpio_init(GPIOA, GPIO_PIN_6, &gpio_initstruct); - break; - case 11: - es32f0_channel = ADC_CHANNEL_11; - ald_gpio_init(GPIOA, GPIO_PIN_7, &gpio_initstruct); - break; - case 12: - es32f0_channel = ADC_CHANNEL_12; - ald_gpio_init(GPIOC, GPIO_PIN_4, &gpio_initstruct); - break; - case 13: - es32f0_channel = ADC_CHANNEL_13; - ald_gpio_init(GPIOC, GPIO_PIN_5, &gpio_initstruct); - break; - case 14: - es32f0_channel = ADC_CHANNEL_14; - ald_gpio_init(GPIOB, GPIO_PIN_0, &gpio_initstruct); - break; - case 15: - es32f0_channel = ADC_CHANNEL_15; - ald_gpio_init(GPIOB, GPIO_PIN_1, &gpio_initstruct); - break; - case 16: - es32f0_channel = ADC_CHANNEL_16; - break; - case 17: - es32f0_channel = ADC_CHANNEL_17; - break; - case 18: - es32f0_channel = ADC_CHANNEL_18; - break; - default: - break; - } - - return es32f0_channel; -} - -static rt_err_t es32f0_get_adc_value(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value) -{ - adc_handle_t *_hadc = (adc_handle_t *)device->parent.user_data; - adc_nch_conf_t nm_config; - - RT_ASSERT(device != RT_NULL); - RT_ASSERT(value != RT_NULL); - - /* config adc channel */ - nm_config.ch = es32f0_adc_get_channel(channel); - nm_config.idx = ADC_NCH_IDX_1; - nm_config.samp = ADC_SAMPLETIME_4; - ald_adc_normal_channel_config(_hadc, &nm_config); - - ald_adc_normal_start(_hadc); - - if (ald_adc_normal_poll_for_conversion(_hadc, 5000) == OK) - *value = ald_adc_normal_get_value(_hadc); - - return RT_EOK; -} - -static const struct rt_adc_ops es32f0_adc_ops = -{ - es32f0_adc_enabled, - es32f0_get_adc_value, -}; - -int rt_hw_adc_init(void) -{ - int result = RT_EOK; - static adc_handle_t _h_adc0; - - /* adc function initialization */ - _h_adc0.perh = ADC0; - _h_adc0.init.align = ADC_DATAALIGN_RIGHT; - _h_adc0.init.scan = DISABLE; - _h_adc0.init.cont = DISABLE; - _h_adc0.init.disc = ADC_ALL_DISABLE; - _h_adc0.init.disc_nr = ADC_DISC_NR_1; - _h_adc0.init.data_bit = ADC_CONV_BIT_12; - _h_adc0.init.div = ADC_CKDIV_128; - _h_adc0.init.nche_sel = ADC_NCHESEL_MODE_ALL; - _h_adc0.init.n_ref = ADC_NEG_REF_VSS; - _h_adc0.init.p_ref = ADC_POS_REF_VDD; - ald_adc_init(&_h_adc0); - - rt_hw_adc_register(&_device_adc0, "adc0", &es32f0_adc_ops, &_h_adc0); - - return result; -} -INIT_BOARD_EXPORT(rt_hw_adc_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_adc.h b/bsp/essemi/es32f0334/drivers/drv_adc.h deleted file mode 100644 index eaddd67407..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_adc.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-04-03 wangyq the first version - */ - -#ifndef DRV_ADC_H__ -#define DRV_ADC_H__ - -int rt_hw_adc_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_gpio.c b/bsp/essemi/es32f0334/drivers/drv_gpio.c deleted file mode 100644 index d816af5fd3..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_gpio.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-01 wangyq the first version - * 2019-11-01 wangyq update libraries - */ - -#include -#include -#include "board.h" -#include "drv_gpio.h" -#include -#include - -#ifdef RT_USING_PIN - -#define __ES32F0_PIN(index, gpio, gpio_index) {index, GPIO##gpio, GPIO_PIN_##gpio_index} -#define __ES32F0_PIN_DEFAULT {-1, 0, 0} - -/* ES32F0 GPIO driver */ -struct pin_index -{ - int index; - GPIO_TypeDef *gpio; - uint32_t pin; -}; - -static const struct pin_index pins[] = -{ - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(2, C, 13), - __ES32F0_PIN(3, C, 14), - __ES32F0_PIN(4, C, 15), - __ES32F0_PIN(5, H, 0), - __ES32F0_PIN(6, H, 1), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(8, C, 0), - __ES32F0_PIN(9, C, 1), - __ES32F0_PIN(10, C, 2), - __ES32F0_PIN(11, C, 3), - __ES32F0_PIN(12, H, 3), - __ES32F0_PIN(13, H, 4), - __ES32F0_PIN(14, A, 0), - __ES32F0_PIN(15, A, 1), - __ES32F0_PIN(16, A, 2), - __ES32F0_PIN(17, A, 3), - __ES32F0_PIN(18, F, 0), - __ES32F0_PIN(19, F, 1), - __ES32F0_PIN(20, A, 4), - __ES32F0_PIN(21, A, 5), - __ES32F0_PIN(22, A, 6), - __ES32F0_PIN(23, A, 7), - __ES32F0_PIN(24, C, 4), - __ES32F0_PIN(25, C, 5), - __ES32F0_PIN(26, B, 0), - __ES32F0_PIN(27, B, 1), - __ES32F0_PIN(28, B, 2), - __ES32F0_PIN(29, B, 10), - __ES32F0_PIN(30, B, 11), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(33, B, 12), - __ES32F0_PIN(34, B, 13), - __ES32F0_PIN(35, B, 14), - __ES32F0_PIN(36, B, 15), - __ES32F0_PIN(37, C, 6), - __ES32F0_PIN(38, C, 7), - __ES32F0_PIN(39, C, 8), - __ES32F0_PIN(40, C, 9), - __ES32F0_PIN(41, A, 8), - __ES32F0_PIN(42, A, 9), - __ES32F0_PIN(43, A, 10), - __ES32F0_PIN(44, A, 11), - __ES32F0_PIN(45, A, 12), - __ES32F0_PIN(46, A, 13), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN(49, A, 14), - __ES32F0_PIN(50, A, 15), - __ES32F0_PIN(51, C, 10), - __ES32F0_PIN(52, C, 11), - __ES32F0_PIN(53, C, 12), - __ES32F0_PIN(54, D, 2), - __ES32F0_PIN(55, B, 3), - __ES32F0_PIN(56, B, 4), - __ES32F0_PIN(57, B, 5), - __ES32F0_PIN(58, B, 6), - __ES32F0_PIN(59, B, 7), - __ES32F0_PIN(60, H, 2), - __ES32F0_PIN(61, B, 8), - __ES32F0_PIN(62, E, 1), - __ES32F0_PIN_DEFAULT, - __ES32F0_PIN_DEFAULT, -}; - -struct pin_irq_map -{ - rt_uint16_t pinbit; - IRQn_Type irqno; -}; -static const struct pin_irq_map pin_irq_map[] = -{ - {GPIO_PIN_0, EXTI0_3_IRQn}, - {GPIO_PIN_1, EXTI0_3_IRQn}, - {GPIO_PIN_2, EXTI0_3_IRQn}, - {GPIO_PIN_3, EXTI0_3_IRQn}, - {GPIO_PIN_4, EXTI4_7_IRQn}, - {GPIO_PIN_5, EXTI4_7_IRQn}, - {GPIO_PIN_6, EXTI4_7_IRQn}, - {GPIO_PIN_7, EXTI4_7_IRQn}, - {GPIO_PIN_8, EXTI8_11_IRQn}, - {GPIO_PIN_9, EXTI8_11_IRQn}, - {GPIO_PIN_10, EXTI8_11_IRQn}, - {GPIO_PIN_11, EXTI8_11_IRQn}, - {GPIO_PIN_12, EXTI12_15_IRQn}, - {GPIO_PIN_13, EXTI12_15_IRQn}, - {GPIO_PIN_14, EXTI12_15_IRQn}, - {GPIO_PIN_15, EXTI12_15_IRQn}, -}; - -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}, -}; - -#define ITEM_NUM(items) sizeof(items) / sizeof(items[0]) -const struct pin_index *get_pin(uint8_t pin) -{ - const struct pin_index *index; - if (pin < ITEM_NUM(pins)) - { - index = &pins[pin]; - if (index->index == -1) - index = RT_NULL; - } - else - { - index = RT_NULL; - } - return index; -}; - -void es32f0_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value) -{ - const struct pin_index *index; - index = get_pin(pin); - if (index == RT_NULL) - { - return; - } - ald_gpio_write_pin(index->gpio, index->pin, value); -} - -int es32f0_pin_read(rt_device_t dev, rt_base_t pin) -{ - int value; - const struct pin_index *index; - value = PIN_LOW; - index = get_pin(pin); - if (index == RT_NULL) - { - return value; - } - value = ald_gpio_read_pin(index->gpio, index->pin); - return value; -} - -void es32f0_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) -{ - const struct pin_index *index; - gpio_init_t gpio_initstruct; - index = get_pin(pin); - if (index == RT_NULL) - { - return; - } - - /* Configure GPIO_InitStructure */ - gpio_initstruct.mode = GPIO_MODE_OUTPUT; - gpio_initstruct.func = GPIO_FUNC_1; - gpio_initstruct.odrv = GPIO_OUT_DRIVE_NORMAL; - gpio_initstruct.type = GPIO_TYPE_CMOS; - gpio_initstruct.pupd = GPIO_FLOATING; - gpio_initstruct.odos = GPIO_PUSH_PULL; - - if (mode == PIN_MODE_OUTPUT) - { - /* output setting */ - gpio_initstruct.mode = GPIO_MODE_OUTPUT; - gpio_initstruct.pupd = GPIO_FLOATING; - } - else if (mode == PIN_MODE_INPUT) - { - /* input setting: not pull. */ - gpio_initstruct.mode = GPIO_MODE_INPUT; - gpio_initstruct.pupd = GPIO_FLOATING; - } - else if (mode == PIN_MODE_INPUT_PULLUP) - { - /* input setting: pull up. */ - gpio_initstruct.mode = GPIO_MODE_INPUT; - gpio_initstruct.pupd = GPIO_PUSH_UP; - } - else if (mode == PIN_MODE_INPUT_PULLDOWN) - { - /* input setting: pull down. */ - gpio_initstruct.mode = GPIO_MODE_INPUT; - gpio_initstruct.pupd = GPIO_PUSH_DOWN; - } - else if (mode == PIN_MODE_OUTPUT_OD) - { - /* output setting: od. */ - gpio_initstruct.mode = GPIO_MODE_OUTPUT; - gpio_initstruct.pupd = GPIO_FLOATING; - gpio_initstruct.odos = GPIO_OPEN_DRAIN; - } - ald_gpio_init(index->gpio, index->pin, &gpio_initstruct); -} - -rt_inline const struct pin_irq_map *get_pin_irq_map(rt_uint16_t gpio_pin) -{ - rt_int32_t mapindex = gpio_pin & 0x00FF; - if (mapindex < 0 || mapindex >= ITEM_NUM(pin_irq_map)) - { - return RT_NULL; - } - return &pin_irq_map[mapindex]; -}; - -rt_err_t es32f0_pin_attach_irq(struct rt_device *device, rt_int32_t pin, - rt_uint32_t mode, void (*hdr)(void *args), void *args) -{ - const struct pin_index *index; - rt_base_t level; - rt_int32_t irqindex; - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - /* pin no. convert to dec no. */ - for (irqindex = 0; irqindex < 16; irqindex++) - { - if ((0x01 << irqindex) == index->pin) - { - break; - } - } - if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) - { - return RT_ENOSYS; - } - 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; -} - -rt_err_t es32f0_pin_detach_irq(struct rt_device *device, rt_int32_t pin) -{ - const struct pin_index *index; - rt_base_t level; - rt_int32_t irqindex = -1; - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - irqindex = index->pin & 0x00FF; - if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) - { - return RT_ENOSYS; - } - 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; -} - -rt_err_t es32f0_pin_irq_enable(struct rt_device *device, rt_base_t pin, - rt_uint32_t enabled) -{ - const struct pin_index *index; - const struct pin_irq_map *irqmap; - rt_base_t level; - rt_int32_t irqindex = -1; - /* Configure GPIO_InitStructure & EXTI_InitStructure */ - gpio_init_t gpio_initstruct; - exti_init_t exti_initstruct; - exti_initstruct.filter = DISABLE; - exti_initstruct.cks = EXTI_FILTER_CLOCK_10K; - exti_initstruct.filter_time = 0x0; - - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - if (enabled == PIN_IRQ_ENABLE) - { - /* pin no. convert to dec no. */ - for (irqindex = 0; irqindex < 16; irqindex++) - { - if ((0x01 << irqindex) == index->pin) - { - break; - } - } - if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) - { - return RT_ENOSYS; - } - level = rt_hw_interrupt_disable(); - if (pin_irq_hdr_tab[irqindex].pin == -1) - { - rt_hw_interrupt_enable(level); - return RT_ENOSYS; - } - irqmap = &pin_irq_map[irqindex]; - ald_gpio_exti_init(index->gpio, index->pin, &exti_initstruct); - /* Configure GPIO_InitStructure */ - gpio_initstruct.mode = GPIO_MODE_INPUT; - gpio_initstruct.func = GPIO_FUNC_1; - switch (pin_irq_hdr_tab[irqindex].mode) - { - case PIN_IRQ_MODE_RISING: - gpio_initstruct.pupd = GPIO_PUSH_DOWN; - ald_gpio_exti_interrupt_config(index->pin, EXTI_TRIGGER_RISING_EDGE, ENABLE); - break; - case PIN_IRQ_MODE_FALLING: - gpio_initstruct.pupd = GPIO_PUSH_UP; - ald_gpio_exti_interrupt_config(index->pin, EXTI_TRIGGER_TRAILING_EDGE, ENABLE); - break; - case PIN_IRQ_MODE_RISING_FALLING: - gpio_initstruct.pupd = GPIO_FLOATING; - ald_gpio_exti_interrupt_config(index->pin, EXTI_TRIGGER_BOTH_EDGE, ENABLE); - break; - } - ald_gpio_init(index->gpio, index->pin, &gpio_initstruct); - NVIC_EnableIRQ(irqmap->irqno); - rt_hw_interrupt_enable(level); - } - else if (enabled == PIN_IRQ_DISABLE) - { - irqmap = get_pin_irq_map(index->pin); - if (irqmap == RT_NULL) - { - return RT_ENOSYS; - } - NVIC_DisableIRQ(irqmap->irqno); - } - else - { - return RT_ENOSYS; - } - return RT_EOK; -} - -const static struct rt_pin_ops _es32f0_pin_ops = -{ - es32f0_pin_mode, - es32f0_pin_write, - es32f0_pin_read, - es32f0_pin_attach_irq, - es32f0_pin_detach_irq, - es32f0_pin_irq_enable, - RT_NULL, -}; - -int rt_hw_pin_init(void) -{ - int result; - ald_cmu_perh_clock_config(CMU_PERH_GPIO, ENABLE); - result = rt_device_pin_register("pin", &_es32f0_pin_ops, RT_NULL); - return result; -} -INIT_BOARD_EXPORT(rt_hw_pin_init); - -rt_inline void pin_irq_hdr(uint16_t GPIO_Pin) -{ - uint16_t irqno; - /* pin no. convert to dec no. */ - for (irqno = 0; irqno < 16; irqno++) - { - if ((0x01 << irqno) == GPIO_Pin) - { - break; - } - } - if (irqno == 16) - return; - if (pin_irq_hdr_tab[irqno].hdr) - { - pin_irq_hdr_tab[irqno].hdr(pin_irq_hdr_tab[irqno].args); - } -} - -void GPIO_EXTI_Callback(uint16_t GPIO_Pin) -{ - if (ald_gpio_exti_get_flag_status(GPIO_Pin) != RESET) - { - ald_gpio_exti_clear_flag_status(GPIO_Pin); - pin_irq_hdr(GPIO_Pin); - } -} - -void EXTI0_3_Handler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(GPIO_PIN_0); - GPIO_EXTI_Callback(GPIO_PIN_1); - GPIO_EXTI_Callback(GPIO_PIN_2); - GPIO_EXTI_Callback(GPIO_PIN_3); - rt_interrupt_leave(); -} - -void EXTI4_7_Handler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(GPIO_PIN_4); - GPIO_EXTI_Callback(GPIO_PIN_5); - GPIO_EXTI_Callback(GPIO_PIN_6); - GPIO_EXTI_Callback(GPIO_PIN_7); - rt_interrupt_leave(); -} - -void EXTI8_11_Handler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(GPIO_PIN_8); - GPIO_EXTI_Callback(GPIO_PIN_9); - GPIO_EXTI_Callback(GPIO_PIN_10); - GPIO_EXTI_Callback(GPIO_PIN_11); - rt_interrupt_leave(); -} - -void EXTI12_15_Handler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(GPIO_PIN_12); - GPIO_EXTI_Callback(GPIO_PIN_13); - GPIO_EXTI_Callback(GPIO_PIN_14); - GPIO_EXTI_Callback(GPIO_PIN_15); - rt_interrupt_leave(); -} - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_gpio.h b/bsp/essemi/es32f0334/drivers/drv_gpio.h deleted file mode 100644 index 506ab8cce6..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_gpio.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-01 wangyq the first version - */ - -#ifndef DRV_GPIO_H__ -#define DRV_GPIO_H__ - -int rt_hw_pin_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_hwtimer.c b/bsp/essemi/es32f0334/drivers/drv_hwtimer.c deleted file mode 100644 index 499a7b429d..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_hwtimer.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-3-19 wangyq the first version - * 2019-11-01 wangyq update libraries - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef RT_USING_HWTIMER - -struct es32f0_hwtimer_dev -{ - rt_hwtimer_t parent; - timer_handle_t *hwtimer_periph; - IRQn_Type IRQn; -}; - -#ifdef BSP_USING_HWTIMER0 -static struct es32f0_hwtimer_dev hwtimer0; - -void BS16T0_Handler(void) -{ - ald_timer_clear_flag_status(hwtimer0.hwtimer_periph, TIMER_FLAG_UPDATE); - rt_device_hwtimer_isr(&hwtimer0.parent); - - if (HWTIMER_MODE_ONESHOT == hwtimer0.parent.mode) - { - ald_timer_base_stop(hwtimer0.hwtimer_periph); - } -} -#endif - -#ifdef BSP_USING_HWTIMER1 -static struct es32f0_hwtimer_dev hwtimer1; - -void BS16T1_UART2_Handler(void) -{ - if (ald_timer_get_it_status(hwtimer1.hwtimer_periph, TIMER_IT_UPDATE) && - ald_timer_get_flag_status(hwtimer1.hwtimer_periph, TIMER_FLAG_UPDATE)) - { - ald_timer_clear_flag_status(hwtimer1.hwtimer_periph, TIMER_FLAG_UPDATE); - rt_device_hwtimer_isr(&hwtimer1.parent); - - if (HWTIMER_MODE_ONESHOT == hwtimer1.parent.mode) - { - ald_timer_base_stop(hwtimer1.hwtimer_periph); - } - } -} -#endif - -#ifdef BSP_USING_HWTIMER2 -static struct es32f0_hwtimer_dev hwtimer2; - -void BS16T2_UART3_Handler(void) -{ - if (ald_timer_get_it_status(hwtimer2.hwtimer_periph, TIMER_IT_UPDATE) && - ald_timer_get_flag_status(hwtimer2.hwtimer_periph, TIMER_FLAG_UPDATE)) - { - ald_timer_clear_flag_status(hwtimer2.hwtimer_periph, TIMER_FLAG_UPDATE); - rt_device_hwtimer_isr(&hwtimer2.parent); - - if (HWTIMER_MODE_ONESHOT == hwtimer2.parent.mode) - { - ald_timer_base_stop(hwtimer2.hwtimer_periph); - } - } -} -#endif - -#ifdef BSP_USING_HWTIMER3 -static struct es32f0_hwtimer_dev hwtimer3; -/* can not use when DAC0 Handler is enabled */ -void BS16T3_DAC0_Handler(void) -{ - /* if BS16T3 it */ - if (ald_timer_get_it_status(hwtimer3.hwtimer_periph, TIMER_IT_UPDATE) && - ald_timer_get_flag_status(hwtimer3.hwtimer_periph, TIMER_FLAG_UPDATE)) - { - ald_timer_clear_flag_status(hwtimer3.hwtimer_periph, TIMER_FLAG_UPDATE); - rt_device_hwtimer_isr(&hwtimer3.parent); - - if (HWTIMER_MODE_ONESHOT == hwtimer3.parent.mode) - { - ald_timer_base_stop(hwtimer3.hwtimer_periph); - } - } -} -#endif - -static struct rt_hwtimer_info es32f0_hwtimer_info = -{ - 48000000, /* maximum count frequency */ - 1, /* minimum count frequency */ - 65535, /* counter maximum value */ - HWTIMER_CNTMODE_UP -}; - -static void es32f0_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - if (1 == state) - { - ald_timer_base_init(hwtimer->hwtimer_periph); - ald_timer_interrupt_config(hwtimer->hwtimer_periph, TIMER_IT_UPDATE, ENABLE); - NVIC_EnableIRQ(hwtimer->IRQn); - } - hwtimer->parent.freq = ald_cmu_get_pclk1_clock(); - es32f0_hwtimer_info.maxfreq = ald_cmu_get_pclk1_clock(); - es32f0_hwtimer_info.minfreq = ald_cmu_get_pclk1_clock(); -} - -static rt_err_t es32f0_hwtimer_start(rt_hwtimer_t *timer, - rt_uint32_t cnt, - rt_hwtimer_mode_t mode) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - WRITE_REG(hwtimer->hwtimer_periph->perh->AR, cnt); - ald_timer_base_start(hwtimer->hwtimer_periph); - - return RT_EOK; -} - -static void es32f0_hwtimer_stop(rt_hwtimer_t *timer) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - ald_timer_base_stop(hwtimer->hwtimer_periph); -} - -static rt_uint32_t es32f0_hwtimer_count_get(rt_hwtimer_t *timer) -{ - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - uint32_t hwtimer_count = 0; - - RT_ASSERT(hwtimer != RT_NULL); - - hwtimer_count = READ_REG(hwtimer->hwtimer_periph->perh->COUNT); - - return hwtimer_count; -} - -static rt_err_t es32f0_hwtimer_control(rt_hwtimer_t *timer, - rt_uint32_t cmd, - void *args) -{ - rt_err_t ret = RT_EOK; - rt_uint32_t freq = 0; - struct es32f0_hwtimer_dev *hwtimer = (struct es32f0_hwtimer_dev *)timer->parent.user_data; - - RT_ASSERT(hwtimer != RT_NULL); - - switch (cmd) - { - case HWTIMER_CTRL_FREQ_SET: - freq = *(rt_uint32_t *)args; - if (freq != ald_cmu_get_pclk1_clock()) - { - ret = -RT_ERROR; - } - break; - - case HWTIMER_CTRL_STOP: - ald_timer_base_stop(hwtimer->hwtimer_periph); - break; - - default: - ret = RT_EINVAL; - break; - } - - return ret; -} - -static struct rt_hwtimer_ops es32f0_hwtimer_ops = -{ - es32f0_hwtimer_init, - es32f0_hwtimer_start, - es32f0_hwtimer_stop, - es32f0_hwtimer_count_get, - es32f0_hwtimer_control -}; - -int rt_hw_hwtimer_init(void) -{ - rt_err_t ret = RT_EOK; - -#ifdef BSP_USING_HWTIMER0 - static timer_handle_t _hwtimer_periph0; - _hwtimer_periph0.perh = BS16T0; - hwtimer0.IRQn = BS16T0_IRQn; - hwtimer0.hwtimer_periph = &_hwtimer_periph0; - hwtimer0.parent.info = &es32f0_hwtimer_info; - hwtimer0.parent.ops = &es32f0_hwtimer_ops; - ret = rt_device_hwtimer_register(&hwtimer0.parent, "timer0", &hwtimer0); -#endif - -#ifdef BSP_USING_HWTIMER1 - static timer_handle_t _hwtimer_periph1; - _hwtimer_periph1.perh = BS16T1; - hwtimer1.IRQn = BS16T1_UART2_IRQn; - hwtimer1.hwtimer_periph = &_hwtimer_periph1; - hwtimer1.parent.info = &es32f0_hwtimer_info; - hwtimer1.parent.ops = &es32f0_hwtimer_ops; - ret = rt_device_hwtimer_register(&hwtimer1.parent, "timer1", &hwtimer1); -#endif - -#ifdef BSP_USING_HWTIMER2 - static timer_handle_t _hwtimer_periph2; - _hwtimer_periph2.perh = BS16T2; - hwtimer2.IRQn = BS16T2_UART3_IRQn; - hwtimer2.hwtimer_periph = &_hwtimer_periph2; - hwtimer2.parent.info = &es32f0_hwtimer_info; - hwtimer2.parent.ops = &es32f0_hwtimer_ops; - ret = rt_device_hwtimer_register(&hwtimer2.parent, "timer2", &hwtimer2); -#endif - -#ifdef BSP_USING_HWTIMER3 - static timer_handle_t _hwtimer_periph3; - _hwtimer_periph3.perh = BS16T3; - hwtimer3.IRQn = BS16T3_DAC0_IRQn; - hwtimer3.hwtimer_periph = &_hwtimer_periph3; - hwtimer3.parent.info = &es32f0_hwtimer_info; - hwtimer3.parent.ops = &es32f0_hwtimer_ops; - ret = rt_device_hwtimer_register(&hwtimer3.parent, "timer3", &hwtimer3); -#endif - - return ret; -} -INIT_BOARD_EXPORT(rt_hw_hwtimer_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_hwtimer.h b/bsp/essemi/es32f0334/drivers/drv_hwtimer.h deleted file mode 100644 index e18d580fbd..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_hwtimer.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-3-19 wangyq the first version - */ - -#ifndef DRV_HWTIMER_H__ -#define DRV_HWTIMER_H__ - -int rt_hw_hwtimer_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_i2c.c b/bsp/essemi/es32f0334/drivers/drv_i2c.c deleted file mode 100644 index 6824d654b5..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_i2c.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-19 wangyq the first version - * 2019-11-01 wangyq update libraries - * 2020-12-15 liuhy update libraries - */ - -#include -#include -#include -#include "board.h" -#include "drv_i2c.h" -#include -#include - -#ifdef RT_USING_I2C - -#define TIMEOUT 0x0FFF -/* I2C struct definition */ -static i2c_handle_t _h_i2c0, _h_i2c1; - -static void _i2c_init(void) -{ - gpio_init_t gpio_instruct; - - /* Initialize I2C Pin */ - gpio_instruct.mode = GPIO_MODE_OUTPUT; - gpio_instruct.odos = GPIO_OPEN_DRAIN; - gpio_instruct.pupd = GPIO_PUSH_UP; - gpio_instruct.odrv = GPIO_OUT_DRIVE_NORMAL; - gpio_instruct.flt = GPIO_FILTER_DISABLE; - gpio_instruct.type = GPIO_TYPE_CMOS; - gpio_instruct.func = GPIO_FUNC_5; - -#ifdef BSP_USING_I2C0 - /* Initialize I2C Function */ - _h_i2c0.perh = I2C0; - _h_i2c0.init.clk_speed = 100000; - _h_i2c0.init.duty = I2C_DUTYCYCLE_2; - _h_i2c0.init.own_addr1 = 0x0A; - _h_i2c0.init.addr_mode = I2C_ADDR_7BIT; - _h_i2c0.init.general_call = I2C_GENERALCALL_DISABLE; - _h_i2c0.init.no_stretch = I2C_NOSTRETCH_ENABLE; - - ald_i2c_reset(&_h_i2c0); - ald_i2c_init(&_h_i2c0); - /* I2C0_SCL->PB8, I2C0_SDA->PB9 */ - ald_gpio_init(GPIOB, GPIO_PIN_8 | GPIO_PIN_9, &gpio_instruct); -#endif - -#ifdef BSP_USING_I2C1 - /* Initialize i2c function */ - _h_i2c1.perh = I2C1; - _h_i2c1.init.clk_speed = 100000; - _h_i2c1.init.duty = I2C_DUTYCYCLE_2; - _h_i2c1.init.own_addr1 = 0xA0; - _h_i2c1.init.addr_mode = I2C_ADDR_7BIT; - _h_i2c1.init.general_call = I2C_GENERALCALL_DISABLE; - _h_i2c1.init.no_stretch = I2C_NOSTRETCH_ENABLE; - - ald_i2c_reset(&_h_i2c1); - ald_i2c_init(&_h_i2c1); - /* I2C1_SCL->PB10, I2C1_SDA->PB11 */ - ald_gpio_init(GPIOB, GPIO_PIN_10 | GPIO_PIN_11, &gpio_instruct); -#endif -} - -static rt_size_t es32f0_master_xfer(struct rt_i2c_bus_device *bus, - struct rt_i2c_msg msgs[], - rt_uint32_t num) -{ - struct rt_i2c_msg *msg; - rt_uint32_t i; - rt_err_t ret = RT_ERROR; - - for (i = 0; i < num; i++) - { - msg = &msgs[i]; - if (msg->flags & RT_I2C_RD) - { - if (ald_i2c_master_recv(bus->priv, msg->addr << 1, msg->buf, msg->len, TIMEOUT) != 0) - { - LOG_E("i2c bus write failed,i2c bus stop!\n"); - goto out; - } - } - else - { - if (ald_i2c_master_send(bus->priv, msg->addr << 1, msg->buf, msg->len, TIMEOUT) != 0) - { - LOG_E("i2c bus write failed,i2c bus stop!\n"); - goto out; - } - } - } - - ret = i; - -out: - LOG_E("send stop condition\n"); - - return ret; -} - -const struct rt_i2c_bus_device_ops es32f0_i2c_ops = -{ - es32f0_master_xfer, - RT_NULL, - RT_NULL, -}; - -int rt_hw_i2c_init(void) -{ - _i2c_init(); - -#ifdef BSP_USING_I2C0 - /* define i2c Instance */ - static struct rt_i2c_bus_device _i2c_device0; - rt_memset((void *)&_i2c_device0, 0, sizeof(struct rt_i2c_bus_device)); - _i2c_device0.ops = &es32f0_i2c_ops; - _i2c_device0.priv = &_h_i2c0; - rt_i2c_bus_device_register(&_i2c_device0, "i2c0"); -#endif - -#ifdef BSP_USING_I2C1 - /* define i2c Instance */ - static struct rt_i2c_bus_device _i2c_device1; - rt_memset((void *)&_i2c_device1, 0, sizeof(struct rt_i2c_bus_device)); - _i2c_device1.ops = &es32f0_i2c_ops; - _i2c_device1.priv = &_h_i2c1; - rt_i2c_bus_device_register(&_i2c_device1, "i2c1"); -#endif - - return RT_EOK; -} -INIT_DEVICE_EXPORT(rt_hw_i2c_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_i2c.h b/bsp/essemi/es32f0334/drivers/drv_i2c.h deleted file mode 100644 index 2ba40feb69..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_i2c.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-19 wangyq the first version - */ - -#ifndef DRV_I2C_H__ -#define DRV_I2C_H__ - -int rt_hw_i2c_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_lptim.c b/bsp/essemi/es32f0334/drivers/drv_lptim.c deleted file mode 100644 index 9bf0f8c0fe..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_lptim.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-11-01 wangyq first version - */ - -#include -#include -#include - -static lptim_handle_t h_lptim; - -void LPTIM0_SPI2_Handler(void) -{ - /* LPTIM Intetrupt */ - if (ald_lptim_get_it_status(&h_lptim, LPTIM_IT_ARRMAT) && - ald_lptim_get_flag_status(&h_lptim, LPTIM_FLAG_ARRMAT)) - { - /* enter interrupt */ - rt_interrupt_enter(); - - ald_lptim_clear_flag_status(&h_lptim, LPTIM_FLAG_ARRMAT); - - /* leave interrupt */ - rt_interrupt_leave(); - } -} - -/** - * This function get current count value of LPTIM - * - * @return the count vlaue - */ -rt_uint32_t es32f0_lptim_get_current_tick(void) -{ - return READ_REG(h_lptim.perh->CNT); -} - -/** - * This function get the max value that LPTIM can count - * - * @return the max count - */ -rt_uint32_t es32f0_lptim_get_tick_max(void) -{ - return (0xFFFF); -} - -/** - * This function start LPTIM with reload value - * - * @param reload The value that LPTIM count down from - * - * @return RT_EOK - */ -rt_err_t es32f0_lptim_start(rt_uint32_t reload) -{ - h_lptim.init.arr = reload; - ald_lptim_toggle_start_by_it(&h_lptim); - - return (RT_EOK); -} - -/** - * This function stop LPTIM - */ -void es32f0_lptim_stop(void) -{ - ald_lptim_toggle_stop_by_it(&h_lptim); -} - -/** - * This function get the count clock of LPTIM - * - * @return the count clock frequency in Hz - */ -rt_uint32_t es32f0_lptim_get_countfreq(void) -{ - return 1000000; -} - -/** - * This function initialize the lptim - */ -int es32f0_hw_lptim_init(void) -{ - lptim_clock_source_init_t clock_config; - lptim_trigger_init_t trigger_config; - - /* Enable LPTIM clock */ - ald_cmu_perh_clock_config(CMU_PERH_LPTIM0, ENABLE); - - /* LPTIM Configuration */ - h_lptim.perh = LPTIM0; - h_lptim.init.psc = LPTIM_PRESC_1; // can not select other premeter - h_lptim.init.arr = 0x0FFF; - h_lptim.init.clock = CMU_LP_PERH_CLOCK_SEL_HRC_1M; - h_lptim.init.mode = LPTIM_MODE_SINGLE; - - ald_lptim_toggle_init(&h_lptim); - - /* Initialize clock source */ - clock_config.sel = LPTIM_CKSEL_INTERNAL; - clock_config.polarity = LPTIM_CKPOL_RISING; - ald_lptim_clock_source_config(&h_lptim, &clock_config); - - /* Initialize toggle */ - trigger_config.mode = LPTIM_TRIGEN_SW; - ald_lptim_trigger_config(&h_lptim, &trigger_config); - - ald_lptim_interrupt_config(&h_lptim, LPTIM_IT_ARRMAT, ENABLE); - - NVIC_ClearPendingIRQ(LPTIM0_SPI2_IRQn); - NVIC_SetPriority(LPTIM0_SPI2_IRQn, 0); - NVIC_EnableIRQ(LPTIM0_SPI2_IRQn); - - return 0; -} - -INIT_DEVICE_EXPORT(es32f0_hw_lptim_init); diff --git a/bsp/essemi/es32f0334/drivers/drv_lptim.h b/bsp/essemi/es32f0334/drivers/drv_lptim.h deleted file mode 100644 index 0e178ce848..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_lptim.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-11-01 wangyq first version - */ - -#ifndef __DRV_PMTIMER_H__ -#define __DRV_PMTIMER_H__ - -#include - -rt_uint32_t es32f0_lptim_get_countfreq(void); -rt_uint32_t es32f0_lptim_get_tick_max(void); -rt_uint32_t es32f0_lptim_get_current_tick(void); - -rt_err_t es32f0_lptim_start(rt_uint32_t load); -void es32f0_lptim_stop(void); - -#endif /* __DRV_PMTIMER_H__ */ diff --git a/bsp/essemi/es32f0334/drivers/drv_pm.c b/bsp/essemi/es32f0334/drivers/drv_pm.c deleted file mode 100644 index d08c13f8d0..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_pm.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-04-08 wangyq the first version - * 2019-11-01 wangyq adapt to the new power management interface - */ -#include -#include -#include -#include -#include -#include - -#ifdef RT_USING_PM - -static void uart_console_reconfig(void) -{ - struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; - - rt_device_control(rt_console_get_device(), RT_DEVICE_CTRL_CONFIG, &config); -} - -static void delay(void) -{ - long i; - rt_base_t level; - - level = rt_hw_interrupt_disable(); - i = 0; - do{ - i++; - } - while (i < 10000); - - rt_hw_interrupt_enable(level); -} - -/** - * This function will put ES32F033x into sleep mode. - * - * @param pm pointer to power manage structure - */ -static void sleep(struct rt_pm *pm, uint8_t mode) -{ - switch (mode) - { - case PM_SLEEP_MODE_NONE: - break; - - case PM_SLEEP_MODE_IDLE: - //__WFI(); - break; - - case PM_SLEEP_MODE_LIGHT: - if (pm->run_mode == PM_RUN_MODE_LOW_SPEED) - { - /* Enter LP SLEEP Mode, Enable low-power regulator */ - ald_pmu_lprun_config(PMU_LDO_LPMODE_OUTPUT_1_5, ENABLE); - } - else - { - /* Enter SLEEP Mode, Main regulator is ON */ - ald_pmu_stop1_enter(); - delay(); - } - break; - - case PM_SLEEP_MODE_DEEP: - /* Enter STOP 2 mode */ - ald_pmu_stop2_enter(); - delay(); - break; - - case PM_SLEEP_MODE_STANDBY: - /* Enter STANDBY mode */ - ald_pmu_stop2_enter(); - delay(); - break; - - case PM_SLEEP_MODE_SHUTDOWN: - /* Enter SHUTDOWNN mode */ - ald_pmu_stop2_enter(); - delay(); - break; - - default: - RT_ASSERT(0); - break; - } -} - -static uint8_t run_speed[PM_RUN_MODE_MAX][2] = -{ - {48, 0}, - {48, 1}, - {24, 2}, - {2, 3}, -}; - -static void run(struct rt_pm *pm, uint8_t mode) -{ - static uint8_t last_mode; - static char *run_str[] = PM_RUN_MODE_NAMES; - extern uint32_t __system_clock; - - if (mode == last_mode) - return; - last_mode = mode; - - ald_cmu_clock_config_default(); - __system_clock = 24000000; - switch (mode) - { - case PM_RUN_MODE_HIGH_SPEED: - case PM_RUN_MODE_NORMAL_SPEED: - /* hosc 12MHz, from hosc/3 pll to 48MHz */ - ald_cmu_pll1_config(CMU_PLL1_INPUT_HRC_6, CMU_PLL1_OUTPUT_48M); - /* MCLK 48MHz */ - ald_cmu_clock_config(CMU_CLOCK_PLL1, 48000000); - break; - case PM_RUN_MODE_MEDIUM_SPEED: - break; - case PM_RUN_MODE_LOW_SPEED: - ald_cmu_clock_config(CMU_CLOCK_HRC, 2000000); - break; - default: - break; - } - - /* 4. 更新外设时钟 */ - uart_console_reconfig(); - /* Re-Configure the Systick time */ - SysTick_Config(ald_cmu_get_sys_clock() / RT_TICK_PER_SECOND); - - rt_kprintf("switch to %s mode, frequency = %d MHz\n", run_str[mode], run_speed[mode][0]); -} - -/** - * This function caculate the PM tick from OS tick - * - * @param tick OS tick - * - * @return the PM tick - */ -static rt_tick_t es32f0_pm_tick_from_os_tick(rt_tick_t tick) -{ - rt_uint32_t freq = es32f0_lptim_get_countfreq(); - - return (freq * tick / RT_TICK_PER_SECOND); -} - -/** - * This function caculate the OS tick from PM tick - * - * @param tick PM tick - * - * @return the OS tick - */ -static rt_tick_t es32f0_os_tick_from_pm_tick(rt_uint32_t tick) -{ - static rt_uint32_t os_tick_remain = 0; - rt_uint32_t ret, freq; - - freq = es32f0_lptim_get_countfreq(); - ret = (tick * RT_TICK_PER_SECOND + os_tick_remain) / freq; - - os_tick_remain += (tick * RT_TICK_PER_SECOND); - os_tick_remain %= freq; - - return ret; -} - -/** - * This function start the timer of pm - * - * @param pm Pointer to power manage structure - * @param timeout How many OS Ticks that MCU can sleep - */ -static void pm_timer_start(struct rt_pm *pm, rt_uint32_t timeout) -{ - RT_ASSERT(pm != RT_NULL); - RT_ASSERT(timeout > 0); - - if (timeout != RT_TICK_MAX) - { - /* Convert OS Tick to pmtimer timeout value */ - timeout = es32f0_pm_tick_from_os_tick(timeout); - /* MAX 0xFFFF */ - if (timeout > es32f0_lptim_get_tick_max()) - { - timeout = es32f0_lptim_get_tick_max(); - } - - /* Enter PM_TIMER_MODE */ - es32f0_lptim_start(timeout); - } -} - -/** - * This function stop the timer of pm - * - * @param pm Pointer to power manage structure - */ -static void pm_timer_stop(struct rt_pm *pm) -{ - RT_ASSERT(pm != RT_NULL); - - /* Reset pmtimer status */ - es32f0_lptim_stop(); -} - -/** - * This function calculate how many OS Ticks that MCU have suspended - * - * @param pm Pointer to power manage structure - * - * @return OS Ticks - */ -static rt_tick_t pm_timer_get_tick(struct rt_pm *pm) -{ - rt_uint32_t timer_tick; - - RT_ASSERT(pm != RT_NULL); - - timer_tick = es32f0_lptim_get_current_tick(); - - return es32f0_os_tick_from_pm_tick(timer_tick); -} - -/** - * This function initialize the power manager - */ -int drv_pm_hw_init(void) -{ - static const struct rt_pm_ops _ops = - { - sleep, - run, - pm_timer_start, - pm_timer_stop, - pm_timer_get_tick - }; - - rt_uint8_t timer_mask = 0; - - /* initialize timer mask */ - timer_mask = 1UL << PM_SLEEP_MODE_DEEP; - - /* initialize system pm module */ - rt_system_pm_init(&_ops, timer_mask, RT_NULL); - - return 0; -} -INIT_BOARD_EXPORT(drv_pm_hw_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_pm.h b/bsp/essemi/es32f0334/drivers/drv_pm.h deleted file mode 100644 index a4f6cc84ee..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_pm.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-04-01 wangyq the first version - */ - -#ifndef DRV_PM_H__ -#define DRV_PM_H__ - -int rt_hw_pm_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_pwm.c b/bsp/essemi/es32f0334/drivers/drv_pwm.c deleted file mode 100644 index 2a40b3d299..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_pwm.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-19 wangyq the first version - * 2019-11-01 wangyq update libraries - */ - -#include -#include -#include -#include -#include -#include -#include - -static void pwm_set_freq(timer_handle_t *timer_initstruct, uint32_t ns) -{ - uint64_t _arr = (uint64_t)ald_cmu_get_pclk1_clock() * ns / 1000000000 / - (timer_initstruct->init.prescaler + 1); - - WRITE_REG(timer_initstruct->perh->AR, (uint32_t)_arr); - timer_initstruct->init.period = (uint32_t)_arr; -} - -static void pwm_set_duty(timer_handle_t *timer_initstruct, timer_channel_t ch, uint32_t ns) -{ - uint64_t tmp = (uint64_t)ald_cmu_get_pclk1_clock() * ns / 1000000000 / - (timer_initstruct->init.prescaler + 1); - - if (ch == TIMER_CHANNEL_1) - WRITE_REG(timer_initstruct->perh->CCVAL1, (uint32_t)tmp); - else if (ch == TIMER_CHANNEL_2) - WRITE_REG(timer_initstruct->perh->CCVAL2, (uint32_t)tmp); - else if (ch == TIMER_CHANNEL_3) - WRITE_REG(timer_initstruct->perh->CCVAL3, (uint32_t)tmp); - else if (ch == TIMER_CHANNEL_4) - WRITE_REG(timer_initstruct->perh->CCVAL4, (uint32_t)tmp); -} - -static rt_err_t es32f0_pwm_control(struct rt_device_pwm *device, int cmd, void *arg) -{ - rt_err_t ret = RT_EOK; - uint32_t _ccep; - timer_channel_t pwm_channel; - timer_oc_init_t tim_ocinit; - timer_handle_t *timer_initstruct = (timer_handle_t *)device->parent.user_data; - struct rt_pwm_configuration *cfg = (struct rt_pwm_configuration *)arg; - - RT_ASSERT(timer_initstruct != RT_NULL); - - tim_ocinit.oc_mode = TIMER_OC_MODE_PWM1; - tim_ocinit.oc_polarity = TIMER_OC_POLARITY_HIGH; - tim_ocinit.oc_fast_en = DISABLE; - tim_ocinit.ocn_polarity = TIMER_OCN_POLARITY_HIGH; - tim_ocinit.ocn_idle = TIMER_OCN_IDLE_RESET; - tim_ocinit.oc_idle = TIMER_OC_IDLE_RESET; - - /* select pwm output channel */ - if (1 == cfg->channel) - { - pwm_channel = TIMER_CHANNEL_1; - } - else if (2 == cfg->channel) - { - pwm_channel = TIMER_CHANNEL_2; - } - else if (3 == cfg->channel) - { - if (timer_initstruct->perh == GP16C2T0 || timer_initstruct->perh == GP16C2T1) - return RT_EINVAL; - pwm_channel = TIMER_CHANNEL_3; - } - else if (4 == cfg->channel) - { - if (timer_initstruct->perh == GP16C2T0 || timer_initstruct->perh == GP16C2T1 || - timer_initstruct->perh == GP16C4T0) - return RT_EINVAL; - pwm_channel = TIMER_CHANNEL_4; - } - else - { - return RT_EINVAL; - } - - switch (cmd) - { - case PWM_CMD_ENABLE: - ald_timer_pwm_start(timer_initstruct, pwm_channel); - break; - - case PWM_CMD_DISABLE: - ald_timer_pwm_stop(timer_initstruct, pwm_channel); - break; - - case PWM_CMD_SET: - _ccep = timer_initstruct->perh->CCEP; - /* count registers max 0xFFFF, auto adjust prescaler */ - do - { - pwm_set_freq(timer_initstruct, cfg->period); - timer_initstruct->init.prescaler ++; - } - while (timer_initstruct->init.period > 0xFFFF); - /* update prescaler */ - WRITE_REG(timer_initstruct->perh->PRES, --timer_initstruct->init.prescaler); - ald_timer_oc_config_channel(timer_initstruct, &tim_ocinit, pwm_channel); - pwm_set_duty(timer_initstruct, pwm_channel, cfg->pulse); - timer_initstruct->perh->CCEP = _ccep; - break; - - case PWM_CMD_GET: - cfg->pulse = ald_timer_read_capture_value(timer_initstruct, pwm_channel) * 100 / - READ_REG(timer_initstruct->perh->AR); - break; - - default: - break; - } - return ret; -} - -const static struct rt_pwm_ops es32f0_pwm_ops = -{ - es32f0_pwm_control -}; - -int rt_hw_pwm_init(void) -{ - rt_err_t ret = RT_EOK; - gpio_init_t gpio_initstructure; - - gpio_initstructure.mode = GPIO_MODE_OUTPUT; - gpio_initstructure.odos = GPIO_PUSH_PULL; - gpio_initstructure.pupd = GPIO_PUSH_UP; - gpio_initstructure.odrv = GPIO_OUT_DRIVE_NORMAL; - gpio_initstructure.flt = GPIO_FILTER_DISABLE; - gpio_initstructure.type = GPIO_TYPE_TTL; - -#ifdef BSP_USING_PWM0 /* 4 channels */ - static struct rt_device_pwm pwm_dev0; - static timer_handle_t timer_initstruct0; - - timer_initstruct0.perh = GP16C4T0; - ald_timer_pwm_init(&timer_initstruct0); - - /* gpio initialization */ - gpio_initstructure.func = GPIO_FUNC_2; - ald_gpio_init(GPIOA, GPIO_PIN_8, &gpio_initstructure); - ald_gpio_init(GPIOA, GPIO_PIN_9, &gpio_initstructure); - ald_gpio_init(GPIOA, GPIO_PIN_10, &gpio_initstructure); - ald_gpio_init(GPIOA, GPIO_PIN_11, &gpio_initstructure); - - ret = rt_device_pwm_register(&pwm_dev0, "pwm0", &es32f0_pwm_ops, - &timer_initstruct0); -#endif - -#ifdef BSP_USING_PWM1 /* 3 channels */ - static struct rt_device_pwm pwm_dev1; - static timer_handle_t timer_initstruct1; - - timer_initstruct1.perh = GP16C4T1; - ald_timer_pwm_init(&timer_initstruct1); - - /* gpio initialization */ - gpio_initstructure.func = GPIO_FUNC_2; - ald_gpio_init(GPIOB, GPIO_PIN_6, &gpio_initstructure); - ald_gpio_init(GPIOB, GPIO_PIN_7, &gpio_initstructure); - ald_gpio_init(GPIOB, GPIO_PIN_8, &gpio_initstructure); - - ret = rt_device_pwm_register(&pwm_dev1, "pwm1", &es32f0_pwm_ops, - &timer_initstruct1); -#endif - -#ifdef BSP_USING_PWM2 /* 2 channels */ - static struct rt_device_pwm pwm_dev2; - static timer_handle_t timer_initstruct2; - - timer_initstruct2.perh = GP16C2T0; - ald_timer_pwm_init(&timer_initstruct2); - - /* gpio initialization */ - gpio_initstructure.func = GPIO_FUNC_2; - ald_gpio_init(GPIOA, GPIO_PIN_0, &gpio_initstructure); - ald_gpio_init(GPIOA, GPIO_PIN_1, &gpio_initstructure); - - ret = rt_device_pwm_register(&pwm_dev2, "pwm2", &es32f0_pwm_ops, - &timer_initstruct2); -#endif - -#ifdef BSP_USING_PWM3 /* 2 channels */ - static struct rt_device_pwm pwm_dev3; - static timer_handle_t timer_initstruct3; - - timer_initstruct3.perh = GP16C2T1; - ald_timer_pwm_init(&timer_initstruct3); - - /* gpio initialization */ - gpio_initstructure.func = GPIO_FUNC_3; - ald_gpio_init(GPIOC, GPIO_PIN_6, &gpio_initstructure); - ald_gpio_init(GPIOC, GPIO_PIN_7, &gpio_initstructure); - - ret = rt_device_pwm_register(&pwm_dev3, "pwm3", &es32f0_pwm_ops, - &timer_initstruct3); -#endif - - return ret; -} -INIT_DEVICE_EXPORT(rt_hw_pwm_init); diff --git a/bsp/essemi/es32f0334/drivers/drv_pwm.h b/bsp/essemi/es32f0334/drivers/drv_pwm.h deleted file mode 100644 index 82505bb28c..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_pwm.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-19 wangyq the first version - */ - -#ifndef DRV_PWM_H__ -#define DRV_PWM_H__ - -int rt_hw_pwm_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_rtc.c b/bsp/essemi/es32f0334/drivers/drv_rtc.c deleted file mode 100644 index 9471368454..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_rtc.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-04-01 wangyq the first version - * 2019-11-01 wangyq update libraries - */ - -#include -#include -#include -#include -#include -#include "board.h" -#include "drv_rtc.h" -#include -#include - -#ifdef RT_USING_RTC - -static void __rtc_init(rtc_init_t *init) -{ - assert_param(IS_RTC_HOUR_FORMAT(init->hour_format)); - assert_param(IS_RTC_OUTPUT_SEL(init->output)); - assert_param(IS_RTC_OUTPUT_POLARITY(init->output_polarity)); - - ald_rtc_reset(); - RTC_UNLOCK(); - - MODIFY_REG(RTC->CON, RTC_CON_HFM_MSK, init->hour_format << RTC_CON_HFM_POS); - MODIFY_REG(RTC->CON, RTC_CON_EOS_MSK, init->output << RTC_CON_EOS_POSS); - MODIFY_REG(RTC->CON, RTC_CON_POL_MSK, init->output_polarity << RTC_CON_POL_POS); - MODIFY_REG(RTC->PSR, RTC_PSR_SPRS_MSK, init->synch_pre_div << RTC_PSR_SPRS_POSS); - MODIFY_REG(RTC->PSR, RTC_PSR_APRS_MSK, init->asynch_pre_div << RTC_PSR_APRS_POSS); - - RTC_LOCK(); - return; -} - -static rt_err_t es32f0_rtc_control(rt_device_t dev, int cmd, void *args) -{ - rt_err_t result = RT_EOK; - - struct tm time_temp; - struct tm *pNow; - rtc_date_t date; - rtc_time_t time; - - switch (cmd) - { - case RT_DEVICE_CTRL_RTC_GET_TIME: - - ald_rtc_get_date_time(&date, &time, RTC_FORMAT_DEC); - time_temp.tm_sec = time.second; - time_temp.tm_min = time.minute; - time_temp.tm_hour = time.hour; - time_temp.tm_mday = date.day; - time_temp.tm_mon = date.month - 1; - time_temp.tm_year = date.year - 1900 + 2000; - *((time_t *)args) = timegm(&time_temp); - break; - - case RT_DEVICE_CTRL_RTC_SET_TIME: - - rt_enter_critical(); - /* converts calendar time time into local time. */ - pNow = gmtime((const time_t *)args); - /* copy the statically located variable */ - memcpy(&time_temp, pNow, sizeof(struct tm)); - /* unlock scheduler. */ - rt_exit_critical(); - - time.hour = time_temp.tm_hour; - time.minute = time_temp.tm_min; - time.second = time_temp.tm_sec; - date.year = time_temp.tm_year + 1900 - 2000; - date.month = time_temp.tm_mon + 1; - date.day = time_temp.tm_mday; - ald_rtc_set_time(&time, RTC_FORMAT_DEC); - ald_rtc_set_date(&date, RTC_FORMAT_DEC); - /* start RTC */ - RTC_UNLOCK(); - SET_BIT(RTC->CON, RTC_CON_GO_MSK); - RTC_LOCK(); - break; - - case RT_DEVICE_CTRL_RTC_GET_ALARM: - break; - - case RT_DEVICE_CTRL_RTC_SET_ALARM: - break; - - default: - break; - } - - return result; -} - -#ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops es32f0_rtc_ops = -{ - RT_NULL, - RT_NULL, - RT_NULL, - RT_NULL, - RT_NULL, - es32f0_rtc_control -}; -#endif - -int rt_hw_rtc_init(void) -{ - rt_err_t ret = RT_EOK; - static struct rt_device rtc_dev; - rtc_init_t rtc_initstruct; - - /* enable external 32.768kHz */ - CMU_LOSC_ENABLE(); - ald_cmu_losc_safe_config(ENABLE); - /* set default time */ - RTC_UNLOCK(); - WRITE_REG(RTC->TIME, 0x134251); - WRITE_REG(RTC->DATE, 0x1190401); - RTC_LOCK(); - /* RTC function initialization */ - rtc_initstruct.hour_format = RTC_HOUR_FORMAT_24; - rtc_initstruct.asynch_pre_div = 0; - rtc_initstruct.synch_pre_div = 32767; - rtc_initstruct.output = RTC_OUTPUT_DISABLE; - __rtc_init(&rtc_initstruct); - - rtc_dev.type = RT_Device_Class_RTC; - rtc_dev.rx_indicate = RT_NULL; - rtc_dev.tx_complete = RT_NULL; - -#ifdef RT_USING_DEVICE_OPS - rtc_dev.ops = &es32f0_rtc_ops; -#else - rtc_dev.init = RT_NULL; - rtc_dev.open = RT_NULL; - rtc_dev.close = RT_NULL; - rtc_dev.read = RT_NULL; - rtc_dev.write = RT_NULL; - rtc_dev.control = es32f0_rtc_control; -#endif - - rtc_dev.user_data = RTC; - - ret = rt_device_register(&rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR); - - return ret; -} -INIT_DEVICE_EXPORT(rt_hw_rtc_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_rtc.h b/bsp/essemi/es32f0334/drivers/drv_rtc.h deleted file mode 100644 index 68c2b8c891..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_rtc.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-04-01 wangyq the first version - */ - -#ifndef DRV_RTC_H__ -#define DRV_RTC_H__ - -int rt_hw_rtc_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_spi.c b/bsp/essemi/es32f0334/drivers/drv_spi.c deleted file mode 100644 index dd37691125..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_spi.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-01-24 wangyq the first version - * 2019-11-01 wangyq update libraries - * 2020-12-15 liuhy update libraries - */ - -#include -#include -#include -#include -#include "board.h" -#include "drv_spi.h" -#include -#include -#include - -#ifdef RT_USING_SPI - -#define SPITIMEOUT 0x0FFF - -rt_err_t spi_configure(struct rt_spi_device *device, - struct rt_spi_configuration *cfg) -{ - spi_handle_t *hspi; - hspi = (spi_handle_t *)device->bus->parent.user_data; - - /* config spi mode */ - if (cfg->mode & RT_SPI_SLAVE) - { - hspi->init.mode = SPI_MODE_SLAVER; - } - else - { - hspi->init.mode = SPI_MODE_MASTER; - } - if (cfg->mode & RT_SPI_3WIRE) - { - hspi->init.dir = SPI_DIRECTION_1LINE; - } - else - { - hspi->init.dir = SPI_DIRECTION_2LINES; - } - if (cfg->data_width == 8) - { - hspi->init.data_size = SPI_DATA_SIZE_8; - } - else if (cfg->data_width == 16) - { - hspi->init.data_size = SPI_DATA_SIZE_16; - } - - if (cfg->mode & RT_SPI_CPHA) - { - hspi->init.phase = SPI_CPHA_SECOND; - } - else - { - hspi->init.phase = SPI_CPHA_FIRST; - } - if (cfg->mode & RT_SPI_CPOL) - { - hspi->init.polarity = SPI_CPOL_HIGH; - } - else - { - hspi->init.polarity = SPI_CPOL_LOW; - } - if (cfg->mode & RT_SPI_NO_CS) - { - hspi->init.ss_en = DISABLE; - } - else - { - hspi->init.ss_en = ENABLE; - } - - /* config spi clock */ - if (cfg->max_hz >= ald_cmu_get_pclk1_clock() / 2) - { - /* pclk1 max speed 48MHz, spi master max speed 10MHz */ - if (ald_cmu_get_pclk1_clock() / 2 <= 10000000) - { - hspi->init.baud = SPI_BAUD_2; - } - else if (ald_cmu_get_pclk1_clock() / 4 <= 10000000) - { - hspi->init.baud = SPI_BAUD_4; - } - else - { - hspi->init.baud = SPI_BAUD_8; - } - } - else if (cfg->max_hz >= ald_cmu_get_pclk1_clock() / 4) - { - /* pclk1 max speed 48MHz, spi master max speed 10MHz */ - if (ald_cmu_get_pclk1_clock() / 4 <= 10000000) - { - hspi->init.baud = SPI_BAUD_4; - } - else - { - hspi->init.baud = SPI_BAUD_8; - } - } - else if (cfg->max_hz >= ald_cmu_get_pclk1_clock() / 8) - { - hspi->init.baud = SPI_BAUD_8; - } - else if (cfg->max_hz >= ald_cmu_get_pclk1_clock() / 16) - { - hspi->init.baud = SPI_BAUD_16; - } - else if (cfg->max_hz >= ald_cmu_get_pclk1_clock() / 32) - { - hspi->init.baud = SPI_BAUD_32; - } - else if (cfg->max_hz >= ald_cmu_get_pclk1_clock() / 64) - { - hspi->init.baud = SPI_BAUD_64; - } - else if (cfg->max_hz >= ald_cmu_get_pclk1_clock() / 128) - { - hspi->init.baud = SPI_BAUD_128; - } - else - { - hspi->init.baud = SPI_BAUD_256; - } - ald_spi_init(hspi); - return RT_EOK; -} - -static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message) -{ - rt_err_t res; - spi_handle_t *hspi; - struct es32f0_hw_spi_cs *cs; - - RT_ASSERT(device != RT_NULL); - RT_ASSERT(device->bus != RT_NULL); - RT_ASSERT(device->bus->parent.user_data != RT_NULL); - - hspi = (spi_handle_t *)device->bus->parent.user_data; - cs = device->parent.user_data; - - if(message->send_buf != RT_NULL || message->recv_buf != RT_NULL) - { - /* send & receive */ - if ((message->send_buf != RT_NULL) && (message->recv_buf != RT_NULL)) - { - if (message->cs_take) - { - rt_pin_write(cs->pin, 0); - } - res = ald_spi_send_recv(hspi, (rt_uint8_t *)message->send_buf, (rt_uint8_t *)message->recv_buf, - (rt_int32_t)message->length, SPITIMEOUT); - if (message->cs_release) - { - rt_pin_write(cs->pin, 1); - } - if (res != RT_EOK) - return RT_ERROR; - } - else - { - /* only send data */ - if (message->recv_buf == RT_NULL) - { - if (message->cs_take) - { - rt_pin_write(cs->pin, 0); - } - res = ald_spi_send(hspi, (rt_uint8_t *)message->send_buf, (rt_int32_t)message->length, SPITIMEOUT); - if (message->cs_release) - { - rt_pin_write(cs->pin, 1); - } - if (res != RT_EOK) - return RT_ERROR; - } - /* only receive data */ - if (message->send_buf == RT_NULL) - { - if (message->cs_take) - { - rt_pin_write(cs->pin, 0); - } - res = ald_spi_recv(hspi, (rt_uint8_t *)message->recv_buf, (rt_int32_t)message->length, SPITIMEOUT); - if (message->cs_release) - { - rt_pin_write(cs->pin, 1); - } - if (res != RT_EOK) - return RT_ERROR; - } - } - - } - else - { - if (message->cs_take) - { - rt_pin_write(cs->pin, 0); - } - - if (message->cs_release) - { - rt_pin_write(cs->pin, 1); - } - return RT_EOK; - } - return message->length; - -} - -const struct rt_spi_ops es32f0_spi_ops = -{ - spi_configure, - spixfer, -}; - - -rt_err_t es32f0_spi_device_attach(rt_uint32_t pin, const char *bus_name, const char *device_name) -{ - /* define spi Instance */ - struct rt_spi_device *spi_device = (struct rt_spi_device *)rt_malloc(sizeof(struct rt_spi_device)); - RT_ASSERT(spi_device != RT_NULL); - struct es32f0_hw_spi_cs *cs_pin = (struct es32f0_hw_spi_cs *)rt_malloc(sizeof(struct es32f0_hw_spi_cs)); - RT_ASSERT(cs_pin != RT_NULL); - cs_pin->pin = pin; - rt_pin_mode(pin, PIN_MODE_OUTPUT); - rt_pin_write(pin, 1); - return rt_spi_bus_attach_device(spi_device, device_name, bus_name, (void *)cs_pin); -} - -#ifdef BSP_USING_SPI0 - static struct rt_spi_bus _spi_bus0; - static spi_handle_t _spi0; -#endif - -#ifdef BSP_USING_SPI1 - static struct rt_spi_bus _spi_bus1; - static spi_handle_t _spi1; -#endif - -int rt_hw_spi_init(void) -{ - int result = RT_EOK; - - struct rt_spi_bus *spi_bus; - spi_handle_t *spi; - gpio_init_t gpio_instruct; - -#ifdef BSP_USING_SPI0 - _spi0.perh = SPI0; - spi_bus = &_spi_bus0; - spi = &_spi0; - rt_device_t spi_bus_dev0; - - /* SPI0 gpio init */ - gpio_instruct.mode = GPIO_MODE_OUTPUT; - gpio_instruct.odos = GPIO_PUSH_PULL; - gpio_instruct.func = GPIO_FUNC_4; - gpio_instruct.type = GPIO_TYPE_CMOS; - gpio_instruct.flt = GPIO_FILTER_DISABLE; - - /* PB3->SPI0_SCK, PB5->SPI0_MOSI */ - ald_gpio_init(GPIOB, GPIO_PIN_3 | GPIO_PIN_5, &gpio_instruct); - - /* PB4->SPI0_MISO */ - gpio_instruct.mode = GPIO_MODE_INPUT; - ald_gpio_init(GPIOB, GPIO_PIN_4, &gpio_instruct); - - spi_bus->parent.user_data = spi; - result = rt_spi_bus_register(spi_bus, "spi0", &es32f0_spi_ops); - if (result != RT_EOK) - { - return result; - } - - rt_device_register(spi_bus_dev0, "spi00", RT_DEVICE_FLAG_RDWR); - - /* SPI0_NSS = PA15 = PIN 50 */ - result = es32f0_spi_device_attach(50, "spi0", "spi00"); - - if (result != RT_EOK) - { - return result; - } - -#endif - -#ifdef BSP_USING_SPI1 - _spi1.perh = SPI1; - spi_bus = &_spi_bus1; - spi = &_spi1; - rt_device_t spi_bus_dev0; - - /* SPI1 gpio init */ - gpio_instruct.mode = GPIO_MODE_OUTPUT; - gpio_instruct.odos = GPIO_PUSH_PULL; - gpio_instruct.func = GPIO_FUNC_4; - gpio_instruct.type = GPIO_TYPE_CMOS; - gpio_instruct.flt = GPIO_FILTER_DISABLE; - - /* PB13->SPI1_SCK, PB15->SPI1_MOSI */ - ald_gpio_init(GPIOB, GPIO_PIN_13 | GPIO_PIN_15, &gpio_instruct); - - /* PB14->SPI1_MISO */ - gpio_instruct.mode = GPIO_MODE_INPUT; - ald_gpio_init(GPIOB, GPIO_PIN_14, &gpio_instruct); - - spi_bus->parent.user_data = spi; - result = rt_spi_bus_register(spi_bus, "spi1", &es32f0_spi_ops); - if (result != RT_EOK) - { - return result; - } - - rt_device_register(spi_bus_dev0, "spi10", RT_DEVICE_FLAG_RDWR); - - /* SPI1_NSS = PC00 = PIN 8 */ - result = es32f0_spi_device_attach(8, "spi1", "spi10"); - - if (result != RT_EOK) - { - return result; - } - -#endif - - return result; -} -INIT_BOARD_EXPORT(rt_hw_spi_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_spi.h b/bsp/essemi/es32f0334/drivers/drv_spi.h deleted file mode 100644 index 08e36431aa..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_spi.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-19 wangyq the first version - */ - -#ifndef DRV_SPI_H__ -#define DRV_SPI_H__ - -#include -#include -#include - -struct es32f0_hw_spi_cs -{ - rt_uint32_t pin; -}; - -/* cannot be used before completion init */ -rt_err_t es32f0_spi_device_attach(rt_uint32_t pin, const char *bus_name, const char *device_name); -int rt_hw_spi_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_spiflash.c b/bsp/essemi/es32f0334/drivers/drv_spiflash.c deleted file mode 100644 index 9173e81ca3..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_spiflash.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-19 wangyq the first version - * 2019-11-01 wangyq update libraries - */ - -#include -#include "spi_flash.h" -#include "drv_spiflash.h" -#include "spi_flash_sfud.h" -#include "drv_spi.h" - -#if defined(BSP_USING_SPI_FLASH) -int rt_hw_spi_flash_init(void) -{ - es32f0_spi_device_attach(50, "spi0", "spi00"); - - if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi00")) - { - return -RT_ERROR; - }; - - return RT_EOK; -} -INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_spiflash.h b/bsp/essemi/es32f0334/drivers/drv_spiflash.h deleted file mode 100644 index f578d2e48f..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_spiflash.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-19 wangyq the first version - */ - -#ifndef DRV_NOR_FLASH_H__ -#define DRV_NOR_FLASH_H__ - -int rt_hw_spi_flash_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_uart.c b/bsp/essemi/es32f0334/drivers/drv_uart.c deleted file mode 100644 index a7fb0deee4..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_uart.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-01 wangyq the first version - * 2019-11-01 wangyq update libraries - */ - -#include -#include -#include -#include "board.h" -#include "drv_uart.h" -#include -#include - -#ifdef RT_USING_SERIAL - -/* es32 uart driver */ -struct es32_uart -{ - uart_handle_t huart; - IRQn_Type irq; -}; - -static rt_err_t es32f0x_configure(struct rt_serial_device *serial, struct serial_configure *cfg) -{ - gpio_init_t gpio_init_initstructure; - struct es32_uart *uart; - RT_ASSERT(serial != RT_NULL); - RT_ASSERT(cfg != RT_NULL); - uart = (struct es32_uart *)serial->parent.user_data; - - /* Initialize tx pin */ - gpio_init_initstructure.mode = GPIO_MODE_OUTPUT; - gpio_init_initstructure.odos = GPIO_PUSH_PULL; - gpio_init_initstructure.pupd = GPIO_PUSH_UP; - gpio_init_initstructure.odrv = GPIO_OUT_DRIVE_NORMAL; - gpio_init_initstructure.flt = GPIO_FILTER_DISABLE; - gpio_init_initstructure.type = GPIO_TYPE_TTL; - -#ifdef BSP_USING_UART0 - gpio_init_initstructure.func = GPIO_FUNC_3; - ald_gpio_init(GPIOB, GPIO_PIN_10, &gpio_init_initstructure); - - /* Initialize rx pin ,the same as txpin except mode */ - gpio_init_initstructure.mode = GPIO_MODE_INPUT; - ald_gpio_init(GPIOB, GPIO_PIN_11, &gpio_init_initstructure); -#endif - -#ifdef BSP_USING_UART1 - /* Initialize tx pin */ - gpio_init_initstructure.func = GPIO_FUNC_3; - ald_gpio_init(GPIOC, GPIO_PIN_10, &gpio_init_initstructure); - - /* Initialize rx pin ,the same as txpin except mode*/ - gpio_init_initstructure.mode = GPIO_MODE_INPUT; - ald_gpio_init(GPIOC, GPIO_PIN_11, &gpio_init_initstructure); -#endif - - uart->huart.init.mode = UART_MODE_UART; - uart->huart.init.baud = cfg->baud_rate; - uart->huart.init.word_length = (uart_word_length_t)(cfg->data_bits - 5); - uart->huart.init.parity = (uart_parity_t)(cfg->parity == PARITY_EVEN ? UART_PARITY_EVEN : cfg->parity); - uart->huart.init.fctl = UART_HW_FLOW_CTL_DISABLE; - ald_uart_init(&uart->huart); - - if (cfg->bit_order == BIT_ORDER_MSB) - { - UART_MSB_FIRST_ENABLE(&uart->huart); - } - else - { - UART_MSB_FIRST_DISABLE(&uart->huart); - } - - if (cfg->invert == NRZ_INVERTED) - { - UART_DATA_INV_ENABLE(&uart->huart); - } - else - { - UART_DATA_INV_DISABLE(&uart->huart); - } - - /* enable rx int */ - ald_uart_interrupt_config(&uart->huart, UART_IT_RXRD, ENABLE); - - return RT_EOK; -} - -static rt_err_t es32f0x_control(struct rt_serial_device *serial, int cmd, void *arg) -{ - struct es32_uart *uart; - RT_ASSERT(serial != RT_NULL); - - uart = (struct es32_uart *)serial->parent.user_data; - switch (cmd) - { - case RT_DEVICE_CTRL_CLR_INT: - /* disable rx irq */ - NVIC_DisableIRQ(uart->irq); - /* disable interrupt */ - ald_uart_interrupt_config(&uart->huart, UART_IT_RXRD, DISABLE); - break; - - case RT_DEVICE_CTRL_SET_INT: - /* enable rx irq */ - NVIC_EnableIRQ(uart->irq); - /* enable interrupt */ - ald_uart_interrupt_config(&uart->huart, UART_IT_RXRD, ENABLE); - break; - } - - return RT_EOK; -} - -static int es32f0x_putc(struct rt_serial_device *serial, char c) -{ - struct es32_uart *uart; - RT_ASSERT(serial != RT_NULL); - uart = (struct es32_uart *)serial->parent.user_data; - - while (!(uart->huart.perh->SR & 0x40)) ; - WRITE_REG(uart->huart.perh->TBR, c); - - return 1; -} - -static int es32f0x_getc(struct rt_serial_device *serial) -{ - int ch = -1; - struct es32_uart *uart; - - RT_ASSERT(serial != RT_NULL); - uart = (struct es32_uart *)serial->parent.user_data; - - if (uart->huart.perh->SR & 0x01) - { - ch = (uint8_t)(uart->huart.perh->RBR & 0xFF); - } - - return ch; -} - -static const struct rt_uart_ops es32f0x_uart_ops = -{ - es32f0x_configure, - es32f0x_control, - es32f0x_putc, - es32f0x_getc, -}; - -#ifdef BSP_USING_UART0 -/* UART0 device driver structure */ -struct es32_uart uart0 = -{ - {UART0}, - UART0_IRQn -}; - -struct rt_serial_device serial0; - -void UART0_Handler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART0->RIF & 0x01) - { - rt_hw_serial_isr(&serial0, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART0 */ - -#ifdef BSP_USING_UART1 -/* UART1 device driver structure */ -struct es32_uart uart1 = -{ - {UART1}, - UART1_IRQn -}; - -struct rt_serial_device serial1; - -void UART1_Handler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART1->RIF & 0x01) - { - rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART1 */ - -int rt_hw_uart_init(void) -{ - struct es32_uart *uart; - struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; - -#ifdef BSP_USING_UART0 - uart = &uart0; - serial0.ops = &es32f0x_uart_ops; - serial0.config = config; - - /* register UART0 device */ - rt_hw_serial_register(&serial0, "uart0", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, - uart); -#endif /* BSP_USING_UART0 */ - -#ifdef BSP_USING_UART1 - uart = &uart1; - serial1.ops = &es32f0x_uart_ops; - serial1.config = config; - - /* register UART1 device */ - rt_hw_serial_register(&serial1, "uart1", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, - uart); -#endif /* BSP_USING_UART1 */ - - return 0; -} -INIT_BOARD_EXPORT(rt_hw_uart_init); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/drv_uart.h b/bsp/essemi/es32f0334/drivers/drv_uart.h deleted file mode 100644 index 6007188c2b..0000000000 --- a/bsp/essemi/es32f0334/drivers/drv_uart.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-03-01 wangyq the first version - */ - -#ifndef DRV_UART_H__ -#define DRV_UART_H__ - -int rt_hw_uart_init(void); - -#endif diff --git a/bsp/essemi/es32f0334/drivers/linker_scripts/link.sct b/bsp/essemi/es32f0334/drivers/linker_scripts/link.sct deleted file mode 100644 index 45489c5687..0000000000 --- a/bsp/essemi/es32f0334/drivers/linker_scripts/link.sct +++ /dev/null @@ -1,15 +0,0 @@ -; ************************************************************* -; *** Scatter-Loading Description File generated by uVision *** -; ************************************************************* - -LR_IROM1 0x00000000 0x00040000 { ; load region size_region - ER_IROM1 0x00000000 0x00040000 { ; load address = execution address - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) - } - RW_IRAM1 0x20000000 0x00008000 { ; RW data - .ANY (+RW +ZI) - } -} - diff --git a/bsp/essemi/es32f0334/figures/ES-PDS-ES32F0334-V1.1.jpg b/bsp/essemi/es32f0334/figures/ES-PDS-ES32F0334-V1.1.jpg deleted file mode 100644 index 9c24b3fa78..0000000000 Binary files a/bsp/essemi/es32f0334/figures/ES-PDS-ES32F0334-V1.1.jpg and /dev/null differ diff --git a/bsp/essemi/es32f0334/figures/ESLinkII-mini.jpg b/bsp/essemi/es32f0334/figures/ESLinkII-mini.jpg deleted file mode 100644 index 7e272811ec..0000000000 Binary files a/bsp/essemi/es32f0334/figures/ESLinkII-mini.jpg and /dev/null differ diff --git a/bsp/essemi/es32f0334/figures/drv_conf.jpg b/bsp/essemi/es32f0334/figures/drv_conf.jpg deleted file mode 100644 index 313e8f1266..0000000000 Binary files a/bsp/essemi/es32f0334/figures/drv_conf.jpg and /dev/null differ diff --git a/bsp/essemi/es32f0334/figures/drv_ex.jpg b/bsp/essemi/es32f0334/figures/drv_ex.jpg deleted file mode 100644 index be631895b6..0000000000 Binary files a/bsp/essemi/es32f0334/figures/drv_ex.jpg and /dev/null differ diff --git a/bsp/essemi/es32f0334/figures/k_conf.jpg b/bsp/essemi/es32f0334/figures/k_conf.jpg deleted file mode 100644 index d900bd8251..0000000000 Binary files a/bsp/essemi/es32f0334/figures/k_conf.jpg and /dev/null differ diff --git a/bsp/essemi/es32f0334/figures/k_ex.jpg b/bsp/essemi/es32f0334/figures/k_ex.jpg deleted file mode 100644 index a4b1d3874d..0000000000 Binary files a/bsp/essemi/es32f0334/figures/k_ex.jpg and /dev/null differ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Include/es32f033x.h b/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Include/es32f033x.h deleted file mode 100644 index e322ab9966..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Include/es32f033x.h +++ /dev/null @@ -1,5882 +0,0 @@ -/** - ********************************************************************************* - * - * @file es32f033x.h - * @brief ES32F033x Device Head File - * - * @version V1.0 - * @date 07 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ES32F0XX_H__ -#define __ES32F0XX_H__ - - -#define __I volatile const /* defines 'read only' permissions */ -#define __O volatile /* defines 'write only' permissions */ -#define __IO volatile /* defines 'read / write' permissions */ - -#define __CHECK_DEVICE_DEFINES -#define __NVIC_PRIO_BITS 2U -#define __CM0_REV 0x0000U -#define __Vendor_SysTickConfig 0U - -typedef enum IRQn { - /* Cortex-M0 processor cxceptions index */ - Reset_IRQn = -15, - NMI_IRQn = -14, - HardFault_IRQn = -13, - SVCall_IRQn = -5, - DebugMonitor_IRQn = -4, - PendSV_IRQn = -2, - SysTick_IRQn = -1, - - /* es32f0xx specific interrupt index */ - WWDG_IWDG_IRQn = 0, - LVD_IRQn = 1, - RTC_TSENSE_IRQn = 2, - CRYPT_TRNG_IRQn = 3, - CMU_IRQn = 4, - EXTI0_3_IRQn = 5, - EXTI4_7_IRQn = 6, - EXTI8_11_IRQn = 7, - EXTI12_15_IRQn = 8, - DMA_IRQn = 9, - CAN0_IRQn = 10, - LPTIM0_SPI2_IRQn = 11, - ADC_ACMP_IRQn = 12, - GP16C4T0_BRK_UP_TRIG_COM_IRQn = 13, - GP16C4T0_CC_IRQn = 14, - BS16T0_IRQn = 15, - GP16C2T0_IRQn = 17, - GP16C2T1_IRQn = 18, - BS16T1_UART2_IRQn = 19, - BS16T2_UART3_IRQn = 20, - GP16C4T1_LCD_IRQn = 21, - BS16T3_DAC0_IRQn = 22, - I2C0_IRQn = 23, - I2C1_IRQn = 24, - SPI0_IRQn = 25, - SPI1_IRQn = 26, - UART0_IRQn = 27, - UART1_IRQn = 28, - USART0_IRQn = 29, - USART1_IRQn = 30, - LPUART0_IRQn = 31, -} IRQn_Type; - - -#include -#include "core_cm0.h" - -#if defined (__CC_ARM) -#pragma anon_unions -#endif - -/* Peripheral register define */ - -/****************** Bit definition for SYSCFG_PROT register ************************/ - -#define SYSCFG_PROT_KEY_POSS 1U -#define SYSCFG_PROT_KEY_POSE 31U -#define SYSCFG_PROT_KEY_MSK BITS(SYSCFG_PROT_KEY_POSS,SYSCFG_PROT_KEY_POSE) - -#define SYSCFG_PROT_PROT_POS 0U -#define SYSCFG_PROT_PROT_MSK BIT(SYSCFG_PROT_PROT_POS) - -/****************** Bit definition for SYSCFG_MEMRMP register ************************/ - -#define SYSCFG_MEMRMP_VTOEN_POS 16U -#define SYSCFG_MEMRMP_VTOEN_MSK BIT(SYSCFG_MEMRMP_VTOEN_POS) - -#define SYSCFG_MEMRMP_BFRMPEN_POS 8U -#define SYSCFG_MEMRMP_BFRMPEN_MSK BIT(SYSCFG_MEMRMP_BFRMPEN_POS) - -#define SYSCFG_MEMRMP_BRRMPEN_POS 0U -#define SYSCFG_MEMRMP_BRRMPEN_MSK BIT(SYSCFG_MEMRMP_BRRMPEN_POS) - -/****************** Bit definition for SYSCFG_VTOR register ************************/ - -#define SYSCFG_VTOR_VTO_POSS 0U -#define SYSCFG_VTOR_VTO_POSE 29U -#define SYSCFG_VTOR_VTO_MSK BITS(SYSCFG_VTOR_VTO_POSS,SYSCFG_VTOR_VTO_POSE) - -typedef struct -{ - __IO uint32_t PROT; - __IO uint32_t MEMRMP; - __IO uint32_t VTOR; -} SYSCFG_TypeDef; - -/****************** Bit definition for MSC_FLASHKEY register ************************/ - -#define MSC_FLASHKEY_STATUS_POSS 0U -#define MSC_FLASHKEY_STATUS_POSE 1U -#define MSC_FLASHKEY_STATUS_MSK BITS(MSC_FLASHKEY_STATUS_POSS,MSC_FLASHKEY_STATUS_POSE) - -/****************** Bit definition for MSC_INFOKEY register ************************/ - -#define MSC_INFOKEY_STATUS_POSS 0U -#define MSC_INFOKEY_STATUS_POSE 1U -#define MSC_INFOKEY_STATUS_MSK BITS(MSC_INFOKEY_STATUS_POSS,MSC_INFOKEY_STATUS_POSE) - -/****************** Bit definition for MSC_FLASHADDR register ************************/ - -#define MSC_FLASHADDR_IFREN_POS 18U -#define MSC_FLASHADDR_IFREN_MSK BIT(MSC_FLASHADDR_IFREN_POS) - -#define MSC_FLASHADDR_ADDR_POSS 0U -#define MSC_FLASHADDR_ADDR_POSE 17U -#define MSC_FLASHADDR_ADDR_MSK BITS(MSC_FLASHADDR_ADDR_POSS,MSC_FLASHADDR_ADDR_POSE) - -/****************** Bit definition for MSC_FLASHFIFO register ************************/ - -#define MSC_FLASHFIFO_FIFO_POSS 0U -#define MSC_FLASHFIFO_FIFO_POSE 31U -#define MSC_FLASHFIFO_FIFO_MSK BITS(MSC_FLASHFIFO_FIFO_POSS,MSC_FLASHFIFO_FIFO_POSE) - -/****************** Bit definition for MSC_FLASHDL register ************************/ - -#define MSC_FLASHDL_DATAL_POSS 0U -#define MSC_FLASHDL_DATAL_POSE 31U -#define MSC_FLASHDL_DATAL_MSK BITS(MSC_FLASHDL_DATAL_POSS,MSC_FLASHDL_DATAL_POSE) - -/****************** Bit definition for MSC_FLASHDH register ************************/ - -#define MSC_FLASHDH_DATAH_POSS 0U -#define MSC_FLASHDH_DATAH_POSE 31U -#define MSC_FLASHDH_DATAH_MSK BITS(MSC_FLASHDH_DATAH_POSS,MSC_FLASHDH_DATAH_POSE) - -/****************** Bit definition for MSC_FLASHCMD register ************************/ - -#define MSC_FLASHCMD_CMD_POSS 0U -#define MSC_FLASHCMD_CMD_POSE 31U -#define MSC_FLASHCMD_CMD_MSK BITS(MSC_FLASHCMD_CMD_POSS,MSC_FLASHCMD_CMD_POSE) - -/****************** Bit definition for MSC_FLASHCR register ************************/ - -#define MSC_FLASHCR_FIFOEN_POS 5U -#define MSC_FLASHCR_FIFOEN_MSK BIT(MSC_FLASHCR_FIFOEN_POS) - -#define MSC_FLASHCR_FLASHREQ_POS 4U -#define MSC_FLASHCR_FLASHREQ_MSK BIT(MSC_FLASHCR_FLASHREQ_POS) - -#define MSC_FLASHCR_IAPRST_POS 1U -#define MSC_FLASHCR_IAPRST_MSK BIT(MSC_FLASHCR_IAPRST_POS) - -#define MSC_FLASHCR_IAPEN_POS 0U -#define MSC_FLASHCR_IAPEN_MSK BIT(MSC_FLASHCR_IAPEN_POS) - -/****************** Bit definition for MSC_FLASHSR register ************************/ - -#define MSC_FLASHSR_TIMEOUT_POS 7U -#define MSC_FLASHSR_TIMEOUT_MSK BIT(MSC_FLASHSR_TIMEOUT_POS) - -#define MSC_FLASHSR_PROG_POS 6U -#define MSC_FLASHSR_PROG_MSK BIT(MSC_FLASHSR_PROG_POS) - -#define MSC_FLASHSR_SERA_POS 5U -#define MSC_FLASHSR_SERA_MSK BIT(MSC_FLASHSR_SERA_POS) - -#define MSC_FLASHSR_MASE_POS 4U -#define MSC_FLASHSR_MASE_MSK BIT(MSC_FLASHSR_MASE_POS) - -#define MSC_FLASHSR_ADDR_OV_POS 3U -#define MSC_FLASHSR_ADDR_OV_MSK BIT(MSC_FLASHSR_ADDR_OV_POS) - -#define MSC_FLASHSR_WRP_FLAG_POS 2U -#define MSC_FLASHSR_WRP_FLAG_MSK BIT(MSC_FLASHSR_WRP_FLAG_POS) - -#define MSC_FLASHSR_BUSY_POS 1U -#define MSC_FLASHSR_BUSY_MSK BIT(MSC_FLASHSR_BUSY_POS) - -#define MSC_FLASHSR_FLASHACK_POS 0U -#define MSC_FLASHSR_FLASHACK_MSK BIT(MSC_FLASHSR_FLASHACK_POS) - -/****************** Bit definition for MSC_FLASHPL register ************************/ - -#define MSC_FLASHPL_PROG_LEN_POSS 0U -#define MSC_FLASHPL_PROG_LEN_POSE 15U -#define MSC_FLASHPL_PROG_LEN_MSK BITS(MSC_FLASHPL_PROG_LEN_POSS,MSC_FLASHPL_PROG_LEN_POSE) - -/****************** Bit definition for MSC_MEMWAIT register ************************/ - -#define MSC_MEMWAIT_SRAM_W_POSS 8U -#define MSC_MEMWAIT_SRAM_W_POSE 9U -#define MSC_MEMWAIT_SRAM_W_MSK BITS(MSC_MEMWAIT_SRAM_W_POSS,MSC_MEMWAIT_SRAM_W_POSE) - -#define MSC_MEMWAIT_FLASH_W_POSS 0U -#define MSC_MEMWAIT_FLASH_W_POSE 3U -#define MSC_MEMWAIT_FLASH_W_MSK BITS(MSC_MEMWAIT_FLASH_W_POSS,MSC_MEMWAIT_FLASH_W_POSE) - -typedef struct -{ - __IO uint32_t FLASHKEY; - __IO uint32_t INFOKEY; - __IO uint32_t FLASHADDR; - __O uint32_t FLASHFIFO; - __IO uint32_t FLASHDL; - __IO uint32_t FLASHDH; - __O uint32_t FLASHCMD; - __IO uint32_t FLASHCR; - __I uint32_t FLASHSR; - __IO uint32_t FLASHPL; - __IO uint32_t MEMWAIT; -} MSC_TypeDef; - -/****************** Bit definition for BKPC_PROT register ************************/ - -#define BKPC_PROT_KEY_POSS 1U -#define BKPC_PROT_KEY_POSE 31U -#define BKPC_PROT_KEY_MSK BITS(BKPC_PROT_KEY_POSS,BKPC_PROT_KEY_POSE) - -#define BKPC_PROT_PROT_POS 0U -#define BKPC_PROT_PROT_MSK BIT(BKPC_PROT_PROT_POS) - -/****************** Bit definition for BKPC_CR register ************************/ - -#define BKPC_CR_LDO_VSEL_POSS 24U -#define BKPC_CR_LDO_VSEL_POSE 26U -#define BKPC_CR_LDO_VSEL_MSK BITS(BKPC_CR_LDO_VSEL_POSS,BKPC_CR_LDO_VSEL_POSE) - -#define BKPC_CR_MT_STDB_POS 19U -#define BKPC_CR_MT_STDB_MSK BIT(BKPC_CR_MT_STDB_POS) - -#define BKPC_CR_VR1P5_VSEL_POSS 16U -#define BKPC_CR_VR1P5_VSEL_POSE 18U -#define BKPC_CR_VR1P5_VSEL_MSK BITS(BKPC_CR_VR1P5_VSEL_POSS,BKPC_CR_VR1P5_VSEL_POSE) - -#define BKPC_CR_TC_PWRDWN_POS 13U -#define BKPC_CR_TC_PWRDWN_MSK BIT(BKPC_CR_TC_PWRDWN_POS) - -#define BKPC_CR_WKPOL_POS 12U -#define BKPC_CR_WKPOL_MSK BIT(BKPC_CR_WKPOL_POS) - -#define BKPC_CR_WKPS_POSS 9U -#define BKPC_CR_WKPS_POSE 11U -#define BKPC_CR_WKPS_MSK BITS(BKPC_CR_WKPS_POSS,BKPC_CR_WKPS_POSE) - -#define BKPC_CR_WKPEN_POS 8U -#define BKPC_CR_WKPEN_MSK BIT(BKPC_CR_WKPEN_POS) - -#define BKPC_CR_LRCEN_POS 2U -#define BKPC_CR_LRCEN_MSK BIT(BKPC_CR_LRCEN_POS) - -#define BKPC_CR_LOSMEN_POS 1U -#define BKPC_CR_LOSMEN_MSK BIT(BKPC_CR_LOSMEN_POS) - -#define BKPC_CR_LOSCEN_POS 0U -#define BKPC_CR_LOSCEN_MSK BIT(BKPC_CR_LOSCEN_POS) - -/****************** Bit definition for BKPC_PCCR register ************************/ - -#define BKPC_PCCR_TSENSECS_POSS 4U -#define BKPC_PCCR_TSENSECS_POSE 5U -#define BKPC_PCCR_TSENSECS_MSK BITS(BKPC_PCCR_TSENSECS_POSS,BKPC_PCCR_TSENSECS_POSE) - -#define BKPC_PCCR_RTCCS_POSS 0U -#define BKPC_PCCR_RTCCS_POSE 1U -#define BKPC_PCCR_RTCCS_MSK BITS(BKPC_PCCR_RTCCS_POSS,BKPC_PCCR_RTCCS_POSE) - -typedef struct -{ - __IO uint32_t PROT; - __IO uint32_t CR; - __IO uint32_t PCCR; -} BKPC_TypeDef; - -/****************** Bit definition for PMU_CR register ************************/ - -#define PMU_CR_MTSTOP_POS 21U -#define PMU_CR_MTSTOP_MSK BIT(PMU_CR_MTSTOP_POS) - -#define PMU_CR_LPSTOP_POS 20U -#define PMU_CR_LPSTOP_MSK BIT(PMU_CR_LPSTOP_POS) - -#define PMU_CR_LPRUN_POS 19U -#define PMU_CR_LPRUN_MSK BIT(PMU_CR_LPRUN_POS) - -#define PMU_CR_LPVS_POSS 16U -#define PMU_CR_LPVS_POSE 18U -#define PMU_CR_LPVS_MSK BITS(PMU_CR_LPVS_POSS,PMU_CR_LPVS_POSE) - -#define PMU_CR_WKPS_POSS 9U -#define PMU_CR_WKPS_POSE 11U -#define PMU_CR_WKPS_MSK BITS(PMU_CR_WKPS_POSS,PMU_CR_WKPS_POSE) - -#define PMU_CR_WKPEN_POS 8U -#define PMU_CR_WKPEN_MSK BIT(PMU_CR_WKPEN_POS) - -#define PMU_CR_CSTANDBYF_POS 3U -#define PMU_CR_CSTANDBYF_MSK BIT(PMU_CR_CSTANDBYF_POS) - -#define PMU_CR_CWUF_POS 2U -#define PMU_CR_CWUF_MSK BIT(PMU_CR_CWUF_POS) - -#define PMU_CR_LPM_POSS 0U -#define PMU_CR_LPM_POSE 1U -#define PMU_CR_LPM_MSK BITS(PMU_CR_LPM_POSS,PMU_CR_LPM_POSE) - -/****************** Bit definition for PMU_SR register ************************/ - -#define PMU_SR_STANDBYF_POS 1U -#define PMU_SR_STANDBYF_MSK BIT(PMU_SR_STANDBYF_POS) - -#define PMU_SR_WUF_POS 0U -#define PMU_SR_WUF_MSK BIT(PMU_SR_WUF_POS) - -/****************** Bit definition for PMU_LVDCR register ************************/ - -#define PMU_LVDCR_LVDO_POS 15U -#define PMU_LVDCR_LVDO_MSK BIT(PMU_LVDCR_LVDO_POS) - -#define PMU_LVDCR_LVDFLT_POS 11U -#define PMU_LVDCR_LVDFLT_MSK BIT(PMU_LVDCR_LVDFLT_POS) - -#define PMU_LVDCR_LVIFS_POSS 8U -#define PMU_LVDCR_LVIFS_POSE 10U -#define PMU_LVDCR_LVIFS_MSK BITS(PMU_LVDCR_LVIFS_POSS,PMU_LVDCR_LVIFS_POSE) - -#define PMU_LVDCR_LVDS_POSS 4U -#define PMU_LVDCR_LVDS_POSE 7U -#define PMU_LVDCR_LVDS_MSK BITS(PMU_LVDCR_LVDS_POSS,PMU_LVDCR_LVDS_POSE) - -#define PMU_LVDCR_LVDCIF_POS 3U -#define PMU_LVDCR_LVDCIF_MSK BIT(PMU_LVDCR_LVDCIF_POS) - -#define PMU_LVDCR_LVDIF_POS 2U -#define PMU_LVDCR_LVDIF_MSK BIT(PMU_LVDCR_LVDIF_POS) - -#define PMU_LVDCR_LVDIE_POS 1U -#define PMU_LVDCR_LVDIE_MSK BIT(PMU_LVDCR_LVDIE_POS) - -#define PMU_LVDCR_LVDEN_POS 0U -#define PMU_LVDCR_LVDEN_MSK BIT(PMU_LVDCR_LVDEN_POS) - -/****************** Bit definition for PMU_PWRCR register ************************/ - -#define PMU_PWRCR_BXCAN_POS 4U -#define PMU_PWRCR_BXCAN_MSK BIT(PMU_PWRCR_BXCAN_POS) - -#define PMU_PWRCR_SRAM_POSS 0U -#define PMU_PWRCR_SRAM_POSE 1U -#define PMU_PWRCR_SRAM_MSK BITS(PMU_PWRCR_SRAM_POSS,PMU_PWRCR_SRAM_POSE) - -/****************** Bit definition for PMU_TWUR register ************************/ - -#define PMU_TWUR_TWU_POSS 0U -#define PMU_TWUR_TWU_POSE 11U -#define PMU_TWUR_TWU_MSK BITS(PMU_TWUR_TWU_POSS,PMU_TWUR_TWU_POSE) - -/****************** Bit definition for PMU_VREFCR register ************************/ - -#define PMU_VREFCR_FLTS_POSS 13U -#define PMU_VREFCR_FLTS_POSE 14U -#define PMU_VREFCR_FLTS_MSK BITS(PMU_VREFCR_FLTS_POSS,PMU_VREFCR_FLTS_POSE) - -#define PMU_VREFCR_CHOPCS_POSS 10U -#define PMU_VREFCR_CHOPCS_POSE 12U -#define PMU_VREFCR_CHOPCS_MSK BITS(PMU_VREFCR_CHOPCS_POSS,PMU_VREFCR_CHOPCS_POSE) - -#define PMU_VREFCR_CHOP1EN_POS 9U -#define PMU_VREFCR_CHOP1EN_MSK BIT(PMU_VREFCR_CHOP1EN_POS) - -#define PMU_VREFCR_CHOPEN_POS 8U -#define PMU_VREFCR_CHOPEN_MSK BIT(PMU_VREFCR_CHOPEN_POS) - -#define PMU_VREFCR_VREFEN_POS 0U -#define PMU_VREFCR_VREFEN_MSK BIT(PMU_VREFCR_VREFEN_POS) - -typedef struct -{ - __IO uint32_t CR; - __I uint32_t SR; - __IO uint32_t LVDCR; - __IO uint32_t PWRCR; - __IO uint32_t TWUR; - __IO uint32_t VREFCR; -} PMU_TypeDef; - -/****************** Bit definition for RMU_CR register ************************/ - -#define RMU_CR_BORVS_POSS 4U -#define RMU_CR_BORVS_POSE 7U -#define RMU_CR_BORVS_MSK BITS(RMU_CR_BORVS_POSS,RMU_CR_BORVS_POSE) - -#define RMU_CR_BORFLT_POSS 1U -#define RMU_CR_BORFLT_POSE 3U -#define RMU_CR_BORFLT_MSK BITS(RMU_CR_BORFLT_POSS,RMU_CR_BORFLT_POSE) - -#define RMU_CR_BOREN_POS 0U -#define RMU_CR_BOREN_MSK BIT(RMU_CR_BOREN_POS) - -/****************** Bit definition for RMU_RSTSR register ************************/ - -#define RMU_RSTSR_CFGERR_POS 16U -#define RMU_RSTSR_CFGERR_MSK BIT(RMU_RSTSR_CFGERR_POS) - -#define RMU_RSTSR_CFG_POS 10U -#define RMU_RSTSR_CFG_MSK BIT(RMU_RSTSR_CFG_POS) - -#define RMU_RSTSR_CPU_POS 9U -#define RMU_RSTSR_CPU_MSK BIT(RMU_RSTSR_CPU_POS) - -#define RMU_RSTSR_MCU_POS 8U -#define RMU_RSTSR_MCU_MSK BIT(RMU_RSTSR_MCU_POS) - -#define RMU_RSTSR_CHIP_POS 7U -#define RMU_RSTSR_CHIP_MSK BIT(RMU_RSTSR_CHIP_POS) - -#define RMU_RSTSR_LOCKUP_POS 6U -#define RMU_RSTSR_LOCKUP_MSK BIT(RMU_RSTSR_LOCKUP_POS) - -#define RMU_RSTSR_WWDT_POS 5U -#define RMU_RSTSR_WWDT_MSK BIT(RMU_RSTSR_WWDT_POS) - -#define RMU_RSTSR_IWDT_POS 4U -#define RMU_RSTSR_IWDT_MSK BIT(RMU_RSTSR_IWDT_POS) - -#define RMU_RSTSR_NMRST_POS 3U -#define RMU_RSTSR_NMRST_MSK BIT(RMU_RSTSR_NMRST_POS) - -#define RMU_RSTSR_BOR_POS 2U -#define RMU_RSTSR_BOR_MSK BIT(RMU_RSTSR_BOR_POS) - -#define RMU_RSTSR_WAKEUP_POS 1U -#define RMU_RSTSR_WAKEUP_MSK BIT(RMU_RSTSR_WAKEUP_POS) - -#define RMU_RSTSR_POR_POS 0U -#define RMU_RSTSR_POR_MSK BIT(RMU_RSTSR_POR_POS) - -/****************** Bit definition for RMU_CRSTSR register ************************/ - -#define RMU_CRSTSR_CFG_POS 10U -#define RMU_CRSTSR_CFG_MSK BIT(RMU_CRSTSR_CFG_POS) - -#define RMU_CRSTSR_CPU_POS 9U -#define RMU_CRSTSR_CPU_MSK BIT(RMU_CRSTSR_CPU_POS) - -#define RMU_CRSTSR_MCU_POS 8U -#define RMU_CRSTSR_MCU_MSK BIT(RMU_CRSTSR_MCU_POS) - -#define RMU_CRSTSR_CHIP_POS 7U -#define RMU_CRSTSR_CHIP_MSK BIT(RMU_CRSTSR_CHIP_POS) - -#define RMU_CRSTSR_LOCKUP_POS 6U -#define RMU_CRSTSR_LOCKUP_MSK BIT(RMU_CRSTSR_LOCKUP_POS) - -#define RMU_CRSTSR_WWDT_POS 5U -#define RMU_CRSTSR_WWDT_MSK BIT(RMU_CRSTSR_WWDT_POS) - -#define RMU_CRSTSR_IWDT_POS 4U -#define RMU_CRSTSR_IWDT_MSK BIT(RMU_CRSTSR_IWDT_POS) - -#define RMU_CRSTSR_NMRST_POS 3U -#define RMU_CRSTSR_NMRST_MSK BIT(RMU_CRSTSR_NMRST_POS) - -#define RMU_CRSTSR_BOR_POS 2U -#define RMU_CRSTSR_BOR_MSK BIT(RMU_CRSTSR_BOR_POS) - -#define RMU_CRSTSR_WAKEUP_POS 1U -#define RMU_CRSTSR_WAKEUP_MSK BIT(RMU_CRSTSR_WAKEUP_POS) - -#define RMU_CRSTSR_POR_POS 0U -#define RMU_CRSTSR_POR_MSK BIT(RMU_CRSTSR_POR_POS) - -/****************** Bit definition for RMU_AHB1RSTR register ************************/ - -#define RMU_AHB1RSTR_PISRST_POS 5U -#define RMU_AHB1RSTR_PISRST_MSK BIT(RMU_AHB1RSTR_PISRST_POS) - -#define RMU_AHB1RSTR_TRNGRST_POS 4U -#define RMU_AHB1RSTR_TRNGRST_MSK BIT(RMU_AHB1RSTR_TRNGRST_POS) - -#define RMU_AHB1RSTR_CRYPTRST_POS 3U -#define RMU_AHB1RSTR_CRYPTRST_MSK BIT(RMU_AHB1RSTR_CRYPTRST_POS) - -#define RMU_AHB1RSTR_CALCRST_POS 2U -#define RMU_AHB1RSTR_CALCRST_MSK BIT(RMU_AHB1RSTR_CALCRST_POS) - -#define RMU_AHB1RSTR_CRCRST_POS 1U -#define RMU_AHB1RSTR_CRCRST_MSK BIT(RMU_AHB1RSTR_CRCRST_POS) - -#define RMU_AHB1RSTR_GPIORST_POS 0U -#define RMU_AHB1RSTR_GPIORST_MSK BIT(RMU_AHB1RSTR_GPIORST_POS) - -/****************** Bit definition for RMU_AHB2RSTR register ************************/ - -#define RMU_AHB2RSTR_CPURST_POS 1U -#define RMU_AHB2RSTR_CPURST_MSK BIT(RMU_AHB2RSTR_CPURST_POS) - -#define RMU_AHB2RSTR_CHIPRST_POS 0U -#define RMU_AHB2RSTR_CHIPRST_MSK BIT(RMU_AHB2RSTR_CHIPRST_POS) - -/****************** Bit definition for RMU_APB1RSTR register ************************/ - -#define RMU_APB1RSTR_CAN0RST_POS 24U -#define RMU_APB1RSTR_CAN0RST_MSK BIT(RMU_APB1RSTR_CAN0RST_POS) - -#define RMU_APB1RSTR_I2C1RST_POS 21U -#define RMU_APB1RSTR_I2C1RST_MSK BIT(RMU_APB1RSTR_I2C1RST_POS) - -#define RMU_APB1RSTR_I2C0RST_POS 20U -#define RMU_APB1RSTR_I2C0RST_MSK BIT(RMU_APB1RSTR_I2C0RST_POS) - -#define RMU_APB1RSTR_SPI2RST_POS 18U -#define RMU_APB1RSTR_SPI2RST_MSK BIT(RMU_APB1RSTR_SPI2RST_POS) - -#define RMU_APB1RSTR_SPI1RST_POS 17U -#define RMU_APB1RSTR_SPI1RST_MSK BIT(RMU_APB1RSTR_SPI1RST_POS) - -#define RMU_APB1RSTR_SPI0RST_POS 16U -#define RMU_APB1RSTR_SPI0RST_MSK BIT(RMU_APB1RSTR_SPI0RST_POS) - -#define RMU_APB1RSTR_USART1RST_POS 13U -#define RMU_APB1RSTR_USART1RST_MSK BIT(RMU_APB1RSTR_USART1RST_POS) - -#define RMU_APB1RSTR_USART0RST_POS 12U -#define RMU_APB1RSTR_USART0RST_MSK BIT(RMU_APB1RSTR_USART0RST_POS) - -#define RMU_APB1RSTR_UART3RST_POS 11U -#define RMU_APB1RSTR_UART3RST_MSK BIT(RMU_APB1RSTR_UART3RST_POS) - -#define RMU_APB1RSTR_UART2RST_POS 10U -#define RMU_APB1RSTR_UART2RST_MSK BIT(RMU_APB1RSTR_UART2RST_POS) - -#define RMU_APB1RSTR_UART1RST_POS 9U -#define RMU_APB1RSTR_UART1RST_MSK BIT(RMU_APB1RSTR_UART1RST_POS) - -#define RMU_APB1RSTR_UART0RST_POS 8U -#define RMU_APB1RSTR_UART0RST_MSK BIT(RMU_APB1RSTR_UART0RST_POS) - -#define RMU_APB1RSTR_TIM7RST_POS 7U -#define RMU_APB1RSTR_TIM7RST_MSK BIT(RMU_APB1RSTR_TIM7RST_POS) - -#define RMU_APB1RSTR_TIM6RST_POS 6U -#define RMU_APB1RSTR_TIM6RST_MSK BIT(RMU_APB1RSTR_TIM6RST_POS) - -#define RMU_APB1RSTR_TIM5RST_POS 5U -#define RMU_APB1RSTR_TIM5RST_MSK BIT(RMU_APB1RSTR_TIM5RST_POS) - -#define RMU_APB1RSTR_TIM4RST_POS 4U -#define RMU_APB1RSTR_TIM4RST_MSK BIT(RMU_APB1RSTR_TIM4RST_POS) - -#define RMU_APB1RSTR_TIM3RST_POS 3U -#define RMU_APB1RSTR_TIM3RST_MSK BIT(RMU_APB1RSTR_TIM3RST_POS) - -#define RMU_APB1RSTR_TIM2RST_POS 2U -#define RMU_APB1RSTR_TIM2RST_MSK BIT(RMU_APB1RSTR_TIM2RST_POS) - -#define RMU_APB1RSTR_TIM1RST_POS 1U -#define RMU_APB1RSTR_TIM1RST_MSK BIT(RMU_APB1RSTR_TIM1RST_POS) - -#define RMU_APB1RSTR_TIM0RST_POS 0U -#define RMU_APB1RSTR_TIM0RST_MSK BIT(RMU_APB1RSTR_TIM0RST_POS) - -/****************** Bit definition for RMU_APB2RSTR register ************************/ - -#define RMU_APB2RSTR_BKPRAMRST_POS 18U -#define RMU_APB2RSTR_BKPRAMRST_MSK BIT(RMU_APB2RSTR_BKPRAMRST_POS) - -#define RMU_APB2RSTR_BKPCRST_POS 17U -#define RMU_APB2RSTR_BKPCRST_MSK BIT(RMU_APB2RSTR_BKPCRST_POS) - -#define RMU_APB2RSTR_TSENSERST_POS 16U -#define RMU_APB2RSTR_TSENSERST_MSK BIT(RMU_APB2RSTR_TSENSERST_POS) - -#define RMU_APB2RSTR_RTCRST_POS 15U -#define RMU_APB2RSTR_RTCRST_MSK BIT(RMU_APB2RSTR_RTCRST_POS) - -#define RMU_APB2RSTR_IWDTRST_POS 14U -#define RMU_APB2RSTR_IWDTRST_MSK BIT(RMU_APB2RSTR_IWDTRST_POS) - -#define RMU_APB2RSTR_LCDRST_POS 13U -#define RMU_APB2RSTR_LCDRST_MSK BIT(RMU_APB2RSTR_LCDRST_POS) - -#define RMU_APB2RSTR_WWDTRST_POS 12U -#define RMU_APB2RSTR_WWDTRST_MSK BIT(RMU_APB2RSTR_WWDTRST_POS) - -#define RMU_APB2RSTR_OPAMPRST_POS 8U -#define RMU_APB2RSTR_OPAMPRST_MSK BIT(RMU_APB2RSTR_OPAMPRST_POS) - -#define RMU_APB2RSTR_ACMP1RST_POS 7U -#define RMU_APB2RSTR_ACMP1RST_MSK BIT(RMU_APB2RSTR_ACMP1RST_POS) - -#define RMU_APB2RSTR_ACMP0RST_POS 6U -#define RMU_APB2RSTR_ACMP0RST_MSK BIT(RMU_APB2RSTR_ACMP0RST_POS) - -#define RMU_APB2RSTR_ADC0RST_POS 4U -#define RMU_APB2RSTR_ADC0RST_MSK BIT(RMU_APB2RSTR_ADC0RST_POS) - -#define RMU_APB2RSTR_LPUART0RST_POS 2U -#define RMU_APB2RSTR_LPUART0RST_MSK BIT(RMU_APB2RSTR_LPUART0RST_POS) - -#define RMU_APB2RSTR_LPTIM0RST_POS 0U -#define RMU_APB2RSTR_LPTIM0RST_MSK BIT(RMU_APB2RSTR_LPTIM0RST_POS) - -typedef struct -{ - __IO uint32_t CR; - uint32_t RESERVED0[3] ; - __I uint32_t RSTSR; - __O uint32_t CRSTSR; - uint32_t RESERVED1[2] ; - __O uint32_t AHB1RSTR; - __O uint32_t AHB2RSTR; - uint32_t RESERVED2[2] ; - __O uint32_t APB1RSTR; - __O uint32_t APB2RSTR; -} RMU_TypeDef; - -/****************** Bit definition for CMU_CSR register ************************/ - -#define CMU_CSR_CFT_RDYN_POS 25U -#define CMU_CSR_CFT_RDYN_MSK BIT(CMU_CSR_CFT_RDYN_POS) - -#define CMU_CSR_CFT_STU_POS 24U -#define CMU_CSR_CFT_STU_MSK BIT(CMU_CSR_CFT_STU_POS) - -#define CMU_CSR_CFT_CMD_POSS 16U -#define CMU_CSR_CFT_CMD_POSE 23U -#define CMU_CSR_CFT_CMD_MSK BITS(CMU_CSR_CFT_CMD_POSS,CMU_CSR_CFT_CMD_POSE) - -#define CMU_CSR_SYS_RDYN_POS 12U -#define CMU_CSR_SYS_RDYN_MSK BIT(CMU_CSR_SYS_RDYN_POS) - -#define CMU_CSR_SYS_STU_POSS 8U -#define CMU_CSR_SYS_STU_POSE 10U -#define CMU_CSR_SYS_STU_MSK BITS(CMU_CSR_SYS_STU_POSS,CMU_CSR_SYS_STU_POSE) - -#define CMU_CSR_SYS_CMD_POSS 0U -#define CMU_CSR_SYS_CMD_POSE 2U -#define CMU_CSR_SYS_CMD_MSK BITS(CMU_CSR_SYS_CMD_POSS,CMU_CSR_SYS_CMD_POSE) - -/****************** Bit definition for CMU_CFGR register ************************/ - -#define CMU_CFGR_HRCFST_POS 25U -#define CMU_CFGR_HRCFST_MSK BIT(CMU_CFGR_HRCFST_POS) - -#define CMU_CFGR_HRCFSW_POS 24U -#define CMU_CFGR_HRCFSW_MSK BIT(CMU_CFGR_HRCFSW_POS) - -#define CMU_CFGR_PCLK2DIV_POSS 20U -#define CMU_CFGR_PCLK2DIV_POSE 23U -#define CMU_CFGR_PCLK2DIV_MSK BITS(CMU_CFGR_PCLK2DIV_POSS,CMU_CFGR_PCLK2DIV_POSE) - -#define CMU_CFGR_PCLK1DIV_POSS 16U -#define CMU_CFGR_PCLK1DIV_POSE 19U -#define CMU_CFGR_PCLK1DIV_MSK BITS(CMU_CFGR_PCLK1DIV_POSS,CMU_CFGR_PCLK1DIV_POSE) - -#define CMU_CFGR_SYSDIV_POSS 12U -#define CMU_CFGR_SYSDIV_POSE 15U -#define CMU_CFGR_SYSDIV_MSK BITS(CMU_CFGR_SYSDIV_POSS,CMU_CFGR_SYSDIV_POSE) - -#define CMU_CFGR_HCLK1DIV_POSS 0U -#define CMU_CFGR_HCLK1DIV_POSE 3U -#define CMU_CFGR_HCLK1DIV_MSK BITS(CMU_CFGR_HCLK1DIV_POSS,CMU_CFGR_HCLK1DIV_POSE) - -/****************** Bit definition for CMU_CLKENR register ************************/ - -#define CMU_CLKENR_PLL2EN_POS 9U -#define CMU_CLKENR_PLL2EN_MSK BIT(CMU_CLKENR_PLL2EN_POS) - -#define CMU_CLKENR_PLL1EN_POS 8U -#define CMU_CLKENR_PLL1EN_MSK BIT(CMU_CLKENR_PLL1EN_POS) - -#define CMU_CLKENR_ULRCEN_POS 4U -#define CMU_CLKENR_ULRCEN_MSK BIT(CMU_CLKENR_ULRCEN_POS) - -#define CMU_CLKENR_LRCEN_POS 3U -#define CMU_CLKENR_LRCEN_MSK BIT(CMU_CLKENR_LRCEN_POS) - -#define CMU_CLKENR_HRCEN_POS 2U -#define CMU_CLKENR_HRCEN_MSK BIT(CMU_CLKENR_HRCEN_POS) - -#define CMU_CLKENR_LOSCEN_POS 1U -#define CMU_CLKENR_LOSCEN_MSK BIT(CMU_CLKENR_LOSCEN_POS) - -#define CMU_CLKENR_HOSCEN_POS 0U -#define CMU_CLKENR_HOSCEN_MSK BIT(CMU_CLKENR_HOSCEN_POS) - -/****************** Bit definition for CMU_CLKSR register ************************/ - -#define CMU_CLKSR_PLL2RDY_POS 25U -#define CMU_CLKSR_PLL2RDY_MSK BIT(CMU_CLKSR_PLL2RDY_POS) - -#define CMU_CLKSR_PLL1RDY_POS 24U -#define CMU_CLKSR_PLL1RDY_MSK BIT(CMU_CLKSR_PLL1RDY_POS) - -#define CMU_CLKSR_LRCRDY_POS 19U -#define CMU_CLKSR_LRCRDY_MSK BIT(CMU_CLKSR_LRCRDY_POS) - -#define CMU_CLKSR_HRCRDY_POS 18U -#define CMU_CLKSR_HRCRDY_MSK BIT(CMU_CLKSR_HRCRDY_POS) - -#define CMU_CLKSR_LOSCRDY_POS 17U -#define CMU_CLKSR_LOSCRDY_MSK BIT(CMU_CLKSR_LOSCRDY_POS) - -#define CMU_CLKSR_HOSCRDY_POS 16U -#define CMU_CLKSR_HOSCRDY_MSK BIT(CMU_CLKSR_HOSCRDY_POS) - -#define CMU_CLKSR_PLL2ACT_POS 9U -#define CMU_CLKSR_PLL2ACT_MSK BIT(CMU_CLKSR_PLL2ACT_POS) - -#define CMU_CLKSR_PLL1ACT_POS 8U -#define CMU_CLKSR_PLL1ACT_MSK BIT(CMU_CLKSR_PLL1ACT_POS) - -#define CMU_CLKSR_ULRCACT_POS 4U -#define CMU_CLKSR_ULRCACT_MSK BIT(CMU_CLKSR_ULRCACT_POS) - -#define CMU_CLKSR_LRCACT_POS 3U -#define CMU_CLKSR_LRCACT_MSK BIT(CMU_CLKSR_LRCACT_POS) - -#define CMU_CLKSR_HRCACT_POS 2U -#define CMU_CLKSR_HRCACT_MSK BIT(CMU_CLKSR_HRCACT_POS) - -#define CMU_CLKSR_LOSCACT_POS 1U -#define CMU_CLKSR_LOSCACT_MSK BIT(CMU_CLKSR_LOSCACT_POS) - -#define CMU_CLKSR_HOSCACT_POS 0U -#define CMU_CLKSR_HOSCACT_MSK BIT(CMU_CLKSR_HOSCACT_POS) - -/****************** Bit definition for CMU_PLLCFG register ************************/ - -#define CMU_PLLCFG_PLL2LCKN_POS 17U -#define CMU_PLLCFG_PLL2LCKN_MSK BIT(CMU_PLLCFG_PLL2LCKN_POS) - -#define CMU_PLLCFG_PLL1LCKN_POS 16U -#define CMU_PLLCFG_PLL1LCKN_MSK BIT(CMU_PLLCFG_PLL1LCKN_POS) - -#define CMU_PLLCFG_PLL2RFS_POSS 8U -#define CMU_PLLCFG_PLL2RFS_POSE 9U -#define CMU_PLLCFG_PLL2RFS_MSK BITS(CMU_PLLCFG_PLL2RFS_POSS,CMU_PLLCFG_PLL2RFS_POSE) - -#define CMU_PLLCFG_PLL1OS_POS 4U -#define CMU_PLLCFG_PLL1OS_MSK BIT(CMU_PLLCFG_PLL1OS_POS) - -#define CMU_PLLCFG_PLL1RFS_POSS 0U -#define CMU_PLLCFG_PLL1RFS_POSE 2U -#define CMU_PLLCFG_PLL1RFS_MSK BITS(CMU_PLLCFG_PLL1RFS_POSS,CMU_PLLCFG_PLL1RFS_POSE) - -/****************** Bit definition for CMU_HOSCCFG register ************************/ - -#define CMU_HOSCCFG_FREQ_POSS 0U -#define CMU_HOSCCFG_FREQ_POSE 4U -#define CMU_HOSCCFG_FREQ_MSK BITS(CMU_HOSCCFG_FREQ_POSS,CMU_HOSCCFG_FREQ_POSE) - -/****************** Bit definition for CMU_HOSMCR register ************************/ - -#define CMU_HOSMCR_NMIE_POS 20U -#define CMU_HOSMCR_NMIE_MSK BIT(CMU_HOSMCR_NMIE_POS) - -#define CMU_HOSMCR_STPIF_POS 19U -#define CMU_HOSMCR_STPIF_MSK BIT(CMU_HOSMCR_STPIF_POS) - -#define CMU_HOSMCR_STRIF_POS 18U -#define CMU_HOSMCR_STRIF_MSK BIT(CMU_HOSMCR_STRIF_POS) - -#define CMU_HOSMCR_STPIE_POS 17U -#define CMU_HOSMCR_STPIE_MSK BIT(CMU_HOSMCR_STPIE_POS) - -#define CMU_HOSMCR_STRIE_POS 16U -#define CMU_HOSMCR_STRIE_MSK BIT(CMU_HOSMCR_STRIE_POS) - -#define CMU_HOSMCR_FRQS_POSS 8U -#define CMU_HOSMCR_FRQS_POSE 10U -#define CMU_HOSMCR_FRQS_MSK BITS(CMU_HOSMCR_FRQS_POSS,CMU_HOSMCR_FRQS_POSE) - -#define CMU_HOSMCR_CLKS_POS 1U -#define CMU_HOSMCR_CLKS_MSK BIT(CMU_HOSMCR_CLKS_POS) - -#define CMU_HOSMCR_EN_POS 0U -#define CMU_HOSMCR_EN_MSK BIT(CMU_HOSMCR_EN_POS) - -/****************** Bit definition for CMU_LOSMCR register ************************/ - -#define CMU_LOSMCR_NMIE_POS 20U -#define CMU_LOSMCR_NMIE_MSK BIT(CMU_LOSMCR_NMIE_POS) - -#define CMU_LOSMCR_STPIF_POS 19U -#define CMU_LOSMCR_STPIF_MSK BIT(CMU_LOSMCR_STPIF_POS) - -#define CMU_LOSMCR_STRIF_POS 18U -#define CMU_LOSMCR_STRIF_MSK BIT(CMU_LOSMCR_STRIF_POS) - -#define CMU_LOSMCR_STPIE_POS 17U -#define CMU_LOSMCR_STPIE_MSK BIT(CMU_LOSMCR_STPIE_POS) - -#define CMU_LOSMCR_STRIE_POS 16U -#define CMU_LOSMCR_STRIE_MSK BIT(CMU_LOSMCR_STRIE_POS) - -#define CMU_LOSMCR_CLKS_POS 1U -#define CMU_LOSMCR_CLKS_MSK BIT(CMU_LOSMCR_CLKS_POS) - -#define CMU_LOSMCR_EN_POS 0U -#define CMU_LOSMCR_EN_MSK BIT(CMU_LOSMCR_EN_POS) - -/****************** Bit definition for CMU_PULMCR register ************************/ - -#define CMU_PULMCR_NMIE_POS 20U -#define CMU_PULMCR_NMIE_MSK BIT(CMU_PULMCR_NMIE_POS) - -#define CMU_PULMCR_ULKIF_POS 19U -#define CMU_PULMCR_ULKIF_MSK BIT(CMU_PULMCR_ULKIF_POS) - -#define CMU_PULMCR_LCKIF_POS 18U -#define CMU_PULMCR_LCKIF_MSK BIT(CMU_PULMCR_LCKIF_POS) - -#define CMU_PULMCR_ULKIE_POS 17U -#define CMU_PULMCR_ULKIE_MSK BIT(CMU_PULMCR_ULKIE_POS) - -#define CMU_PULMCR_LCKIE_POS 16U -#define CMU_PULMCR_LCKIE_MSK BIT(CMU_PULMCR_LCKIE_POS) - -#define CMU_PULMCR_MODE_POSS 8U -#define CMU_PULMCR_MODE_POSE 9U -#define CMU_PULMCR_MODE_MSK BITS(CMU_PULMCR_MODE_POSS,CMU_PULMCR_MODE_POSE) - -#define CMU_PULMCR_CLKS_POS 1U -#define CMU_PULMCR_CLKS_MSK BIT(CMU_PULMCR_CLKS_POS) - -#define CMU_PULMCR_EN_POS 0U -#define CMU_PULMCR_EN_MSK BIT(CMU_PULMCR_EN_POS) - -/****************** Bit definition for CMU_CLKOCR register ************************/ - -#define CMU_CLKOCR_LSCOS_POSS 24U -#define CMU_CLKOCR_LSCOS_POSE 26U -#define CMU_CLKOCR_LSCOS_MSK BITS(CMU_CLKOCR_LSCOS_POSS,CMU_CLKOCR_LSCOS_POSE) - -#define CMU_CLKOCR_LSCOEN_POS 16U -#define CMU_CLKOCR_LSCOEN_MSK BIT(CMU_CLKOCR_LSCOEN_POS) - -#define CMU_CLKOCR_HSCODIV_POSS 12U -#define CMU_CLKOCR_HSCODIV_POSE 14U -#define CMU_CLKOCR_HSCODIV_MSK BITS(CMU_CLKOCR_HSCODIV_POSS,CMU_CLKOCR_HSCODIV_POSE) - -#define CMU_CLKOCR_HSCOS_POSS 8U -#define CMU_CLKOCR_HSCOS_POSE 10U -#define CMU_CLKOCR_HSCOS_MSK BITS(CMU_CLKOCR_HSCOS_POSS,CMU_CLKOCR_HSCOS_POSE) - -#define CMU_CLKOCR_HSCOEN_POS 0U -#define CMU_CLKOCR_HSCOEN_MSK BIT(CMU_CLKOCR_HSCOEN_POS) - -/****************** Bit definition for CMU_BUZZCR register ************************/ - -#define CMU_BUZZCR_DAT_POSS 16U -#define CMU_BUZZCR_DAT_POSE 31U -#define CMU_BUZZCR_DAT_MSK BITS(CMU_BUZZCR_DAT_POSS,CMU_BUZZCR_DAT_POSE) - -#define CMU_BUZZCR_DIV_POSS 8U -#define CMU_BUZZCR_DIV_POSE 10U -#define CMU_BUZZCR_DIV_MSK BITS(CMU_BUZZCR_DIV_POSS,CMU_BUZZCR_DIV_POSE) - -#define CMU_BUZZCR_EN_POS 0U -#define CMU_BUZZCR_EN_MSK BIT(CMU_BUZZCR_EN_POS) - -/****************** Bit definition for CMU_AHB1ENR register ************************/ - -#define CMU_AHB1ENR_PISEN_POS 5U -#define CMU_AHB1ENR_PISEN_MSK BIT(CMU_AHB1ENR_PISEN_POS) - -#define CMU_AHB1ENR_TRNGEN_POS 4U -#define CMU_AHB1ENR_TRNGEN_MSK BIT(CMU_AHB1ENR_TRNGEN_POS) - -#define CMU_AHB1ENR_CRYPTEN_POS 3U -#define CMU_AHB1ENR_CRYPTEN_MSK BIT(CMU_AHB1ENR_CRYPTEN_POS) - -#define CMU_AHB1ENR_CALCEN_POS 2U -#define CMU_AHB1ENR_CALCEN_MSK BIT(CMU_AHB1ENR_CALCEN_POS) - -#define CMU_AHB1ENR_CRCEN_POS 1U -#define CMU_AHB1ENR_CRCEN_MSK BIT(CMU_AHB1ENR_CRCEN_POS) - -#define CMU_AHB1ENR_GPIOEN_POS 0U -#define CMU_AHB1ENR_GPIOEN_MSK BIT(CMU_AHB1ENR_GPIOEN_POS) - -/****************** Bit definition for CMU_APB1ENR register ************************/ - -#define CMU_APB1ENR_CAN0EN_POS 24U -#define CMU_APB1ENR_CAN0EN_MSK BIT(CMU_APB1ENR_CAN0EN_POS) - -#define CMU_APB1ENR_I2C1EN_POS 21U -#define CMU_APB1ENR_I2C1EN_MSK BIT(CMU_APB1ENR_I2C1EN_POS) - -#define CMU_APB1ENR_I2C0EN_POS 20U -#define CMU_APB1ENR_I2C0EN_MSK BIT(CMU_APB1ENR_I2C0EN_POS) - -#define CMU_APB1ENR_SPI2EN_POS 18U -#define CMU_APB1ENR_SPI2EN_MSK BIT(CMU_APB1ENR_SPI2EN_POS) - -#define CMU_APB1ENR_SPI1EN_POS 17U -#define CMU_APB1ENR_SPI1EN_MSK BIT(CMU_APB1ENR_SPI1EN_POS) - -#define CMU_APB1ENR_SPI0EN_POS 16U -#define CMU_APB1ENR_SPI0EN_MSK BIT(CMU_APB1ENR_SPI0EN_POS) - -#define CMU_APB1ENR_USART1EN_POS 13U -#define CMU_APB1ENR_USART1EN_MSK BIT(CMU_APB1ENR_USART1EN_POS) - -#define CMU_APB1ENR_USART0EN_POS 12U -#define CMU_APB1ENR_USART0EN_MSK BIT(CMU_APB1ENR_USART0EN_POS) - -#define CMU_APB1ENR_UART3EN_POS 11U -#define CMU_APB1ENR_UART3EN_MSK BIT(CMU_APB1ENR_UART3EN_POS) - -#define CMU_APB1ENR_UART2EN_POS 10U -#define CMU_APB1ENR_UART2EN_MSK BIT(CMU_APB1ENR_UART2EN_POS) - -#define CMU_APB1ENR_UART1EN_POS 9U -#define CMU_APB1ENR_UART1EN_MSK BIT(CMU_APB1ENR_UART1EN_POS) - -#define CMU_APB1ENR_UART0EN_POS 8U -#define CMU_APB1ENR_UART0EN_MSK BIT(CMU_APB1ENR_UART0EN_POS) - -#define CMU_APB1ENR_TIM7EN_POS 7U -#define CMU_APB1ENR_TIM7EN_MSK BIT(CMU_APB1ENR_TIM7EN_POS) - -#define CMU_APB1ENR_TIM6EN_POS 6U -#define CMU_APB1ENR_TIM6EN_MSK BIT(CMU_APB1ENR_TIM6EN_POS) - -#define CMU_APB1ENR_TIM5EN_POS 5U -#define CMU_APB1ENR_TIM5EN_MSK BIT(CMU_APB1ENR_TIM5EN_POS) - -#define CMU_APB1ENR_TIM4EN_POS 4U -#define CMU_APB1ENR_TIM4EN_MSK BIT(CMU_APB1ENR_TIM4EN_POS) - -#define CMU_APB1ENR_TIM3EN_POS 3U -#define CMU_APB1ENR_TIM3EN_MSK BIT(CMU_APB1ENR_TIM3EN_POS) - -#define CMU_APB1ENR_TIM2EN_POS 2U -#define CMU_APB1ENR_TIM2EN_MSK BIT(CMU_APB1ENR_TIM2EN_POS) - -#define CMU_APB1ENR_TIM1EN_POS 1U -#define CMU_APB1ENR_TIM1EN_MSK BIT(CMU_APB1ENR_TIM1EN_POS) - -#define CMU_APB1ENR_TIM0EN_POS 0U -#define CMU_APB1ENR_TIM0EN_MSK BIT(CMU_APB1ENR_TIM0EN_POS) - -/****************** Bit definition for CMU_APB2ENR register ************************/ - -#define CMU_APB2ENR_DBGCEN_POS 19U -#define CMU_APB2ENR_DBGCEN_MSK BIT(CMU_APB2ENR_DBGCEN_POS) - -#define CMU_APB2ENR_BKPCEN_POS 17U -#define CMU_APB2ENR_BKPCEN_MSK BIT(CMU_APB2ENR_BKPCEN_POS) - -#define CMU_APB2ENR_TSENSEEN_POS 16U -#define CMU_APB2ENR_TSENSEEN_MSK BIT(CMU_APB2ENR_TSENSEEN_POS) - -#define CMU_APB2ENR_RTCEN_POS 15U -#define CMU_APB2ENR_RTCEN_MSK BIT(CMU_APB2ENR_RTCEN_POS) - -#define CMU_APB2ENR_IWDTEN_POS 14U -#define CMU_APB2ENR_IWDTEN_MSK BIT(CMU_APB2ENR_IWDTEN_POS) - -#define CMU_APB2ENR_LCDEN_POS 13U -#define CMU_APB2ENR_LCDEN_MSK BIT(CMU_APB2ENR_LCDEN_POS) - -#define CMU_APB2ENR_WWDTEN_POS 12U -#define CMU_APB2ENR_WWDTEN_MSK BIT(CMU_APB2ENR_WWDTEN_POS) - -#define CMU_APB2ENR_OPAMPEN_POS 8U -#define CMU_APB2ENR_OPAMPEN_MSK BIT(CMU_APB2ENR_OPAMPEN_POS) - -#define CMU_APB2ENR_ACMP1EN_POS 7U -#define CMU_APB2ENR_ACMP1EN_MSK BIT(CMU_APB2ENR_ACMP1EN_POS) - -#define CMU_APB2ENR_ACMP0EN_POS 6U -#define CMU_APB2ENR_ACMP0EN_MSK BIT(CMU_APB2ENR_ACMP0EN_POS) - -#define CMU_APB2ENR_ADC0EN_POS 4U -#define CMU_APB2ENR_ADC0EN_MSK BIT(CMU_APB2ENR_ADC0EN_POS) - -#define CMU_APB2ENR_LPUART0EN_POS 2U -#define CMU_APB2ENR_LPUART0EN_MSK BIT(CMU_APB2ENR_LPUART0EN_POS) - -#define CMU_APB2ENR_LPTIM0EN_POS 0U -#define CMU_APB2ENR_LPTIM0EN_MSK BIT(CMU_APB2ENR_LPTIM0EN_POS) - -/****************** Bit definition for CMU_LPENR register ************************/ - -#define CMU_LPENR_HOSCEN_POS 3U -#define CMU_LPENR_HOSCEN_MSK BIT(CMU_LPENR_HOSCEN_POS) - -#define CMU_LPENR_HRCEN_POS 2U -#define CMU_LPENR_HRCEN_MSK BIT(CMU_LPENR_HRCEN_POS) - -#define CMU_LPENR_LOSCEN_POS 1U -#define CMU_LPENR_LOSCEN_MSK BIT(CMU_LPENR_LOSCEN_POS) - -#define CMU_LPENR_LRCEN_POS 0U -#define CMU_LPENR_LRCEN_MSK BIT(CMU_LPENR_LRCEN_POS) - -/****************** Bit definition for CMU_PERICR register ************************/ - -#define CMU_PERICR_LCD_POSS 16U -#define CMU_PERICR_LCD_POSE 18U -#define CMU_PERICR_LCD_MSK BITS(CMU_PERICR_LCD_POSS,CMU_PERICR_LCD_POSE) - -#define CMU_PERICR_LPUART0_POSS 8U -#define CMU_PERICR_LPUART0_POSE 11U -#define CMU_PERICR_LPUART0_MSK BITS(CMU_PERICR_LPUART0_POSS,CMU_PERICR_LPUART0_POSE) - -#define CMU_PERICR_LPTIM0_POSS 0U -#define CMU_PERICR_LPTIM0_POSE 3U -#define CMU_PERICR_LPTIM0_MSK BITS(CMU_PERICR_LPTIM0_POSS,CMU_PERICR_LPTIM0_POSE) - -/****************** Bit definition for CMU_HRCACR register ************************/ - -#define CMU_HRCACR_IB_POSS 28U -#define CMU_HRCACR_IB_POSE 29U -#define CMU_HRCACR_IB_MSK BITS(CMU_HRCACR_IB_POSS,CMU_HRCACR_IB_POSE) - -#define CMU_HRCACR_CAP_POSS 26U -#define CMU_HRCACR_CAP_POSE 27U -#define CMU_HRCACR_CAP_MSK BITS(CMU_HRCACR_CAP_POSS,CMU_HRCACR_CAP_POSE) - -#define CMU_HRCACR_CAL_POSS 16U -#define CMU_HRCACR_CAL_POSE 25U -#define CMU_HRCACR_CAL_MSK BITS(CMU_HRCACR_CAL_POSS,CMU_HRCACR_CAL_POSE) - -#define CMU_HRCACR_IBSET_POSS 14U -#define CMU_HRCACR_IBSET_POSE 15U -#define CMU_HRCACR_IBSET_MSK BITS(CMU_HRCACR_IBSET_POSS,CMU_HRCACR_IBSET_POSE) - -#define CMU_HRCACR_CAPSET_POSS 12U -#define CMU_HRCACR_CAPSET_POSE 13U -#define CMU_HRCACR_CAPSET_MSK BITS(CMU_HRCACR_CAPSET_POSS,CMU_HRCACR_CAPSET_POSE) - -#define CMU_HRCACR_STA_POSS 9U -#define CMU_HRCACR_STA_POSE 10U -#define CMU_HRCACR_STA_MSK BITS(CMU_HRCACR_STA_POSS,CMU_HRCACR_STA_POSE) - -#define CMU_HRCACR_BUSY_POS 8U -#define CMU_HRCACR_BUSY_MSK BIT(CMU_HRCACR_BUSY_POS) - -#define CMU_HRCACR_WRTRG_POS 7U -#define CMU_HRCACR_WRTRG_MSK BIT(CMU_HRCACR_WRTRG_POS) - -#define CMU_HRCACR_AC_POSS 4U -#define CMU_HRCACR_AC_POSE 6U -#define CMU_HRCACR_AC_MSK BITS(CMU_HRCACR_AC_POSS,CMU_HRCACR_AC_POSE) - -#define CMU_HRCACR_IBS_POS 3U -#define CMU_HRCACR_IBS_MSK BIT(CMU_HRCACR_IBS_POS) - -#define CMU_HRCACR_RFSEL_POS 2U -#define CMU_HRCACR_RFSEL_MSK BIT(CMU_HRCACR_RFSEL_POS) - -#define CMU_HRCACR_FREQ_POS 1U -#define CMU_HRCACR_FREQ_MSK BIT(CMU_HRCACR_FREQ_POS) - -#define CMU_HRCACR_EN_POS 0U -#define CMU_HRCACR_EN_MSK BIT(CMU_HRCACR_EN_POS) - -typedef struct -{ - __O uint32_t CSR; - __IO uint32_t CFGR; - uint32_t RESERVED0[2] ; - __IO uint32_t CLKENR; - __I uint32_t CLKSR; - __IO uint32_t PLLCFG; - __IO uint32_t HOSCCFG; - __IO uint32_t HOSMCR; - __IO uint32_t LOSMCR; - __IO uint32_t PULMCR; - uint32_t RESERVED1 ; - __IO uint32_t CLKOCR; - __IO uint32_t BUZZCR; - uint32_t RESERVED2[2] ; - __IO uint32_t AHB1ENR; - uint32_t RESERVED3[3] ; - __IO uint32_t APB1ENR; - __IO uint32_t APB2ENR; - uint32_t RESERVED4[2] ; - __IO uint32_t LPENR; - uint32_t RESERVED5[7] ; - __IO uint32_t PERICR; - uint32_t RESERVED6[3] ; - __IO uint32_t HRCACR; -} CMU_TypeDef; - -/****************** Bit definition for DMA_STATUS register ************************/ - -#define DMA_STATUS_STATUS_POSS 4U -#define DMA_STATUS_STATUS_POSE 7U -#define DMA_STATUS_STATUS_MSK BITS(DMA_STATUS_STATUS_POSS,DMA_STATUS_STATUS_POSE) - -#define DMA_STATUS_MASTER_ENABLE_POS 0U -#define DMA_STATUS_MASTER_ENABLE_MSK BIT(DMA_STATUS_MASTER_ENABLE_POS) - -/****************** Bit definition for DMA_CFG register ************************/ - -#define DMA_CFG_CHNL_PROT_CTRL_POSS 5U -#define DMA_CFG_CHNL_PROT_CTRL_POSE 7U -#define DMA_CFG_CHNL_PROT_CTRL_MSK BITS(DMA_CFG_CHNL_PROT_CTRL_POSS,DMA_CFG_CHNL_PROT_CTRL_POSE) - -#define DMA_CFG_MASTER_ENABLE_POS 0U -#define DMA_CFG_MASTER_ENABLE_MSK BIT(DMA_CFG_MASTER_ENABLE_POS) - -/****************** Bit definition for DMA_CTRLBASE register ************************/ - -#define DMA_CTRLBASE_CTRL_BASE_PTR_POSS 9U -#define DMA_CTRLBASE_CTRL_BASE_PTR_POSE 31U -#define DMA_CTRLBASE_CTRL_BASE_PTR_MSK BITS(DMA_CTRLBASE_CTRL_BASE_PTR_POSS,DMA_CTRLBASE_CTRL_BASE_PTR_POSE) - -/****************** Bit definition for DMA_ALTCTRLBASE register ************************/ - -#define DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSS 0U -#define DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSE 31U -#define DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_MSK BITS(DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSS,DMA_ALTCTRLBASE_ALT_CTRL_BASE_PTR_POSE) - -/****************** Bit definition for DMA_CHWAITSTATUS register ************************/ - -#define DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSS 0U -#define DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSE 31U -#define DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_MSK BITS(DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSS,DMA_CHWAITSTATUS_DMA_WAITONREQ_STATUS_POSE) - -/****************** Bit definition for DMA_CHSWREQ register ************************/ - -#define DMA_CHSWREQ_CHSWREQ_POSS 0U -#define DMA_CHSWREQ_CHSWREQ_POSE 31U -#define DMA_CHSWREQ_CHSWREQ_MSK BITS(DMA_CHSWREQ_CHSWREQ_POSS,DMA_CHSWREQ_CHSWREQ_POSE) - -/****************** Bit definition for DMA_CHUSEBURSTSET register ************************/ - -#define DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSS 0U -#define DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSE 31U -#define DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_MSK BITS(DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSS,DMA_CHUSEBURSTSET_CHNL_USEBURST_SET_POSE) - -/****************** Bit definition for DMA_CHUSEBURSTCLR register ************************/ - -#define DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSS 0U -#define DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSE 31U -#define DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_MSK BITS(DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSS,DMA_CHUSEBURSTCLR_CHNL_USEBURST_CLR_POSE) - -/****************** Bit definition for DMA_CHREQMASKSET register ************************/ - -#define DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSS 0U -#define DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSE 31U -#define DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_MSK BITS(DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSS,DMA_CHREQMASKSET_CHNL_REQ_MASK_SET_POSE) - -/****************** Bit definition for DMA_CHREQMASKCLR register ************************/ - -#define DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSS 0U -#define DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSE 31U -#define DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_MSK BITS(DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSS,DMA_CHREQMASKCLR_CHNL_REQ_MASK_CLR_POSE) - -/****************** Bit definition for DMA_CHENSET register ************************/ - -#define DMA_CHENSET_CHNL_ENABLE_SET_POSS 0U -#define DMA_CHENSET_CHNL_ENABLE_SET_POSE 31U -#define DMA_CHENSET_CHNL_ENABLE_SET_MSK BITS(DMA_CHENSET_CHNL_ENABLE_SET_POSS,DMA_CHENSET_CHNL_ENABLE_SET_POSE) - -/****************** Bit definition for DMA_CHENCLR register ************************/ - -#define DMA_CHENCLR_CHNL_ENABLE_CLR_POSS 0U -#define DMA_CHENCLR_CHNL_ENABLE_CLR_POSE 31U -#define DMA_CHENCLR_CHNL_ENABLE_CLR_MSK BITS(DMA_CHENCLR_CHNL_ENABLE_CLR_POSS,DMA_CHENCLR_CHNL_ENABLE_CLR_POSE) - -/****************** Bit definition for DMA_CHPRIALTSET register ************************/ - -#define DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSS 0U -#define DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSE 31U -#define DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_MSK BITS(DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSS,DMA_CHPRIALTSET_CHNL_PRI_ALT_SET_POSE) - -/****************** Bit definition for DMA_CHPRIALTCLR register ************************/ - -#define DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSS 0U -#define DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSE 31U -#define DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_MSK BITS(DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSS,DMA_CHPRIALTCLR_CHNL_PRI_ALT_CLR_POSE) - -/****************** Bit definition for DMA_CHPRSET register ************************/ - -#define DMA_CHPRSET_CHNL_PRIORITY_SET_POSS 0U -#define DMA_CHPRSET_CHNL_PRIORITY_SET_POSE 31U -#define DMA_CHPRSET_CHNL_PRIORITY_SET_MSK BITS(DMA_CHPRSET_CHNL_PRIORITY_SET_POSS,DMA_CHPRSET_CHNL_PRIORITY_SET_POSE) - -/****************** Bit definition for DMA_CHPRCLR register ************************/ - -#define DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSS 0U -#define DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSE 31U -#define DMA_CHPRCLR_CHNL_PRIORITY_CLR_MSK BITS(DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSS,DMA_CHPRCLR_CHNL_PRIORITY_CLR_POSE) - -/****************** Bit definition for DMA_ERRCLR register ************************/ - -#define DMA_ERRCLR_ERR_CLR_POS 0U -#define DMA_ERRCLR_ERR_CLR_MSK BIT(DMA_ERRCLR_ERR_CLR_POS) - -/****************** Bit definition for DMA_IFLAG register ************************/ - -#define DMA_IFLAG_DMAERRIF_POS 31U -#define DMA_IFLAG_DMAERRIF_MSK BIT(DMA_IFLAG_DMAERRIF_POS) - -#define DMA_IFLAG_CH5DONEIF_POS 5U -#define DMA_IFLAG_CH5DONEIF_MSK BIT(DMA_IFLAG_CH5DONEIF_POS) - -#define DMA_IFLAG_CH4DONEIF_POS 4U -#define DMA_IFLAG_CH4DONEIF_MSK BIT(DMA_IFLAG_CH4DONEIF_POS) - -#define DMA_IFLAG_CH3DONEIF_POS 3U -#define DMA_IFLAG_CH3DONEIF_MSK BIT(DMA_IFLAG_CH3DONEIF_POS) - -#define DMA_IFLAG_CH2DONEIF_POS 2U -#define DMA_IFLAG_CH2DONEIF_MSK BIT(DMA_IFLAG_CH2DONEIF_POS) - -#define DMA_IFLAG_CH1DONEIF_POS 1U -#define DMA_IFLAG_CH1DONEIF_MSK BIT(DMA_IFLAG_CH1DONEIF_POS) - -#define DMA_IFLAG_CH0DONEIF_POS 0U -#define DMA_IFLAG_CH0DONEIF_MSK BIT(DMA_IFLAG_CH0DONEIF_POS) - -/****************** Bit definition for DMA_ICFR register ************************/ - -#define DMA_ICFR_DMAERRC_POS 31U -#define DMA_ICFR_DMAERRC_MSK BIT(DMA_ICFR_DMAERRC_POS) - -#define DMA_ICFR_CH5DONEC_POS 5U -#define DMA_ICFR_CH5DONEC_MSK BIT(DMA_ICFR_CH5DONEC_POS) - -#define DMA_ICFR_CH4DONEC_POS 4U -#define DMA_ICFR_CH4DONEC_MSK BIT(DMA_ICFR_CH4DONEC_POS) - -#define DMA_ICFR_CH3DONEC_POS 3U -#define DMA_ICFR_CH3DONEC_MSK BIT(DMA_ICFR_CH3DONEC_POS) - -#define DMA_ICFR_CH2DONEC_POS 2U -#define DMA_ICFR_CH2DONEC_MSK BIT(DMA_ICFR_CH2DONEC_POS) - -#define DMA_ICFR_CH1DONEC_POS 1U -#define DMA_ICFR_CH1DONEC_MSK BIT(DMA_ICFR_CH1DONEC_POS) - -#define DMA_ICFR_CH0DONEC_POS 0U -#define DMA_ICFR_CH0DONEC_MSK BIT(DMA_ICFR_CH0DONEC_POS) - -/****************** Bit definition for DMA_IER register ************************/ - -#define DMA_IER_DMAERRIE_POS 31U -#define DMA_IER_DMAERRIE_MSK BIT(DMA_IER_DMAERRIE_POS) - -#define DMA_IER_CH5DONEIE_POS 5U -#define DMA_IER_CH5DONEIE_MSK BIT(DMA_IER_CH5DONEIE_POS) - -#define DMA_IER_CH4DONEIE_POS 4U -#define DMA_IER_CH4DONEIE_MSK BIT(DMA_IER_CH4DONEIE_POS) - -#define DMA_IER_CH3DONEIE_POS 3U -#define DMA_IER_CH3DONEIE_MSK BIT(DMA_IER_CH3DONEIE_POS) - -#define DMA_IER_CH2DONEIE_POS 2U -#define DMA_IER_CH2DONEIE_MSK BIT(DMA_IER_CH2DONEIE_POS) - -#define DMA_IER_CH1DONEIE_POS 1U -#define DMA_IER_CH1DONEIE_MSK BIT(DMA_IER_CH1DONEIE_POS) - -#define DMA_IER_CH0DONEIE_POS 0U -#define DMA_IER_CH0DONEIE_MSK BIT(DMA_IER_CH0DONEIE_POS) - -/****************** Bit definition for DMA_CH0_SELCON register ************************/ - -#define DMA_CH0_SELCON_MSEL_POSS 8U -#define DMA_CH0_SELCON_MSEL_POSE 13U -#define DMA_CH0_SELCON_MSEL_MSK BITS(DMA_CH0_SELCON_MSEL_POSS,DMA_CH0_SELCON_MSEL_POSE) - -#define DMA_CH0_SELCON_MSIGSEL_POSS 0U -#define DMA_CH0_SELCON_MSIGSEL_POSE 3U -#define DMA_CH0_SELCON_MSIGSEL_MSK BITS(DMA_CH0_SELCON_MSIGSEL_POSS,DMA_CH0_SELCON_MSIGSEL_POSE) - -typedef struct -{ - __I uint32_t STATUS; - __IO uint32_t CFG; - __IO uint32_t CTRLBASE; - __I uint32_t ALTCTRLBASE; - __I uint32_t CHWAITSTATUS; - __IO uint32_t CHSWREQ; - __IO uint32_t CHUSEBURSTSET; - __O uint32_t CHUSEBURSTCLR; - __IO uint32_t CHREQMASKSET; - __O uint32_t CHREQMASKCLR; - __IO uint32_t CHENSET; - __O uint32_t CHENCLR; - __IO uint32_t CHPRIALTSET; - __O uint32_t CHPRIALTCLR; - __IO uint32_t CHPRSET; - __O uint32_t CHPRCLR; - uint32_t RESERVED0[3] ; - __IO uint32_t ERRCLR; - uint32_t RESERVED1[1004] ; - __I uint32_t IFLAG; - uint32_t RESERVED2 ; - __O uint32_t ICFR; - __IO uint32_t IER; - uint32_t RESERVED3[60] ; - __IO uint32_t CH_SELCON[6]; -} DMA_TypeDef; - -/****************** Bit definition for PIS_CH0_CON register ************************/ - -#define PIS_CH0_CON_SYNCSEL_POSS 24U -#define PIS_CH0_CON_SYNCSEL_POSE 26U -#define PIS_CH0_CON_SYNCSEL_MSK BITS(PIS_CH0_CON_SYNCSEL_POSS,PIS_CH0_CON_SYNCSEL_POSE) - -#define PIS_CH0_CON_PULCK_POSS 18U -#define PIS_CH0_CON_PULCK_POSE 19U -#define PIS_CH0_CON_PULCK_MSK BITS(PIS_CH0_CON_PULCK_POSS,PIS_CH0_CON_PULCK_POSE) - -#define PIS_CH0_CON_EDGS_POSS 16U -#define PIS_CH0_CON_EDGS_POSE 17U -#define PIS_CH0_CON_EDGS_MSK BITS(PIS_CH0_CON_EDGS_POSS,PIS_CH0_CON_EDGS_POSE) - -#define PIS_CH0_CON_SRCS_POSS 8U -#define PIS_CH0_CON_SRCS_POSE 13U -#define PIS_CH0_CON_SRCS_MSK BITS(PIS_CH0_CON_SRCS_POSS,PIS_CH0_CON_SRCS_POSE) - -#define PIS_CH0_CON_MSIGS_POSS 0U -#define PIS_CH0_CON_MSIGS_POSE 3U -#define PIS_CH0_CON_MSIGS_MSK BITS(PIS_CH0_CON_MSIGS_POSS,PIS_CH0_CON_MSIGS_POSE) - -/****************** Bit definition for PIS_CH_OER register ************************/ - -#define PIS_CH_OER_CH3OE_POS 3U -#define PIS_CH_OER_CH3OE_MSK BIT(PIS_CH_OER_CH3OE_POS) - -#define PIS_CH_OER_CH2OE_POS 2U -#define PIS_CH_OER_CH2OE_MSK BIT(PIS_CH_OER_CH2OE_POS) - -#define PIS_CH_OER_CH1OE_POS 1U -#define PIS_CH_OER_CH1OE_MSK BIT(PIS_CH_OER_CH1OE_POS) - -#define PIS_CH_OER_CH0OE_POS 0U -#define PIS_CH_OER_CH0OE_MSK BIT(PIS_CH_OER_CH0OE_POS) - -/****************** Bit definition for PIS_TAR_CON0 register ************************/ - -#define PIS_TAR_CON0_TIM3_CH2IN_SEL_POS 25U -#define PIS_TAR_CON0_TIM3_CH2IN_SEL_MSK BIT(PIS_TAR_CON0_TIM3_CH2IN_SEL_POS) - -#define PIS_TAR_CON0_TIM3_CH1IN_SEL_POS 24U -#define PIS_TAR_CON0_TIM3_CH1IN_SEL_MSK BIT(PIS_TAR_CON0_TIM3_CH1IN_SEL_POS) - -#define PIS_TAR_CON0_TIM2_CH2IN_SEL_POS 17U -#define PIS_TAR_CON0_TIM2_CH2IN_SEL_MSK BIT(PIS_TAR_CON0_TIM2_CH2IN_SEL_POS) - -#define PIS_TAR_CON0_TIM2_CH1IN_SEL_POS 16U -#define PIS_TAR_CON0_TIM2_CH1IN_SEL_MSK BIT(PIS_TAR_CON0_TIM2_CH1IN_SEL_POS) - -#define PIS_TAR_CON0_TIM0_BRKIN_SEL_POS 4U -#define PIS_TAR_CON0_TIM0_BRKIN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_BRKIN_SEL_POS) - -#define PIS_TAR_CON0_TIM0_CH4IN_SEL_POS 3U -#define PIS_TAR_CON0_TIM0_CH4IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH4IN_SEL_POS) - -#define PIS_TAR_CON0_TIM0_CH3IN_SEL_POS 2U -#define PIS_TAR_CON0_TIM0_CH3IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH3IN_SEL_POS) - -#define PIS_TAR_CON0_TIM0_CH2IN_SEL_POS 1U -#define PIS_TAR_CON0_TIM0_CH2IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH2IN_SEL_POS) - -#define PIS_TAR_CON0_TIM0_CH1IN_SEL_POS 0U -#define PIS_TAR_CON0_TIM0_CH1IN_SEL_MSK BIT(PIS_TAR_CON0_TIM0_CH1IN_SEL_POS) - -/****************** Bit definition for PIS_TAR_CON1 register ************************/ - -#define PIS_TAR_CON1_SPI1_CLK_SEL_POS 15U -#define PIS_TAR_CON1_SPI1_CLK_SEL_MSK BIT(PIS_TAR_CON1_SPI1_CLK_SEL_POS) - -#define PIS_TAR_CON1_SPI1_RX_SEL_POS 14U -#define PIS_TAR_CON1_SPI1_RX_SEL_MSK BIT(PIS_TAR_CON1_SPI1_RX_SEL_POS) - -#define PIS_TAR_CON1_SPI0_CLK_SEL_POS 13U -#define PIS_TAR_CON1_SPI0_CLK_SEL_MSK BIT(PIS_TAR_CON1_SPI0_CLK_SEL_POS) - -#define PIS_TAR_CON1_SPI0_RX_SEL_POS 12U -#define PIS_TAR_CON1_SPI0_RX_SEL_MSK BIT(PIS_TAR_CON1_SPI0_RX_SEL_POS) - -#define PIS_TAR_CON1_LPUART0_RXD_SEL_POS 8U -#define PIS_TAR_CON1_LPUART0_RXD_SEL_MSK BIT(PIS_TAR_CON1_LPUART0_RXD_SEL_POS) - -#define PIS_TAR_CON1_USART1_RXD_SEL_POS 7U -#define PIS_TAR_CON1_USART1_RXD_SEL_MSK BIT(PIS_TAR_CON1_USART1_RXD_SEL_POS) - -#define PIS_TAR_CON1_USART0_RXD_SEL_POS 6U -#define PIS_TAR_CON1_USART0_RXD_SEL_MSK BIT(PIS_TAR_CON1_USART0_RXD_SEL_POS) - -#define PIS_TAR_CON1_UART3_RXD_SEL_POS 3U -#define PIS_TAR_CON1_UART3_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART3_RXD_SEL_POS) - -#define PIS_TAR_CON1_UART2_RXD_SEL_POS 2U -#define PIS_TAR_CON1_UART2_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART2_RXD_SEL_POS) - -#define PIS_TAR_CON1_UART1_RXD_SEL_POS 1U -#define PIS_TAR_CON1_UART1_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART1_RXD_SEL_POS) - -#define PIS_TAR_CON1_UART0_RXD_SEL_POS 0U -#define PIS_TAR_CON1_UART0_RXD_SEL_MSK BIT(PIS_TAR_CON1_UART0_RXD_SEL_POS) - -/****************** Bit definition for PIS_TXMCR register ************************/ - -#define PIS_TXMCR_TXMLVLS_POS 8U -#define PIS_TXMCR_TXMLVLS_MSK BIT(PIS_TXMCR_TXMLVLS_POS) - -#define PIS_TXMCR_TXMSS_POSS 4U -#define PIS_TXMCR_TXMSS_POSE 7U -#define PIS_TXMCR_TXMSS_MSK BITS(PIS_TXMCR_TXMSS_POSS,PIS_TXMCR_TXMSS_POSE) - -#define PIS_TXMCR_TXSIGS_POSS 0U -#define PIS_TXMCR_TXSIGS_POSE 3U -#define PIS_TXMCR_TXSIGS_MSK BITS(PIS_TXMCR_TXSIGS_POSS,PIS_TXMCR_TXSIGS_POSE) - -typedef struct -{ - __IO uint32_t CH_CON[8]; - uint32_t RESERVED0[8] ; - __IO uint32_t CH_OER; - __IO uint32_t TAR_CON0; - __IO uint32_t TAR_CON1; - uint32_t RESERVED1[5] ; - __IO uint32_t UART0_TXMCR; - __IO uint32_t UART1_TXMCR; - __IO uint32_t UART2_TXMCR; - __IO uint32_t UART3_TXMCR; - __IO uint32_t LPUART0_TXMCR; -} PIS_TypeDef; - -/****************** Bit definition for GPIO_DIN register ************************/ - -#define GPIO_DIN_DIN_POSS 0U -#define GPIO_DIN_DIN_POSE 15U -#define GPIO_DIN_DIN_MSK BITS(GPIO_DIN_DIN_POSS,GPIO_DIN_DIN_POSE) - -/****************** Bit definition for GPIO_DOUT register ************************/ - -#define GPIO_DOUT_DOUT_POSS 0U -#define GPIO_DOUT_DOUT_POSE 15U -#define GPIO_DOUT_DOUT_MSK BITS(GPIO_DOUT_DOUT_POSS,GPIO_DOUT_DOUT_POSE) - -/****************** Bit definition for GPIO_BSRR register ************************/ - -#define GPIO_BSRR_BRR_POSS 16U -#define GPIO_BSRR_BRR_POSE 31U -#define GPIO_BSRR_BRR_MSK BITS(GPIO_BSRR_BRR_POSS,GPIO_BSRR_BRR_POSE) - -#define GPIO_BSRR_BSR_POSS 0U -#define GPIO_BSRR_BSR_POSE 15U -#define GPIO_BSRR_BSR_MSK BITS(GPIO_BSRR_BSR_POSS,GPIO_BSRR_BSR_POSE) - -/****************** Bit definition for GPIO_BIR register ************************/ - -#define GPIO_BIR_BIR_POSS 0U -#define GPIO_BIR_BIR_POSE 15U -#define GPIO_BIR_BIR_MSK BITS(GPIO_BIR_BIR_POSS,GPIO_BIR_BIR_POSE) - -/****************** Bit definition for GPIO_MODE register ************************/ - -#define GPIO_MODE_MODE_POSS 0U -#define GPIO_MODE_MODE_POSE 31U -#define GPIO_MODE_MODE_MSK BITS(GPIO_MODE_MODE_POSS,GPIO_MODE_MODE_POSE) - -/****************** Bit definition for GPIO_ODOS register ************************/ - -#define GPIO_ODOS_ODOS_POSS 0U -#define GPIO_ODOS_ODOS_POSE 31U -#define GPIO_ODOS_ODOS_MSK BITS(GPIO_ODOS_ODOS_POSS,GPIO_ODOS_ODOS_POSE) - -/****************** Bit definition for GPIO_PUPD register ************************/ - -#define GPIO_PUPD_PUPD_POSS 0U -#define GPIO_PUPD_PUPD_POSE 31U -#define GPIO_PUPD_PUPD_MSK BITS(GPIO_PUPD_PUPD_POSS,GPIO_PUPD_PUPD_POSE) - -/****************** Bit definition for GPIO_ODRV register ************************/ - -#define GPIO_ODRV_ODRV_POSS 0U -#define GPIO_ODRV_ODRV_POSE 31U -#define GPIO_ODRV_ODRV_MSK BITS(GPIO_ODRV_ODRV_POSS,GPIO_ODRV_ODRV_POSE) - -/****************** Bit definition for GPIO_FLT register ************************/ - -#define GPIO_FLT_FLT_POSS 0U -#define GPIO_FLT_FLT_POSE 15U -#define GPIO_FLT_FLT_MSK BITS(GPIO_FLT_FLT_POSS,GPIO_FLT_FLT_POSE) - -/****************** Bit definition for GPIO_TYPE register ************************/ - -#define GPIO_TYPE_TYPE_POSS 0U -#define GPIO_TYPE_TYPE_POSE 15U -#define GPIO_TYPE_TYPE_MSK BITS(GPIO_TYPE_TYPE_POSS,GPIO_TYPE_TYPE_POSE) - -/****************** Bit definition for GPIO_FUNC0 register ************************/ - -#define GPIO_FUNC0_FSEL_IO7_POSS 28U -#define GPIO_FUNC0_FSEL_IO7_POSE 31U -#define GPIO_FUNC0_FSEL_IO7_MSK BITS(GPIO_FUNC0_FSEL_IO7_POSS,GPIO_FUNC0_FSEL_IO7_POSE) - -#define GPIO_FUNC0_FSEL_IO6_POSS 24U -#define GPIO_FUNC0_FSEL_IO6_POSE 27U -#define GPIO_FUNC0_FSEL_IO6_MSK BITS(GPIO_FUNC0_FSEL_IO6_POSS,GPIO_FUNC0_FSEL_IO6_POSE) - -#define GPIO_FUNC0_FSEL_IO5_POSS 20U -#define GPIO_FUNC0_FSEL_IO5_POSE 23U -#define GPIO_FUNC0_FSEL_IO5_MSK BITS(GPIO_FUNC0_FSEL_IO5_POSS,GPIO_FUNC0_FSEL_IO5_POSE) - -#define GPIO_FUNC0_FSEL_IO4_POSS 16U -#define GPIO_FUNC0_FSEL_IO4_POSE 19U -#define GPIO_FUNC0_FSEL_IO4_MSK BITS(GPIO_FUNC0_FSEL_IO4_POSS,GPIO_FUNC0_FSEL_IO4_POSE) - -#define GPIO_FUNC0_FSEL_IO3_POSS 12U -#define GPIO_FUNC0_FSEL_IO3_POSE 15U -#define GPIO_FUNC0_FSEL_IO3_MSK BITS(GPIO_FUNC0_FSEL_IO3_POSS,GPIO_FUNC0_FSEL_IO3_POSE) - -#define GPIO_FUNC0_FSEL_IO2_POSS 8U -#define GPIO_FUNC0_FSEL_IO2_POSE 11U -#define GPIO_FUNC0_FSEL_IO2_MSK BITS(GPIO_FUNC0_FSEL_IO2_POSS,GPIO_FUNC0_FSEL_IO2_POSE) - -#define GPIO_FUNC0_FSEL_IO1_POSS 4U -#define GPIO_FUNC0_FSEL_IO1_POSE 7U -#define GPIO_FUNC0_FSEL_IO1_MSK BITS(GPIO_FUNC0_FSEL_IO1_POSS,GPIO_FUNC0_FSEL_IO1_POSE) - -#define GPIO_FUNC0_FSEL_IO0_POSS 0U -#define GPIO_FUNC0_FSEL_IO0_POSE 3U -#define GPIO_FUNC0_FSEL_IO0_MSK BITS(GPIO_FUNC0_FSEL_IO0_POSS,GPIO_FUNC0_FSEL_IO0_POSE) - -/****************** Bit definition for GPIO_FUNC1 register ************************/ - -#define GPIO_FUNC1_FSEL_IO15_POSS 28U -#define GPIO_FUNC1_FSEL_IO15_POSE 31U -#define GPIO_FUNC1_FSEL_IO15_MSK BITS(GPIO_FUNC1_FSEL_IO15_POSS,GPIO_FUNC1_FSEL_IO15_POSE) - -#define GPIO_FUNC1_FSEL_IO14_POSS 24U -#define GPIO_FUNC1_FSEL_IO14_POSE 27U -#define GPIO_FUNC1_FSEL_IO14_MSK BITS(GPIO_FUNC1_FSEL_IO14_POSS,GPIO_FUNC1_FSEL_IO14_POSE) - -#define GPIO_FUNC1_FSEL_IO13_POSS 20U -#define GPIO_FUNC1_FSEL_IO13_POSE 23U -#define GPIO_FUNC1_FSEL_IO13_MSK BITS(GPIO_FUNC1_FSEL_IO13_POSS,GPIO_FUNC1_FSEL_IO13_POSE) - -#define GPIO_FUNC1_FSEL_IO12_POSS 16U -#define GPIO_FUNC1_FSEL_IO12_POSE 19U -#define GPIO_FUNC1_FSEL_IO12_MSK BITS(GPIO_FUNC1_FSEL_IO12_POSS,GPIO_FUNC1_FSEL_IO12_POSE) - -#define GPIO_FUNC1_FSEL_IO11_POSS 12U -#define GPIO_FUNC1_FSEL_IO11_POSE 15U -#define GPIO_FUNC1_FSEL_IO11_MSK BITS(GPIO_FUNC1_FSEL_IO11_POSS,GPIO_FUNC1_FSEL_IO11_POSE) - -#define GPIO_FUNC1_FSEL_IO10_POSS 8U -#define GPIO_FUNC1_FSEL_IO10_POSE 11U -#define GPIO_FUNC1_FSEL_IO10_MSK BITS(GPIO_FUNC1_FSEL_IO10_POSS,GPIO_FUNC1_FSEL_IO10_POSE) - -#define GPIO_FUNC1_FSEL_IO9_POSS 4U -#define GPIO_FUNC1_FSEL_IO9_POSE 7U -#define GPIO_FUNC1_FSEL_IO9_MSK BITS(GPIO_FUNC1_FSEL_IO9_POSS,GPIO_FUNC1_FSEL_IO9_POSE) - -#define GPIO_FUNC1_FSEL_IO8_POSS 0U -#define GPIO_FUNC1_FSEL_IO8_POSE 3U -#define GPIO_FUNC1_FSEL_IO8_MSK BITS(GPIO_FUNC1_FSEL_IO8_POSS,GPIO_FUNC1_FSEL_IO8_POSE) - -/****************** Bit definition for GPIO_LOCK register ************************/ - -#define GPIO_LOCK_KEY_POSS 16U -#define GPIO_LOCK_KEY_POSE 31U -#define GPIO_LOCK_KEY_MSK BITS(GPIO_LOCK_KEY_POSS,GPIO_LOCK_KEY_POSE) - -#define GPIO_LOCK_LOCK_POSS 0U -#define GPIO_LOCK_LOCK_POSE 15U -#define GPIO_LOCK_LOCK_MSK BITS(GPIO_LOCK_LOCK_POSS,GPIO_LOCK_LOCK_POSE) - -typedef struct -{ - __I uint32_t DIN; - __IO uint32_t DOUT; - __O uint32_t BSRR; - __O uint32_t BIR; - __IO uint32_t MODE; - __IO uint32_t ODOS; - __IO uint32_t PUPD; - __IO uint32_t ODRV; - __IO uint32_t FLT; - __IO uint32_t TYPE; - __IO uint32_t FUNC0; - __IO uint32_t FUNC1; - __IO uint32_t LOCK; -} GPIO_TypeDef; - -/****************** Bit definition for GPIO_EXTIRER register ************************/ - -#define GPIO_EXTIRER_EXTIRER_POSS 0U -#define GPIO_EXTIRER_EXTIRER_POSE 15U -#define GPIO_EXTIRER_EXTIRER_MSK BITS(GPIO_EXTIRER_EXTIRER_POSS,GPIO_EXTIRER_EXTIRER_POSE) - -/****************** Bit definition for GPIO_EXTIFER register ************************/ - -#define GPIO_EXTIFER_EXTIFER_POSS 0U -#define GPIO_EXTIFER_EXTIFER_POSE 15U -#define GPIO_EXTIFER_EXTIFER_MSK BITS(GPIO_EXTIFER_EXTIFER_POSS,GPIO_EXTIFER_EXTIFER_POSE) - -/****************** Bit definition for GPIO_EXTIEN register ************************/ - -#define GPIO_EXTIEN_EXTIEN_POSS 0U -#define GPIO_EXTIEN_EXTIEN_POSE 15U -#define GPIO_EXTIEN_EXTIEN_MSK BITS(GPIO_EXTIEN_EXTIEN_POSS,GPIO_EXTIEN_EXTIEN_POSE) - -/****************** Bit definition for GPIO_EXTIFLAG register ************************/ - -#define GPIO_EXTIFLAG_EXTIFLAG_POSS 0U -#define GPIO_EXTIFLAG_EXTIFLAG_POSE 15U -#define GPIO_EXTIFLAG_EXTIFLAG_MSK BITS(GPIO_EXTIFLAG_EXTIFLAG_POSS,GPIO_EXTIFLAG_EXTIFLAG_POSE) - -/****************** Bit definition for GPIO_EXTISFR register ************************/ - -#define GPIO_EXTISFR_EXTISFR_POSS 0U -#define GPIO_EXTISFR_EXTISFR_POSE 15U -#define GPIO_EXTISFR_EXTISFR_MSK BITS(GPIO_EXTISFR_EXTISFR_POSS,GPIO_EXTISFR_EXTISFR_POSE) - -/****************** Bit definition for GPIO_EXTICFR register ************************/ - -#define GPIO_EXTICFR_EXTICFR_POSS 0U -#define GPIO_EXTICFR_EXTICFR_POSE 15U -#define GPIO_EXTICFR_EXTICFR_MSK BITS(GPIO_EXTICFR_EXTICFR_POSS,GPIO_EXTICFR_EXTICFR_POSE) - -/****************** Bit definition for GPIO_EXTIPSR0 register ************************/ - -#define GPIO_EXTIPSR0_EXTIS7_POSS 28U -#define GPIO_EXTIPSR0_EXTIS7_POSE 30U -#define GPIO_EXTIPSR0_EXTIS7_MSK BITS(GPIO_EXTIPSR0_EXTIS7_POSS,GPIO_EXTIPSR0_EXTIS7_POSE) - -#define GPIO_EXTIPSR0_EXTIS6_POSS 24U -#define GPIO_EXTIPSR0_EXTIS6_POSE 26U -#define GPIO_EXTIPSR0_EXTIS6_MSK BITS(GPIO_EXTIPSR0_EXTIS6_POSS,GPIO_EXTIPSR0_EXTIS6_POSE) - -#define GPIO_EXTIPSR0_EXTIS5_POSS 20U -#define GPIO_EXTIPSR0_EXTIS5_POSE 22U -#define GPIO_EXTIPSR0_EXTIS5_MSK BITS(GPIO_EXTIPSR0_EXTIS5_POSS,GPIO_EXTIPSR0_EXTIS5_POSE) - -#define GPIO_EXTIPSR0_EXTIS4_POSS 16U -#define GPIO_EXTIPSR0_EXTIS4_POSE 18U -#define GPIO_EXTIPSR0_EXTIS4_MSK BITS(GPIO_EXTIPSR0_EXTIS4_POSS,GPIO_EXTIPSR0_EXTIS4_POSE) - -#define GPIO_EXTIPSR0_EXTIS3_POSS 12U -#define GPIO_EXTIPSR0_EXTIS3_POSE 14U -#define GPIO_EXTIPSR0_EXTIS3_MSK BITS(GPIO_EXTIPSR0_EXTIS3_POSS,GPIO_EXTIPSR0_EXTIS3_POSE) - -#define GPIO_EXTIPSR0_EXTIS2_POSS 8U -#define GPIO_EXTIPSR0_EXTIS2_POSE 10U -#define GPIO_EXTIPSR0_EXTIS2_MSK BITS(GPIO_EXTIPSR0_EXTIS2_POSS,GPIO_EXTIPSR0_EXTIS2_POSE) - -#define GPIO_EXTIPSR0_EXTIS1_POSS 4U -#define GPIO_EXTIPSR0_EXTIS1_POSE 6U -#define GPIO_EXTIPSR0_EXTIS1_MSK BITS(GPIO_EXTIPSR0_EXTIS1_POSS,GPIO_EXTIPSR0_EXTIS1_POSE) - -#define GPIO_EXTIPSR0_EXTIS0_POSS 0U -#define GPIO_EXTIPSR0_EXTIS0_POSE 2U -#define GPIO_EXTIPSR0_EXTIS0_MSK BITS(GPIO_EXTIPSR0_EXTIS0_POSS,GPIO_EXTIPSR0_EXTIS0_POSE) - -/****************** Bit definition for GPIO_EXTIPSR1 register ************************/ - -#define GPIO_EXTIPSR1_EXTIS15_POSS 28U -#define GPIO_EXTIPSR1_EXTIS15_POSE 30U -#define GPIO_EXTIPSR1_EXTIS15_MSK BITS(GPIO_EXTIPSR1_EXTIS15_POSS,GPIO_EXTIPSR1_EXTIS15_POSE) - -#define GPIO_EXTIPSR1_EXTIS14_POSS 24U -#define GPIO_EXTIPSR1_EXTIS14_POSE 26U -#define GPIO_EXTIPSR1_EXTIS14_MSK BITS(GPIO_EXTIPSR1_EXTIS14_POSS,GPIO_EXTIPSR1_EXTIS14_POSE) - -#define GPIO_EXTIPSR1_EXTIS13_POSS 20U -#define GPIO_EXTIPSR1_EXTIS13_POSE 22U -#define GPIO_EXTIPSR1_EXTIS13_MSK BITS(GPIO_EXTIPSR1_EXTIS13_POSS,GPIO_EXTIPSR1_EXTIS13_POSE) - -#define GPIO_EXTIPSR1_EXTIS12_POSS 16U -#define GPIO_EXTIPSR1_EXTIS12_POSE 18U -#define GPIO_EXTIPSR1_EXTIS12_MSK BITS(GPIO_EXTIPSR1_EXTIS12_POSS,GPIO_EXTIPSR1_EXTIS12_POSE) - -#define GPIO_EXTIPSR1_EXTIS11_POSS 12U -#define GPIO_EXTIPSR1_EXTIS11_POSE 14U -#define GPIO_EXTIPSR1_EXTIS11_MSK BITS(GPIO_EXTIPSR1_EXTIS11_POSS,GPIO_EXTIPSR1_EXTIS11_POSE) - -#define GPIO_EXTIPSR1_EXTIS10_POSS 8U -#define GPIO_EXTIPSR1_EXTIS10_POSE 10U -#define GPIO_EXTIPSR1_EXTIS10_MSK BITS(GPIO_EXTIPSR1_EXTIS10_POSS,GPIO_EXTIPSR1_EXTIS10_POSE) - -#define GPIO_EXTIPSR1_EXTIS9_POSS 4U -#define GPIO_EXTIPSR1_EXTIS9_POSE 6U -#define GPIO_EXTIPSR1_EXTIS9_MSK BITS(GPIO_EXTIPSR1_EXTIS9_POSS,GPIO_EXTIPSR1_EXTIS9_POSE) - -#define GPIO_EXTIPSR1_EXTIS8_POSS 0U -#define GPIO_EXTIPSR1_EXTIS8_POSE 2U -#define GPIO_EXTIPSR1_EXTIS8_MSK BITS(GPIO_EXTIPSR1_EXTIS8_POSS,GPIO_EXTIPSR1_EXTIS8_POSE) - -/****************** Bit definition for GPIO_EXTIFLTCR register ************************/ - -#define GPIO_EXTIFLTCR_FLTCKS_POSS 24U -#define GPIO_EXTIFLTCR_FLTCKS_POSE 25U -#define GPIO_EXTIFLTCR_FLTCKS_MSK BITS(GPIO_EXTIFLTCR_FLTCKS_POSS,GPIO_EXTIFLTCR_FLTCKS_POSE) - -#define GPIO_EXTIFLTCR_FLTSEL_POSS 16U -#define GPIO_EXTIFLTCR_FLTSEL_POSE 23U -#define GPIO_EXTIFLTCR_FLTSEL_MSK BITS(GPIO_EXTIFLTCR_FLTSEL_POSS,GPIO_EXTIFLTCR_FLTSEL_POSE) - -#define GPIO_EXTIFLTCR_FLTEN_POSS 0U -#define GPIO_EXTIFLTCR_FLTEN_POSE 15U -#define GPIO_EXTIFLTCR_FLTEN_MSK BITS(GPIO_EXTIFLTCR_FLTEN_POSS,GPIO_EXTIFLTCR_FLTEN_POSE) - -typedef struct -{ - __IO uint32_t EXTIRER; - uint32_t RESERVED0 ; - __IO uint32_t EXTIFER; - uint32_t RESERVED1 ; - __IO uint32_t EXTIEN; - uint32_t RESERVED2 ; - __I uint32_t EXTIFLAG; - uint32_t RESERVED3 ; - __O uint32_t EXTISFR; - uint32_t RESERVED4 ; - __O uint32_t EXTICFR; - uint32_t RESERVED5 ; - __IO uint32_t EXTIPSR0; - __IO uint32_t EXTIPSR1; - uint32_t RESERVED6[2] ; - __IO uint32_t EXTIFLTCR; -} EXTI_TypeDef; - -/****************** Bit definition for RTC_WPR register ************************/ - -#define RTC_WPR_WP_POS 0U -#define RTC_WPR_WP_MSK BIT(RTC_WPR_WP_POS) - -/****************** Bit definition for RTC_CON register ************************/ - -#define RTC_CON_SSEC_POS 25U -#define RTC_CON_SSEC_MSK BIT(RTC_CON_SSEC_POS) - -#define RTC_CON_BUSY_POS 24U -#define RTC_CON_BUSY_MSK BIT(RTC_CON_BUSY_POS) - -#define RTC_CON_POL_POS 22U -#define RTC_CON_POL_MSK BIT(RTC_CON_POL_POS) - -#define RTC_CON_EOS_POSS 20U -#define RTC_CON_EOS_POSE 21U -#define RTC_CON_EOS_MSK BITS(RTC_CON_EOS_POSS,RTC_CON_EOS_POSE) - -#define RTC_CON_CKOS_POSS 17U -#define RTC_CON_CKOS_POSE 19U -#define RTC_CON_CKOS_MSK BITS(RTC_CON_CKOS_POSS,RTC_CON_CKOS_POSE) - -#define RTC_CON_CKOE_POS 16U -#define RTC_CON_CKOE_MSK BIT(RTC_CON_CKOE_POS) - -#define RTC_CON_WUCKS_POSS 13U -#define RTC_CON_WUCKS_POSE 15U -#define RTC_CON_WUCKS_MSK BITS(RTC_CON_WUCKS_POSS,RTC_CON_WUCKS_POSE) - -#define RTC_CON_WUTE_POS 12U -#define RTC_CON_WUTE_MSK BIT(RTC_CON_WUTE_POS) - -#define RTC_CON_DSTS_POS 10U -#define RTC_CON_DSTS_MSK BIT(RTC_CON_DSTS_POS) - -#define RTC_CON_SUB1H_POS 9U -#define RTC_CON_SUB1H_MSK BIT(RTC_CON_SUB1H_POS) - -#define RTC_CON_ADD1H_POS 8U -#define RTC_CON_ADD1H_MSK BIT(RTC_CON_ADD1H_POS) - -#define RTC_CON_TSPIN_POS 7U -#define RTC_CON_TSPIN_MSK BIT(RTC_CON_TSPIN_POS) - -#define RTC_CON_TSSEL_POS 6U -#define RTC_CON_TSSEL_MSK BIT(RTC_CON_TSSEL_POS) - -#define RTC_CON_TSEN_POS 5U -#define RTC_CON_TSEN_MSK BIT(RTC_CON_TSEN_POS) - -#define RTC_CON_SHDBP_POS 4U -#define RTC_CON_SHDBP_MSK BIT(RTC_CON_SHDBP_POS) - -#define RTC_CON_HFM_POS 3U -#define RTC_CON_HFM_MSK BIT(RTC_CON_HFM_POS) - -#define RTC_CON_ALMBEN_POS 2U -#define RTC_CON_ALMBEN_MSK BIT(RTC_CON_ALMBEN_POS) - -#define RTC_CON_ALMAEN_POS 1U -#define RTC_CON_ALMAEN_MSK BIT(RTC_CON_ALMAEN_POS) - -#define RTC_CON_GO_POS 0U -#define RTC_CON_GO_MSK BIT(RTC_CON_GO_POS) - -/****************** Bit definition for RTC_PSR register ************************/ - -#define RTC_PSR_APRS_POSS 16U -#define RTC_PSR_APRS_POSE 22U -#define RTC_PSR_APRS_MSK BITS(RTC_PSR_APRS_POSS,RTC_PSR_APRS_POSE) - -#define RTC_PSR_SPRS_POSS 0U -#define RTC_PSR_SPRS_POSE 14U -#define RTC_PSR_SPRS_MSK BITS(RTC_PSR_SPRS_POSS,RTC_PSR_SPRS_POSE) - -/****************** Bit definition for RTC_TAMPCON register ************************/ - -#define RTC_TAMPCON_TAMPFLT_POSS 20U -#define RTC_TAMPCON_TAMPFLT_POSE 21U -#define RTC_TAMPCON_TAMPFLT_MSK BITS(RTC_TAMPCON_TAMPFLT_POSS,RTC_TAMPCON_TAMPFLT_POSE) - -#define RTC_TAMPCON_TAMPCKS_POSS 17U -#define RTC_TAMPCON_TAMPCKS_POSE 19U -#define RTC_TAMPCON_TAMPCKS_MSK BITS(RTC_TAMPCON_TAMPCKS_POSS,RTC_TAMPCON_TAMPCKS_POSE) - -#define RTC_TAMPCON_TAMPTS_POS 16U -#define RTC_TAMPCON_TAMPTS_MSK BIT(RTC_TAMPCON_TAMPTS_POS) - -#define RTC_TAMPCON_TAMP1LV_POS 9U -#define RTC_TAMPCON_TAMP1LV_MSK BIT(RTC_TAMPCON_TAMP1LV_POS) - -#define RTC_TAMPCON_TAMP1EN_POS 8U -#define RTC_TAMPCON_TAMP1EN_MSK BIT(RTC_TAMPCON_TAMP1EN_POS) - -#define RTC_TAMPCON_TAMP0LV_POS 1U -#define RTC_TAMPCON_TAMP0LV_MSK BIT(RTC_TAMPCON_TAMP0LV_POS) - -#define RTC_TAMPCON_TAMP0EN_POS 0U -#define RTC_TAMPCON_TAMP0EN_MSK BIT(RTC_TAMPCON_TAMP0EN_POS) - -/****************** Bit definition for RTC_TIME register ************************/ - -#define RTC_TIME_PM_POS 22U -#define RTC_TIME_PM_MSK BIT(RTC_TIME_PM_POS) - -#define RTC_TIME_HRT_POSS 20U -#define RTC_TIME_HRT_POSE 21U -#define RTC_TIME_HRT_MSK BITS(RTC_TIME_HRT_POSS,RTC_TIME_HRT_POSE) - -#define RTC_TIME_HRU_POSS 16U -#define RTC_TIME_HRU_POSE 19U -#define RTC_TIME_HRU_MSK BITS(RTC_TIME_HRU_POSS,RTC_TIME_HRU_POSE) - -#define RTC_TIME_MINT_POSS 12U -#define RTC_TIME_MINT_POSE 14U -#define RTC_TIME_MINT_MSK BITS(RTC_TIME_MINT_POSS,RTC_TIME_MINT_POSE) - -#define RTC_TIME_MINU_POSS 8U -#define RTC_TIME_MINU_POSE 11U -#define RTC_TIME_MINU_MSK BITS(RTC_TIME_MINU_POSS,RTC_TIME_MINU_POSE) - -#define RTC_TIME_SECT_POSS 4U -#define RTC_TIME_SECT_POSE 6U -#define RTC_TIME_SECT_MSK BITS(RTC_TIME_SECT_POSS,RTC_TIME_SECT_POSE) - -#define RTC_TIME_SECU_POSS 0U -#define RTC_TIME_SECU_POSE 3U -#define RTC_TIME_SECU_MSK BITS(RTC_TIME_SECU_POSS,RTC_TIME_SECU_POSE) - -/****************** Bit definition for RTC_DATE register ************************/ - -#define RTC_DATE_WD_POSS 24U -#define RTC_DATE_WD_POSE 26U -#define RTC_DATE_WD_MSK BITS(RTC_DATE_WD_POSS,RTC_DATE_WD_POSE) - -#define RTC_DATE_YRT_POSS 20U -#define RTC_DATE_YRT_POSE 23U -#define RTC_DATE_YRT_MSK BITS(RTC_DATE_YRT_POSS,RTC_DATE_YRT_POSE) - -#define RTC_DATE_YRU_POSS 16U -#define RTC_DATE_YRU_POSE 19U -#define RTC_DATE_YRU_MSK BITS(RTC_DATE_YRU_POSS,RTC_DATE_YRU_POSE) - -#define RTC_DATE_MONT_POS 12U -#define RTC_DATE_MONT_MSK BIT(RTC_DATE_MONT_POS) - -#define RTC_DATE_MONU_POSS 8U -#define RTC_DATE_MONU_POSE 11U -#define RTC_DATE_MONU_MSK BITS(RTC_DATE_MONU_POSS,RTC_DATE_MONU_POSE) - -#define RTC_DATE_DAYT_POSS 4U -#define RTC_DATE_DAYT_POSE 5U -#define RTC_DATE_DAYT_MSK BITS(RTC_DATE_DAYT_POSS,RTC_DATE_DAYT_POSE) - -#define RTC_DATE_DAYU_POSS 0U -#define RTC_DATE_DAYU_POSE 3U -#define RTC_DATE_DAYU_MSK BITS(RTC_DATE_DAYU_POSS,RTC_DATE_DAYU_POSE) - -/****************** Bit definition for RTC_SSEC register ************************/ - -#define RTC_SSEC_VAL_POSS 0U -#define RTC_SSEC_VAL_POSE 15U -#define RTC_SSEC_VAL_MSK BITS(RTC_SSEC_VAL_POSS,RTC_SSEC_VAL_POSE) - -/****************** Bit definition for RTC_WUMAT register ************************/ - -#define RTC_WUMAT_VAL_POSS 0U -#define RTC_WUMAT_VAL_POSE 15U -#define RTC_WUMAT_VAL_MSK BITS(RTC_WUMAT_VAL_POSS,RTC_WUMAT_VAL_POSE) - -/****************** Bit definition for RTC_ALMA register ************************/ - -#define RTC_ALMA_WDS_POS 31U -#define RTC_ALMA_WDS_MSK BIT(RTC_ALMA_WDS_POS) - -#define RTC_ALMA_DAWD_POSS 24U -#define RTC_ALMA_DAWD_POSE 30U -#define RTC_ALMA_DAWD_MSK BITS(RTC_ALMA_DAWD_POSS,RTC_ALMA_DAWD_POSE) - -#define RTC_ALMA_DAYMSK_POS 30U -#define RTC_ALMA_DAYMSK_MSK BIT(RTC_ALMA_DAYMSK_POS) - -#define RTC_ALMA_DAWD_DAYT_POSS 28U -#define RTC_ALMA_DAWD_DAYT_POSE 29U -#define RTC_ALMA_DAWD_DAYT_MSK BITS(RTC_ALMA_DAWD_DAYT_POSS, RTC_ALMA_DAWD_DAYT_POSE) - -#define RTC_ALMA_DAWD_DAYU_POSS 24U -#define RTC_ALMA_DAWD_DAYU_POSE 27U -#define RTC_ALMA_DAWD_DAYU_MSK BITS(RTC_ALMA_DAWD_DAYU_POSS, RTC_ALMA_DAWD_DAYU_POSE) - -#define RTC_ALMA_HRMSK_POS 23U -#define RTC_ALMA_HRMSK_MSK BIT(RTC_ALMA_HRMSK_POS) - -#define RTC_ALMA_PM_POS 22U -#define RTC_ALMA_PM_MSK BIT(RTC_ALMA_PM_POS) - -#define RTC_ALMA_HRT_POSS 20U -#define RTC_ALMA_HRT_POSE 21U -#define RTC_ALMA_HRT_MSK BITS(RTC_ALMA_HRT_POSS,RTC_ALMA_HRT_POSE) - -#define RTC_ALMA_HRU_POSS 16U -#define RTC_ALMA_HRU_POSE 19U -#define RTC_ALMA_HRU_MSK BITS(RTC_ALMA_HRU_POSS,RTC_ALMA_HRU_POSE) - -#define RTC_ALMA_MINMSK_POS 15U -#define RTC_ALMA_MINMSK_MSK BIT(RTC_ALMA_MINMSK_POS) - -#define RTC_ALMA_MINT_POSS 12U -#define RTC_ALMA_MINT_POSE 14U -#define RTC_ALMA_MINT_MSK BITS(RTC_ALMA_MINT_POSS,RTC_ALMA_MINT_POSE) - -#define RTC_ALMA_MINU_POSS 8U -#define RTC_ALMA_MINU_POSE 11U -#define RTC_ALMA_MINU_MSK BITS(RTC_ALMA_MINU_POSS,RTC_ALMA_MINU_POSE) - -#define RTC_ALMA_SECMSK_POS 7U -#define RTC_ALMA_SECMSK_MSK BIT(RTC_ALMA_SECMSK_POS) - -#define RTC_ALMA_SECT_POSS 4U -#define RTC_ALMA_SECT_POSE 6U -#define RTC_ALMA_SECT_MSK BITS(RTC_ALMA_SECT_POSS,RTC_ALMA_SECT_POSE) - -#define RTC_ALMA_SECU_POSS 0U -#define RTC_ALMA_SECU_POSE 3U -#define RTC_ALMA_SECU_MSK BITS(RTC_ALMA_SECU_POSS,RTC_ALMA_SECU_POSE) - -/****************** Bit definition for RTC_ALMB register ************************/ - -#define RTC_ALMB_WDS_POS 31U -#define RTC_ALMB_WDS_MSK BIT(RTC_ALMB_WDS_POS) - -#define RTC_ALMB_DAWD_POSS 24U -#define RTC_ALMB_DAWD_POSE 30U -#define RTC_ALMB_DAWD_MSK BITS(RTC_ALMB_DAWD_POSS,RTC_ALMB_DAWD_POSE) - -#define RTC_ALMB_DAYMSK_POS 30U -#define RTC_ALMB_DAYMSK_MSK BIT(RTC_ALMB_DAYMSK_POS) - -#define RTC_ALMB_DAWD_DAYT_POSS 28U -#define RTC_ALMB_DAWD_DAYT_POSE 29U -#define RTC_ALMB_DAWD_DAYT_MSK BITS(RTC_ALMB_DAWD_DAYT_POSS, RTC_ALMB_DAWD_DAYT_POSE) - -#define RTC_ALMB_DAWD_DAYU_POSS 24U -#define RTC_ALMB_DAWD_DAYU_POSE 27U -#define RTC_ALMB_DAWD_DAYU_MSK BITS(RTC_ALMB_DAWD_DAYU_POSS, RTC_ALMB_DAWD_DAYU_POSE) - -#define RTC_ALMB_HRMSK_POS 23U -#define RTC_ALMB_HRMSK_MSK BIT(RTC_ALMB_HRMSK_POS) - -#define RTC_ALMB_PM_POS 22U -#define RTC_ALMB_PM_MSK BIT(RTC_ALMB_PM_POS) - -#define RTC_ALMB_HRT_POSS 20U -#define RTC_ALMB_HRT_POSE 21U -#define RTC_ALMB_HRT_MSK BITS(RTC_ALMB_HRT_POSS,RTC_ALMB_HRT_POSE) - -#define RTC_ALMB_HRU_POSS 16U -#define RTC_ALMB_HRU_POSE 19U -#define RTC_ALMB_HRU_MSK BITS(RTC_ALMB_HRU_POSS,RTC_ALMB_HRU_POSE) - -#define RTC_ALMB_MINMSK_POS 15U -#define RTC_ALMB_MINMSK_MSK BIT(RTC_ALMB_MINMSK_POS) - -#define RTC_ALMB_MINT_POSS 12U -#define RTC_ALMB_MINT_POSE 14U -#define RTC_ALMB_MINT_MSK BITS(RTC_ALMB_MINT_POSS,RTC_ALMB_MINT_POSE) - -#define RTC_ALMB_MINU_POSS 8U -#define RTC_ALMB_MINU_POSE 11U -#define RTC_ALMB_MINU_MSK BITS(RTC_ALMB_MINU_POSS,RTC_ALMB_MINU_POSE) - -#define RTC_ALMB_SECMSK_POS 7U -#define RTC_ALMB_SECMSK_MSK BIT(RTC_ALMB_SECMSK_POS) - -#define RTC_ALMB_SECT_POSS 4U -#define RTC_ALMB_SECT_POSE 6U -#define RTC_ALMB_SECT_MSK BITS(RTC_ALMB_SECT_POSS,RTC_ALMB_SECT_POSE) - -#define RTC_ALMB_SECU_POSS 0U -#define RTC_ALMB_SECU_POSE 3U -#define RTC_ALMB_SECU_MSK BITS(RTC_ALMB_SECU_POSS,RTC_ALMB_SECU_POSE) - -/****************** Bit definition for RTC_ALMASSEC register ************************/ - -#define RTC_ALMASSEC_SSECM_POSS 24U -#define RTC_ALMASSEC_SSECM_POSE 27U -#define RTC_ALMASSEC_SSECM_MSK BITS(RTC_ALMASSEC_SSECM_POSS,RTC_ALMASSEC_SSECM_POSE) - -#define RTC_ALMASSEC_SSEC_POSS 0U -#define RTC_ALMASSEC_SSEC_POSE 14U -#define RTC_ALMASSEC_SSEC_MSK BITS(RTC_ALMASSEC_SSEC_POSS,RTC_ALMASSEC_SSEC_POSE) - -/****************** Bit definition for RTC_ALMBSSEC register ************************/ - -#define RTC_ALMBSSEC_SSECM_POSS 24U -#define RTC_ALMBSSEC_SSECM_POSE 27U -#define RTC_ALMBSSEC_SSECM_MSK BITS(RTC_ALMBSSEC_SSECM_POSS,RTC_ALMBSSEC_SSECM_POSE) - -#define RTC_ALMBSSEC_SSEC_POSS 0U -#define RTC_ALMBSSEC_SSEC_POSE 14U -#define RTC_ALMBSSEC_SSEC_MSK BITS(RTC_ALMBSSEC_SSEC_POSS,RTC_ALMBSSEC_SSEC_POSE) - -/****************** Bit definition for RTC_TSTIME register ************************/ - -#define RTC_TSTIME_PM_POS 22U -#define RTC_TSTIME_PM_MSK BIT(RTC_TSTIME_PM_POS) - -#define RTC_TSTIME_HRT_POSS 20U -#define RTC_TSTIME_HRT_POSE 21U -#define RTC_TSTIME_HRT_MSK BITS(RTC_TSTIME_HRT_POSS,RTC_TSTIME_HRT_POSE) - -#define RTC_TSTIME_HRU_POSS 16U -#define RTC_TSTIME_HRU_POSE 19U -#define RTC_TSTIME_HRU_MSK BITS(RTC_TSTIME_HRU_POSS,RTC_TSTIME_HRU_POSE) - -#define RTC_TSTIME_MINT_POSS 12U -#define RTC_TSTIME_MINT_POSE 14U -#define RTC_TSTIME_MINT_MSK BITS(RTC_TSTIME_MINT_POSS,RTC_TSTIME_MINT_POSE) - -#define RTC_TSTIME_MINU_POSS 8U -#define RTC_TSTIME_MINU_POSE 11U -#define RTC_TSTIME_MINU_MSK BITS(RTC_TSTIME_MINU_POSS,RTC_TSTIME_MINU_POSE) - -#define RTC_TSTIME_SECT_POSS 4U -#define RTC_TSTIME_SECT_POSE 6U -#define RTC_TSTIME_SECT_MSK BITS(RTC_TSTIME_SECT_POSS,RTC_TSTIME_SECT_POSE) - -#define RTC_TSTIME_SECU_POSS 0U -#define RTC_TSTIME_SECU_POSE 3U -#define RTC_TSTIME_SECU_MSK BITS(RTC_TSTIME_SECU_POSS,RTC_TSTIME_SECU_POSE) - -/****************** Bit definition for RTC_TSDATE register ************************/ - -#define RTC_TSDATE_WD_POSS 24U -#define RTC_TSDATE_WD_POSE 26U -#define RTC_TSDATE_WD_MSK BITS(RTC_TSDATE_WD_POSS,RTC_TSDATE_WD_POSE) - -#define RTC_TSDATE_YRT_POSS 20U -#define RTC_TSDATE_YRT_POSE 23U -#define RTC_TSDATE_YRT_MSK BITS(RTC_TSDATE_YRT_POSS,RTC_TSDATE_YRT_POSE) - -#define RTC_TSDATE_YRU_POSS 16U -#define RTC_TSDATE_YRU_POSE 19U -#define RTC_TSDATE_YRU_MSK BITS(RTC_TSDATE_YRU_POSS,RTC_TSDATE_YRU_POSE) - -#define RTC_TSDATE_MONT_POS 12U -#define RTC_TSDATE_MONT_MSK BIT(RTC_TSDATE_MONT_POS) - -#define RTC_TSDATE_MONU_POSS 8U -#define RTC_TSDATE_MONU_POSE 11U -#define RTC_TSDATE_MONU_MSK BITS(RTC_TSDATE_MONU_POSS,RTC_TSDATE_MONU_POSE) - -#define RTC_TSDATE_DAYT_POSS 4U -#define RTC_TSDATE_DAYT_POSE 5U -#define RTC_TSDATE_DAYT_MSK BITS(RTC_TSDATE_DAYT_POSS,RTC_TSDATE_DAYT_POSE) - -#define RTC_TSDATE_DAYU_POSS 0U -#define RTC_TSDATE_DAYU_POSE 3U -#define RTC_TSDATE_DAYU_MSK BITS(RTC_TSDATE_DAYU_POSS,RTC_TSDATE_DAYU_POSE) - -/****************** Bit definition for RTC_TSSSEC register ************************/ - -#define RTC_TSSSEC_SSEC_POSS 0U -#define RTC_TSSSEC_SSEC_POSE 15U -#define RTC_TSSSEC_SSEC_MSK BITS(RTC_TSSSEC_SSEC_POSS,RTC_TSSSEC_SSEC_POSE) - -/****************** Bit definition for RTC_SSECTR register ************************/ - -#define RTC_SSECTR_INC_POS 31U -#define RTC_SSECTR_INC_MSK BIT(RTC_SSECTR_INC_POS) - -#define RTC_SSECTR_TRIM_POSS 0U -#define RTC_SSECTR_TRIM_POSE 14U -#define RTC_SSECTR_TRIM_MSK BITS(RTC_SSECTR_TRIM_POSS,RTC_SSECTR_TRIM_POSE) - -/****************** Bit definition for RTC_IER register ************************/ - -#define RTC_IER_TCE_POS 25U -#define RTC_IER_TCE_MSK BIT(RTC_IER_TCE_POS) - -#define RTC_IER_TCC_POS 24U -#define RTC_IER_TCC_MSK BIT(RTC_IER_TCC_POS) - -#define RTC_IER_WU_POS 18U -#define RTC_IER_WU_MSK BIT(RTC_IER_WU_POS) - -#define RTC_IER_SSTC_POS 17U -#define RTC_IER_SSTC_MSK BIT(RTC_IER_SSTC_POS) - -#define RTC_IER_RSC_POS 16U -#define RTC_IER_RSC_MSK BIT(RTC_IER_RSC_POS) - -#define RTC_IER_TAMP1_POS 13U -#define RTC_IER_TAMP1_MSK BIT(RTC_IER_TAMP1_POS) - -#define RTC_IER_TAMP0_POS 12U -#define RTC_IER_TAMP0_MSK BIT(RTC_IER_TAMP0_POS) - -#define RTC_IER_TSOV_POS 11U -#define RTC_IER_TSOV_MSK BIT(RTC_IER_TSOV_POS) - -#define RTC_IER_TS_POS 10U -#define RTC_IER_TS_MSK BIT(RTC_IER_TS_POS) - -#define RTC_IER_ALMB_POS 9U -#define RTC_IER_ALMB_MSK BIT(RTC_IER_ALMB_POS) - -#define RTC_IER_ALMA_POS 8U -#define RTC_IER_ALMA_MSK BIT(RTC_IER_ALMA_POS) - -#define RTC_IER_YR_POS 5U -#define RTC_IER_YR_MSK BIT(RTC_IER_YR_POS) - -#define RTC_IER_MON_POS 4U -#define RTC_IER_MON_MSK BIT(RTC_IER_MON_POS) - -#define RTC_IER_DAY_POS 3U -#define RTC_IER_DAY_MSK BIT(RTC_IER_DAY_POS) - -#define RTC_IER_HR_POS 2U -#define RTC_IER_HR_MSK BIT(RTC_IER_HR_POS) - -#define RTC_IER_MIN_POS 1U -#define RTC_IER_MIN_MSK BIT(RTC_IER_MIN_POS) - -#define RTC_IER_SEC_POS 0U -#define RTC_IER_SEC_MSK BIT(RTC_IER_SEC_POS) - -/****************** Bit definition for RTC_IFR register ************************/ - -#define RTC_IFR_TCEF_POS 25U -#define RTC_IFR_TCEF_MSK BIT(RTC_IFR_TCEF_POS) - -#define RTC_IFR_TCCF_POS 24U -#define RTC_IFR_TCCF_MSK BIT(RTC_IFR_TCCF_POS) - -#define RTC_IFR_WUF_POS 18U -#define RTC_IFR_WUF_MSK BIT(RTC_IFR_WUF_POS) - -#define RTC_IFR_SSTCF_POS 17U -#define RTC_IFR_SSTCF_MSK BIT(RTC_IFR_SSTCF_POS) - -#define RTC_IFR_RSCF_POS 16U -#define RTC_IFR_RSCF_MSK BIT(RTC_IFR_RSCF_POS) - -#define RTC_IFR_TAMP1F_POS 13U -#define RTC_IFR_TAMP1F_MSK BIT(RTC_IFR_TAMP1F_POS) - -#define RTC_IFR_TAMP0F_POS 12U -#define RTC_IFR_TAMP0F_MSK BIT(RTC_IFR_TAMP0F_POS) - -#define RTC_IFR_TSOVF_POS 11U -#define RTC_IFR_TSOVF_MSK BIT(RTC_IFR_TSOVF_POS) - -#define RTC_IFR_TSF_POS 10U -#define RTC_IFR_TSF_MSK BIT(RTC_IFR_TSF_POS) - -#define RTC_IFR_ALMBF_POS 9U -#define RTC_IFR_ALMBF_MSK BIT(RTC_IFR_ALMBF_POS) - -#define RTC_IFR_ALMAF_POS 8U -#define RTC_IFR_ALMAF_MSK BIT(RTC_IFR_ALMAF_POS) - -#define RTC_IFR_YRF_POS 5U -#define RTC_IFR_YRF_MSK BIT(RTC_IFR_YRF_POS) - -#define RTC_IFR_MONF_POS 4U -#define RTC_IFR_MONF_MSK BIT(RTC_IFR_MONF_POS) - -#define RTC_IFR_DAYF_POS 3U -#define RTC_IFR_DAYF_MSK BIT(RTC_IFR_DAYF_POS) - -#define RTC_IFR_HRF_POS 2U -#define RTC_IFR_HRF_MSK BIT(RTC_IFR_HRF_POS) - -#define RTC_IFR_MINF_POS 1U -#define RTC_IFR_MINF_MSK BIT(RTC_IFR_MINF_POS) - -#define RTC_IFR_SECF_POS 0U -#define RTC_IFR_SECF_MSK BIT(RTC_IFR_SECF_POS) - -/****************** Bit definition for RTC_IFCR register ************************/ - -#define RTC_IFCR_TCEFC_POS 25U -#define RTC_IFCR_TCEFC_MSK BIT(RTC_IFCR_TCEFC_POS) - -#define RTC_IFCR_TCCFC_POS 24U -#define RTC_IFCR_TCCFC_MSK BIT(RTC_IFCR_TCCFC_POS) - -#define RTC_IFCR_WUFC_POS 18U -#define RTC_IFCR_WUFC_MSK BIT(RTC_IFCR_WUFC_POS) - -#define RTC_IFCR_SSTCFC_POS 17U -#define RTC_IFCR_SSTCFC_MSK BIT(RTC_IFCR_SSTCFC_POS) - -#define RTC_IFCR_RSCFC_POS 16U -#define RTC_IFCR_RSCFC_MSK BIT(RTC_IFCR_RSCFC_POS) - -#define RTC_IFCR_TAMP1FC_POS 13U -#define RTC_IFCR_TAMP1FC_MSK BIT(RTC_IFCR_TAMP1FC_POS) - -#define RTC_IFCR_TAMP0FC_POS 12U -#define RTC_IFCR_TAMP0FC_MSK BIT(RTC_IFCR_TAMP0FC_POS) - -#define RTC_IFCR_TSOVFC_POS 11U -#define RTC_IFCR_TSOVFC_MSK BIT(RTC_IFCR_TSOVFC_POS) - -#define RTC_IFCR_TSFC_POS 10U -#define RTC_IFCR_TSFC_MSK BIT(RTC_IFCR_TSFC_POS) - -#define RTC_IFCR_ALMBFC_POS 9U -#define RTC_IFCR_ALMBFC_MSK BIT(RTC_IFCR_ALMBFC_POS) - -#define RTC_IFCR_ALMAFC_POS 8U -#define RTC_IFCR_ALMAFC_MSK BIT(RTC_IFCR_ALMAFC_POS) - -#define RTC_IFCR_YRFC_POS 5U -#define RTC_IFCR_YRFC_MSK BIT(RTC_IFCR_YRFC_POS) - -#define RTC_IFCR_MONFC_POS 4U -#define RTC_IFCR_MONFC_MSK BIT(RTC_IFCR_MONFC_POS) - -#define RTC_IFCR_DAYFC_POS 3U -#define RTC_IFCR_DAYFC_MSK BIT(RTC_IFCR_DAYFC_POS) - -#define RTC_IFCR_HRFC_POS 2U -#define RTC_IFCR_HRFC_MSK BIT(RTC_IFCR_HRFC_POS) - -#define RTC_IFCR_MINFC_POS 1U -#define RTC_IFCR_MINFC_MSK BIT(RTC_IFCR_MINFC_POS) - -#define RTC_IFCR_SECFC_POS 0U -#define RTC_IFCR_SECFC_MSK BIT(RTC_IFCR_SECFC_POS) - -/****************** Bit definition for RTC_ISR register ************************/ - -#define RTC_ISR_TCEF_POS 25U -#define RTC_ISR_TCEF_MSK BIT(RTC_ISR_TCEF_POS) - -#define RTC_ISR_TCCF_POS 24U -#define RTC_ISR_TCCF_MSK BIT(RTC_ISR_TCCF_POS) - -#define RTC_ISR_WUF_POS 18U -#define RTC_ISR_WUF_MSK BIT(RTC_ISR_WUF_POS) - -#define RTC_ISR_SSTCF_POS 17U -#define RTC_ISR_SSTCF_MSK BIT(RTC_ISR_SSTCF_POS) - -#define RTC_ISR_RSCF_POS 16U -#define RTC_ISR_RSCF_MSK BIT(RTC_ISR_RSCF_POS) - -#define RTC_ISR_TAMP1F_POS 13U -#define RTC_ISR_TAMP1F_MSK BIT(RTC_ISR_TAMP1F_POS) - -#define RTC_ISR_TAMP0F_POS 12U -#define RTC_ISR_TAMP0F_MSK BIT(RTC_ISR_TAMP0F_POS) - -#define RTC_ISR_TSOVF_POS 11U -#define RTC_ISR_TSOVF_MSK BIT(RTC_ISR_TSOVF_POS) - -#define RTC_ISR_TSF_POS 10U -#define RTC_ISR_TSF_MSK BIT(RTC_ISR_TSF_POS) - -#define RTC_ISR_ALMBF_POS 9U -#define RTC_ISR_ALMBF_MSK BIT(RTC_ISR_ALMBF_POS) - -#define RTC_ISR_ALMAF_POS 8U -#define RTC_ISR_ALMAF_MSK BIT(RTC_ISR_ALMAF_POS) - -#define RTC_ISR_YRF_POS 5U -#define RTC_ISR_YRF_MSK BIT(RTC_ISR_YRF_POS) - -#define RTC_ISR_MONF_POS 4U -#define RTC_ISR_MONF_MSK BIT(RTC_ISR_MONF_POS) - -#define RTC_ISR_DAYF_POS 3U -#define RTC_ISR_DAYF_MSK BIT(RTC_ISR_DAYF_POS) - -#define RTC_ISR_HRF_POS 2U -#define RTC_ISR_HRF_MSK BIT(RTC_ISR_HRF_POS) - -#define RTC_ISR_MINF_POS 1U -#define RTC_ISR_MINF_MSK BIT(RTC_ISR_MINF_POS) - -#define RTC_ISR_SECF_POS 0U -#define RTC_ISR_SECF_MSK BIT(RTC_ISR_SECF_POS) - -/****************** Bit definition for RTC_CALWPR register ************************/ - -#define RTC_CALWPR_WP_POS 0U -#define RTC_CALWPR_WP_MSK BIT(RTC_CALWPR_WP_POS) - -/****************** Bit definition for RTC_CALCON register ************************/ - -#define RTC_CALCON_DCMACC_POS 24U -#define RTC_CALCON_DCMACC_MSK BIT(RTC_CALCON_DCMACC_POS) - -#define RTC_CALCON_ALG_POS 23U -#define RTC_CALCON_ALG_MSK BIT(RTC_CALCON_ALG_POS) - -#define RTC_CALCON_TCP_POSS 20U -#define RTC_CALCON_TCP_POSE 22U -#define RTC_CALCON_TCP_MSK BITS(RTC_CALCON_TCP_POSS,RTC_CALCON_TCP_POSE) - -#define RTC_CALCON_ERR_POS 19U -#define RTC_CALCON_ERR_MSK BIT(RTC_CALCON_ERR_POS) - -#define RTC_CALCON_BUSY_POS 18U -#define RTC_CALCON_BUSY_MSK BIT(RTC_CALCON_BUSY_POS) - -#define RTC_CALCON_TCM_POSS 16U -#define RTC_CALCON_TCM_POSE 17U -#define RTC_CALCON_TCM_MSK BITS(RTC_CALCON_TCM_POSS,RTC_CALCON_TCM_POSE) - -#define RTC_CALCON_CALP_POSS 1U -#define RTC_CALCON_CALP_POSE 3U -#define RTC_CALCON_CALP_MSK BITS(RTC_CALCON_CALP_POSS,RTC_CALCON_CALP_POSE) - -#define RTC_CALCON_CALEN_POS 0U -#define RTC_CALCON_CALEN_MSK BIT(RTC_CALCON_CALEN_POS) - -/****************** Bit definition for RTC_CALDR register ************************/ - -#define RTC_CALDR_DATA_POSS 16U -#define RTC_CALDR_DATA_POSE 31U -#define RTC_CALDR_DATA_MSK BITS(RTC_CALDR_DATA_POSS,RTC_CALDR_DATA_POSE) - -#define RTC_CALDR_VAL_POSS 0U -#define RTC_CALDR_VAL_POSE 15U -#define RTC_CALDR_VAL_MSK BITS(RTC_CALDR_VAL_POSS,RTC_CALDR_VAL_POSE) - -/****************** Bit definition for RTC_TEMPR register ************************/ - -#define RTC_TEMPR_DATA_POSS 16U -#define RTC_TEMPR_DATA_POSE 31U -#define RTC_TEMPR_DATA_MSK BITS(RTC_TEMPR_DATA_POSS,RTC_TEMPR_DATA_POSE) - -#define RTC_TEMPR_VAL_POSS 0U -#define RTC_TEMPR_VAL_POSE 15U -#define RTC_TEMPR_VAL_MSK BITS(RTC_TEMPR_VAL_POSS,RTC_TEMPR_VAL_POSE) - -/****************** Bit definition for RTC_TEMPBDR register ************************/ - -#define RTC_TEMPBDR_VAL_POSS 0U -#define RTC_TEMPBDR_VAL_POSE 15U -#define RTC_TEMPBDR_VAL_MSK BITS(RTC_TEMPBDR_VAL_POSS,RTC_TEMPBDR_VAL_POSE) - -/****************** Bit definition for RTC_BKP register ************************/ - -#define RTC_BKP_BKP_POSS 0U -#define RTC_BKP_BKP_POSE 31U -#define RTC_BKP_BKP_MSK BITS(RTC_BKP_BKP_POSS,RTC_BKP_BKP_POSE) - -typedef struct -{ - __IO uint32_t WPR; - __IO uint32_t CON; - __IO uint32_t PSR; - __IO uint32_t TAMPCON; - __IO uint32_t TIME; - __IO uint32_t DATE; - __IO uint32_t SSEC; - __IO uint32_t WUMAT; - __IO uint32_t ALMA; - __IO uint32_t ALMB; - __IO uint32_t ALMASSEC; - __IO uint32_t ALMBSSEC; - __I uint32_t TSTIME; - __I uint32_t TSDATE; - __I uint32_t TSSSEC; - __O uint32_t SSECTR; - __IO uint32_t IER; - __I uint32_t IFR; - __O uint32_t IFCR; - __I uint32_t ISR; - __IO uint32_t CALWPR; - __IO uint32_t CALCON; - __IO uint32_t CALDR; - __IO uint32_t TEMPR; - __IO uint32_t LTCAR; - __IO uint32_t LTCBR; - __IO uint32_t LTCCR; - __IO uint32_t LTCDR; - __IO uint32_t LTCER; - __IO uint32_t HTCAR; - __IO uint32_t HTCBR; - __IO uint32_t HTCCR; - __IO uint32_t HTCDR; - __IO uint32_t HTCER; - __IO uint32_t TEMPBDR; - uint32_t RESERVED0[29] ; - __IO uint32_t BKPR[32]; -} RTC_TypeDef; - -/****************** Bit definition for TIMER_CON1 register ************************/ - -#define TIMER_CON1_DFCKSEL_POSS 8U -#define TIMER_CON1_DFCKSEL_POSE 9U -#define TIMER_CON1_DFCKSEL_MSK BITS(TIMER_CON1_DFCKSEL_POSS,TIMER_CON1_DFCKSEL_POSE) - -#define TIMER_CON1_ARPEN_POS 7U -#define TIMER_CON1_ARPEN_MSK BIT(TIMER_CON1_ARPEN_POS) - -#define TIMER_CON1_CMSEL_POSS 5U -#define TIMER_CON1_CMSEL_POSE 6U -#define TIMER_CON1_CMSEL_MSK BITS(TIMER_CON1_CMSEL_POSS,TIMER_CON1_CMSEL_POSE) - -#define TIMER_CON1_DIRSEL_POS 4U -#define TIMER_CON1_DIRSEL_MSK BIT(TIMER_CON1_DIRSEL_POS) - -#define TIMER_CON1_SPMEN_POS 3U -#define TIMER_CON1_SPMEN_MSK BIT(TIMER_CON1_SPMEN_POS) - -#define TIMER_CON1_UERSEL_POS 2U -#define TIMER_CON1_UERSEL_MSK BIT(TIMER_CON1_UERSEL_POS) - -#define TIMER_CON1_DISUE_POS 1U -#define TIMER_CON1_DISUE_MSK BIT(TIMER_CON1_DISUE_POS) - -#define TIMER_CON1_CNTEN_POS 0U -#define TIMER_CON1_CNTEN_MSK BIT(TIMER_CON1_CNTEN_POS) - -/****************** Bit definition for TIMER_CON2 register ************************/ - -#define TIMER_CON2_OISS4_POS 14U -#define TIMER_CON2_OISS4_MSK BIT(TIMER_CON2_OISS4_POS) - -#define TIMER_CON2_OISS3N_POS 13U -#define TIMER_CON2_OISS3N_MSK BIT(TIMER_CON2_OISS3N_POS) - -#define TIMER_CON2_OISS3_POS 12U -#define TIMER_CON2_OISS3_MSK BIT(TIMER_CON2_OISS3_POS) - -#define TIMER_CON2_OISS2N_POS 11U -#define TIMER_CON2_OISS2N_MSK BIT(TIMER_CON2_OISS2N_POS) - -#define TIMER_CON2_OISS2_POS 10U -#define TIMER_CON2_OISS2_MSK BIT(TIMER_CON2_OISS2_POS) - -#define TIMER_CON2_OISS1N_POS 9U -#define TIMER_CON2_OISS1N_MSK BIT(TIMER_CON2_OISS1N_POS) - -#define TIMER_CON2_OISS1_POS 8U -#define TIMER_CON2_OISS1_MSK BIT(TIMER_CON2_OISS1_POS) - -#define TIMER_CON2_I1FSEL_POS 7U -#define TIMER_CON2_I1FSEL_MSK BIT(TIMER_CON2_I1FSEL_POS) - -#define TIMER_CON2_TRGOSEL_POSS 4U -#define TIMER_CON2_TRGOSEL_POSE 6U -#define TIMER_CON2_TRGOSEL_MSK BITS(TIMER_CON2_TRGOSEL_POSS,TIMER_CON2_TRGOSEL_POSE) - -#define TIMER_CON2_CCDMASEL_POS 3U -#define TIMER_CON2_CCDMASEL_MSK BIT(TIMER_CON2_CCDMASEL_POS) - -#define TIMER_CON2_CCUSEL_POS 2U -#define TIMER_CON2_CCUSEL_MSK BIT(TIMER_CON2_CCUSEL_POS) - -#define TIMER_CON2_CCPCEN_POS 0U -#define TIMER_CON2_CCPCEN_MSK BIT(TIMER_CON2_CCPCEN_POS) - -/****************** Bit definition for TIMER_SMCON register ************************/ - -#define TIMER_SMCON_ETPOL_POS 15U -#define TIMER_SMCON_ETPOL_MSK BIT(TIMER_SMCON_ETPOL_POS) - -#define TIMER_SMCON_ECM2EN_POS 14U -#define TIMER_SMCON_ECM2EN_MSK BIT(TIMER_SMCON_ECM2EN_POS) - -#define TIMER_SMCON_ETPSEL_POSS 12U -#define TIMER_SMCON_ETPSEL_POSE 13U -#define TIMER_SMCON_ETPSEL_MSK BITS(TIMER_SMCON_ETPSEL_POSS,TIMER_SMCON_ETPSEL_POSE) - -#define TIMER_SMCON_ETFLT_POSS 8U -#define TIMER_SMCON_ETFLT_POSE 11U -#define TIMER_SMCON_ETFLT_MSK BITS(TIMER_SMCON_ETFLT_POSS,TIMER_SMCON_ETFLT_POSE) - -#define TIMER_SMCON_MSCFG_POS 7U -#define TIMER_SMCON_MSCFG_MSK BIT(TIMER_SMCON_MSCFG_POS) - -#define TIMER_SMCON_TSSEL_POSS 4U -#define TIMER_SMCON_TSSEL_POSE 6U -#define TIMER_SMCON_TSSEL_MSK BITS(TIMER_SMCON_TSSEL_POSS,TIMER_SMCON_TSSEL_POSE) - -#define TIMER_SMCON_SMODS_POSS 0U -#define TIMER_SMCON_SMODS_POSE 2U -#define TIMER_SMCON_SMODS_MSK BITS(TIMER_SMCON_SMODS_POSS,TIMER_SMCON_SMODS_POSE) - -/****************** Bit definition for TIMER_DIER register ************************/ - -#define TIMER_DIER_TRGDMA_POS 14U -#define TIMER_DIER_TRGDMA_MSK BIT(TIMER_DIER_TRGDMA_POS) - -#define TIMER_DIER_COMDMA_POS 13U -#define TIMER_DIER_COMDMA_MSK BIT(TIMER_DIER_COMDMA_POS) - -#define TIMER_DIER_CC4DMA_POS 12U -#define TIMER_DIER_CC4DMA_MSK BIT(TIMER_DIER_CC4DMA_POS) - -#define TIMER_DIER_CC3DMA_POS 11U -#define TIMER_DIER_CC3DMA_MSK BIT(TIMER_DIER_CC3DMA_POS) - -#define TIMER_DIER_CC2DMA_POS 10U -#define TIMER_DIER_CC2DMA_MSK BIT(TIMER_DIER_CC2DMA_POS) - -#define TIMER_DIER_CC1DMA_POS 9U -#define TIMER_DIER_CC1DMA_MSK BIT(TIMER_DIER_CC1DMA_POS) - -#define TIMER_DIER_UDMA_POS 8U -#define TIMER_DIER_UDMA_MSK BIT(TIMER_DIER_UDMA_POS) - -#define TIMER_DIER_BRKIT_POS 7U -#define TIMER_DIER_BRKIT_MSK BIT(TIMER_DIER_BRKIT_POS) - -#define TIMER_DIER_TRGIT_POS 6U -#define TIMER_DIER_TRGIT_MSK BIT(TIMER_DIER_TRGIT_POS) - -#define TIMER_DIER_COMIT_POS 5U -#define TIMER_DIER_COMIT_MSK BIT(TIMER_DIER_COMIT_POS) - -#define TIMER_DIER_CC4IT_POS 4U -#define TIMER_DIER_CC4IT_MSK BIT(TIMER_DIER_CC4IT_POS) - -#define TIMER_DIER_CC3IT_POS 3U -#define TIMER_DIER_CC3IT_MSK BIT(TIMER_DIER_CC3IT_POS) - -#define TIMER_DIER_CC2IT_POS 2U -#define TIMER_DIER_CC2IT_MSK BIT(TIMER_DIER_CC2IT_POS) - -#define TIMER_DIER_CC1IT_POS 1U -#define TIMER_DIER_CC1IT_MSK BIT(TIMER_DIER_CC1IT_POS) - -#define TIMER_DIER_UIT_POS 0U -#define TIMER_DIER_UIT_MSK BIT(TIMER_DIER_UIT_POS) - -/****************** Bit definition for TIMER_DIDR register ************************/ - -#define TIMER_DIDR_TRGDMA_POS 14U -#define TIMER_DIDR_TRGDMA_MSK BIT(TIMER_DIDR_TRGDMA_POS) - -#define TIMER_DIDR_COMD_POS 13U -#define TIMER_DIDR_COMD_MSK BIT(TIMER_DIDR_COMD_POS) - -#define TIMER_DIDR_CC4D_POS 12U -#define TIMER_DIDR_CC4D_MSK BIT(TIMER_DIDR_CC4D_POS) - -#define TIMER_DIDR_CC3D_POS 11U -#define TIMER_DIDR_CC3D_MSK BIT(TIMER_DIDR_CC3D_POS) - -#define TIMER_DIDR_CC2D_POS 10U -#define TIMER_DIDR_CC2D_MSK BIT(TIMER_DIDR_CC2D_POS) - -#define TIMER_DIDR_CC1D_POS 9U -#define TIMER_DIDR_CC1D_MSK BIT(TIMER_DIDR_CC1D_POS) - -#define TIMER_DIDR_UD_POS 8U -#define TIMER_DIDR_UD_MSK BIT(TIMER_DIDR_UD_POS) - -#define TIMER_DIDR_BRKI_POS 7U -#define TIMER_DIDR_BRKI_MSK BIT(TIMER_DIDR_BRKI_POS) - -#define TIMER_DIDR_TRGI_POS 6U -#define TIMER_DIDR_TRGI_MSK BIT(TIMER_DIDR_TRGI_POS) - -#define TIMER_DIDR_COMI_POS 5U -#define TIMER_DIDR_COMI_MSK BIT(TIMER_DIDR_COMI_POS) - -#define TIMER_DIDR_CC4I_POS 4U -#define TIMER_DIDR_CC4I_MSK BIT(TIMER_DIDR_CC4I_POS) - -#define TIMER_DIDR_CC3I_POS 3U -#define TIMER_DIDR_CC3I_MSK BIT(TIMER_DIDR_CC3I_POS) - -#define TIMER_DIDR_CC2I_POS 2U -#define TIMER_DIDR_CC2I_MSK BIT(TIMER_DIDR_CC2I_POS) - -#define TIMER_DIDR_CC1I_POS 1U -#define TIMER_DIDR_CC1I_MSK BIT(TIMER_DIDR_CC1I_POS) - -#define TIMER_DIDR_UI_POS 0U -#define TIMER_DIDR_UI_MSK BIT(TIMER_DIDR_UI_POS) - -/****************** Bit definition for TIMER_DIVS register ************************/ - -#define TIMER_DIVS_TRGDMA_POS 14U -#define TIMER_DIVS_TRGDMA_MSK BIT(TIMER_DIVS_TRGDMA_POS) - -#define TIMER_DIVS_COMDMA_POS 13U -#define TIMER_DIVS_COMDMA_MSK BIT(TIMER_DIVS_COMDMA_POS) - -#define TIMER_DIVS_CC4DMA_POS 12U -#define TIMER_DIVS_CC4DMA_MSK BIT(TIMER_DIVS_CC4DMA_POS) - -#define TIMER_DIVS_CC3DMA_POS 11U -#define TIMER_DIVS_CC3DMA_MSK BIT(TIMER_DIVS_CC3DMA_POS) - -#define TIMER_DIVS_CC2DMA_POS 10U -#define TIMER_DIVS_CC2DMA_MSK BIT(TIMER_DIVS_CC2DMA_POS) - -#define TIMER_DIVS_CC1DMA_POS 9U -#define TIMER_DIVS_CC1DMA_MSK BIT(TIMER_DIVS_CC1DMA_POS) - -#define TIMER_DIVS_UEDTR_POS 8U -#define TIMER_DIVS_UEDTR_MSK BIT(TIMER_DIVS_UEDTR_POS) - -#define TIMER_DIVS_BKI_POS 7U -#define TIMER_DIVS_BKI_MSK BIT(TIMER_DIVS_BKI_POS) - -#define TIMER_DIVS_TRGI_POS 6U -#define TIMER_DIVS_TRGI_MSK BIT(TIMER_DIVS_TRGI_POS) - -#define TIMER_DIVS_COMI_POS 5U -#define TIMER_DIVS_COMI_MSK BIT(TIMER_DIVS_COMI_POS) - -#define TIMER_DIVS_CC4I_POS 4U -#define TIMER_DIVS_CC4I_MSK BIT(TIMER_DIVS_CC4I_POS) - -#define TIMER_DIVS_CC3I_POS 3U -#define TIMER_DIVS_CC3I_MSK BIT(TIMER_DIVS_CC3I_POS) - -#define TIMER_DIVS_CC2I_POS 2U -#define TIMER_DIVS_CC2I_MSK BIT(TIMER_DIVS_CC2I_POS) - -#define TIMER_DIVS_CC1I_POS 1U -#define TIMER_DIVS_CC1I_MSK BIT(TIMER_DIVS_CC1I_POS) - -#define TIMER_DIVS_UEI_POS 0U -#define TIMER_DIVS_UEI_MSK BIT(TIMER_DIVS_UEI_POS) - -/****************** Bit definition for TIMER_RIF register ************************/ - -#define TIMER_RIF_CH4OVIF_POS 12U -#define TIMER_RIF_CH4OVIF_MSK BIT(TIMER_RIF_CH4OVIF_POS) - -#define TIMER_RIF_CH3OVIF_POS 11U -#define TIMER_RIF_CH3OVIF_MSK BIT(TIMER_RIF_CH3OVIF_POS) - -#define TIMER_RIF_CH2OVIF_POS 10U -#define TIMER_RIF_CH2OVIF_MSK BIT(TIMER_RIF_CH2OVIF_POS) - -#define TIMER_RIF_CH1OVIF_POS 9U -#define TIMER_RIF_CH1OVIF_MSK BIT(TIMER_RIF_CH1OVIF_POS) - -#define TIMER_RIF_BRKIF_POS 7U -#define TIMER_RIF_BRKIF_MSK BIT(TIMER_RIF_BRKIF_POS) - -#define TIMER_RIF_TRGIF_POS 6U -#define TIMER_RIF_TRGIF_MSK BIT(TIMER_RIF_TRGIF_POS) - -#define TIMER_RIF_COMIF_POS 5U -#define TIMER_RIF_COMIF_MSK BIT(TIMER_RIF_COMIF_POS) - -#define TIMER_RIF_CH4IF_POS 4U -#define TIMER_RIF_CH4IF_MSK BIT(TIMER_RIF_CH4IF_POS) - -#define TIMER_RIF_CH3IF_POS 3U -#define TIMER_RIF_CH3IF_MSK BIT(TIMER_RIF_CH3IF_POS) - -#define TIMER_RIF_CH2IF_POS 2U -#define TIMER_RIF_CH2IF_MSK BIT(TIMER_RIF_CH2IF_POS) - -#define TIMER_RIF_CH1IF_POS 1U -#define TIMER_RIF_CH1IF_MSK BIT(TIMER_RIF_CH1IF_POS) - -#define TIMER_RIF_UEVTIF_POS 0U -#define TIMER_RIF_UEVTIF_MSK BIT(TIMER_RIF_UEVTIF_POS) - -/****************** Bit definition for TIMER_IFM register ************************/ - -#define TIMER_IFM_BRKIM_POS 7U -#define TIMER_IFM_BRKIM_MSK BIT(TIMER_IFM_BRKIM_POS) - -#define TIMER_IFM_TRGI_POS 6U -#define TIMER_IFM_TRGI_MSK BIT(TIMER_IFM_TRGI_POS) - -#define TIMER_IFM_COMI_POS 5U -#define TIMER_IFM_COMI_MSK BIT(TIMER_IFM_COMI_POS) - -#define TIMER_IFM_CH4CCI_POS 4U -#define TIMER_IFM_CH4CCI_MSK BIT(TIMER_IFM_CH4CCI_POS) - -#define TIMER_IFM_CH3CCI_POS 3U -#define TIMER_IFM_CH3CCI_MSK BIT(TIMER_IFM_CH3CCI_POS) - -#define TIMER_IFM_CH2CCI_POS 2U -#define TIMER_IFM_CH2CCI_MSK BIT(TIMER_IFM_CH2CCI_POS) - -#define TIMER_IFM_CH1CCI_POS 1U -#define TIMER_IFM_CH1CCI_MSK BIT(TIMER_IFM_CH1CCI_POS) - -#define TIMER_IFM_UEI_POS 0U -#define TIMER_IFM_UEI_MSK BIT(TIMER_IFM_UEI_POS) - -/****************** Bit definition for TIMER_ICR register ************************/ - -#define TIMER_ICR_BRKIC_POS 7U -#define TIMER_ICR_BRKIC_MSK BIT(TIMER_ICR_BRKIC_POS) - -#define TIMER_ICR_TRGIC_POS 6U -#define TIMER_ICR_TRGIC_MSK BIT(TIMER_ICR_TRGIC_POS) - -#define TIMER_ICR_COMIC_POS 5U -#define TIMER_ICR_COMIC_MSK BIT(TIMER_ICR_COMIC_POS) - -#define TIMER_ICR_CH4CCIC_POS 4U -#define TIMER_ICR_CH4CCIC_MSK BIT(TIMER_ICR_CH4CCIC_POS) - -#define TIMER_ICR_CH3CCIC_POS 3U -#define TIMER_ICR_CH3CCIC_MSK BIT(TIMER_ICR_CH3CCIC_POS) - -#define TIMER_ICR_CH2CCIC_POS 2U -#define TIMER_ICR_CH2CCIC_MSK BIT(TIMER_ICR_CH2CCIC_POS) - -#define TIMER_ICR_CH1CCIC_POS 1U -#define TIMER_ICR_CH1CCIC_MSK BIT(TIMER_ICR_CH1CCIC_POS) - -#define TIMER_ICR_UEIC_POS 0U -#define TIMER_ICR_UEIC_MSK BIT(TIMER_ICR_UEIC_POS) - -/****************** Bit definition for TIMER_SGE register ************************/ - -#define TIMER_SGE_SGBRK_POS 7U -#define TIMER_SGE_SGBRK_MSK BIT(TIMER_SGE_SGBRK_POS) - -#define TIMER_SGE_SGTRG_POS 6U -#define TIMER_SGE_SGTRG_MSK BIT(TIMER_SGE_SGTRG_POS) - -#define TIMER_SGE_SGCOM_POS 5U -#define TIMER_SGE_SGCOM_MSK BIT(TIMER_SGE_SGCOM_POS) - -#define TIMER_SGE_SGCC4E_POS 4U -#define TIMER_SGE_SGCC4E_MSK BIT(TIMER_SGE_SGCC4E_POS) - -#define TIMER_SGE_SGCC3E_POS 3U -#define TIMER_SGE_SGCC3E_MSK BIT(TIMER_SGE_SGCC3E_POS) - -#define TIMER_SGE_SGCC2E_POS 2U -#define TIMER_SGE_SGCC2E_MSK BIT(TIMER_SGE_SGCC2E_POS) - -#define TIMER_SGE_SGCC1E_POS 1U -#define TIMER_SGE_SGCC1E_MSK BIT(TIMER_SGE_SGCC1E_POS) - -#define TIMER_SGE_SGU_POS 0U -#define TIMER_SGE_SGU_MSK BIT(TIMER_SGE_SGU_POS) - -/****************** Bit definition for TIMER_CHMR1 register ************************/ -/* Output */ -#define TIMER_CHMR1_CH2OCLREN_POS 15U -#define TIMER_CHMR1_CH2OCLREN_MSK BIT(TIMER_CHMR1_CH2OCLREN_POS) - -#define TIMER_CHMR1_CH2OMOD_POSS 12U -#define TIMER_CHMR1_CH2OMOD_POSE 14U -#define TIMER_CHMR1_CH2OMOD_MSK BITS(TIMER_CHMR1_CH2OMOD_POSS,TIMER_CHMR1_CH2OMOD_POSE) - -#define TIMER_CHMR1_CH2OPEN_POS 11U -#define TIMER_CHMR1_CH2OPEN_MSK BIT(TIMER_CHMR1_CH2OPEN_POS) - -#define TIMER_CHMR1_CH2OFEN_POS 10U -#define TIMER_CHMR1_CH2OFEN_MSK BIT(TIMER_CHMR1_CH2OFEN_POS) - -#define TIMER_CHMR1_CC2SSEL_POSS 8U -#define TIMER_CHMR1_CC2SSEL_POSE 9U -#define TIMER_CHMR1_CC2SSEL_MSK BITS(TIMER_CHMR1_CC2SSEL_POSS,TIMER_CHMR1_CC2SSEL_POSE) - -#define TIMER_CHMR1_CH1OCLREN_POS 7U -#define TIMER_CHMR1_CH1OCLREN_MSK BIT(TIMER_CHMR1_CH1OCLREN_POS) - -#define TIMER_CHMR1_CH1OMOD_POSS 4U -#define TIMER_CHMR1_CH1OMOD_POSE 6U -#define TIMER_CHMR1_CH1OMOD_MSK BITS(TIMER_CHMR1_CH1OMOD_POSS,TIMER_CHMR1_CH1OMOD_POSE) - -#define TIMER_CHMR1_CH1OPREN_POS 3U -#define TIMER_CHMR1_CH1OPREN_MSK BIT(TIMER_CHMR1_CH1OPREN_POS) - -#define TIMER_CHMR1_CH1OHSEN_POS 2U -#define TIMER_CHMR1_CH1OHSEN_MSK BIT(TIMER_CHMR1_CH1OHSEN_POS) - -#define TIMER_CHMR1_CC1SSEL_POSS 0U -#define TIMER_CHMR1_CC1SSEL_POSE 1U -#define TIMER_CHMR1_CC1SSEL_MSK BITS(TIMER_CHMR1_CC1SSEL_POSS,TIMER_CHMR1_CC1SSEL_POSE) - -/* Input */ -#define TIMER_CHMR1_I2FLT_POSS 12U -#define TIMER_CHMR1_I2FLT_POSE 15U -#define TIMER_CHMR1_I2FLT_MSK BITS(TIMER_CHMR1_I2FLT_POSS,TIMER_CHMR1_I2FLT_POSE) - -#define TIMER_CHMR1_IC2PRES_POSS 10U -#define TIMER_CHMR1_IC2PRES_POSE 11U -#define TIMER_CHMR1_IC2PRES_MSK BITS(TIMER_CHMR1_IC2PRES_POSS,TIMER_CHMR1_IC2PRES_POSE) - -#define TIMER_CHMR1_CC2SSEL_POSS 8U -#define TIMER_CHMR1_CC2SSEL_POSE 9U -#define TIMER_CHMR1_CC2SSEL_MSK BITS(TIMER_CHMR1_CC2SSEL_POSS,TIMER_CHMR1_CC2SSEL_POSE) - -#define TIMER_CHMR1_I1FLT_POSS 4U -#define TIMER_CHMR1_I1FLT_POSE 7U -#define TIMER_CHMR1_I1FLT_MSK BITS(TIMER_CHMR1_I1FLT_POSS,TIMER_CHMR1_I1FLT_POSE) - -#define TIMER_CHMR1_IC1PRES_POSS 2U -#define TIMER_CHMR1_IC1PRES_POSE 3U -#define TIMER_CHMR1_IC1PRES_MSK BITS(TIMER_CHMR1_IC1PRES_POSS,TIMER_CHMR1_IC1PRES_POSE) - -#define TIMER_CHMR1_CC1SSEL_POSS 0U -#define TIMER_CHMR1_CC1SSEL_POSE 1U -#define TIMER_CHMR1_CC1SSEL_MSK BITS(TIMER_CHMR1_CC1SSEL_POSS,TIMER_CHMR1_CC1SSEL_POSE) - -/****************** Bit definition for TIMER_CHMR2 register ************************/ -/* Output */ -#define TIMER_CHMR2_CH4OCLREN_POS 15U -#define TIMER_CHMR2_CH4OCLREN_MSK BIT(TIMER_CHMR2_CH4OCLREN_POS) - -#define TIMER_CHMR2_CH4OMOD_POSS 12U -#define TIMER_CHMR2_CH4OMOD_POSE 14U -#define TIMER_CHMR2_CH4OMOD_MSK BITS(TIMER_CHMR2_CH4OMOD_POSS,TIMER_CHMR2_CH4OMOD_POSE) - -#define TIMER_CHMR2_CH4OPEN_POS 11U -#define TIMER_CHMR2_CH4OPEN_MSK BIT(TIMER_CHMR2_CH4OPEN_POS) - -#define TIMER_CHMR2_CH4OHSEN_POS 10U -#define TIMER_CHMR2_CH4OHSEN_MSK BIT(TIMER_CHMR2_CH4OHSEN_POS) - -#define TIMER_CHMR2_CC4SSEL_POSS 8U -#define TIMER_CHMR2_CC4SSEL_POSE 9U -#define TIMER_CHMR2_CC4SSEL_MSK BITS(TIMER_CHMR2_CC4SSEL_POSS,TIMER_CHMR2_CC4SSEL_POSE) - -#define TIMER_CHMR2_CH3OCLREN_POS 7U -#define TIMER_CHMR2_CH3OCLREN_MSK BIT(TIMER_CHMR2_CH3OCLREN_POS) - -#define TIMER_CHMR2_CH3OMOD_POSS 4U -#define TIMER_CHMR2_CH3OMOD_POSE 6U -#define TIMER_CHMR2_CH3OMOD_MSK BITS(TIMER_CHMR2_CH3OMOD_POSS,TIMER_CHMR2_CH3OMOD_POSE) - -#define TIMER_CHMR2_CH3OPEN_POS 3U -#define TIMER_CHMR2_CH3OPEN_MSK BIT(TIMER_CHMR2_CH3OPEN_POS) - -#define TIMER_CHMR2_CH3OFEN_POS 2U -#define TIMER_CHMR2_CH3OFEN_MSK BIT(TIMER_CHMR2_CH3OFEN_POS) - -#define TIMER_CHMR2_CC3SSEL_POSS 0U -#define TIMER_CHMR2_CC3SSEL_POSE 1U -#define TIMER_CHMR2_CC3SSEL_MSK BITS(TIMER_CHMR2_CC3SSEL_POSS,TIMER_CHMR2_CC3SSEL_POSE) - -/* Input */ -#define TIMER_CHMR2_I4FLT_POSS 12U -#define TIMER_CHMR2_I4FLT_POSE 15U -#define TIMER_CHMR2_I4FLT_MSK BITS(TIMER_CHMR2_I4FLT_POSS,TIMER_CHMR2_I4FLT_POSE) - -#define TIMER_CHMR2_IC4PRES_POSS 10U -#define TIMER_CHMR2_IC4PRES_POSE 11U -#define TIMER_CHMR2_IC4PRES_MSK BITS(TIMER_CHMR2_IC4PRES_POSS,TIMER_CHMR2_IC4PRES_POSE) - -#define TIMER_CHMR2_CC4SSEL_POSS 8U -#define TIMER_CHMR2_CC4SSEL_POSE 9U -#define TIMER_CHMR2_CC4SSEL_MSK BITS(TIMER_CHMR2_CC4SSEL_POSS,TIMER_CHMR2_CC4SSEL_POSE) - -#define TIMER_CHMR2_I3FLT_POSS 4U -#define TIMER_CHMR2_I3FLT_POSE 7U -#define TIMER_CHMR2_I3FLT_MSK BITS(TIMER_CHMR2_I3FLT_POSS,TIMER_CHMR2_I3FLT_POSE) - -#define TIMER_CHMR2_IC3PRES_POSS 2U -#define TIMER_CHMR2_IC3PRES_POSE 3U -#define TIMER_CHMR2_IC3PRES_MSK BITS(TIMER_CHMR2_IC3PRES_POSS,TIMER_CHMR2_IC3PRES_POSE) - -#define TIMER_CHMR2_CC3SSEL_POSS 0U -#define TIMER_CHMR2_CC3SSEL_POSE 1U -#define TIMER_CHMR2_CC3SSEL_MSK BITS(TIMER_CHMR2_CC3SSEL_POSS,TIMER_CHMR2_CC3SSEL_POSE) - -/****************** Bit definition for TIMER_CCEP register ************************/ - -#define TIMER_CCEP_CC4POL_POS 13U -#define TIMER_CCEP_CC4POL_MSK BIT(TIMER_CCEP_CC4POL_POS) - -#define TIMER_CCEP_CC4EN_POS 12U -#define TIMER_CCEP_CC4EN_MSK BIT(TIMER_CCEP_CC4EN_POS) - -#define TIMER_CCEP_CC3NPOL_POS 11U -#define TIMER_CCEP_CC3NPOL_MSK BIT(TIMER_CCEP_CC3NPOL_POS) - -#define TIMER_CCEP_CC3NEN_POS 10U -#define TIMER_CCEP_CC3NEN_MSK BIT(TIMER_CCEP_CC3NEN_POS) - -#define TIMER_CCEP_CC3POL_POS 9U -#define TIMER_CCEP_CC3POL_MSK BIT(TIMER_CCEP_CC3POL_POS) - -#define TIMER_CCEP_CC3EN_POS 8U -#define TIMER_CCEP_CC3EN_MSK BIT(TIMER_CCEP_CC3EN_POS) - -#define TIMER_CCEP_CC2NPOL_POS 7U -#define TIMER_CCEP_CC2NPOL_MSK BIT(TIMER_CCEP_CC2NPOL_POS) - -#define TIMER_CCEP_CC2NEN_POS 6U -#define TIMER_CCEP_CC2NEN_MSK BIT(TIMER_CCEP_CC2NEN_POS) - -#define TIMER_CCEP_CC2POL_POS 5U -#define TIMER_CCEP_CC2POL_MSK BIT(TIMER_CCEP_CC2POL_POS) - -#define TIMER_CCEP_CC2EN_POS 4U -#define TIMER_CCEP_CC2EN_MSK BIT(TIMER_CCEP_CC2EN_POS) - -#define TIMER_CCEP_CC1NPOL_POS 3U -#define TIMER_CCEP_CC1NPOL_MSK BIT(TIMER_CCEP_CC1NPOL_POS) - -#define TIMER_CCEP_CC1NEN_POS 2U -#define TIMER_CCEP_CC1NEN_MSK BIT(TIMER_CCEP_CC1NEN_POS) - -#define TIMER_CCEP_CC1POL_POS 1U -#define TIMER_CCEP_CC1POL_MSK BIT(TIMER_CCEP_CC1POL_POS) - -#define TIMER_CCEP_CC1EN_POS 0U -#define TIMER_CCEP_CC1EN_MSK BIT(TIMER_CCEP_CC1EN_POS) - -/****************** Bit definition for TIMER_COUNT register ************************/ - -#define TIMER_COUNT_CNTV_POSS 0U -#define TIMER_COUNT_CNTV_POSE 15U -#define TIMER_COUNT_CNTV_MSK BITS(TIMER_COUNT_CNTV_POSS,TIMER_COUNT_CNTV_POSE) - -/****************** Bit definition for TIMER_PRES register ************************/ - -#define TIMER_PRES_PSCV_POSS 0U -#define TIMER_PRES_PSCV_POSE 15U -#define TIMER_PRES_PSCV_MSK BITS(TIMER_PRES_PSCV_POSS,TIMER_PRES_PSCV_POSE) - -/****************** Bit definition for TIMER_AR register ************************/ - -#define TIMER_AR_ARRV_POSS 0U -#define TIMER_AR_ARRV_POSE 15U -#define TIMER_AR_ARRV_MSK BITS(TIMER_AR_ARRV_POSS,TIMER_AR_ARRV_POSE) - -/****************** Bit definition for TIMER_REPAR register ************************/ - -#define TIMER_REPAR_REPV_POSS 0U -#define TIMER_REPAR_REPV_POSE 7U -#define TIMER_REPAR_REPV_MSK BITS(TIMER_REPAR_REPV_POSS,TIMER_REPAR_REPV_POSE) - -/****************** Bit definition for TIMER_CCVAL1 register ************************/ - -#define TIMER_CCVAL1_CCRV1_POSS 0U -#define TIMER_CCVAL1_CCRV1_POSE 15U -#define TIMER_CCVAL1_CCRV1_MSK BITS(TIMER_CCVAL1_CCRV1_POSS,TIMER_CCVAL1_CCRV1_POSE) - -/****************** Bit definition for TIMER_CCVAL2 register ************************/ - -#define TIMER_CCVAL2_CCRV2_POSS 0U -#define TIMER_CCVAL2_CCRV2_POSE 15U -#define TIMER_CCVAL2_CCRV2_MSK BITS(TIMER_CCVAL2_CCRV2_POSS,TIMER_CCVAL2_CCRV2_POSE) - -/****************** Bit definition for TIMER_CCVAL3 register ************************/ - -#define TIMER_CCVAL3_CCRV3_POSS 0U -#define TIMER_CCVAL3_CCRV3_POSE 15U -#define TIMER_CCVAL3_CCRV3_MSK BITS(TIMER_CCVAL3_CCRV3_POSS,TIMER_CCVAL3_CCRV3_POSE) - -/****************** Bit definition for TIMER_CCVAL4 register ************************/ - -#define TIMER_CCVAL4_CCRV4_POSS 0U -#define TIMER_CCVAL4_CCRV4_POSE 15U -#define TIMER_CCVAL4_CCRV4_MSK BITS(TIMER_CCVAL4_CCRV4_POSS,TIMER_CCVAL4_CCRV4_POSE) - -/****************** Bit definition for TIMER_BDCFG register ************************/ - -#define TIMER_BDCFG_GOEN_POS 15U -#define TIMER_BDCFG_GOEN_MSK BIT(TIMER_BDCFG_GOEN_POS) - -#define TIMER_BDCFG_AOEN_POS 14U -#define TIMER_BDCFG_AOEN_MSK BIT(TIMER_BDCFG_AOEN_POS) - -#define TIMER_BDCFG_BRKP_POS 13U -#define TIMER_BDCFG_BRKP_MSK BIT(TIMER_BDCFG_BRKP_POS) - -#define TIMER_BDCFG_BRKEN_POS 12U -#define TIMER_BDCFG_BRKEN_MSK BIT(TIMER_BDCFG_BRKEN_POS) - -#define TIMER_BDCFG_OFFSSR_POS 11U -#define TIMER_BDCFG_OFFSSR_MSK BIT(TIMER_BDCFG_OFFSSR_POS) - -#define TIMER_BDCFG_OFFSSI_POS 10U -#define TIMER_BDCFG_OFFSSI_MSK BIT(TIMER_BDCFG_OFFSSI_POS) - -#define TIMER_BDCFG_LOCKLVL_POSS 8U -#define TIMER_BDCFG_LOCKLVL_POSE 9U -#define TIMER_BDCFG_LOCKLVL_MSK BITS(TIMER_BDCFG_LOCKLVL_POSS,TIMER_BDCFG_LOCKLVL_POSE) - -#define TIMER_BDCFG_DT_POSS 0U -#define TIMER_BDCFG_DT_POSE 7U -#define TIMER_BDCFG_DT_MSK BITS(TIMER_BDCFG_DT_POSS,TIMER_BDCFG_DT_POSE) - -typedef struct -{ - __IO uint32_t CON1; - __IO uint32_t CON2; - __IO uint32_t SMCON; - __O uint32_t DIER; - __O uint32_t DIDR; - __I uint32_t DIVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; - __O uint32_t SGE; - __IO uint32_t CHMR1; - __IO uint32_t CHMR2; - __IO uint32_t CCEP; - __IO uint32_t COUNT; - __IO uint32_t PRES; - __IO uint32_t AR; - __IO uint32_t REPAR; - __IO uint32_t CCVAL1; - __IO uint32_t CCVAL2; - __IO uint32_t CCVAL3; - __IO uint32_t CCVAL4; - __IO uint32_t BDCFG; -} TIMER_TypeDef; - -/****************** Bit definition for USART_STAT register ************************/ - -#define USART_STAT_CTSIF_POS 9U -#define USART_STAT_CTSIF_MSK BIT(USART_STAT_CTSIF_POS) - -#define USART_STAT_TXEMPIF_POS 7U -#define USART_STAT_TXEMPIF_MSK BIT(USART_STAT_TXEMPIF_POS) - -#define USART_STAT_TXCIF_POS 6U -#define USART_STAT_TXCIF_MSK BIT(USART_STAT_TXCIF_POS) - -#define USART_STAT_RXNEIF_POS 5U -#define USART_STAT_RXNEIF_MSK BIT(USART_STAT_RXNEIF_POS) - -#define USART_STAT_IDLEIF_POS 4U -#define USART_STAT_IDLEIF_MSK BIT(USART_STAT_IDLEIF_POS) - -#define USART_STAT_OVRIF_POS 3U -#define USART_STAT_OVRIF_MSK BIT(USART_STAT_OVRIF_POS) - -#define USART_STAT_NDETIF_POS 2U -#define USART_STAT_NDETIF_MSK BIT(USART_STAT_NDETIF_POS) - -#define USART_STAT_FERRIF_POS 1U -#define USART_STAT_FERRIF_MSK BIT(USART_STAT_FERRIF_POS) - -#define USART_STAT_PERRIF_POS 0U -#define USART_STAT_PERRIF_MSK BIT(USART_STAT_PERRIF_POS) - -/****************** Bit definition for USART_DATA register ************************/ - -#define USART_DATA_VAL_POSS 0U -#define USART_DATA_VAL_POSE 8U -#define USART_DATA_VAL_MSK BITS(USART_DATA_VAL_POSS,USART_DATA_VAL_POSE) - -/****************** Bit definition for USART_BAUDCON register ************************/ - -#define USART_BAUDCON_DIV_M_POSS 4U -#define USART_BAUDCON_DIV_M_POSE 15U -#define USART_BAUDCON_DIV_M_MSK BITS(USART_BAUDCON_DIV_M_POSS,USART_BAUDCON_DIV_M_POSE) - -#define USART_BAUDCON_DIV_F_POSS 0U -#define USART_BAUDCON_DIV_F_POSE 3U -#define USART_BAUDCON_DIV_F_MSK BITS(USART_BAUDCON_DIV_F_POSS,USART_BAUDCON_DIV_F_POSE) - -/****************** Bit definition for USART_CON0 register ************************/ - -#define USART_CON0_EN_POS 13U -#define USART_CON0_EN_MSK BIT(USART_CON0_EN_POS) - -#define USART_CON0_DLEN_POS 12U -#define USART_CON0_DLEN_MSK BIT(USART_CON0_DLEN_POS) - -#define USART_CON0_WKMOD_POS 11U -#define USART_CON0_WKMOD_MSK BIT(USART_CON0_WKMOD_POS) - -#define USART_CON0_PEN_POS 10U -#define USART_CON0_PEN_MSK BIT(USART_CON0_PEN_POS) - -#define USART_CON0_PSEL_POS 9U -#define USART_CON0_PSEL_MSK BIT(USART_CON0_PSEL_POS) - -#define USART_CON0_PERRIE_POS 8U -#define USART_CON0_PERRIE_MSK BIT(USART_CON0_PERRIE_POS) - -#define USART_CON0_TXEMPIE_POS 7U -#define USART_CON0_TXEMPIE_MSK BIT(USART_CON0_TXEMPIE_POS) - -#define USART_CON0_TXCIE_POS 6U -#define USART_CON0_TXCIE_MSK BIT(USART_CON0_TXCIE_POS) - -#define USART_CON0_RXNEIE_POS 5U -#define USART_CON0_RXNEIE_MSK BIT(USART_CON0_RXNEIE_POS) - -#define USART_CON0_IDLEIE_POS 4U -#define USART_CON0_IDLEIE_MSK BIT(USART_CON0_IDLEIE_POS) - -#define USART_CON0_TXEN_POS 3U -#define USART_CON0_TXEN_MSK BIT(USART_CON0_TXEN_POS) - -#define USART_CON0_RXEN_POS 2U -#define USART_CON0_RXEN_MSK BIT(USART_CON0_RXEN_POS) - -#define USART_CON0_RXWK_POS 1U -#define USART_CON0_RXWK_MSK BIT(USART_CON0_RXWK_POS) - -/****************** Bit definition for USART_CON1 register ************************/ - -#define USART_CON1_STPLEN_POSS 12U -#define USART_CON1_STPLEN_POSE 13U -#define USART_CON1_STPLEN_MSK BITS(USART_CON1_STPLEN_POSS,USART_CON1_STPLEN_POSE) - -#define USART_CON1_SCKEN_POS 11U -#define USART_CON1_SCKEN_MSK BIT(USART_CON1_SCKEN_POS) - -#define USART_CON1_SCKPOL_POS 10U -#define USART_CON1_SCKPOL_MSK BIT(USART_CON1_SCKPOL_POS) - -#define USART_CON1_SCKPHA_POS 9U -#define USART_CON1_SCKPHA_MSK BIT(USART_CON1_SCKPHA_POS) - -#define USART_CON1_LBCP_POS 8U -#define USART_CON1_LBCP_MSK BIT(USART_CON1_LBCP_POS) - -#define USART_CON1_ADDR_POSS 0U -#define USART_CON1_ADDR_POSE 3U -#define USART_CON1_ADDR_MSK BITS(USART_CON1_ADDR_POSS,USART_CON1_ADDR_POSE) - -/****************** Bit definition for USART_CON2 register ************************/ - -#define USART_CON2_CTSIE_POS 10U -#define USART_CON2_CTSIE_MSK BIT(USART_CON2_CTSIE_POS) - -#define USART_CON2_CTSEN_POS 9U -#define USART_CON2_CTSEN_MSK BIT(USART_CON2_CTSEN_POS) - -#define USART_CON2_RTSEN_POS 8U -#define USART_CON2_RTSEN_MSK BIT(USART_CON2_RTSEN_POS) - -#define USART_CON2_TXDMAEN_POS 7U -#define USART_CON2_TXDMAEN_MSK BIT(USART_CON2_TXDMAEN_POS) - -#define USART_CON2_RXDMAEN_POS 6U -#define USART_CON2_RXDMAEN_MSK BIT(USART_CON2_RXDMAEN_POS) - -#define USART_CON2_SMARTEN_POS 5U -#define USART_CON2_SMARTEN_MSK BIT(USART_CON2_SMARTEN_POS) - -#define USART_CON2_NACK_POS 4U -#define USART_CON2_NACK_MSK BIT(USART_CON2_NACK_POS) - -#define USART_CON2_HDPSEL_POS 3U -#define USART_CON2_HDPSEL_MSK BIT(USART_CON2_HDPSEL_POS) - -#define USART_CON2_IREN_POS 1U -#define USART_CON2_IREN_MSK BIT(USART_CON2_IREN_POS) - -#define USART_CON2_ERRIE_POS 0U -#define USART_CON2_ERRIE_MSK BIT(USART_CON2_ERRIE_POS) - -/****************** Bit definition for USART_GP register ************************/ - -#define USART_GP_GTVAL_POSS 8U -#define USART_GP_GTVAL_POSE 15U -#define USART_GP_GTVAL_MSK BITS(USART_GP_GTVAL_POSS,USART_GP_GTVAL_POSE) - -#define USART_GP_PSC_POSS 0U -#define USART_GP_PSC_POSE 7U -#define USART_GP_PSC_MSK BITS(USART_GP_PSC_POSS,USART_GP_PSC_POSE) - -typedef struct -{ - __IO uint32_t STAT; - __IO uint32_t DATA; - __IO uint32_t BAUDCON; - __IO uint32_t CON0; - __IO uint32_t CON1; - __IO uint32_t CON2; - __IO uint32_t GP; -} USART_TypeDef; - -/****************** Bit definition for UART_RBR register ************************/ - -#define UART_RBR_RBR_POSS 0U -#define UART_RBR_RBR_POSE 8U -#define UART_RBR_RBR_MSK BITS(UART_RBR_RBR_POSS,UART_RBR_RBR_POSE) - -/****************** Bit definition for UART_TBR register ************************/ - -#define UART_TBR_TBR_POSS 0U -#define UART_TBR_TBR_POSE 8U -#define UART_TBR_TBR_MSK BITS(UART_TBR_TBR_POSS,UART_TBR_TBR_POSE) - -/****************** Bit definition for UART_BRR register ************************/ - -#define UART_BRR_BRR_POSS 0U -#define UART_BRR_BRR_POSE 15U -#define UART_BRR_BRR_MSK BITS(UART_BRR_BRR_POSS,UART_BRR_BRR_POSE) - -/****************** Bit definition for UART_LCR register ************************/ - -#define UART_LCR_SWAP_POS 13U -#define UART_LCR_SWAP_MSK BIT(UART_LCR_SWAP_POS) - -#define UART_LCR_TXINV_POS 12U -#define UART_LCR_TXINV_MSK BIT(UART_LCR_TXINV_POS) - -#define UART_LCR_RXINV_POS 11U -#define UART_LCR_RXINV_MSK BIT(UART_LCR_RXINV_POS) - -#define UART_LCR_DATAINV_POS 10U -#define UART_LCR_DATAINV_MSK BIT(UART_LCR_DATAINV_POS) - -#define UART_LCR_MSBFIRST_POS 9U -#define UART_LCR_MSBFIRST_MSK BIT(UART_LCR_MSBFIRST_POS) - -#define UART_LCR_RTOEN_POS 8U -#define UART_LCR_RTOEN_MSK BIT(UART_LCR_RTOEN_POS) - -#define UART_LCR_BRWEN_POS 7U -#define UART_LCR_BRWEN_MSK BIT(UART_LCR_BRWEN_POS) - -#define UART_LCR_BC_POS 6U -#define UART_LCR_BC_MSK BIT(UART_LCR_BC_POS) - -#define UART_LCR_RXEN_POS 5U -#define UART_LCR_RXEN_MSK BIT(UART_LCR_RXEN_POS) - -#define UART_LCR_PS_POS 4U -#define UART_LCR_PS_MSK BIT(UART_LCR_PS_POS) - -#define UART_LCR_PEN_POS 3U -#define UART_LCR_PEN_MSK BIT(UART_LCR_PEN_POS) - -#define UART_LCR_STOP_POS 2U -#define UART_LCR_STOP_MSK BIT(UART_LCR_STOP_POS) - -#define UART_LCR_DLS_POSS 0U -#define UART_LCR_DLS_POSE 1U -#define UART_LCR_DLS_MSK BITS(UART_LCR_DLS_POSS,UART_LCR_DLS_POSE) - -/****************** Bit definition for UART_MCR register ************************/ - -#define UART_MCR_HDSEL_POS 22U -#define UART_MCR_HDSEL_MSK BIT(UART_MCR_HDSEL_POS) - -#define UART_MCR_ABRRS_POS 15U -#define UART_MCR_ABRRS_MSK BIT(UART_MCR_ABRRS_POS) - -#define UART_MCR_ABRMOD_POSS 13U -#define UART_MCR_ABRMOD_POSE 14U -#define UART_MCR_ABRMOD_MSK BITS(UART_MCR_ABRMOD_POSS,UART_MCR_ABRMOD_POSE) - -#define UART_MCR_ABREN_POS 12U -#define UART_MCR_ABREN_MSK BIT(UART_MCR_ABREN_POS) - -#define UART_MCR_DMAEN_POS 11U -#define UART_MCR_DMAEN_MSK BIT(UART_MCR_DMAEN_POS) - -#define UART_MCR_LINBDL_POS 10U -#define UART_MCR_LINBDL_MSK BIT(UART_MCR_LINBDL_POS) - -#define UART_MCR_BKREQ_POS 9U -#define UART_MCR_BKREQ_MSK BIT(UART_MCR_BKREQ_POS) - -#define UART_MCR_LINEN_POS 8U -#define UART_MCR_LINEN_MSK BIT(UART_MCR_LINEN_POS) - -#define UART_MCR_AADINV_POS 7U -#define UART_MCR_AADINV_MSK BIT(UART_MCR_AADINV_POS) - -#define UART_MCR_AADDIR_POS 6U -#define UART_MCR_AADDIR_MSK BIT(UART_MCR_AADDIR_POS) - -#define UART_MCR_AADNOR_POS 5U -#define UART_MCR_AADNOR_MSK BIT(UART_MCR_AADNOR_POS) - -#define UART_MCR_AADEN_POS 4U -#define UART_MCR_AADEN_MSK BIT(UART_MCR_AADEN_POS) - -#define UART_MCR_RTSCTRL_POS 3U -#define UART_MCR_RTSCTRL_MSK BIT(UART_MCR_RTSCTRL_POS) - -#define UART_MCR_AFCEN_POS 2U -#define UART_MCR_AFCEN_MSK BIT(UART_MCR_AFCEN_POS) - -#define UART_MCR_LBEN_POS 1U -#define UART_MCR_LBEN_MSK BIT(UART_MCR_LBEN_POS) - -#define UART_MCR_IREN_POS 0U -#define UART_MCR_IREN_MSK BIT(UART_MCR_IREN_POS) - -/****************** Bit definition for UART_CR register ************************/ - -#define UART_CR_PSC_POSS 16U -#define UART_CR_PSC_POSE 23U -#define UART_CR_PSC_MSK BITS(UART_CR_PSC_POSS,UART_CR_PSC_POSE) - -#define UART_CR_DLY_POSS 8U -#define UART_CR_DLY_POSE 15U -#define UART_CR_DLY_MSK BITS(UART_CR_DLY_POSS,UART_CR_DLY_POSE) - -#define UART_CR_ADDR_POSS 0U -#define UART_CR_ADDR_POSE 7U -#define UART_CR_ADDR_MSK BITS(UART_CR_ADDR_POSS,UART_CR_ADDR_POSE) - -/****************** Bit definition for UART_RTOR register ************************/ - -#define UART_RTOR_BLEN_POSS 24U -#define UART_RTOR_BLEN_POSE 31U -#define UART_RTOR_BLEN_MSK BITS(UART_RTOR_BLEN_POSS,UART_RTOR_BLEN_POSE) - -#define UART_RTOR_RTO_POSS 0U -#define UART_RTOR_RTO_POSE 23U -#define UART_RTOR_RTO_MSK BITS(UART_RTOR_RTO_POSS,UART_RTOR_RTO_POSE) - -/****************** Bit definition for UART_FCR register ************************/ - -#define UART_FCR_TXFL_POSS 12U -#define UART_FCR_TXFL_POSE 15U -#define UART_FCR_TXFL_MSK BITS(UART_FCR_TXFL_POSS,UART_FCR_TXFL_POSE) - -#define UART_FCR_RXFL_POSS 8U -#define UART_FCR_RXFL_POSE 11U -#define UART_FCR_RXFL_MSK BITS(UART_FCR_RXFL_POSS,UART_FCR_RXFL_POSE) - -#define UART_FCR_TXTL_POSS 6U -#define UART_FCR_TXTL_POSE 7U -#define UART_FCR_TXTL_MSK BITS(UART_FCR_TXTL_POSS,UART_FCR_TXTL_POSE) - -#define UART_FCR_RXTL_POSS 4U -#define UART_FCR_RXTL_POSE 5U -#define UART_FCR_RXTL_MSK BITS(UART_FCR_RXTL_POSS,UART_FCR_RXTL_POSE) - -#define UART_FCR_TFRST_POS 2U -#define UART_FCR_TFRST_MSK BIT(UART_FCR_TFRST_POS) - -#define UART_FCR_RFRST_POS 1U -#define UART_FCR_RFRST_MSK BIT(UART_FCR_RFRST_POS) - -#define UART_FCR_FIFOEN_POS 0U -#define UART_FCR_FIFOEN_MSK BIT(UART_FCR_FIFOEN_POS) - -/****************** Bit definition for UART_SR register ************************/ - -#define UART_SR_CTS_POS 14U -#define UART_SR_CTS_MSK BIT(UART_SR_CTS_POS) - -#define UART_SR_DCTS_POS 13U -#define UART_SR_DCTS_MSK BIT(UART_SR_DCTS_POS) - -#define UART_SR_RFF_POS 12U -#define UART_SR_RFF_MSK BIT(UART_SR_RFF_POS) - -#define UART_SR_RFNE_POS 11U -#define UART_SR_RFNE_MSK BIT(UART_SR_RFNE_POS) - -#define UART_SR_TFEM_POS 10U -#define UART_SR_TFEM_MSK BIT(UART_SR_TFEM_POS) - -#define UART_SR_TFNF_POS 9U -#define UART_SR_TFNF_MSK BIT(UART_SR_TFNF_POS) - -#define UART_SR_BUSY_POS 8U -#define UART_SR_BUSY_MSK BIT(UART_SR_BUSY_POS) - -#define UART_SR_RFE_POS 7U -#define UART_SR_RFE_MSK BIT(UART_SR_RFE_POS) - -#define UART_SR_TEM_POS 6U -#define UART_SR_TEM_MSK BIT(UART_SR_TEM_POS) - -#define UART_SR_TBEM_POS 5U -#define UART_SR_TBEM_MSK BIT(UART_SR_TBEM_POS) - -#define UART_SR_BF_POS 4U -#define UART_SR_BF_MSK BIT(UART_SR_BF_POS) - -#define UART_SR_FE_POS 3U -#define UART_SR_FE_MSK BIT(UART_SR_FE_POS) - -#define UART_SR_PE_POS 2U -#define UART_SR_PE_MSK BIT(UART_SR_PE_POS) - -#define UART_SR_OE_POS 1U -#define UART_SR_OE_MSK BIT(UART_SR_OE_POS) - -#define UART_SR_DR_POS 0U -#define UART_SR_DR_MSK BIT(UART_SR_DR_POS) - -/****************** Bit definition for UART_IER register ************************/ - -#define UART_IER_CMIE_POS 11U -#define UART_IER_CMIE_MSK BIT(UART_IER_CMIE_POS) - -#define UART_IER_EOBIE_POS 10U -#define UART_IER_EOBIE_MSK BIT(UART_IER_EOBIE_POS) - -#define UART_IER_TCIE_POS 9U -#define UART_IER_TCIE_MSK BIT(UART_IER_TCIE_POS) - -#define UART_IER_LINBKIE_POS 8U -#define UART_IER_LINBKIE_MSK BIT(UART_IER_LINBKIE_POS) - -#define UART_IER_ABTOIE_POS 7U -#define UART_IER_ABTOIE_MSK BIT(UART_IER_ABTOIE_POS) - -#define UART_IER_ABEIE_POS 6U -#define UART_IER_ABEIE_MSK BIT(UART_IER_ABEIE_POS) - -#define UART_IER_BZIE_POS 5U -#define UART_IER_BZIE_MSK BIT(UART_IER_BZIE_POS) - -#define UART_IER_RTOIE_POS 4U -#define UART_IER_RTOIE_MSK BIT(UART_IER_RTOIE_POS) - -#define UART_IER_MDSIE_POS 3U -#define UART_IER_MDSIE_MSK BIT(UART_IER_MDSIE_POS) - -#define UART_IER_RXSIE_POS 2U -#define UART_IER_RXSIE_MSK BIT(UART_IER_RXSIE_POS) - -#define UART_IER_TXSIE_POS 1U -#define UART_IER_TXSIE_MSK BIT(UART_IER_TXSIE_POS) - -#define UART_IER_RXRDIE_POS 0U -#define UART_IER_RXRDIE_MSK BIT(UART_IER_RXRDIE_POS) - -/****************** Bit definition for UART_IDR register ************************/ - -#define UART_IDR_CMID_POS 11U -#define UART_IDR_CMID_MSK BIT(UART_IDR_CMID_POS) - -#define UART_IDR_EOBID_POS 10U -#define UART_IDR_EOBID_MSK BIT(UART_IDR_EOBID_POS) - -#define UART_IDR_TCID_POS 9U -#define UART_IDR_TCID_MSK BIT(UART_IDR_TCID_POS) - -#define UART_IDR_LINBKID_POS 8U -#define UART_IDR_LINBKID_MSK BIT(UART_IDR_LINBKID_POS) - -#define UART_IDR_ABTOID_POS 7U -#define UART_IDR_ABTOID_MSK BIT(UART_IDR_ABTOID_POS) - -#define UART_IDR_ABEID_POS 6U -#define UART_IDR_ABEID_MSK BIT(UART_IDR_ABEID_POS) - -#define UART_IDR_BZID_POS 5U -#define UART_IDR_BZID_MSK BIT(UART_IDR_BZID_POS) - -#define UART_IDR_RTOID_POS 4U -#define UART_IDR_RTOID_MSK BIT(UART_IDR_RTOID_POS) - -#define UART_IDR_MDSID_POS 3U -#define UART_IDR_MDSID_MSK BIT(UART_IDR_MDSID_POS) - -#define UART_IDR_RXSID_POS 2U -#define UART_IDR_RXSID_MSK BIT(UART_IDR_RXSID_POS) - -#define UART_IDR_TXSID_POS 1U -#define UART_IDR_TXSID_MSK BIT(UART_IDR_TXSID_POS) - -#define UART_IDR_RXRDID_POS 0U -#define UART_IDR_RXRDID_MSK BIT(UART_IDR_RXRDID_POS) - -/****************** Bit definition for UART_IVS register ************************/ - -#define UART_IVS_CMIS_POS 11U -#define UART_IVS_CMIS_MSK BIT(UART_IVS_CMIS_POS) - -#define UART_IVS_EOBIS_POS 10U -#define UART_IVS_EOBIS_MSK BIT(UART_IVS_EOBIS_POS) - -#define UART_IVS_TCIS_POS 9U -#define UART_IVS_TCIS_MSK BIT(UART_IVS_TCIS_POS) - -#define UART_IVS_LINBKIS_POS 8U -#define UART_IVS_LINBKIS_MSK BIT(UART_IVS_LINBKIS_POS) - -#define UART_IVS_ABTOIS_POS 7U -#define UART_IVS_ABTOIS_MSK BIT(UART_IVS_ABTOIS_POS) - -#define UART_IVS_ABEIS_POS 6U -#define UART_IVS_ABEIS_MSK BIT(UART_IVS_ABEIS_POS) - -#define UART_IVS_BZIS_POS 5U -#define UART_IVS_BZIS_MSK BIT(UART_IVS_BZIS_POS) - -#define UART_IVS_RTOIS_POS 4U -#define UART_IVS_RTOIS_MSK BIT(UART_IVS_RTOIS_POS) - -#define UART_IVS_MDSIS_POS 3U -#define UART_IVS_MDSIS_MSK BIT(UART_IVS_MDSIS_POS) - -#define UART_IVS_RXSIS_POS 2U -#define UART_IVS_RXSIS_MSK BIT(UART_IVS_RXSIS_POS) - -#define UART_IVS_TXSIS_POS 1U -#define UART_IVS_TXSIS_MSK BIT(UART_IVS_TXSIS_POS) - -#define UART_IVS_RXRDIS_POS 0U -#define UART_IVS_RXRDIS_MSK BIT(UART_IVS_RXRDIS_POS) - -/****************** Bit definition for UART_RIF register ************************/ - -#define UART_RIF_CMIF_POS 11U -#define UART_RIF_CMIF_MSK BIT(UART_RIF_CMIF_POS) - -#define UART_RIF_EOBIF_POS 10U -#define UART_RIF_EOBIF_MSK BIT(UART_RIF_EOBIF_POS) - -#define UART_RIF_TCIF_POS 9U -#define UART_RIF_TCIF_MSK BIT(UART_RIF_TCIF_POS) - -#define UART_RIF_LINBKIF_POS 8U -#define UART_RIF_LINBKIF_MSK BIT(UART_RIF_LINBKIF_POS) - -#define UART_RIF_ABTOIF_POS 7U -#define UART_RIF_ABTOIF_MSK BIT(UART_RIF_ABTOIF_POS) - -#define UART_RIF_ABEIF_POS 6U -#define UART_RIF_ABEIF_MSK BIT(UART_RIF_ABEIF_POS) - -#define UART_RIF_BZIF_POS 5U -#define UART_RIF_BZIF_MSK BIT(UART_RIF_BZIF_POS) - -#define UART_RIF_RTOIF_POS 4U -#define UART_RIF_RTOIF_MSK BIT(UART_RIF_RTOIF_POS) - -#define UART_RIF_MDSIF_POS 3U -#define UART_RIF_MDSIF_MSK BIT(UART_RIF_MDSIF_POS) - -#define UART_RIF_RXSIF_POS 2U -#define UART_RIF_RXSIF_MSK BIT(UART_RIF_RXSIF_POS) - -#define UART_RIF_TXSIF_POS 1U -#define UART_RIF_TXSIF_MSK BIT(UART_RIF_TXSIF_POS) - -#define UART_RIF_RXRDIF_POS 0U -#define UART_RIF_RXRDIF_MSK BIT(UART_RIF_RXRDIF_POS) - -/****************** Bit definition for UART_IFM register ************************/ - -#define UART_IFM_CMIM_POS 11U -#define UART_IFM_CMIM_MSK BIT(UART_IFM_CMIM_POS) - -#define UART_IFM_EOBIM_POS 10U -#define UART_IFM_EOBIM_MSK BIT(UART_IFM_EOBIM_POS) - -#define UART_IFM_TCIM_POS 9U -#define UART_IFM_TCIM_MSK BIT(UART_IFM_TCIM_POS) - -#define UART_IFM_LINBKIM_POS 8U -#define UART_IFM_LINBKIM_MSK BIT(UART_IFM_LINBKIM_POS) - -#define UART_IFM_ABTOIM_POS 7U -#define UART_IFM_ABTOIM_MSK BIT(UART_IFM_ABTOIM_POS) - -#define UART_IFM_ABEIM_POS 6U -#define UART_IFM_ABEIM_MSK BIT(UART_IFM_ABEIM_POS) - -#define UART_IFM_BZIM_POS 5U -#define UART_IFM_BZIM_MSK BIT(UART_IFM_BZIM_POS) - -#define UART_IFM_RTOIM_POS 4U -#define UART_IFM_RTOIM_MSK BIT(UART_IFM_RTOIM_POS) - -#define UART_IFM_MDSIM_POS 3U -#define UART_IFM_MDSIM_MSK BIT(UART_IFM_MDSIM_POS) - -#define UART_IFM_RXSIM_POS 2U -#define UART_IFM_RXSIM_MSK BIT(UART_IFM_RXSIM_POS) - -#define UART_IFM_TXSIM_POS 1U -#define UART_IFM_TXSIM_MSK BIT(UART_IFM_TXSIM_POS) - -#define UART_IFM_RXRDIM_POS 0U -#define UART_IFM_RXRDIM_MSK BIT(UART_IFM_RXRDIM_POS) - -/****************** Bit definition for UART_ICR register ************************/ - -#define UART_ICR_CMIC_POS 11U -#define UART_ICR_CMIC_MSK BIT(UART_ICR_CMIC_POS) - -#define UART_ICR_EOBIC_POS 10U -#define UART_ICR_EOBIC_MSK BIT(UART_ICR_EOBIC_POS) - -#define UART_ICR_TCIC_POS 9U -#define UART_ICR_TCIC_MSK BIT(UART_ICR_TCIC_POS) - -#define UART_ICR_LINBKIC_POS 8U -#define UART_ICR_LINBKIC_MSK BIT(UART_ICR_LINBKIC_POS) - -#define UART_ICR_ABTOIC_POS 7U -#define UART_ICR_ABTOIC_MSK BIT(UART_ICR_ABTOIC_POS) - -#define UART_ICR_ABEIC_POS 6U -#define UART_ICR_ABEIC_MSK BIT(UART_ICR_ABEIC_POS) - -#define UART_ICR_BZIC_POS 5U -#define UART_ICR_BZIC_MSK BIT(UART_ICR_BZIC_POS) - -#define UART_ICR_CHTOIC_POS 4U -#define UART_ICR_CHTOIC_MSK BIT(UART_ICR_CHTOIC_POS) - -#define UART_ICR_MDSIC_POS 3U -#define UART_ICR_MDSIC_MSK BIT(UART_ICR_MDSIC_POS) - -#define UART_ICR_RXSIC_POS 2U -#define UART_ICR_RXSIC_MSK BIT(UART_ICR_RXSIC_POS) - -#define UART_ICR_TXSIC_POS 1U -#define UART_ICR_TXSIC_MSK BIT(UART_ICR_TXSIC_POS) - -#define UART_ICR_RXRDIC_POS 0U -#define UART_ICR_RXRDIC_MSK BIT(UART_ICR_RXRDIC_POS) - -typedef struct -{ - __I uint32_t RBR; - __IO uint32_t TBR; - __IO uint32_t BRR; - __IO uint32_t LCR; - __IO uint32_t MCR; - __IO uint32_t CR; - __IO uint32_t RTOR; - __IO uint32_t FCR; - __I uint32_t SR; - __O uint32_t IER; - __O uint32_t IDR; - __I uint32_t IVS; - __I uint32_t RIF; - __I uint32_t IFM; - __O uint32_t ICR; -} UART_TypeDef; - -/****************** Bit definition for LPUART_CON0 register ************************/ - -#define LPUART_CON0_MODESEL_POSS 30U -#define LPUART_CON0_MODESEL_POSE 31U -#define LPUART_CON0_MODESEL_MSK BITS(LPUART_CON0_MODESEL_POSS,LPUART_CON0_MODESEL_POSE) - -#define LPUART_CON0_TXDMAE_POS 29U -#define LPUART_CON0_TXDMAE_MSK BIT(LPUART_CON0_TXDMAE_POS) - -#define LPUART_CON0_RXDMAE_POS 28U -#define LPUART_CON0_RXDMAE_MSK BIT(LPUART_CON0_RXDMAE_POS) - -#define LPUART_CON0_INTERVAL_POSS 16U -#define LPUART_CON0_INTERVAL_POSE 23U -#define LPUART_CON0_INTERVAL_MSK BITS(LPUART_CON0_INTERVAL_POSS,LPUART_CON0_INTERVAL_POSE) - -#define LPUART_CON0_SYNCBP_POS 15U -#define LPUART_CON0_SYNCBP_MSK BIT(LPUART_CON0_SYNCBP_POS) - -#define LPUART_CON0_CTSPOL_POS 13U -#define LPUART_CON0_CTSPOL_MSK BIT(LPUART_CON0_CTSPOL_POS) - -#define LPUART_CON0_RTSPOL_POS 12U -#define LPUART_CON0_RTSPOL_MSK BIT(LPUART_CON0_RTSPOL_POS) - -#define LPUART_CON0_ATCTSE_POS 11U -#define LPUART_CON0_ATCTSE_MSK BIT(LPUART_CON0_ATCTSE_POS) - -#define LPUART_CON0_ATRTSE_POS 10U -#define LPUART_CON0_ATRTSE_MSK BIT(LPUART_CON0_ATRTSE_POS) - -#define LPUART_CON0_BRKCE_POS 8U -#define LPUART_CON0_BRKCE_MSK BIT(LPUART_CON0_BRKCE_POS) - -#define LPUART_CON0_LPBMOD_POS 7U -#define LPUART_CON0_LPBMOD_MSK BIT(LPUART_CON0_LPBMOD_POS) - -#define LPUART_CON0_STICKPARSEL_POS 6U -#define LPUART_CON0_STICKPARSEL_MSK BIT(LPUART_CON0_STICKPARSEL_POS) - -#define LPUART_CON0_EVENPARSEL_POS 5U -#define LPUART_CON0_EVENPARSEL_MSK BIT(LPUART_CON0_EVENPARSEL_POS) - -#define LPUART_CON0_PARCHKE_POS 4U -#define LPUART_CON0_PARCHKE_MSK BIT(LPUART_CON0_PARCHKE_POS) - -#define LPUART_CON0_STPLENTH_POS 3U -#define LPUART_CON0_STPLENTH_MSK BIT(LPUART_CON0_STPLENTH_POS) - -#define LPUART_CON0_DATLENTH_POSS 0U -#define LPUART_CON0_DATLENTH_POSE 2U -#define LPUART_CON0_DATLENTH_MSK BITS(LPUART_CON0_DATLENTH_POSS,LPUART_CON0_DATLENTH_POSE) - -/****************** Bit definition for LPUART_CON1 register ************************/ - -#define LPUART_CON1_ADDCMP_POSS 24U -#define LPUART_CON1_ADDCMP_POSE 31U -#define LPUART_CON1_ADDCMP_MSK BITS(LPUART_CON1_ADDCMP_POSS,LPUART_CON1_ADDCMP_POSE) - -#define LPUART_CON1_ADETE_POS 23U -#define LPUART_CON1_ADETE_MSK BIT(LPUART_CON1_ADETE_POS) - -#define LPUART_CON1_ATDIRM_POS 22U -#define LPUART_CON1_ATDIRM_MSK BIT(LPUART_CON1_ATDIRM_POS) - -#define LPUART_CON1_ATADETE_POS 21U -#define LPUART_CON1_ATADETE_MSK BIT(LPUART_CON1_ATADETE_POS) - -#define LPUART_CON1_NMPMOD_POS 20U -#define LPUART_CON1_NMPMOD_MSK BIT(LPUART_CON1_NMPMOD_POS) - -#define LPUART_CON1_IRWIDTH_POS 16U -#define LPUART_CON1_IRWIDTH_MSK BIT(LPUART_CON1_IRWIDTH_POS) - -#define LPUART_CON1_TOICMP_POSS 8U -#define LPUART_CON1_TOICMP_POSE 15U -#define LPUART_CON1_TOICMP_MSK BITS(LPUART_CON1_TOICMP_POSS,LPUART_CON1_TOICMP_POSE) - -#define LPUART_CON1_TOCNTE_POS 7U -#define LPUART_CON1_TOCNTE_MSK BIT(LPUART_CON1_TOCNTE_POS) - -#define LPUART_CON1_IRTXINV_POS 3U -#define LPUART_CON1_IRTXINV_MSK BIT(LPUART_CON1_IRTXINV_POS) - -#define LPUART_CON1_IRRXINV_POS 2U -#define LPUART_CON1_IRRXINV_MSK BIT(LPUART_CON1_IRRXINV_POS) - -#define LPUART_CON1_IRTXE_POS 1U -#define LPUART_CON1_IRTXE_MSK BIT(LPUART_CON1_IRTXE_POS) - -#define LPUART_CON1_RTS_POS 0U -#define LPUART_CON1_RTS_MSK BIT(LPUART_CON1_RTS_POS) - -/****************** Bit definition for LPUART_CLKDIV register ************************/ - -#define LPUART_CLKDIV_CLKDIV_POSS 0U -#define LPUART_CLKDIV_CLKDIV_POSE 19U -#define LPUART_CLKDIV_CLKDIV_MSK BITS(LPUART_CLKDIV_CLKDIV_POSS,LPUART_CLKDIV_CLKDIV_POSE) - -/****************** Bit definition for LPUART_FIFOCON register ************************/ - -#define LPUART_FIFOCON_RTSTRGLVL_POSS 12U -#define LPUART_FIFOCON_RTSTRGLVL_POSE 15U -#define LPUART_FIFOCON_RTSTRGLVL_MSK BITS(LPUART_FIFOCON_RTSTRGLVL_POSS,LPUART_FIFOCON_RTSTRGLVL_POSE) - -#define LPUART_FIFOCON_RXTRGLVL_POSS 8U -#define LPUART_FIFOCON_RXTRGLVL_POSE 11U -#define LPUART_FIFOCON_RXTRGLVL_MSK BITS(LPUART_FIFOCON_RXTRGLVL_POSS,LPUART_FIFOCON_RXTRGLVL_POSE) - -#define LPUART_FIFOCON_NMPMRXDIS_POS 2U -#define LPUART_FIFOCON_NMPMRXDIS_MSK BIT(LPUART_FIFOCON_NMPMRXDIS_POS) - -#define LPUART_FIFOCON_TXRESET_POS 1U -#define LPUART_FIFOCON_TXRESET_MSK BIT(LPUART_FIFOCON_TXRESET_POS) - -#define LPUART_FIFOCON_RXRESET_POS 0U -#define LPUART_FIFOCON_RXRESET_MSK BIT(LPUART_FIFOCON_RXRESET_POS) - -/****************** Bit definition for LPUART_RXDR register ************************/ - -#define LPUART_RXDR_FERR_POS 15U -#define LPUART_RXDR_FERR_MSK BIT(LPUART_RXDR_FERR_POS) - -#define LPUART_RXDR_PERR_POS 14U -#define LPUART_RXDR_PERR_MSK BIT(LPUART_RXDR_PERR_POS) - -#define LPUART_RXDR_RXDR_POSS 0U -#define LPUART_RXDR_RXDR_POSE 8U -#define LPUART_RXDR_RXDR_MSK BITS(LPUART_RXDR_RXDR_POSS,LPUART_RXDR_RXDR_POSE) - -/****************** Bit definition for LPUART_TXDR register ************************/ - -#define LPUART_TXDR_TXDR_POSS 0U -#define LPUART_TXDR_TXDR_POSE 8U -#define LPUART_TXDR_TXDR_MSK BITS(LPUART_TXDR_TXDR_POSS,LPUART_TXDR_TXDR_POSE) - -/****************** Bit definition for LPUART_STAT register ************************/ - -#define LPUART_STAT_RTSSTAT_POS 18U -#define LPUART_STAT_RTSSTAT_MSK BIT(LPUART_STAT_RTSSTAT_POS) - -#define LPUART_STAT_CTSSTAT_POS 17U -#define LPUART_STAT_CTSSTAT_MSK BIT(LPUART_STAT_CTSSTAT_POS) - -#define LPUART_STAT_TXIDLE_POS 16U -#define LPUART_STAT_TXIDLE_MSK BIT(LPUART_STAT_TXIDLE_POS) - -#define LPUART_STAT_TXFULL_POS 15U -#define LPUART_STAT_TXFULL_MSK BIT(LPUART_STAT_TXFULL_POS) - -#define LPUART_STAT_TXEMP_POS 14U -#define LPUART_STAT_TXEMP_MSK BIT(LPUART_STAT_TXEMP_POS) - -#define LPUART_STAT_TXPTR_POSS 8U -#define LPUART_STAT_TXPTR_POSE 13U -#define LPUART_STAT_TXPTR_MSK BITS(LPUART_STAT_TXPTR_POSS,LPUART_STAT_TXPTR_POSE) - -#define LPUART_STAT_RXFULL_POS 7U -#define LPUART_STAT_RXFULL_MSK BIT(LPUART_STAT_RXFULL_POS) - -#define LPUART_STAT_RXEMP_POS 6U -#define LPUART_STAT_RXEMP_MSK BIT(LPUART_STAT_RXEMP_POS) - -#define LPUART_STAT_RXPTR_POSS 0U -#define LPUART_STAT_RXPTR_POSE 5U -#define LPUART_STAT_RXPTR_MSK BITS(LPUART_STAT_RXPTR_POSS,LPUART_STAT_RXPTR_POSE) - -/****************** Bit definition for LPUART_IER register ************************/ - -#define LPUART_IER_TCIE_POS 15U -#define LPUART_IER_TCIE_MSK BIT(LPUART_IER_TCIE_POS) - -#define LPUART_IER_ADETIE_POS 12U -#define LPUART_IER_ADETIE_MSK BIT(LPUART_IER_ADETIE_POS) - -#define LPUART_IER_BRKERRIE_POS 11U -#define LPUART_IER_BRKERRIE_MSK BIT(LPUART_IER_BRKERRIE_POS) - -#define LPUART_IER_FERRIE_POS 10U -#define LPUART_IER_FERRIE_MSK BIT(LPUART_IER_FERRIE_POS) - -#define LPUART_IER_PERRIE_POS 9U -#define LPUART_IER_PERRIE_MSK BIT(LPUART_IER_PERRIE_POS) - -#define LPUART_IER_DATWKIE_POS 8U -#define LPUART_IER_DATWKIE_MSK BIT(LPUART_IER_DATWKIE_POS) - -#define LPUART_IER_CTSWKIE_POS 7U -#define LPUART_IER_CTSWKIE_MSK BIT(LPUART_IER_CTSWKIE_POS) - -#define LPUART_IER_TXOVIE_POS 5U -#define LPUART_IER_TXOVIE_MSK BIT(LPUART_IER_TXOVIE_POS) - -#define LPUART_IER_RXOVIE_POS 4U -#define LPUART_IER_RXOVIE_MSK BIT(LPUART_IER_RXOVIE_POS) - -#define LPUART_IER_RXTOIE_POS 3U -#define LPUART_IER_RXTOIE_MSK BIT(LPUART_IER_RXTOIE_POS) - -#define LPUART_IER_CTSDETIE_POS 2U -#define LPUART_IER_CTSDETIE_MSK BIT(LPUART_IER_CTSDETIE_POS) - -#define LPUART_IER_TBEMPIE_POS 1U -#define LPUART_IER_TBEMPIE_MSK BIT(LPUART_IER_TBEMPIE_POS) - -#define LPUART_IER_RBRIE_POS 0U -#define LPUART_IER_RBRIE_MSK BIT(LPUART_IER_RBRIE_POS) - -/****************** Bit definition for LPUART_IFLAG register ************************/ - -#define LPUART_IFLAG_TCIF_POS 15U -#define LPUART_IFLAG_TCIF_MSK BIT(LPUART_IFLAG_TCIF_POS) - -#define LPUART_IFLAG_ADETIF_POS 12U -#define LPUART_IFLAG_ADETIF_MSK BIT(LPUART_IFLAG_ADETIF_POS) - -#define LPUART_IFLAG_BRKERRIF_POS 11U -#define LPUART_IFLAG_BRKERRIF_MSK BIT(LPUART_IFLAG_BRKERRIF_POS) - -#define LPUART_IFLAG_FERRIF_POS 10U -#define LPUART_IFLAG_FERRIF_MSK BIT(LPUART_IFLAG_FERRIF_POS) - -#define LPUART_IFLAG_PERRIF_POS 9U -#define LPUART_IFLAG_PERRIF_MSK BIT(LPUART_IFLAG_PERRIF_POS) - -#define LPUART_IFLAG_DATWKIF_POS 8U -#define LPUART_IFLAG_DATWKIF_MSK BIT(LPUART_IFLAG_DATWKIF_POS) - -#define LPUART_IFLAG_CTSWKIF_POS 7U -#define LPUART_IFLAG_CTSWKIF_MSK BIT(LPUART_IFLAG_CTSWKIF_POS) - -#define LPUART_IFLAG_TXOVIF_POS 5U -#define LPUART_IFLAG_TXOVIF_MSK BIT(LPUART_IFLAG_TXOVIF_POS) - -#define LPUART_IFLAG_RXOVIF_POS 4U -#define LPUART_IFLAG_RXOVIF_MSK BIT(LPUART_IFLAG_RXOVIF_POS) - -#define LPUART_IFLAG_RXTOIF_POS 3U -#define LPUART_IFLAG_RXTOIF_MSK BIT(LPUART_IFLAG_RXTOIF_POS) - -#define LPUART_IFLAG_CTSDETIF_POS 2U -#define LPUART_IFLAG_CTSDETIF_MSK BIT(LPUART_IFLAG_CTSDETIF_POS) - -#define LPUART_IFLAG_TBEMPIF_POS 1U -#define LPUART_IFLAG_TBEMPIF_MSK BIT(LPUART_IFLAG_TBEMPIF_POS) - -#define LPUART_IFLAG_RBRIF_POS 0U -#define LPUART_IFLAG_RBRIF_MSK BIT(LPUART_IFLAG_RBRIF_POS) - -/****************** Bit definition for LPUART_IFC register ************************/ - -#define LPUART_IFC_TCIFC_POS 15U -#define LPUART_IFC_TCIFC_MSK BIT(LPUART_IFC_TCIFC_POS) - -#define LPUART_IFC_ADETIFC_POS 12U -#define LPUART_IFC_ADETIFC_MSK BIT(LPUART_IFC_ADETIFC_POS) - -#define LPUART_IFC_BRKERRIFC_POS 11U -#define LPUART_IFC_BRKERRIFC_MSK BIT(LPUART_IFC_BRKERRIFC_POS) - -#define LPUART_IFC_FERRIFC_POS 10U -#define LPUART_IFC_FERRIFC_MSK BIT(LPUART_IFC_FERRIFC_POS) - -#define LPUART_IFC_PERRIFC_POS 9U -#define LPUART_IFC_PERRIFC_MSK BIT(LPUART_IFC_PERRIFC_POS) - -#define LPUART_IFC_DATWKIFC_POS 8U -#define LPUART_IFC_DATWKIFC_MSK BIT(LPUART_IFC_DATWKIFC_POS) - -#define LPUART_IFC_CTSWKIFC_POS 7U -#define LPUART_IFC_CTSWKIFC_MSK BIT(LPUART_IFC_CTSWKIFC_POS) - -#define LPUART_IFC_TXOVIFC_POS 5U -#define LPUART_IFC_TXOVIFC_MSK BIT(LPUART_IFC_TXOVIFC_POS) - -#define LPUART_IFC_RXOVIFC_POS 4U -#define LPUART_IFC_RXOVIFC_MSK BIT(LPUART_IFC_RXOVIFC_POS) - -#define LPUART_IFC_CTSDETIFC_POS 2U -#define LPUART_IFC_CTSDETIFC_MSK BIT(LPUART_IFC_CTSDETIFC_POS) - -#define LPUART_IFC_TBEMPIFC_POS 1U -#define LPUART_IFC_TBEMPIFC_MSK BIT(LPUART_IFC_TBEMPIFC_POS) - -#define LPUART_IFC_RBRIFC_POS 0U -#define LPUART_IFC_RBRIFC_MSK BIT(LPUART_IFC_RBRIFC_POS) - -/****************** Bit definition for LPUART_ISTAT register ************************/ - -#define LPUART_ISTAT_TCINT_POS 15U -#define LPUART_ISTAT_TCINT_MSK BIT(LPUART_ISTAT_TCINT_POS) - -#define LPUART_ISTAT_RXSTATINT_POS 9U -#define LPUART_ISTAT_RXSTATINT_MSK BIT(LPUART_ISTAT_RXSTATINT_POS) - -#define LPUART_ISTAT_DATWKINT_POS 8U -#define LPUART_ISTAT_DATWKINT_MSK BIT(LPUART_ISTAT_DATWKINT_POS) - -#define LPUART_ISTAT_CTSWKINT_POS 7U -#define LPUART_ISTAT_CTSWKINT_MSK BIT(LPUART_ISTAT_CTSWKINT_POS) - -#define LPUART_ISTAT_BUFERRINT_POS 4U -#define LPUART_ISTAT_BUFERRINT_MSK BIT(LPUART_ISTAT_BUFERRINT_POS) - -#define LPUART_ISTAT_RXTOINT_POS 3U -#define LPUART_ISTAT_RXTOINT_MSK BIT(LPUART_ISTAT_RXTOINT_POS) - -#define LPUART_ISTAT_CTSDETINT_POS 2U -#define LPUART_ISTAT_CTSDETINT_MSK BIT(LPUART_ISTAT_CTSDETINT_POS) - -#define LPUART_ISTAT_TBEMPINT_POS 1U -#define LPUART_ISTAT_TBEMPINT_MSK BIT(LPUART_ISTAT_TBEMPINT_POS) - -#define LPUART_ISTAT_RBRINT_POS 0U -#define LPUART_ISTAT_RBRINT_MSK BIT(LPUART_ISTAT_RBRINT_POS) - -/****************** Bit definition for LPUART_UPDATE register ************************/ - -#define LPUART_UPDATE_UDIS_POS 0U -#define LPUART_UPDATE_UDIS_MSK BIT(LPUART_UPDATE_UDIS_POS) - -/****************** Bit definition for LPUART_SYNCSTAT register ************************/ - -#define LPUART_SYNCSTAT_FIFOCONWBSY_POS 3U -#define LPUART_SYNCSTAT_FIFOCONWBSY_MSK BIT(LPUART_SYNCSTAT_FIFOCONWBSY_POS) - -#define LPUART_SYNCSTAT_CLKDIVWBSY_POS 2U -#define LPUART_SYNCSTAT_CLKDIVWBSY_MSK BIT(LPUART_SYNCSTAT_CLKDIVWBSY_POS) - -#define LPUART_SYNCSTAT_CON1WBSY_POS 1U -#define LPUART_SYNCSTAT_CON1WBSY_MSK BIT(LPUART_SYNCSTAT_CON1WBSY_POS) - -#define LPUART_SYNCSTAT_CON0WBSY_POS 0U -#define LPUART_SYNCSTAT_CON0WBSY_MSK BIT(LPUART_SYNCSTAT_CON0WBSY_POS) - -typedef struct -{ - __IO uint32_t CON0; - __IO uint32_t CON1; - __IO uint32_t CLKDIV; - __IO uint32_t FIFOCON; - uint32_t RESERVED0 ; - __I uint32_t RXDR; - __O uint32_t TXDR; - __I uint32_t STAT; - __IO uint32_t IER; - __I uint32_t IFLAG; - __O uint32_t IFC; - __I uint32_t ISTAT; - uint32_t RESERVED1[2] ; - __IO uint32_t UPDATE; - __I uint32_t SYNCSTAT; -} LPUART_TypeDef; - -/****************** Bit definition for SPI_CON1 register ************************/ - -#define SPI_CON1_BIDEN_POS 15U -#define SPI_CON1_BIDEN_MSK BIT(SPI_CON1_BIDEN_POS) - -#define SPI_CON1_BIDOEN_POS 14U -#define SPI_CON1_BIDOEN_MSK BIT(SPI_CON1_BIDOEN_POS) - -#define SPI_CON1_CRCEN_POS 13U -#define SPI_CON1_CRCEN_MSK BIT(SPI_CON1_CRCEN_POS) - -#define SPI_CON1_NXTCRC_POS 12U -#define SPI_CON1_NXTCRC_MSK BIT(SPI_CON1_NXTCRC_POS) - -#define SPI_CON1_FLEN_POS 11U -#define SPI_CON1_FLEN_MSK BIT(SPI_CON1_FLEN_POS) - -#define SPI_CON1_RXO_POS 10U -#define SPI_CON1_RXO_MSK BIT(SPI_CON1_RXO_POS) - -#define SPI_CON1_SSEN_POS 9U -#define SPI_CON1_SSEN_MSK BIT(SPI_CON1_SSEN_POS) - -#define SPI_CON1_SSOUT_POS 8U -#define SPI_CON1_SSOUT_MSK BIT(SPI_CON1_SSOUT_POS) - -#define SPI_CON1_LSBFST_POS 7U -#define SPI_CON1_LSBFST_MSK BIT(SPI_CON1_LSBFST_POS) - -#define SPI_CON1_SPIEN_POS 6U -#define SPI_CON1_SPIEN_MSK BIT(SPI_CON1_SPIEN_POS) - -#define SPI_CON1_BAUD_POSS 3U -#define SPI_CON1_BAUD_POSE 5U -#define SPI_CON1_BAUD_MSK BITS(SPI_CON1_BAUD_POSS,SPI_CON1_BAUD_POSE) - -#define SPI_CON1_MSTREN_POS 2U -#define SPI_CON1_MSTREN_MSK BIT(SPI_CON1_MSTREN_POS) - -#define SPI_CON1_CPOL_POS 1U -#define SPI_CON1_CPOL_MSK BIT(SPI_CON1_CPOL_POS) - -#define SPI_CON1_CPHA_POS 0U -#define SPI_CON1_CPHA_MSK BIT(SPI_CON1_CPHA_POS) - -/****************** Bit definition for SPI_CON2 register ************************/ - -#define SPI_CON2_TXBEIE_POS 7U -#define SPI_CON2_TXBEIE_MSK BIT(SPI_CON2_TXBEIE_POS) - -#define SPI_CON2_RXBNEIE_POS 6U -#define SPI_CON2_RXBNEIE_MSK BIT(SPI_CON2_RXBNEIE_POS) - -#define SPI_CON2_ERRIE_POS 5U -#define SPI_CON2_ERRIE_MSK BIT(SPI_CON2_ERRIE_POS) - -#define SPI_CON2_NSSOE_POS 2U -#define SPI_CON2_NSSOE_MSK BIT(SPI_CON2_NSSOE_POS) - -#define SPI_CON2_TXDMA_POS 1U -#define SPI_CON2_TXDMA_MSK BIT(SPI_CON2_TXDMA_POS) - -#define SPI_CON2_RXDMA_POS 0U -#define SPI_CON2_RXDMA_MSK BIT(SPI_CON2_RXDMA_POS) - -/****************** Bit definition for SPI_STAT register ************************/ - -#define SPI_STAT_BUSY_POS 7U -#define SPI_STAT_BUSY_MSK BIT(SPI_STAT_BUSY_POS) - -#define SPI_STAT_OVERR_POS 6U -#define SPI_STAT_OVERR_MSK BIT(SPI_STAT_OVERR_POS) - -#define SPI_STAT_MODERR_POS 5U -#define SPI_STAT_MODERR_MSK BIT(SPI_STAT_MODERR_POS) - -#define SPI_STAT_CRCERR_POS 4U -#define SPI_STAT_CRCERR_MSK BIT(SPI_STAT_CRCERR_POS) - -#define SPI_STAT_TXBE_POS 1U -#define SPI_STAT_TXBE_MSK BIT(SPI_STAT_TXBE_POS) - -#define SPI_STAT_RXBNE_POS 0U -#define SPI_STAT_RXBNE_MSK BIT(SPI_STAT_RXBNE_POS) - -/****************** Bit definition for SPI_DATA register ************************/ - -#define SPI_DATA_VALUE_POSS 0U -#define SPI_DATA_VALUE_POSE 15U -#define SPI_DATA_VALUE_MSK BITS(SPI_DATA_VALUE_POSS,SPI_DATA_VALUE_POSE) - -/****************** Bit definition for SPI_CRCPOLY register ************************/ - -#define SPI_CRCPOLY_VALUE_POSS 0U -#define SPI_CRCPOLY_VALUE_POSE 15U -#define SPI_CRCPOLY_VALUE_MSK BITS(SPI_CRCPOLY_VALUE_POSS,SPI_CRCPOLY_VALUE_POSE) - -/****************** Bit definition for SPI_RXCRC register ************************/ - -#define SPI_RXCRC_CRCVAL_POSS 0U -#define SPI_RXCRC_CRCVAL_POSE 15U -#define SPI_RXCRC_CRCVAL_MSK BITS(SPI_RXCRC_CRCVAL_POSS,SPI_RXCRC_CRCVAL_POSE) - -/****************** Bit definition for SPI_TXCRC register ************************/ - -#define SPI_TXCRC_CRCVAL_POSS 0U -#define SPI_TXCRC_CRCVAL_POSE 15U -#define SPI_TXCRC_CRCVAL_MSK BITS(SPI_TXCRC_CRCVAL_POSS,SPI_TXCRC_CRCVAL_POSE) - -typedef struct -{ - __IO uint32_t CON1; - __IO uint32_t CON2; - __IO uint32_t STAT; - __IO uint32_t DATA; - __IO uint32_t CRCPOLY; - __I uint32_t RXCRC; - __I uint32_t TXCRC; -} SPI_TypeDef; - -/****************** Bit definition for I2C_CON1 register ************************/ - -#define I2C_CON1_SRST_POS 15U -#define I2C_CON1_SRST_MSK BIT(I2C_CON1_SRST_POS) - -#define I2C_CON1_ALARM_POS 13U -#define I2C_CON1_ALARM_MSK BIT(I2C_CON1_ALARM_POS) - -#define I2C_CON1_TRPEC_POS 12U -#define I2C_CON1_TRPEC_MSK BIT(I2C_CON1_TRPEC_POS) - -#define I2C_CON1_POSAP_POS 11U -#define I2C_CON1_POSAP_MSK BIT(I2C_CON1_POSAP_POS) - -#define I2C_CON1_ACKEN_POS 10U -#define I2C_CON1_ACKEN_MSK BIT(I2C_CON1_ACKEN_POS) - -#define I2C_CON1_STOP_POS 9U -#define I2C_CON1_STOP_MSK BIT(I2C_CON1_STOP_POS) - -#define I2C_CON1_START_POS 8U -#define I2C_CON1_START_MSK BIT(I2C_CON1_START_POS) - -#define I2C_CON1_DISCS_POS 7U -#define I2C_CON1_DISCS_MSK BIT(I2C_CON1_DISCS_POS) - -#define I2C_CON1_GCEN_POS 6U -#define I2C_CON1_GCEN_MSK BIT(I2C_CON1_GCEN_POS) - -#define I2C_CON1_PECEN_POS 5U -#define I2C_CON1_PECEN_MSK BIT(I2C_CON1_PECEN_POS) - -#define I2C_CON1_ARPEN_POS 4U -#define I2C_CON1_ARPEN_MSK BIT(I2C_CON1_ARPEN_POS) - -#define I2C_CON1_SMBMOD_POS 3U -#define I2C_CON1_SMBMOD_MSK BIT(I2C_CON1_SMBMOD_POS) - -#define I2C_CON1_PMOD_POS 1U -#define I2C_CON1_PMOD_MSK BIT(I2C_CON1_PMOD_POS) - -#define I2C_CON1_PEN_POS 0U -#define I2C_CON1_PEN_MSK BIT(I2C_CON1_PEN_POS) - -/****************** Bit definition for I2C_CON2 register ************************/ - -#define I2C_CON2_LDMA_POS 12U -#define I2C_CON2_LDMA_MSK BIT(I2C_CON2_LDMA_POS) - -#define I2C_CON2_DMAEN_POS 11U -#define I2C_CON2_DMAEN_MSK BIT(I2C_CON2_DMAEN_POS) - -#define I2C_CON2_BUFIE_POS 10U -#define I2C_CON2_BUFIE_MSK BIT(I2C_CON2_BUFIE_POS) - -#define I2C_CON2_EVTIE_POS 9U -#define I2C_CON2_EVTIE_MSK BIT(I2C_CON2_EVTIE_POS) - -#define I2C_CON2_ERRIE_POS 8U -#define I2C_CON2_ERRIE_MSK BIT(I2C_CON2_ERRIE_POS) - -#define I2C_CON2_CLKF_POSS 0U -#define I2C_CON2_CLKF_POSE 5U -#define I2C_CON2_CLKF_MSK BITS(I2C_CON2_CLKF_POSS,I2C_CON2_CLKF_POSE) - -/****************** Bit definition for I2C_ADDR1 register ************************/ - -#define I2C_ADDR1_ADDTYPE_POS 15U -#define I2C_ADDR1_ADDTYPE_MSK BIT(I2C_ADDR1_ADDTYPE_POS) - -#define I2C_ADDR1_ADDH_POSS 8U -#define I2C_ADDR1_ADDH_POSE 9U -#define I2C_ADDR1_ADDH_MSK BITS(I2C_ADDR1_ADDH_POSS,I2C_ADDR1_ADDH_POSE) - -#define I2C_ADDR1_ADD_POSS 1U -#define I2C_ADDR1_ADD_POSE 7U -#define I2C_ADDR1_ADD_MSK BITS(I2C_ADDR1_ADD_POSS,I2C_ADDR1_ADD_POSE) - -#define I2C_ADDR1_ADDLSB_POS 0U -#define I2C_ADDR1_ADDLSB_MSK BIT(I2C_ADDR1_ADDLSB_POS) - -/****************** Bit definition for I2C_ADDR2 register ************************/ - -#define I2C_ADDR2_ADD_POSS 1U -#define I2C_ADDR2_ADD_POSE 7U -#define I2C_ADDR2_ADD_MSK BITS(I2C_ADDR2_ADD_POSS,I2C_ADDR2_ADD_POSE) - -#define I2C_ADDR2_DUALEN_POS 0U -#define I2C_ADDR2_DUALEN_MSK BIT(I2C_ADDR2_DUALEN_POS) - -/****************** Bit definition for I2C_DATA register ************************/ - -#define I2C_DATA_TRBUF_POSS 0U -#define I2C_DATA_TRBUF_POSE 7U -#define I2C_DATA_TRBUF_MSK BITS(I2C_DATA_TRBUF_POSS,I2C_DATA_TRBUF_POSE) - -/****************** Bit definition for I2C_STAT1 register ************************/ - -#define I2C_STAT1_SMBALARM_POS 15U -#define I2C_STAT1_SMBALARM_MSK BIT(I2C_STAT1_SMBALARM_POS) - -#define I2C_STAT1_SMBTO_POS 14U -#define I2C_STAT1_SMBTO_MSK BIT(I2C_STAT1_SMBTO_POS) - -#define I2C_STAT1_PECERR_POS 12U -#define I2C_STAT1_PECERR_MSK BIT(I2C_STAT1_PECERR_POS) - -#define I2C_STAT1_ROUERR_POS 11U -#define I2C_STAT1_ROUERR_MSK BIT(I2C_STAT1_ROUERR_POS) - -#define I2C_STAT1_ACKERR_POS 10U -#define I2C_STAT1_ACKERR_MSK BIT(I2C_STAT1_ACKERR_POS) - -#define I2C_STAT1_LARB_POS 9U -#define I2C_STAT1_LARB_MSK BIT(I2C_STAT1_LARB_POS) - -#define I2C_STAT1_BUSERR_POS 8U -#define I2C_STAT1_BUSERR_MSK BIT(I2C_STAT1_BUSERR_POS) - -#define I2C_STAT1_TXBE_POS 7U -#define I2C_STAT1_TXBE_MSK BIT(I2C_STAT1_TXBE_POS) - -#define I2C_STAT1_RXBNE_POS 6U -#define I2C_STAT1_RXBNE_MSK BIT(I2C_STAT1_RXBNE_POS) - -#define I2C_STAT1_DETSTP_POS 4U -#define I2C_STAT1_DETSTP_MSK BIT(I2C_STAT1_DETSTP_POS) - -#define I2C_STAT1_SENDADD10_POS 3U -#define I2C_STAT1_SENDADD10_MSK BIT(I2C_STAT1_SENDADD10_POS) - -#define I2C_STAT1_BTC_POS 2U -#define I2C_STAT1_BTC_MSK BIT(I2C_STAT1_BTC_POS) - -#define I2C_STAT1_ADDR_POS 1U -#define I2C_STAT1_ADDR_MSK BIT(I2C_STAT1_ADDR_POS) - -#define I2C_STAT1_SENDSTR_POS 0U -#define I2C_STAT1_SENDSTR_MSK BIT(I2C_STAT1_SENDSTR_POS) - -/****************** Bit definition for I2C_STAT2 register ************************/ - -#define I2C_STAT2_PECV_POSS 8U -#define I2C_STAT2_PECV_POSE 15U -#define I2C_STAT2_PECV_MSK BITS(I2C_STAT2_PECV_POSS,I2C_STAT2_PECV_POSE) - -#define I2C_STAT2_DMF_POS 7U -#define I2C_STAT2_DMF_MSK BIT(I2C_STAT2_DMF_POS) - -#define I2C_STAT2_SMBHH_POS 6U -#define I2C_STAT2_SMBHH_MSK BIT(I2C_STAT2_SMBHH_POS) - -#define I2C_STAT2_SMBDEF_POS 5U -#define I2C_STAT2_SMBDEF_MSK BIT(I2C_STAT2_SMBDEF_POS) - -#define I2C_STAT2_RXGCF_POS 4U -#define I2C_STAT2_RXGCF_MSK BIT(I2C_STAT2_RXGCF_POS) - -#define I2C_STAT2_TRF_POS 2U -#define I2C_STAT2_TRF_MSK BIT(I2C_STAT2_TRF_POS) - -#define I2C_STAT2_BSYF_POS 1U -#define I2C_STAT2_BSYF_MSK BIT(I2C_STAT2_BSYF_POS) - -#define I2C_STAT2_MASTER_POS 0U -#define I2C_STAT2_MASTER_MSK BIT(I2C_STAT2_MASTER_POS) - -/****************** Bit definition for I2C_CKCFG register ************************/ - -#define I2C_CKCFG_CLKMOD_POS 15U -#define I2C_CKCFG_CLKMOD_MSK BIT(I2C_CKCFG_CLKMOD_POS) - -#define I2C_CKCFG_DUTY_POS 14U -#define I2C_CKCFG_DUTY_MSK BIT(I2C_CKCFG_DUTY_POS) - -#define I2C_CKCFG_CLKSET_POSS 0U -#define I2C_CKCFG_CLKSET_POSE 11U -#define I2C_CKCFG_CLKSET_MSK BITS(I2C_CKCFG_CLKSET_POSS,I2C_CKCFG_CLKSET_POSE) - -/****************** Bit definition for I2C_RT register ************************/ - -#define I2C_RT_RISET_POSS 0U -#define I2C_RT_RISET_POSE 5U -#define I2C_RT_RISET_MSK BITS(I2C_RT_RISET_POSS,I2C_RT_RISET_POSE) - -typedef struct -{ - __IO uint32_t CON1; - __IO uint32_t CON2; - __IO uint32_t ADDR1; - __IO uint32_t ADDR2; - __IO uint32_t DATA; - __IO uint32_t STAT1; - __I uint32_t STAT2; - __IO uint32_t CKCFG; - __IO uint32_t RT; -} I2C_TypeDef; - -/****************** Bit definition for CRC_CR register ************************/ -#define CRC_CR_BYTORD_POS 24U -#define CRC_CR_BYTORD_MSK BIT(CRC_CR_BYTORD_POS) - -#define CRC_CR_DATLEN_POSS 22U -#define CRC_CR_DATLEN_POSE 23U -#define CRC_CR_DATLEN_MSK BITS(CRC_CR_DATLEN_POSS,CRC_CR_DATLEN_POSE) - -#define CRC_CR_MODE_POSS 20U -#define CRC_CR_MODE_POSE 21U -#define CRC_CR_MODE_MSK BITS(CRC_CR_MODE_POSS,CRC_CR_MODE_POSE) - -#define CRC_CR_CHSINV_POS 19U -#define CRC_CR_CHSINV_MSK BIT(CRC_CR_CHSINV_POS) - -#define CRC_CR_DATINV_POS 18U -#define CRC_CR_DATINV_MSK BIT(CRC_CR_DATINV_POS) - -#define CRC_CR_CHSREV_POS 17U -#define CRC_CR_CHSREV_MSK BIT(CRC_CR_CHSREV_POS) - -#define CRC_CR_DATREV_POS 16U -#define CRC_CR_DATREV_MSK BIT(CRC_CR_DATREV_POS) - -#define CRC_CR_DMAEN_POS 4U -#define CRC_CR_DMAEN_MSK BIT(CRC_CR_DMAEN_POS) - -#define CRC_CR_CWERR_POS 3U -#define CRC_CR_CWERR_MSK BIT(CRC_CR_CWERR_POS) - -#define CRC_CR_WERR_POS 2U -#define CRC_CR_WERR_MSK BIT(CRC_CR_WERR_POS) - -#define CRC_CR_RST_POS 1U -#define CRC_CR_RST_MSK BIT(CRC_CR_RST_POS) - -#define CRC_CR_EN_POS 0U -#define CRC_CR_EN_MSK BIT(CRC_CR_EN_POS) - -/****************** Bit definition for CRC_DATA register ************************/ - -#define CRC_DATA_DATA_POSS 0U -#define CRC_DATA_DATA_POSE 31U -#define CRC_DATA_DATA_MSK BITS(CRC_DATA_DATA_POSS,CRC_DATA_DATA_POSE) - -/****************** Bit definition for CRC_SEED register ************************/ - -#define CRC_SEED_SEED_POSS 0U -#define CRC_SEED_SEED_POSE 31U -#define CRC_SEED_SEED_MSK BITS(CRC_SEED_SEED_POSS,CRC_SEED_SEED_POSE) - -/****************** Bit definition for CRC_CHECKSUM register ************************/ - -#define CRC_CHECKSUM_CHECKSUM_POSS 0U -#define CRC_CHECKSUM_CHECKSUM_POSE 31U -#define CRC_CHECKSUM_CHECKSUM_MSK BITS(CRC_CHECKSUM_CHECKSUM_POSS,CRC_CHECKSUM_CHECKSUM_POSE) - -typedef struct -{ - __IO uint32_t CR; - __IO uint32_t DATA; - __IO uint32_t SEED; - __I uint32_t CHECKSUM; -} CRC_TypeDef; - -/****************** Bit definition for CRYPT_CON register ************************/ - -#define CRYPT_CON_CRYSEL_POS 31U -#define CRYPT_CON_CRYSEL_MSK BIT(CRYPT_CON_CRYSEL_POS) - -#define CRYPT_CON_RESCLR_POS 15U -#define CRYPT_CON_RESCLR_MSK BIT(CRYPT_CON_RESCLR_POS) - -#define CRYPT_CON_DMAEN_POS 14U -#define CRYPT_CON_DMAEN_MSK BIT(CRYPT_CON_DMAEN_POS) - -#define CRYPT_CON_FIFOODR_POS 13U -#define CRYPT_CON_FIFOODR_MSK BIT(CRYPT_CON_FIFOODR_POS) - -#define CRYPT_CON_FIFOEN_POS 12U -#define CRYPT_CON_FIFOEN_MSK BIT(CRYPT_CON_FIFOEN_POS) - -#define CRYPT_CON_DESKS_POS 11U -#define CRYPT_CON_DESKS_MSK BIT(CRYPT_CON_DESKS_POS) - -#define CRYPT_CON_TDES_POS 10U -#define CRYPT_CON_TDES_MSK BIT(CRYPT_CON_TDES_POS) - -#define CRYPT_CON_TYPE_POSS 8U -#define CRYPT_CON_TYPE_POSE 9U -#define CRYPT_CON_TYPE_MSK BITS(CRYPT_CON_TYPE_POSS,CRYPT_CON_TYPE_POSE) - -#define CRYPT_CON_IE_POS 7U -#define CRYPT_CON_IE_MSK BIT(CRYPT_CON_IE_POS) - -#define CRYPT_CON_IVEN_POS 6U -#define CRYPT_CON_IVEN_MSK BIT(CRYPT_CON_IVEN_POS) - -#define CRYPT_CON_MODE_POSS 4U -#define CRYPT_CON_MODE_POSE 5U -#define CRYPT_CON_MODE_MSK BITS(CRYPT_CON_MODE_POSS,CRYPT_CON_MODE_POSE) - -#define CRYPT_CON_AESKS_POSS 2U -#define CRYPT_CON_AESKS_POSE 3U -#define CRYPT_CON_AESKS_MSK BITS(CRYPT_CON_AESKS_POSS,CRYPT_CON_AESKS_POSE) - -#define CRYPT_CON_ENCS_POS 1U -#define CRYPT_CON_ENCS_MSK BIT(CRYPT_CON_ENCS_POS) - -#define CRYPT_CON_GO_POS 0U -#define CRYPT_CON_GO_MSK BIT(CRYPT_CON_GO_POS) - -/****************** Bit definition for CRYPT_IF register ************************/ - -#define CRYPT_IF_DONE_POS 8U -#define CRYPT_IF_DONE_MSK BIT(CRYPT_IF_DONE_POS) - -#define CRYPT_IF_MULTHIF_POS 2U -#define CRYPT_IF_MULTHIF_MSK BIT(CRYPT_IF_MULTHIF_POS) - -#define CRYPT_IF_DESIF_POS 1U -#define CRYPT_IF_DESIF_MSK BIT(CRYPT_IF_DESIF_POS) - -#define CRYPT_IF_AESIF_POS 0U -#define CRYPT_IF_AESIF_MSK BIT(CRYPT_IF_AESIF_POS) - -/****************** Bit definition for CRYPT_IFC register ************************/ - -#define CRYPT_IFC_MULTHIFC_POS 2U -#define CRYPT_IFC_MULTHIFC_MSK BIT(CRYPT_IFC_MULTHIFC_POS) - -#define CRYPT_IFC_DESIFC_POS 1U -#define CRYPT_IFC_DESIFC_MSK BIT(CRYPT_IFC_DESIFC_POS) - -#define CRYPT_IFC_AESIFC_POS 0U -#define CRYPT_IFC_AESIFC_MSK BIT(CRYPT_IFC_AESIFC_POS) - -/****************** Bit definition for CRYPT_FIFO register ************************/ - -#define CRYPT_FIFO_FIFO_POSS 0U -#define CRYPT_FIFO_FIFO_POSE 31U -#define CRYPT_FIFO_FIFO_MSK BITS(CRYPT_FIFO_FIFO_POSS,CRYPT_FIFO_FIFO_POSE) - -typedef struct -{ - __IO uint32_t DATA[4]; - __IO uint32_t KEY[8]; - __IO uint32_t IV[4]; - __I uint32_t RES[4]; - __IO uint32_t CON; - __I uint32_t IF; - __O uint32_t IFC; - __IO uint32_t FIFO; -} CRYPT_TypeDef; - -/****************** Bit definition for LCD_CR register ************************/ - -#define LCD_CR_VCHPS_POSS 24U -#define LCD_CR_VCHPS_POSE 25U -#define LCD_CR_VCHPS_MSK BITS(LCD_CR_VCHPS_POSS,LCD_CR_VCHPS_POSE) - -#define LCD_CR_DSLD_POSS 20U -#define LCD_CR_DSLD_POSE 23U -#define LCD_CR_DSLD_MSK BITS(LCD_CR_DSLD_POSS,LCD_CR_DSLD_POSE) - -#define LCD_CR_DSHD_POSS 16U -#define LCD_CR_DSHD_POSE 19U -#define LCD_CR_DSHD_MSK BITS(LCD_CR_DSHD_POSS,LCD_CR_DSHD_POSE) - -#define LCD_CR_VBUFLD_POS 15U -#define LCD_CR_VBUFLD_MSK BIT(LCD_CR_VBUFLD_POS) - -#define LCD_CR_VBUFHD_POS 14U -#define LCD_CR_VBUFHD_MSK BIT(LCD_CR_VBUFHD_POS) - -#define LCD_CR_RESLD_POSS 12U -#define LCD_CR_RESLD_POSE 13U -#define LCD_CR_RESLD_MSK BITS(LCD_CR_RESLD_POSS,LCD_CR_RESLD_POSE) - -#define LCD_CR_RESHD_POSS 10U -#define LCD_CR_RESHD_POSE 11U -#define LCD_CR_RESHD_MSK BITS(LCD_CR_RESHD_POSS,LCD_CR_RESHD_POSE) - -#define LCD_CR_BIAS_POSS 8U -#define LCD_CR_BIAS_POSE 9U -#define LCD_CR_BIAS_MSK BITS(LCD_CR_BIAS_POSS,LCD_CR_BIAS_POSE) - -#define LCD_CR_DUTY_POSS 4U -#define LCD_CR_DUTY_POSE 6U -#define LCD_CR_DUTY_MSK BITS(LCD_CR_DUTY_POSS,LCD_CR_DUTY_POSE) - -#define LCD_CR_OE_POS 3U -#define LCD_CR_OE_MSK BIT(LCD_CR_OE_POS) - -#define LCD_CR_VSEL_POSS 1U -#define LCD_CR_VSEL_POSE 2U -#define LCD_CR_VSEL_MSK BITS(LCD_CR_VSEL_POSS,LCD_CR_VSEL_POSE) - -#define LCD_CR_EN_POS 0U -#define LCD_CR_EN_MSK BIT(LCD_CR_EN_POS) - -/****************** Bit definition for LCD_FCR register ************************/ - -#define LCD_FCR_WFS_POS 31U -#define LCD_FCR_WFS_MSK BIT(LCD_FCR_WFS_POS) - -#define LCD_FCR_PRS_POSS 24U -#define LCD_FCR_PRS_POSE 27U -#define LCD_FCR_PRS_MSK BITS(LCD_FCR_PRS_POSS,LCD_FCR_PRS_POSE) - -#define LCD_FCR_DIV_POSS 20U -#define LCD_FCR_DIV_POSE 23U -#define LCD_FCR_DIV_MSK BITS(LCD_FCR_DIV_POSS,LCD_FCR_DIV_POSE) - -#define LCD_FCR_BLMOD_POSS 16U -#define LCD_FCR_BLMOD_POSE 17U -#define LCD_FCR_BLMOD_MSK BITS(LCD_FCR_BLMOD_POSS,LCD_FCR_BLMOD_POSE) - -#define LCD_FCR_BLFRQ_POSS 12U -#define LCD_FCR_BLFRQ_POSE 14U -#define LCD_FCR_BLFRQ_MSK BITS(LCD_FCR_BLFRQ_POSS,LCD_FCR_BLFRQ_POSE) - -#define LCD_FCR_DEAD_POSS 8U -#define LCD_FCR_DEAD_POSE 10U -#define LCD_FCR_DEAD_MSK BITS(LCD_FCR_DEAD_POSS,LCD_FCR_DEAD_POSE) - -#define LCD_FCR_HD_POS 7U -#define LCD_FCR_HD_MSK BIT(LCD_FCR_HD_POS) - -#define LCD_FCR_PON_POSS 4U -#define LCD_FCR_PON_POSE 6U -#define LCD_FCR_PON_MSK BITS(LCD_FCR_PON_POSS,LCD_FCR_PON_POSE) - -#define LCD_FCR_VGS_POSS 0U -#define LCD_FCR_VGS_POSE 3U -#define LCD_FCR_VGS_MSK BITS(LCD_FCR_VGS_POSS,LCD_FCR_VGS_POSE) - -/****************** Bit definition for LCD_SEGCR0 register ************************/ - -#define LCD_SEGCR0_SEG_OE_POSS 0U -#define LCD_SEGCR0_SEG_OE_POSE 31U -#define LCD_SEGCR0_SEG_OE_MSK BITS(LCD_SEGCR0_SEG_OE_POSS,LCD_SEGCR0_SEG_OE_POSE) - -/****************** Bit definition for LCD_SEGCR1 register ************************/ - -#define LCD_SEGCR1_SEG_OE_POSS 0U -#define LCD_SEGCR1_SEG_OE_POSE 11U -#define LCD_SEGCR1_SEG_OE_MSK BITS(LCD_SEGCR1_SEG_OE_POSS,LCD_SEGCR1_SEG_OE_POSE) - -/****************** Bit definition for LCD_IE register ************************/ - -#define LCD_IE_UDDIE_POS 1U -#define LCD_IE_UDDIE_MSK BIT(LCD_IE_UDDIE_POS) - -#define LCD_IE_SOFIE_POS 0U -#define LCD_IE_SOFIE_MSK BIT(LCD_IE_SOFIE_POS) - -/****************** Bit definition for LCD_IF register ************************/ - -#define LCD_IF_UDDIF_POS 1U -#define LCD_IF_UDDIF_MSK BIT(LCD_IF_UDDIF_POS) - -#define LCD_IF_SOFIF_POS 0U -#define LCD_IF_SOFIF_MSK BIT(LCD_IF_SOFIF_POS) - -/****************** Bit definition for LCD_IFCR register ************************/ - -#define LCD_IFCR_UDDIFC_POS 1U -#define LCD_IFCR_UDDIFC_MSK BIT(LCD_IFCR_UDDIFC_POS) - -#define LCD_IFCR_SOFIFC_POS 0U -#define LCD_IFCR_SOFIFC_MSK BIT(LCD_IFCR_SOFIFC_POS) - -/****************** Bit definition for LCD_SR register ************************/ - -#define LCD_SR_FCRSF_POS 3U -#define LCD_SR_FCRSF_MSK BIT(LCD_SR_FCRSF_POS) - -#define LCD_SR_UDR_POS 2U -#define LCD_SR_UDR_MSK BIT(LCD_SR_UDR_POS) - -#define LCD_SR_ENS_POS 1U -#define LCD_SR_ENS_MSK BIT(LCD_SR_ENS_POS) - -#define LCD_SR_RDY_POS 0U -#define LCD_SR_RDY_MSK BIT(LCD_SR_RDY_POS) - -/****************** Bit definition for LCD_BUF register ************************/ - -#define LCD_BUF_SEG_DATA_POSS 0U -#define LCD_BUF_SEG_DATA_POSE 31U -#define LCD_BUF_SEG_DATA_MSK BITS(LCD_BUF_SEG_DATA_POSS,LCD_BUF_SEG_DATA_POSE) - -typedef struct -{ - __IO uint32_t CR; - __IO uint32_t FCR; - __IO uint32_t SEGCR0; - __IO uint32_t SEGCR1; - __IO uint32_t IE; - __I uint32_t IF; - __O uint32_t IFCR; - __I uint32_t SR; - uint32_t RESERVED0[8] ; - __IO uint32_t BUF[16]; -} LCD_TypeDef; - -/****************** Bit definition for ADC_STAT register ************************/ - -#define ADC_STAT_ICHS_POS 9U -#define ADC_STAT_ICHS_MSK BIT(ADC_STAT_ICHS_POS) - -#define ADC_STAT_NCHS_POS 8U -#define ADC_STAT_NCHS_MSK BIT(ADC_STAT_NCHS_POS) - -#define ADC_STAT_OVR_POS 3U -#define ADC_STAT_OVR_MSK BIT(ADC_STAT_OVR_POS) - -#define ADC_STAT_ICHE_POS 2U -#define ADC_STAT_ICHE_MSK BIT(ADC_STAT_ICHE_POS) - -#define ADC_STAT_NCHE_POS 1U -#define ADC_STAT_NCHE_MSK BIT(ADC_STAT_NCHE_POS) - -#define ADC_STAT_AWDF_POS 0U -#define ADC_STAT_AWDF_MSK BIT(ADC_STAT_AWDF_POS) - -/****************** Bit definition for ADC_CLR register ************************/ - -#define ADC_CLR_ICHS_POS 9U -#define ADC_CLR_ICHS_MSK BIT(ADC_CLR_ICHS_POS) - -#define ADC_CLR_NCHS_POS 8U -#define ADC_CLR_NCHS_MSK BIT(ADC_CLR_NCHS_POS) - -#define ADC_CLR_OVR_POS 3U -#define ADC_CLR_OVR_MSK BIT(ADC_CLR_OVR_POS) - -#define ADC_CLR_ICHE_POS 2U -#define ADC_CLR_ICHE_MSK BIT(ADC_CLR_ICHE_POS) - -#define ADC_CLR_NCHE_POS 1U -#define ADC_CLR_NCHE_MSK BIT(ADC_CLR_NCHE_POS) - -#define ADC_CLR_AWDF_POS 0U -#define ADC_CLR_AWDF_MSK BIT(ADC_CLR_AWDF_POS) - -/****************** Bit definition for ADC_CON0 register ************************/ - -#define ADC_CON0_OVRIE_POS 26U -#define ADC_CON0_OVRIE_MSK BIT(ADC_CON0_OVRIE_POS) - -#define ADC_CON0_RSEL_POSS 24U -#define ADC_CON0_RSEL_POSE 25U -#define ADC_CON0_RSEL_MSK BITS(ADC_CON0_RSEL_POSS,ADC_CON0_RSEL_POSE) - -#define ADC_CON0_NCHWDEN_POS 23U -#define ADC_CON0_NCHWDEN_MSK BIT(ADC_CON0_NCHWDEN_POS) - -#define ADC_CON0_ICHWDTEN_POS 22U -#define ADC_CON0_ICHWDTEN_MSK BIT(ADC_CON0_ICHWDTEN_POS) - -#define ADC_CON0_ETRGN_POSS 13U -#define ADC_CON0_ETRGN_POSE 15U -#define ADC_CON0_ETRGN_MSK BITS(ADC_CON0_ETRGN_POSS,ADC_CON0_ETRGN_POSE) - -#define ADC_CON0_ICHDCEN_POS 12U -#define ADC_CON0_ICHDCEN_MSK BIT(ADC_CON0_ICHDCEN_POS) - -#define ADC_CON0_NCHDCEN_POS 11U -#define ADC_CON0_NCHDCEN_MSK BIT(ADC_CON0_NCHDCEN_POS) - -#define ADC_CON0_IAUTO_POS 10U -#define ADC_CON0_IAUTO_MSK BIT(ADC_CON0_IAUTO_POS) - -#define ADC_CON0_AWDSGL_POS 9U -#define ADC_CON0_AWDSGL_MSK BIT(ADC_CON0_AWDSGL_POS) - -#define ADC_CON0_SCANEN_POS 8U -#define ADC_CON0_SCANEN_MSK BIT(ADC_CON0_SCANEN_POS) - -#define ADC_CON0_ICHEIE_POS 7U -#define ADC_CON0_ICHEIE_MSK BIT(ADC_CON0_ICHEIE_POS) - -#define ADC_CON0_AWDIE_POS 6U -#define ADC_CON0_AWDIE_MSK BIT(ADC_CON0_AWDIE_POS) - -#define ADC_CON0_NCHEIE_POS 5U -#define ADC_CON0_NCHEIE_MSK BIT(ADC_CON0_NCHEIE_POS) - -#define ADC_CON0_AWDCH_POSS 0U -#define ADC_CON0_AWDCH_POSE 4U -#define ADC_CON0_AWDCH_MSK BITS(ADC_CON0_AWDCH_POSS,ADC_CON0_AWDCH_POSE) - -/****************** Bit definition for ADC_CON1 register ************************/ - -#define ADC_CON1_NCHTRG_POS 30U -#define ADC_CON1_NCHTRG_MSK BIT(ADC_CON1_NCHTRG_POS) - -#define ADC_CON1_ICHTRG_POS 22U -#define ADC_CON1_ICHTRG_MSK BIT(ADC_CON1_ICHTRG_POS) - -#define ADC_CON1_ALIGN_POS 11U -#define ADC_CON1_ALIGN_MSK BIT(ADC_CON1_ALIGN_POS) - -#define ADC_CON1_NCHESEL_POS 10U -#define ADC_CON1_NCHESEL_MSK BIT(ADC_CON1_NCHESEL_POS) - -#define ADC_CON1_OVRDIS_POS 8U -#define ADC_CON1_OVRDIS_MSK BIT(ADC_CON1_OVRDIS_POS) - -#define ADC_CON1_CM_POS 1U -#define ADC_CON1_CM_MSK BIT(ADC_CON1_CM_POS) - -#define ADC_CON1_ADCEN_POS 0U -#define ADC_CON1_ADCEN_MSK BIT(ADC_CON1_ADCEN_POS) - -/****************** Bit definition for ADC_SMPT1 register ************************/ - -#define ADC_SMPT1_CHT_POSS 0U -#define ADC_SMPT1_CHT_POSE 31U -#define ADC_SMPT1_CHT_MSK BITS(ADC_SMPT1_CHT_POSS,ADC_SMPT1_CHT_POSE) - -/****************** Bit definition for ADC_SMPT2 register ************************/ - -#define ADC_SMPT2_CHT_POSS 0U -#define ADC_SMPT2_CHT_POSE 7U -#define ADC_SMPT2_CHT_MSK BITS(ADC_SMPT2_CHT_POSS,ADC_SMPT2_CHT_POSE) - -/****************** Bit definition for ADC_ICHOFF1 register ************************/ - -#define ADC_ICHOFF1_IOFF_POSS 0U -#define ADC_ICHOFF1_IOFF_POSE 11U -#define ADC_ICHOFF1_IOFF_MSK BITS(ADC_ICHOFF1_IOFF_POSS,ADC_ICHOFF1_IOFF_POSE) - -/****************** Bit definition for ADC_ICHOFF2 register ************************/ - -#define ADC_ICHOFF2_IOFF_POSS 0U -#define ADC_ICHOFF2_IOFF_POSE 11U -#define ADC_ICHOFF2_IOFF_MSK BITS(ADC_ICHOFF2_IOFF_POSS,ADC_ICHOFF2_IOFF_POSE) - -/****************** Bit definition for ADC_ICHOFF3 register ************************/ - -#define ADC_ICHOFF3_IOFF_POSS 0U -#define ADC_ICHOFF3_IOFF_POSE 11U -#define ADC_ICHOFF3_IOFF_MSK BITS(ADC_ICHOFF3_IOFF_POSS,ADC_ICHOFF3_IOFF_POSE) - -/****************** Bit definition for ADC_ICHOFF4 register ************************/ - -#define ADC_ICHOFF4_IOFF_POSS 0U -#define ADC_ICHOFF4_IOFF_POSE 11U -#define ADC_ICHOFF4_IOFF_MSK BITS(ADC_ICHOFF4_IOFF_POSS,ADC_ICHOFF4_IOFF_POSE) - -/****************** Bit definition for ADC_WDTH register ************************/ - -#define ADC_WDTH_HT_POSS 0U -#define ADC_WDTH_HT_POSE 11U -#define ADC_WDTH_HT_MSK BITS(ADC_WDTH_HT_POSS,ADC_WDTH_HT_POSE) - -/****************** Bit definition for ADC_WDTL register ************************/ - -#define ADC_WDTL_LT_POSS 0U -#define ADC_WDTL_LT_POSE 11U -#define ADC_WDTL_LT_MSK BITS(ADC_WDTL_LT_POSS,ADC_WDTL_LT_POSE) - -/****************** Bit definition for ADC_NCHS1 register ************************/ - -#define ADC_NCHS1_NS4_POSS 24U -#define ADC_NCHS1_NS4_POSE 28U -#define ADC_NCHS1_NS4_MSK BITS(ADC_NCHS1_NS4_POSS,ADC_NCHS1_NS4_POSE) - -#define ADC_NCHS1_NS3_POSS 16U -#define ADC_NCHS1_NS3_POSE 20U -#define ADC_NCHS1_NS3_MSK BITS(ADC_NCHS1_NS3_POSS,ADC_NCHS1_NS3_POSE) - -#define ADC_NCHS1_NS2_POSS 8U -#define ADC_NCHS1_NS2_POSE 12U -#define ADC_NCHS1_NS2_MSK BITS(ADC_NCHS1_NS2_POSS,ADC_NCHS1_NS2_POSE) - -#define ADC_NCHS1_NS1_POSS 0U -#define ADC_NCHS1_NS1_POSE 4U -#define ADC_NCHS1_NS1_MSK BITS(ADC_NCHS1_NS1_POSS,ADC_NCHS1_NS1_POSE) - -/****************** Bit definition for ADC_NCHS2 register ************************/ - -#define ADC_NCHS2_NS8_POSS 24U -#define ADC_NCHS2_NS8_POSE 28U -#define ADC_NCHS2_NS8_MSK BITS(ADC_NCHS2_NS8_POSS,ADC_NCHS2_NS8_POSE) - -#define ADC_NCHS2_NS7_POSS 16U -#define ADC_NCHS2_NS7_POSE 20U -#define ADC_NCHS2_NS7_MSK BITS(ADC_NCHS2_NS7_POSS,ADC_NCHS2_NS7_POSE) - -#define ADC_NCHS2_NS6_POSS 8U -#define ADC_NCHS2_NS6_POSE 12U -#define ADC_NCHS2_NS6_MSK BITS(ADC_NCHS2_NS6_POSS,ADC_NCHS2_NS6_POSE) - -#define ADC_NCHS2_NS5_POSS 0U -#define ADC_NCHS2_NS5_POSE 4U -#define ADC_NCHS2_NS5_MSK BITS(ADC_NCHS2_NS5_POSS,ADC_NCHS2_NS5_POSE) - -/****************** Bit definition for ADC_NCHS3 register ************************/ - -#define ADC_NCHS3_NS12_POSS 24U -#define ADC_NCHS3_NS12_POSE 28U -#define ADC_NCHS3_NS12_MSK BITS(ADC_NCHS3_NS12_POSS,ADC_NCHS3_NS12_POSE) - -#define ADC_NCHS3_NS11_POSS 16U -#define ADC_NCHS3_NS11_POSE 20U -#define ADC_NCHS3_NS11_MSK BITS(ADC_NCHS3_NS11_POSS,ADC_NCHS3_NS11_POSE) - -#define ADC_NCHS3_NS10_POSS 8U -#define ADC_NCHS3_NS10_POSE 12U -#define ADC_NCHS3_NS10_MSK BITS(ADC_NCHS3_NS10_POSS,ADC_NCHS3_NS10_POSE) - -#define ADC_NCHS3_NS9_POSS 0U -#define ADC_NCHS3_NS9_POSE 4U -#define ADC_NCHS3_NS9_MSK BITS(ADC_NCHS3_NS9_POSS,ADC_NCHS3_NS9_POSE) - -/****************** Bit definition for ADC_NCHS4 register ************************/ - -#define ADC_NCHS4_NS16_POSS 24U -#define ADC_NCHS4_NS16_POSE 28U -#define ADC_NCHS4_NS16_MSK BITS(ADC_NCHS4_NS16_POSS,ADC_NCHS4_NS16_POSE) - -#define ADC_NCHS4_NS15_POSS 16U -#define ADC_NCHS4_NS15_POSE 20U -#define ADC_NCHS4_NS15_MSK BITS(ADC_NCHS4_NS15_POSS,ADC_NCHS4_NS15_POSE) - -#define ADC_NCHS4_NS14_POSS 8U -#define ADC_NCHS4_NS14_POSE 12U -#define ADC_NCHS4_NS14_MSK BITS(ADC_NCHS4_NS14_POSS,ADC_NCHS4_NS14_POSE) - -#define ADC_NCHS4_NS13_POSS 0U -#define ADC_NCHS4_NS13_POSE 4U -#define ADC_NCHS4_NS13_MSK BITS(ADC_NCHS4_NS13_POSS,ADC_NCHS4_NS13_POSE) - -/****************** Bit definition for ADC_ICHS register ************************/ - -#define ADC_ICHS_IS4_POSS 24U -#define ADC_ICHS_IS4_POSE 28U -#define ADC_ICHS_IS4_MSK BITS(ADC_ICHS_IS4_POSS,ADC_ICHS_IS4_POSE) - -#define ADC_ICHS_IS3_POSS 16U -#define ADC_ICHS_IS3_POSE 20U -#define ADC_ICHS_IS3_MSK BITS(ADC_ICHS_IS3_POSS,ADC_ICHS_IS3_POSE) - -#define ADC_ICHS_IS2_POSS 8U -#define ADC_ICHS_IS2_POSE 12U -#define ADC_ICHS_IS2_MSK BITS(ADC_ICHS_IS2_POSS,ADC_ICHS_IS2_POSE) - -#define ADC_ICHS_IS1_POSS 0U -#define ADC_ICHS_IS1_POSE 4U -#define ADC_ICHS_IS1_MSK BITS(ADC_ICHS_IS1_POSS,ADC_ICHS_IS1_POSE) - -/****************** Bit definition for ADC_CHSL register ************************/ - -#define ADC_CHSL_ISL_POSS 8U -#define ADC_CHSL_ISL_POSE 9U -#define ADC_CHSL_ISL_MSK BITS(ADC_CHSL_ISL_POSS,ADC_CHSL_ISL_POSE) - -#define ADC_CHSL_NSL_POSS 0U -#define ADC_CHSL_NSL_POSE 3U -#define ADC_CHSL_NSL_MSK BITS(ADC_CHSL_NSL_POSS,ADC_CHSL_NSL_POSE) - -/****************** Bit definition for ADC_ICHDR1 register ************************/ - -#define ADC_ICHDR1_VAL_POSS 0U -#define ADC_ICHDR1_VAL_POSE 15U -#define ADC_ICHDR1_VAL_MSK BITS(ADC_ICHDR1_VAL_POSS,ADC_ICHDR1_VAL_POSE) - -/****************** Bit definition for ADC_ICHDR2 register ************************/ - -#define ADC_ICHDR2_VAL_POSS 0U -#define ADC_ICHDR2_VAL_POSE 15U -#define ADC_ICHDR2_VAL_MSK BITS(ADC_ICHDR2_VAL_POSS,ADC_ICHDR2_VAL_POSE) - -/****************** Bit definition for ADC_ICHDR3 register ************************/ - -#define ADC_ICHDR3_VAL_POSS 0U -#define ADC_ICHDR3_VAL_POSE 15U -#define ADC_ICHDR3_VAL_MSK BITS(ADC_ICHDR3_VAL_POSS,ADC_ICHDR3_VAL_POSE) - -/****************** Bit definition for ADC_ICHDR4 register ************************/ - -#define ADC_ICHDR4_VAL_POSS 0U -#define ADC_ICHDR4_VAL_POSE 15U -#define ADC_ICHDR4_VAL_MSK BITS(ADC_ICHDR4_VAL_POSS,ADC_ICHDR4_VAL_POSE) - -/****************** Bit definition for ADC_NCHDR register ************************/ - -#define ADC_NCHDR_VAL_POSS 0U -#define ADC_NCHDR_VAL_POSE 15U -#define ADC_NCHDR_VAL_MSK BITS(ADC_NCHDR_VAL_POSS,ADC_NCHDR_VAL_POSE) - -/****************** Bit definition for ADC_CCR register ************************/ - -#define ADC_CCR_TRMEN_POS 28U -#define ADC_CCR_TRMEN_MSK BIT(ADC_CCR_TRMEN_POS) - -#define ADC_CCR_GAINCALEN_POS 25U -#define ADC_CCR_GAINCALEN_MSK BIT(ADC_CCR_GAINCALEN_POS) - -#define ADC_CCR_OFFCALEN_POS 24U -#define ADC_CCR_OFFCALEN_MSK BIT(ADC_CCR_OFFCALEN_POS) - -#define ADC_CCR_VREFOEN_POS 19U -#define ADC_CCR_VREFOEN_MSK BIT(ADC_CCR_VREFOEN_POS) - -#define ADC_CCR_VRNSEL_POS 18U -#define ADC_CCR_VRNSEL_MSK BIT(ADC_CCR_VRNSEL_POS) - -#define ADC_CCR_VRPSEL_POSS 16U -#define ADC_CCR_VRPSEL_POSE 17U -#define ADC_CCR_VRPSEL_MSK BITS(ADC_CCR_VRPSEL_POSS,ADC_CCR_VRPSEL_POSE) - -#define ADC_CCR_PWRMODSEL_POS 15U -#define ADC_CCR_PWRMODSEL_MSK BIT(ADC_CCR_PWRMODSEL_POS) - -#define ADC_CCR_DIFFEN_POS 12U -#define ADC_CCR_DIFFEN_MSK BIT(ADC_CCR_DIFFEN_POS) - -#define ADC_CCR_IREFEN_POS 11U -#define ADC_CCR_IREFEN_MSK BIT(ADC_CCR_IREFEN_POS) - -#define ADC_CCR_VRBUFEN_POS 10U -#define ADC_CCR_VRBUFEN_MSK BIT(ADC_CCR_VRBUFEN_POS) - -#define ADC_CCR_VCMBUFEN_POS 9U -#define ADC_CCR_VCMBUFEN_MSK BIT(ADC_CCR_VCMBUFEN_POS) - -#define ADC_CCR_VREFEN_POS 8U -#define ADC_CCR_VREFEN_MSK BIT(ADC_CCR_VREFEN_POS) - -#define ADC_CCR_CKDIV_POSS 0U -#define ADC_CCR_CKDIV_POSE 2U -#define ADC_CCR_CKDIV_MSK BITS(ADC_CCR_CKDIV_POSS,ADC_CCR_CKDIV_POSE) - -typedef struct -{ - __I uint32_t STAT; - __O uint32_t CLR; - __IO uint32_t CON0; - __IO uint32_t CON1; - __IO uint32_t SMPT1; - __IO uint32_t SMPT2; - __IO uint32_t ICHOFF[4]; - __IO uint32_t WDTH; - __IO uint32_t WDTL; - __IO uint32_t NCHS1; - __IO uint32_t NCHS2; - __IO uint32_t NCHS3; - __IO uint32_t NCHS4; - __IO uint32_t ICHS; - __IO uint32_t CHSL; - __I uint32_t ICHDR[4]; - __I uint32_t NCHDR; - __IO uint32_t CCR; -} ADC_TypeDef; - -/****************** Bit definition for ACMP_CON register ************************/ - -#define ACMP_CON_FALLEN_POS 17U -#define ACMP_CON_FALLEN_MSK BIT(ACMP_CON_FALLEN_POS) - -#define ACMP_CON_RISEEN_POS 16U -#define ACMP_CON_RISEEN_MSK BIT(ACMP_CON_RISEEN_POS) - -#define ACMP_CON_MODSEL_POSS 14U -#define ACMP_CON_MODSEL_POSE 15U -#define ACMP_CON_MODSEL_MSK BITS(ACMP_CON_MODSEL_POSS,ACMP_CON_MODSEL_POSE) - -#define ACMP_CON_WARMUPT_POSS 8U -#define ACMP_CON_WARMUPT_POSE 10U -#define ACMP_CON_WARMUPT_MSK BITS(ACMP_CON_WARMUPT_POSS,ACMP_CON_WARMUPT_POSE) - -#define ACMP_CON_HYSTSEL_POSS 4U -#define ACMP_CON_HYSTSEL_POSE 6U -#define ACMP_CON_HYSTSEL_MSK BITS(ACMP_CON_HYSTSEL_POSS,ACMP_CON_HYSTSEL_POSE) - -#define ACMP_CON_OUTINV_POS 3U -#define ACMP_CON_OUTINV_MSK BIT(ACMP_CON_OUTINV_POS) - -#define ACMP_CON_INACTV_POS 2U -#define ACMP_CON_INACTV_MSK BIT(ACMP_CON_INACTV_POS) - -#define ACMP_CON_EN_POS 0U -#define ACMP_CON_EN_MSK BIT(ACMP_CON_EN_POS) - -/****************** Bit definition for ACMP_INPUTSEL register ************************/ - -#define ACMP_INPUTSEL_VDDLVL_POSS 8U -#define ACMP_INPUTSEL_VDDLVL_POSE 13U -#define ACMP_INPUTSEL_VDDLVL_MSK BITS(ACMP_INPUTSEL_VDDLVL_POSS,ACMP_INPUTSEL_VDDLVL_POSE) - -#define ACMP_INPUTSEL_NSEL_POSS 4U -#define ACMP_INPUTSEL_NSEL_POSE 7U -#define ACMP_INPUTSEL_NSEL_MSK BITS(ACMP_INPUTSEL_NSEL_POSS,ACMP_INPUTSEL_NSEL_POSE) - -#define ACMP_INPUTSEL_PSEL_POSS 0U -#define ACMP_INPUTSEL_PSEL_POSE 2U -#define ACMP_INPUTSEL_PSEL_MSK BITS(ACMP_INPUTSEL_PSEL_POSS,ACMP_INPUTSEL_PSEL_POSE) - -/****************** Bit definition for ACMP_STAT register ************************/ - -#define ACMP_STAT_OUT_POS 1U -#define ACMP_STAT_OUT_MSK BIT(ACMP_STAT_OUT_POS) - -#define ACMP_STAT_ACT_POS 0U -#define ACMP_STAT_ACT_MSK BIT(ACMP_STAT_ACT_POS) - -/****************** Bit definition for ACMP_IES register ************************/ - -#define ACMP_IES_WARMUP_POS 1U -#define ACMP_IES_WARMUP_MSK BIT(ACMP_IES_WARMUP_POS) - -#define ACMP_IES_EDGE_POS 0U -#define ACMP_IES_EDGE_MSK BIT(ACMP_IES_EDGE_POS) - -/****************** Bit definition for ACMP_IEV register ************************/ - -#define ACMP_IEV_WARMUP_POS 1U -#define ACMP_IEV_WARMUP_MSK BIT(ACMP_IEV_WARMUP_POS) - -#define ACMP_IEV_EDGE_POS 0U -#define ACMP_IEV_EDGE_MSK BIT(ACMP_IEV_EDGE_POS) - -/****************** Bit definition for ACMP_IEC register ************************/ - -#define ACMP_IEC_WARMUP_POS 1U -#define ACMP_IEC_WARMUP_MSK BIT(ACMP_IEC_WARMUP_POS) - -#define ACMP_IEC_EDGE_POS 0U -#define ACMP_IEC_EDGE_MSK BIT(ACMP_IEC_EDGE_POS) - -/****************** Bit definition for ACMP_RIF register ************************/ - -#define ACMP_RIF_WARMUP_POS 1U -#define ACMP_RIF_WARMUP_MSK BIT(ACMP_RIF_WARMUP_POS) - -#define ACMP_RIF_EDGE_POS 0U -#define ACMP_RIF_EDGE_MSK BIT(ACMP_RIF_EDGE_POS) - -/****************** Bit definition for ACMP_IFM register ************************/ - -#define ACMP_IFM_WARMUP_POS 1U -#define ACMP_IFM_WARMUP_MSK BIT(ACMP_IFM_WARMUP_POS) - -#define ACMP_IFM_EDGE_POS 0U -#define ACMP_IFM_EDGE_MSK BIT(ACMP_IFM_EDGE_POS) - -/****************** Bit definition for ACMP_IFC register ************************/ - -#define ACMP_IFC_WARMUP_POS 1U -#define ACMP_IFC_WARMUP_MSK BIT(ACMP_IFC_WARMUP_POS) - -#define ACMP_IFC_EDGE_POS 0U -#define ACMP_IFC_EDGE_MSK BIT(ACMP_IFC_EDGE_POS) - -/****************** Bit definition for ACMP_PORT register ************************/ - -#define ACMP_PORT_PEN_POS 0U -#define ACMP_PORT_PEN_MSK BIT(ACMP_PORT_PEN_POS) - -typedef struct -{ - __IO uint32_t CON; - __IO uint32_t INPUTSEL; - __I uint32_t STAT; - __O uint32_t IES; - __I uint32_t IEV; - __O uint32_t IEC; - __I uint32_t RIF; - __O uint32_t IFM; - __O uint32_t IFC; - __IO uint32_t PORT; -} ACMP_TypeDef; - -/****************** Bit definition for CALC_SQRTSR register ************************/ - -#define CALC_SQRTSR_BUSY_POS 0U -#define CALC_SQRTSR_BUSY_MSK BIT(CALC_SQRTSR_BUSY_POS) - -/****************** Bit definition for CALC_RDCND register ************************/ - -#define CALC_RDCND_RADICAND_POSS 0U -#define CALC_RDCND_RADICAND_POSE 31U -#define CALC_RDCND_RADICAND_MSK BITS(CALC_RDCND_RADICAND_POSS,CALC_RDCND_RADICAND_POSE) - -/****************** Bit definition for CALC_SQRTRES register ************************/ - -#define CALC_SQRTRES_RESULT_POSS 0U -#define CALC_SQRTRES_RESULT_POSE 15U -#define CALC_SQRTRES_RESULT_MSK BITS(CALC_SQRTRES_RESULT_POSS,CALC_SQRTRES_RESULT_POSE) - -/****************** Bit definition for CALC_DIVDR register ************************/ - -#define CALC_DIVDR_DIVD_POSS 0U -#define CALC_DIVDR_DIVD_POSE 31U -#define CALC_DIVDR_DIVD_MSK BITS(CALC_DIVDR_DIVD_POSS,CALC_DIVDR_DIVD_POSE) - -/****************** Bit definition for CALC_DIVSR register ************************/ - -#define CALC_DIVSR_DIVS_POSS 0U -#define CALC_DIVSR_DIVS_POSE 31U -#define CALC_DIVSR_DIVS_MSK BITS(CALC_DIVSR_DIVS_POSS,CALC_DIVSR_DIVS_POSE) - -/****************** Bit definition for CALC_DIVQR register ************************/ - -#define CALC_DIVQR_DIVQ_POSS 0U -#define CALC_DIVQR_DIVQ_POSE 31U -#define CALC_DIVQR_DIVQ_MSK BITS(CALC_DIVQR_DIVQ_POSS,CALC_DIVQR_DIVQ_POSE) - -/****************** Bit definition for CALC_DIVRR register ************************/ - -#define CALC_DIVRR_DIVS_POSS 0U -#define CALC_DIVRR_DIVS_POSE 31U -#define CALC_DIVRR_DIVS_MSK BITS(CALC_DIVRR_DIVS_POSS,CALC_DIVRR_DIVS_POSE) - -/****************** Bit definition for CALC_DIVCSR register ************************/ - -#define CALC_DIVCSR_TRM_POS 9U -#define CALC_DIVCSR_TRM_MSK BIT(CALC_DIVCSR_TRM_POS) - -#define CALC_DIVCSR_SIGN_POS 8U -#define CALC_DIVCSR_SIGN_MSK BIT(CALC_DIVCSR_SIGN_POS) - -#define CALC_DIVCSR_DZ_POS 1U -#define CALC_DIVCSR_DZ_MSK BIT(CALC_DIVCSR_DZ_POS) - -#define CALC_DIVCSR_BUSY_POS 0U -#define CALC_DIVCSR_BUSY_MSK BIT(CALC_DIVCSR_BUSY_POS) - -typedef struct -{ - __I uint32_t SQRTSR; - __IO uint32_t RDCND; - __I uint32_t SQRTRES; - uint32_t RESERVED0[5] ; - __IO uint32_t DIVDR; - __IO uint32_t DIVSR; - __I uint32_t DIVQR; - __I uint32_t DIVRR; - __IO uint32_t DIVCSR; -} CALC_TypeDef; - -/****************** Bit definition for TRNG_CR register ************************/ - -#define TRNG_CR_ADJC_POSS 16U -#define TRNG_CR_ADJC_POSE 17U -#define TRNG_CR_ADJC_MSK BITS(TRNG_CR_ADJC_POSS,TRNG_CR_ADJC_POSE) - -#define TRNG_CR_SDSEL_POSS 10U -#define TRNG_CR_SDSEL_POSE 11U -#define TRNG_CR_SDSEL_MSK BITS(TRNG_CR_SDSEL_POSS,TRNG_CR_SDSEL_POSE) - -#define TRNG_CR_DSEL_POSS 8U -#define TRNG_CR_DSEL_POSE 9U -#define TRNG_CR_DSEL_MSK BITS(TRNG_CR_DSEL_POSS,TRNG_CR_DSEL_POSE) - -#define TRNG_CR_POSTEN_POS 3U -#define TRNG_CR_POSTEN_MSK BIT(TRNG_CR_POSTEN_POS) - -#define TRNG_CR_TRNGSEL_POS 2U -#define TRNG_CR_TRNGSEL_MSK BIT(TRNG_CR_TRNGSEL_POS) - -#define TRNG_CR_ADJM_POS 1U -#define TRNG_CR_ADJM_MSK BIT(TRNG_CR_ADJM_POS) - -#define TRNG_CR_TRNGEN_POS 0U -#define TRNG_CR_TRNGEN_MSK BIT(TRNG_CR_TRNGEN_POS) - -/****************** Bit definition for TRNG_SR register ************************/ - -#define TRNG_SR_OVER_POS 3U -#define TRNG_SR_OVER_MSK BIT(TRNG_SR_OVER_POS) - -#define TRNG_SR_SERR_POS 2U -#define TRNG_SR_SERR_MSK BIT(TRNG_SR_SERR_POS) - -#define TRNG_SR_DAVLD_POS 1U -#define TRNG_SR_DAVLD_MSK BIT(TRNG_SR_DAVLD_POS) - -#define TRNG_SR_START_POS 0U -#define TRNG_SR_START_MSK BIT(TRNG_SR_START_POS) - -/****************** Bit definition for TRNG_DR register ************************/ - -#define TRNG_DR_DATA_POSS 0U -#define TRNG_DR_DATA_POSE 31U -#define TRNG_DR_DATA_MSK BITS(TRNG_DR_DATA_POSS,TRNG_DR_DATA_POSE) - -/****************** Bit definition for TRNG_SEED register ************************/ - -#define TRNG_SEED_SEED_POSS 0U -#define TRNG_SEED_SEED_POSE 31U -#define TRNG_SEED_SEED_MSK BITS(TRNG_SEED_SEED_POSS,TRNG_SEED_SEED_POSE) - -/****************** Bit definition for TRNG_CFGR register ************************/ - -#define TRNG_CFGR_TOPLMT_POSS 16U -#define TRNG_CFGR_TOPLMT_POSE 24U -#define TRNG_CFGR_TOPLMT_MSK BITS(TRNG_CFGR_TOPLMT_POSS,TRNG_CFGR_TOPLMT_POSE) - -#define TRNG_CFGR_CKDIV_POSS 8U -#define TRNG_CFGR_CKDIV_POSE 11U -#define TRNG_CFGR_CKDIV_MSK BITS(TRNG_CFGR_CKDIV_POSS,TRNG_CFGR_CKDIV_POSE) - -#define TRNG_CFGR_TSTART_POSS 0U -#define TRNG_CFGR_TSTART_POSE 2U -#define TRNG_CFGR_TSTART_MSK BITS(TRNG_CFGR_TSTART_POSS,TRNG_CFGR_TSTART_POSE) - -/****************** Bit definition for TRNG_IER register ************************/ - -#define TRNG_IER_SERR_POS 2U -#define TRNG_IER_SERR_MSK BIT(TRNG_IER_SERR_POS) - -#define TRNG_IER_DAVLD_POS 1U -#define TRNG_IER_DAVLD_MSK BIT(TRNG_IER_DAVLD_POS) - -#define TRNG_IER_START_POS 0U -#define TRNG_IER_START_MSK BIT(TRNG_IER_START_POS) - -/****************** Bit definition for TRNG_IFR register ************************/ - -#define TRNG_IFR_SERR_POS 2U -#define TRNG_IFR_SERR_MSK BIT(TRNG_IFR_SERR_POS) - -#define TRNG_IFR_DAVLD_POS 1U -#define TRNG_IFR_DAVLD_MSK BIT(TRNG_IFR_DAVLD_POS) - -#define TRNG_IFR_START_POS 0U -#define TRNG_IFR_START_MSK BIT(TRNG_IFR_START_POS) - -/****************** Bit definition for TRNG_IFCR register ************************/ - -#define TRNG_IFCR_SERRC_POS 2U -#define TRNG_IFCR_SERRC_MSK BIT(TRNG_IFCR_SERRC_POS) - -#define TRNG_IFCR_DAVLDC_POS 1U -#define TRNG_IFCR_DAVLDC_MSK BIT(TRNG_IFCR_DAVLDC_POS) - -#define TRNG_IFCR_STARTC_POS 0U -#define TRNG_IFCR_STARTC_MSK BIT(TRNG_IFCR_STARTC_POS) - -/****************** Bit definition for TRNG_ISR register ************************/ - -#define TRNG_ISR_SERR_POS 2U -#define TRNG_ISR_SERR_MSK BIT(TRNG_ISR_SERR_POS) - -#define TRNG_ISR_DAVLD_POS 1U -#define TRNG_ISR_DAVLD_MSK BIT(TRNG_ISR_DAVLD_POS) - -#define TRNG_ISR_START_POS 0U -#define TRNG_ISR_START_MSK BIT(TRNG_ISR_START_POS) - -typedef struct -{ - __IO uint32_t CR; - __I uint32_t SR; - __I uint32_t DR; - __IO uint32_t SEED; - __IO uint32_t CFGR; - __IO uint32_t IER; - __I uint32_t IFR; - __O uint32_t IFCR; - __I uint32_t ISR; -} TRNG_TypeDef; - -/****************** Bit definition for TSENSE_WPR register ************************/ - -#define TSENSE_WPR_WP_POS 0U -#define TSENSE_WPR_WP_MSK BIT(TSENSE_WPR_WP_POS) - -/****************** Bit definition for TSENSE_CR register ************************/ - -#define TSENSE_CR_TSU_POSS 12U -#define TSENSE_CR_TSU_POSE 14U -#define TSENSE_CR_TSU_MSK BITS(TSENSE_CR_TSU_POSS,TSENSE_CR_TSU_POSE) - -#define TSENSE_CR_TOM_POSS 8U -#define TSENSE_CR_TOM_POSE 10U -#define TSENSE_CR_TOM_MSK BITS(TSENSE_CR_TOM_POSS,TSENSE_CR_TOM_POSE) - -#define TSENSE_CR_CTN_POS 4U -#define TSENSE_CR_CTN_MSK BIT(TSENSE_CR_CTN_POS) - -#define TSENSE_CR_RST_POS 3U -#define TSENSE_CR_RST_MSK BIT(TSENSE_CR_RST_POS) - -#define TSENSE_CR_ENS_POS 2U -#define TSENSE_CR_ENS_MSK BIT(TSENSE_CR_ENS_POS) - -#define TSENSE_CR_REQEN_POS 1U -#define TSENSE_CR_REQEN_MSK BIT(TSENSE_CR_REQEN_POS) - -#define TSENSE_CR_EN_POS 0U -#define TSENSE_CR_EN_MSK BIT(TSENSE_CR_EN_POS) - -/****************** Bit definition for TSENSE_DR register ************************/ - -#define TSENSE_DR_ERR_POS 31U -#define TSENSE_DR_ERR_MSK BIT(TSENSE_DR_ERR_POS) - -#define TSENSE_DR_DATA_POSS 0U -#define TSENSE_DR_DATA_POSE 15U -#define TSENSE_DR_DATA_MSK BITS(TSENSE_DR_DATA_POSS,TSENSE_DR_DATA_POSE) - -/****************** Bit definition for TSENSE_PSR register ************************/ - -#define TSENSE_PSR_PRS_POSS 0U -#define TSENSE_PSR_PRS_POSE 7U -#define TSENSE_PSR_PRS_MSK BITS(TSENSE_PSR_PRS_POSS,TSENSE_PSR_PRS_POSE) - -/****************** Bit definition for TSENSE_IE register ************************/ - -#define TSENSE_IE_TSENSE_POS 0U -#define TSENSE_IE_TSENSE_MSK BIT(TSENSE_IE_TSENSE_POS) - -/****************** Bit definition for TSENSE_IF register ************************/ - -#define TSENSE_IF_TSENSE_POS 0U -#define TSENSE_IF_TSENSE_MSK BIT(TSENSE_IF_TSENSE_POS) - -/****************** Bit definition for TSENSE_IFCR register ************************/ - -#define TSENSE_IFCR_TSENSE_POS 0U -#define TSENSE_IFCR_TSENSE_MSK BIT(TSENSE_IFCR_TSENSE_POS) - -/****************** Bit definition for TSENSE_LTGR register ************************/ - -#define TSENSE_LTGR_LTG_POSS 0U -#define TSENSE_LTGR_LTG_POSE 20U -#define TSENSE_LTGR_LTG_MSK BITS(TSENSE_LTGR_LTG_POSS,TSENSE_LTGR_LTG_POSE) - -/****************** Bit definition for TSENSE_HTGR register ************************/ - -#define TSENSE_HTGR_HTG_POSS 0U -#define TSENSE_HTGR_HTG_POSE 20U -#define TSENSE_HTGR_HTG_MSK BITS(TSENSE_HTGR_HTG_POSS,TSENSE_HTGR_HTG_POSE) - -/****************** Bit definition for TSENSE_TBDR register ************************/ - -#define TSENSE_TBDR_TBD_POSS 0U -#define TSENSE_TBDR_TBD_POSE 15U -#define TSENSE_TBDR_TBD_MSK BITS(TSENSE_TBDR_TBD_POSS,TSENSE_TBDR_TBD_POSE) - -/****************** Bit definition for TSENSE_TCALBDR register ************************/ - -#define TSENSE_TCALBDR_TCAL_POSS 0U -#define TSENSE_TCALBDR_TCAL_POSE 16U -#define TSENSE_TCALBDR_TCAL_MSK BITS(TSENSE_TCALBDR_TCAL_POSS,TSENSE_TCALBDR_TCAL_POSE) - -/****************** Bit definition for TSENSE_SR register ************************/ - -#define TSENSE_SR_TSOUT_POS 31U -#define TSENSE_SR_TSOUT_MSK BIT(TSENSE_SR_TSOUT_POS) - -#define TSENSE_SR_NVLD_POS 25U -#define TSENSE_SR_NVLD_MSK BIT(TSENSE_SR_NVLD_POS) - -#define TSENSE_SR_TCAL_POSS 0U -#define TSENSE_SR_TCAL_POSE 24U -#define TSENSE_SR_TCAL_MSK BITS(TSENSE_SR_TCAL_POSS,TSENSE_SR_TCAL_POSE) - -typedef struct -{ - __IO uint32_t WPR; - __IO uint32_t CR; - __I uint32_t DR; - __IO uint32_t PSR; - __IO uint32_t IE; - __I uint32_t IF; - __IO uint32_t IFCR; - __IO uint32_t LTGR; - __IO uint32_t HTGR; - __IO uint32_t TBDR; - __IO uint32_t TCALBDR; - __I uint32_t SR; -} TSENSE_TypeDef; - -/****************** Bit definition for IWDT_LOAD register ************************/ - -#define IWDT_LOAD_LOAD_POSS 0U -#define IWDT_LOAD_LOAD_POSE 31U -#define IWDT_LOAD_LOAD_MSK BITS(IWDT_LOAD_LOAD_POSS,IWDT_LOAD_LOAD_POSE) - -/****************** Bit definition for IWDT_VALUE register ************************/ - -#define IWDT_VALUE_VALUE_POSS 0U -#define IWDT_VALUE_VALUE_POSE 31U -#define IWDT_VALUE_VALUE_MSK BITS(IWDT_VALUE_VALUE_POSS,IWDT_VALUE_VALUE_POSE) - -/****************** Bit definition for IWDT_CON register ************************/ - -#define IWDT_CON_CLKS_POS 3U -#define IWDT_CON_CLKS_MSK BIT(IWDT_CON_CLKS_POS) - -#define IWDT_CON_RSTEN_POS 2U -#define IWDT_CON_RSTEN_MSK BIT(IWDT_CON_RSTEN_POS) - -#define IWDT_CON_IE_POS 1U -#define IWDT_CON_IE_MSK BIT(IWDT_CON_IE_POS) - -#define IWDT_CON_EN_POS 0U -#define IWDT_CON_EN_MSK BIT(IWDT_CON_EN_POS) - -/****************** Bit definition for IWDT_INTCLR register ************************/ - -#define IWDT_INTCLR_INTCLR_POSS 0U -#define IWDT_INTCLR_INTCLR_POSE 31U -#define IWDT_INTCLR_INTCLR_MSK BITS(IWDT_INTCLR_INTCLR_POSS,IWDT_INTCLR_INTCLR_POSE) - -/****************** Bit definition for IWDT_RIS register ************************/ - -#define IWDT_RIS_WDTIF_POS 0U -#define IWDT_RIS_WDTIF_MSK BIT(IWDT_RIS_WDTIF_POS) - -/****************** Bit definition for IWDT_LOCK register ************************/ - -#define IWDT_LOCK_LOCK_POS 0U -#define IWDT_LOCK_LOCK_MSK BIT(IWDT_LOCK_LOCK_POS) - -typedef struct -{ - __O uint32_t LOAD; - __I uint32_t VALUE; - __IO uint32_t CON; - __O uint32_t INTCLR; - __I uint32_t RIS; - uint32_t RESERVED0[59] ; - __IO uint32_t LOCK; -} IWDT_TypeDef; - -/****************** Bit definition for WWDT_LOAD register ************************/ - -#define WWDT_LOAD_LOAD_POSS 0U -#define WWDT_LOAD_LOAD_POSE 31U -#define WWDT_LOAD_LOAD_MSK BITS(WWDT_LOAD_LOAD_POSS,WWDT_LOAD_LOAD_POSE) - -/****************** Bit definition for WWDT_VALUE register ************************/ - -#define WWDT_VALUE_VALUE_POSS 0U -#define WWDT_VALUE_VALUE_POSE 31U -#define WWDT_VALUE_VALUE_MSK BITS(WWDT_VALUE_VALUE_POSS,WWDT_VALUE_VALUE_POSE) - -/****************** Bit definition for WWDT_CON register ************************/ - -#define WWDT_CON_WWDTWIN_POSS 4U -#define WWDT_CON_WWDTWIN_POSE 5U -#define WWDT_CON_WWDTWIN_MSK BITS(WWDT_CON_WWDTWIN_POSS,WWDT_CON_WWDTWIN_POSE) - -#define WWDT_CON_CLKS_POS 3U -#define WWDT_CON_CLKS_MSK BIT(WWDT_CON_CLKS_POS) - -#define WWDT_CON_RSTEN_POS 2U -#define WWDT_CON_RSTEN_MSK BIT(WWDT_CON_RSTEN_POS) - -#define WWDT_CON_IE_POS 1U -#define WWDT_CON_IE_MSK BIT(WWDT_CON_IE_POS) - -#define WWDT_CON_EN_POS 0U -#define WWDT_CON_EN_MSK BIT(WWDT_CON_EN_POS) - -/****************** Bit definition for WWDT_INTCLR register ************************/ - -#define WWDT_INTCLR_INTCLR_POSS 0U -#define WWDT_INTCLR_INTCLR_POSE 31U -#define WWDT_INTCLR_INTCLR_MSK BITS(WWDT_INTCLR_INTCLR_POSS,WWDT_INTCLR_INTCLR_POSE) - -/****************** Bit definition for WWDT_RIS register ************************/ - -#define WWDT_RIS_WWDTIF_POS 0U -#define WWDT_RIS_WWDTIF_MSK BIT(WWDT_RIS_WWDTIF_POS) - -/****************** Bit definition for WWDT_LOCK register ************************/ - -#define WWDT_LOCK_LOCK_POS 0U -#define WWDT_LOCK_LOCK_MSK BIT(WWDT_LOCK_LOCK_POS) - -typedef struct -{ - __O uint32_t LOAD; - __I uint32_t VALUE; - __IO uint32_t CON; - __O uint32_t INTCLR; - __I uint32_t RIS; - uint32_t RESERVED0[59]; - __IO uint32_t LOCK; -} WWDT_TypeDef; - -/****************** Bit definition for LP16T_CON0 register ************************/ - -#define LP16T_CON0_PRELOAD_POS 22U -#define LP16T_CON0_PRELOAD_MSK BIT(LP16T_CON0_PRELOAD_POS) - -#define LP16T_CON0_WAVEPOL_POS 21U -#define LP16T_CON0_WAVEPOL_MSK BIT(LP16T_CON0_WAVEPOL_POS) - -#define LP16T_CON0_WAVE_POSS 19U -#define LP16T_CON0_WAVE_POSE 20U -#define LP16T_CON0_WAVE_MSK BITS(LP16T_CON0_WAVE_POSS,LP16T_CON0_WAVE_POSE) - -#define LP16T_CON0_TRIGEN_POSS 17U -#define LP16T_CON0_TRIGEN_POSE 18U -#define LP16T_CON0_TRIGEN_MSK BITS(LP16T_CON0_TRIGEN_POSS,LP16T_CON0_TRIGEN_POSE) - -#define LP16T_CON0_TRIGSEL_POSS 13U -#define LP16T_CON0_TRIGSEL_POSE 15U -#define LP16T_CON0_TRIGSEL_MSK BITS(LP16T_CON0_TRIGSEL_POSS,LP16T_CON0_TRIGSEL_POSE) - -#define LP16T_CON0_PRESC_POSS 9U -#define LP16T_CON0_PRESC_POSE 11U -#define LP16T_CON0_PRESC_MSK BITS(LP16T_CON0_PRESC_POSS,LP16T_CON0_PRESC_POSE) - -#define LP16T_CON0_TRGFLT_POSS 6U -#define LP16T_CON0_TRGFLT_POSE 7U -#define LP16T_CON0_TRGFLT_MSK BITS(LP16T_CON0_TRGFLT_POSS,LP16T_CON0_TRGFLT_POSE) - -#define LP16T_CON0_CKFLT_POSS 3U -#define LP16T_CON0_CKFLT_POSE 4U -#define LP16T_CON0_CKFLT_MSK BITS(LP16T_CON0_CKFLT_POSS,LP16T_CON0_CKFLT_POSE) - -#define LP16T_CON0_CKPOL_POS 1U -#define LP16T_CON0_CKPOL_MSK BIT(LP16T_CON0_CKPOL_POS) - -#define LP16T_CON0_CKSEL_POS 0U -#define LP16T_CON0_CKSEL_MSK BIT(LP16T_CON0_CKSEL_POS) - -/****************** Bit definition for LP16T_CON1 register ************************/ - -#define LP16T_CON1_CNTSTRT_POS 2U -#define LP16T_CON1_CNTSTRT_MSK BIT(LP16T_CON1_CNTSTRT_POS) - -#define LP16T_CON1_SNGSTRT_POS 1U -#define LP16T_CON1_SNGSTRT_MSK BIT(LP16T_CON1_SNGSTRT_POS) - -#define LP16T_CON1_ENABLE_POS 0U -#define LP16T_CON1_ENABLE_MSK BIT(LP16T_CON1_ENABLE_POS) - -/****************** Bit definition for LP16T_ARR register ************************/ - -#define LP16T_ARR_ARR_POSS 0U -#define LP16T_ARR_ARR_POSE 15U -#define LP16T_ARR_ARR_MSK BITS(LP16T_ARR_ARR_POSS,LP16T_ARR_ARR_POSE) - -/****************** Bit definition for LP16T_CNT register ************************/ - -#define LP16T_CNT_CNT_POSS 0U -#define LP16T_CNT_CNT_POSE 15U -#define LP16T_CNT_CNT_MSK BITS(LP16T_CNT_CNT_POSS,LP16T_CNT_CNT_POSE) - -/****************** Bit definition for LP16T_CMP register ************************/ - -#define LP16T_CMP_CMP_POSS 0U -#define LP16T_CMP_CMP_POSE 15U -#define LP16T_CMP_CMP_MSK BITS(LP16T_CMP_CMP_POSS,LP16T_CMP_CMP_POSE) - -/****************** Bit definition for LP16T_IER register ************************/ - -#define LP16T_IER_EXTTRIGIE_POS 2U -#define LP16T_IER_EXTTRIGIE_MSK BIT(LP16T_IER_EXTTRIGIE_POS) - -#define LP16T_IER_ARRMIE_POS 1U -#define LP16T_IER_ARRMIE_MSK BIT(LP16T_IER_ARRMIE_POS) - -#define LP16T_IER_CMPMIE_POS 0U -#define LP16T_IER_CMPMIE_MSK BIT(LP16T_IER_CMPMIE_POS) - -/****************** Bit definition for LP16T_ISR register ************************/ - -#define LP16T_ISR_EXTTRIG_POS 2U -#define LP16T_ISR_EXTTRIG_MSK BIT(LP16T_ISR_EXTTRIG_POS) - -#define LP16T_ISR_ARRM_POS 1U -#define LP16T_ISR_ARRM_MSK BIT(LP16T_ISR_ARRM_POS) - -#define LP16T_ISR_CMPM_POS 0U -#define LP16T_ISR_CMPM_MSK BIT(LP16T_ISR_CMPM_POS) - -/****************** Bit definition for LP16T_IFC register ************************/ - -#define LP16T_IFC_EXTTRIG_POS 2U -#define LP16T_IFC_EXTTRIG_MSK BIT(LP16T_IFC_EXTTRIG_POS) - -#define LP16T_IFC_ARRM_POS 1U -#define LP16T_IFC_ARRM_MSK BIT(LP16T_IFC_ARRM_POS) - -#define LP16T_IFC_CMPM_POS 0U -#define LP16T_IFC_CMPM_MSK BIT(LP16T_IFC_CMPM_POS) - -/****************** Bit definition for LP16T_UPDATE register ************************/ - -#define LP16T_UPDATE_UDIS_POS 0U -#define LP16T_UPDATE_UDIS_MSK BIT(LP16T_UPDATE_UDIS_POS) - -/****************** Bit definition for LP16T_SYNCSTAT register ************************/ - -#define LP16T_SYNCSTAT_CMPWBSY_POS 3U -#define LP16T_SYNCSTAT_CMPWBSY_MSK BIT(LP16T_SYNCSTAT_CMPWBSY_POS) - -#define LP16T_SYNCSTAT_ARRWBSY_POS 2U -#define LP16T_SYNCSTAT_ARRWBSY_MSK BIT(LP16T_SYNCSTAT_ARRWBSY_POS) - -#define LP16T_SYNCSTAT_CON1WBSY_POS 1U -#define LP16T_SYNCSTAT_CON1WBSY_MSK BIT(LP16T_SYNCSTAT_CON1WBSY_POS) - -typedef struct -{ - __IO uint32_t CON0; - __IO uint32_t CON1; - __IO uint32_t ARR; - __I uint32_t CNT; - __IO uint32_t CMP; - uint32_t RESERVED0 ; - __IO uint32_t IER; - __I uint32_t ISR; - __O uint32_t IFC; - uint32_t RESERVED1[3] ; - __IO uint32_t UPDATE; - __I uint32_t SYNCSTAT; -} LPTIM_TypeDef; - -/****************** Bit definition for DBGC_IDCODE register ************************/ - -#define DBGC_IDCODE_REV_ID_POSS 16U -#define DBGC_IDCODE_REV_ID_POSE 31U -#define DBGC_IDCODE_REV_ID_MSK BITS(DBGC_IDCODE_REV_ID_POSS,DBGC_IDCODE_REV_ID_POSE) - -#define DBGC_IDCODE_CORE_ID_POSS 12U -#define DBGC_IDCODE_CORE_ID_POSE 15U -#define DBGC_IDCODE_CORE_ID_MSK BITS(DBGC_IDCODE_CORE_ID_POSS,DBGC_IDCODE_CORE_ID_POSE) - -#define DBGC_IDCODE_DEV_ID_POSS 0U -#define DBGC_IDCODE_DEV_ID_POSE 11U -#define DBGC_IDCODE_DEV_ID_MSK BITS(DBGC_IDCODE_DEV_ID_POSS,DBGC_IDCODE_DEV_ID_POSE) - -/****************** Bit definition for DBGC_CR register ************************/ - -#define DBGC_CR_DBG_STANDBY_POS 3U -#define DBGC_CR_DBG_STANDBY_MSK BIT(DBGC_CR_DBG_STANDBY_POS) - -#define DBGC_CR_DBG_STOP2_POS 2U -#define DBGC_CR_DBG_STOP2_MSK BIT(DBGC_CR_DBG_STOP2_POS) - -#define DBGC_CR_DBG_STOP1_POS 1U -#define DBGC_CR_DBG_STOP1_MSK BIT(DBGC_CR_DBG_STOP1_POS) - -#define DBGC_CR_DBG_SLEEP_POS 0U -#define DBGC_CR_DBG_SLEEP_MSK BIT(DBGC_CR_DBG_SLEEP_POS) - -/****************** Bit definition for DBGC_APB1FZ register ************************/ - -#define DBGC_APB1FZ_CAN_STOP_POS 12U -#define DBGC_APB1FZ_CAN_STOP_MSK BIT(DBGC_APB1FZ_CAN_STOP_POS) - -#define DBGC_APB1FZ_I2C1_SMBUS_TO_POS 9U -#define DBGC_APB1FZ_I2C1_SMBUS_TO_MSK BIT(DBGC_APB1FZ_I2C1_SMBUS_TO_POS) - -#define DBGC_APB1FZ_I2C0_SMBUS_TO_POS 8U -#define DBGC_APB1FZ_I2C0_SMBUS_TO_MSK BIT(DBGC_APB1FZ_I2C0_SMBUS_TO_POS) - -#define DBGC_APB1FZ_TIM7_STOP_POS 7U -#define DBGC_APB1FZ_TIM7_STOP_MSK BIT(DBGC_APB1FZ_TIM7_STOP_POS) - -#define DBGC_APB1FZ_TIM6_STOP_POS 6U -#define DBGC_APB1FZ_TIM6_STOP_MSK BIT(DBGC_APB1FZ_TIM6_STOP_POS) - -#define DBGC_APB1FZ_TIM5_STOP_POS 5U -#define DBGC_APB1FZ_TIM5_STOP_MSK BIT(DBGC_APB1FZ_TIM5_STOP_POS) - -#define DBGC_APB1FZ_TIM4_STOP_POS 4U -#define DBGC_APB1FZ_TIM4_STOP_MSK BIT(DBGC_APB1FZ_TIM4_STOP_POS) - -#define DBGC_APB1FZ_TIM3_STOP_POS 3U -#define DBGC_APB1FZ_TIM3_STOP_MSK BIT(DBGC_APB1FZ_TIM3_STOP_POS) - -#define DBGC_APB1FZ_TIM2_STOP_POS 2U -#define DBGC_APB1FZ_TIM2_STOP_MSK BIT(DBGC_APB1FZ_TIM2_STOP_POS) - -#define DBGC_APB1FZ_TIM1_STOP_POS 1U -#define DBGC_APB1FZ_TIM1_STOP_MSK BIT(DBGC_APB1FZ_TIM1_STOP_POS) - -#define DBGC_APB1FZ_TIM0_STOP_POS 0U -#define DBGC_APB1FZ_TIM0_STOP_MSK BIT(DBGC_APB1FZ_TIM0_STOP_POS) - -/****************** Bit definition for DBGC_APB2FZ register ************************/ - -#define DBGC_APB2FZ_RTC_STOP_POS 10U -#define DBGC_APB2FZ_RTC_STOP_MSK BIT(DBGC_APB2FZ_RTC_STOP_POS) - -#define DBGC_APB2FZ_WWDT_STOP_POS 9U -#define DBGC_APB2FZ_WWDT_STOP_MSK BIT(DBGC_APB2FZ_WWDT_STOP_POS) - -#define DBGC_APB2FZ_IWDT_STOP_POS 8U -#define DBGC_APB2FZ_IWDT_STOP_MSK BIT(DBGC_APB2FZ_IWDT_STOP_POS) - -#define DBGC_APB2FZ_LPTIM0_STOP_POS 0U -#define DBGC_APB2FZ_LPTIM0_STOP_MSK BIT(DBGC_APB2FZ_LPTIM0_STOP_POS) - -typedef struct -{ - __I uint32_t IDCODE; - __IO uint32_t CR; - __IO uint32_t APB1FZ; - __IO uint32_t APB2FZ; -} DBGC_TypeDef; - - -/* Base addresses */ -#define SRAM_BASE (0x20000000UL) -#define APB1_BASE (0x40000000UL) -#define APB2_BASE (0x40040000UL) -#define AHB_BASE (0x40080000UL) - -/* APB1 peripherals Base Address */ -#define GP16C4T0_BASE (APB1_BASE + 0x0000) -#define BS16T0_BASE (APB1_BASE + 0x0400) -#define GP16C2T0_BASE (APB1_BASE + 0x0800) -#define GP16C2T1_BASE (APB1_BASE + 0x0C00) -#define BS16T1_BASE (APB1_BASE + 0x1000) -#define BS16T2_BASE (APB1_BASE + 0x1400) -#define GP16C4T1_BASE (APB1_BASE + 0x1800) -#define BS16T3_BASE (APB1_BASE + 0x1C00) -#define UART0_BASE (APB1_BASE + 0x4000) -#define UART1_BASE (APB1_BASE + 0x4400) -#define UART2_BASE (APB1_BASE + 0x4800) -#define UART3_BASE (APB1_BASE + 0x4C00) -#define USART0_BASE (APB1_BASE + 0x5000) -#define USART1_BASE (APB1_BASE + 0x5400) -#define SPI0_BASE (APB1_BASE + 0x6000) -#define SPI1_BASE (APB1_BASE + 0x6400) -#define I2C0_BASE (APB1_BASE + 0x8000) -#define I2C1_BASE (APB1_BASE + 0x8400) -#define DMA0_BASE (APB1_BASE + 0xC000) - -/* APB2 peripherals Base Address */ -#define LPTIM0_BASE (APB2_BASE + 0x0000) -#define LPUART0_BASE (APB2_BASE + 0x1000) -#define ADC0_BASE (APB2_BASE + 0x2000) -#define ACMP0_BASE (APB2_BASE + 0x3000) -#define ACMP1_BASE (APB2_BASE + 0x3400) -#define DAC0_BASE (APB2_BASE + 0x5000) -#define WWDT_BASE (APB2_BASE + 0x6000) -#define IWDT_BASE (APB2_BASE + 0x6400) -#define LCD_BASE (APB2_BASE + 0x7000) -#define BKPC_BASE (APB2_BASE + 0x8000) -#define RTC_BASE (APB2_BASE + 0x8400) -#define TSENSE_BASE (APB2_BASE + 0x8800) -#define DBGC_BASE (APB2_BASE + 0xA000) - -/* AHB peripherals Base Address */ -#define SYSCFG_BASE (AHB_BASE + 0x0000) -#define CMU_BASE (AHB_BASE + 0x0400) -#define RMU_BASE (AHB_BASE + 0x0800) -#define PMU_BASE (AHB_BASE + 0x0C00) -#define MSC_BASE (AHB_BASE + 0x1000) -#define GPIOA_BASE (AHB_BASE + 0x4000) -#define GPIOB_BASE (AHB_BASE + 0x4040) -#define GPIOC_BASE (AHB_BASE + 0x4080) -#define GPIOD_BASE (AHB_BASE + 0x40C0) -#define GPIOE_BASE (AHB_BASE + 0x4100) -#define GPIOF_BASE (AHB_BASE + 0x4140) -#define GPIOG_BASE (AHB_BASE + 0x4180) -#define GPIOH_BASE (AHB_BASE + 0x41C0) -#define EXTI_BASE (AHB_BASE + 0x4300) -#define CRC_BASE (AHB_BASE + 0x5000) -#define CALC_BASE (AHB_BASE + 0x5400) -#define CRYPT_BASE (AHB_BASE + 0x5800) -#define TRNG_BASE (AHB_BASE + 0x5C00) -#define PIS_BASE (AHB_BASE + 0x6000) - -/* APB1 peripherals */ -#define GP16C4T0 ((TIMER_TypeDef *)GP16C4T0_BASE) -#define BS16T0 ((TIMER_TypeDef *)BS16T0_BASE) -#define GP16C2T0 ((TIMER_TypeDef *)GP16C2T0_BASE) -#define GP16C2T1 ((TIMER_TypeDef *)GP16C2T1_BASE) -#define BS16T1 ((TIMER_TypeDef *)BS16T1_BASE) -#define BS16T2 ((TIMER_TypeDef *)BS16T2_BASE) -#define GP16C4T1 ((TIMER_TypeDef *)GP16C4T1_BASE) -#define BS16T3 ((TIMER_TypeDef *)BS16T3_BASE) -#define UART0 ((UART_TypeDef *)UART0_BASE) -#define UART1 ((UART_TypeDef *)UART1_BASE) -#define UART2 ((UART_TypeDef *)UART2_BASE) -#define UART3 ((UART_TypeDef *)UART3_BASE) -#define USART0 ((USART_TypeDef *)USART0_BASE) -#define USART1 ((USART_TypeDef *)USART1_BASE) -#define SPI0 ((SPI_TypeDef *)SPI0_BASE) -#define SPI1 ((SPI_TypeDef *)SPI1_BASE) -#define I2C0 ((I2C_TypeDef *)I2C0_BASE) -#define I2C1 ((I2C_TypeDef *)I2C1_BASE) -#define DMA0 ((DMA_TypeDef *)DMA0_BASE) - -/* APB2 peripherals */ -#define LPTIM0 ((LPTIM_TypeDef *)LPTIM0_BASE) -#define LPUART0 ((LPUART_TypeDef *)LPUART0_BASE) -#define ADC0 ((ADC_TypeDef *)ADC0_BASE) -#define ACMP0 ((ACMP_TypeDef *)ACMP0_BASE) -#define ACMP1 ((ACMP_TypeDef *)ACMP1_BASE) -#define WWDT ((WWDT_TypeDef *)WWDT_BASE) -#define IWDT ((IWDT_TypeDef *)IWDT_BASE) -#define LCD ((LCD_TypeDef *)LCD_BASE) -#define BKPC ((BKPC_TypeDef *)BKPC_BASE) -#define RTC ((RTC_TypeDef *)RTC_BASE) -#define TSENSE ((TSENSE_TypeDef *)TSENSE_BASE) -#define DBGC ((DBGC_TypeDef *)DBGC_BASE) - -/* AHB peripherals */ -#define SYSCFG ((SYSCFG_TypeDef *)SYSCFG_BASE) -#define CMU ((CMU_TypeDef *)CMU_BASE) -#define RMU ((RMU_TypeDef *)RMU_BASE) -#define PMU ((PMU_TypeDef *)PMU_BASE) -#define MSC ((MSC_TypeDef *)MSC_BASE) -#define GPIOA ((GPIO_TypeDef *)GPIOA_BASE) -#define GPIOB ((GPIO_TypeDef *)GPIOB_BASE) -#define GPIOC ((GPIO_TypeDef *)GPIOC_BASE) -#define GPIOD ((GPIO_TypeDef *)GPIOD_BASE) -#define GPIOE ((GPIO_TypeDef *)GPIOE_BASE) -#define GPIOF ((GPIO_TypeDef *)GPIOF_BASE) -#define GPIOG ((GPIO_TypeDef *)GPIOG_BASE) -#define GPIOH ((GPIO_TypeDef *)GPIOH_BASE) -#define EXTI ((EXTI_TypeDef *)EXTI_BASE) -#define CRC ((CRC_TypeDef *)CRC_BASE) -#define CALC ((CALC_TypeDef *)CALC_BASE) -#define CRYPT ((CRYPT_TypeDef *)CRYPT_BASE) -#define TRNG ((TRNG_TypeDef *)TRNG_BASE) -#define PIS ((PIS_TypeDef *)PIS_BASE) - -#endif diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Startup/iar/startup_es32f033x.s b/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Startup/iar/startup_es32f033x.s deleted file mode 100644 index f341d9e5ac..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Startup/iar/startup_es32f033x.s +++ /dev/null @@ -1,266 +0,0 @@ -;******************************************************************************* -; file : startup_es32f033x.s -; description: es32f033x Device Startup File -; author : AE Team -; data : 10 Dec 2018 -; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. -;******************************************************************************* - - MODULE ?cstartup - - ;; Forward declaration of sections. - SECTION CSTACK:DATA:NOROOT(3) - SECTION .intvec:CODE:NOROOT(2) - - EXTERN __iar_program_start - PUBLIC __vector_table - - DATA -__vector_table - DCD sfe(CSTACK) ;0, load top of stack - DCD Reset_Handler ;1, reset handler - DCD NMI_Handler ;2, nmi handler - DCD HardFault_Handler ;3, hard fault handler - DCD 0 ;4, MPU Fault Handler - DCD 0 ;5, Bus Fault Handler - DCD 0 ;6, Usage Fault Handler - DCD 0 ;7, Reserved - DCD 0 ;8, Reserved - DCD 0 ;9, Reserved - DCD 0 ;10, Reserved - DCD SVC_Handler ;11, svcall handler - DCD DebugMon_Handler ;12, Debug Monitor Handler - DCD 0 ;13, Reserved - DCD PendSV_Handler ;14, pendsv handler - DCD SysTick_Handler ;15, systick handler - DCD WWDG_IWDG_Handler ;16, irq0 WWDG_IWDG handler - DCD LVD_Handler ;17, irq1 LVD handler - DCD RTC_TEMP_Handler ;18, irq2 RTC handler - DCD CRYPT_TRNG_Handler ;19, irq3 CRYPT handler - DCD CMU_Handler ;20, irq4 CMU handler - DCD EXTI0_3_Handler ;21, irq5 EXTI0_3 handler - DCD EXTI4_7_Handler ;22, irq6 EXTI4_7 handler - DCD EXTI8_11_Handler ;23, irq7 EXTI8_11 handler - DCD EXTI12_15_Handler ;24, irq8 EXTI12_15 handler - DCD DMA_Handler ;25, irq9 DMA handler - DCD CAN0_Handler ;26, irq10 CAN0_CRYPT_TRNG handler - DCD LPTIM0_SPI2_Handler ;27, irq11 LPTIM0_SPI2 handler - DCD ADC_ACMP_Handler ;28, irq12 ADC_ACMP handler - DCD AD16C4T0_BRK_UP_TRIG_COM_Handler ;29, irq13 AD16C4T0_BRK_UP_TRIG_COM handler - DCD AD16C4T0_CC_Handler ;30, irq14 AD16C4T0_CC handler - DCD BS16T0_Handler ;31, irq15 BS16T0 handler - DCD 0 ;32, irq16 Reserved - DCD GP16C2T0_Handler ;33, irq17 GP16C2T0 handler - DCD GP16C2T1_Handler ;34, irq18 GP16C2T1 handler - DCD BS16T1_UART2_Handler ;35, irq19 BS16T1_UART2 handler - DCD BS16T2_UART3_Handler ;36, irq20 BS16T2_UART3 handler - DCD GP16C4T0_LCD_Handler ;37, irq21 GP16C4T0_LCD handler - DCD BS16T3_DAC0_Handler ;38, irq22 BS16T3_DAC0 handler - DCD I2C0_Handler ;39, irq23 I2C0 handler - DCD I2C1_Handler ;40, irq24 I2C1 handler - DCD SPI0_Handler ;41, irq25 SPI0 handler - DCD SPI1_Handler ;42, irq26 SPI1 handler - DCD UART0_Handler ;43, irq27 UART0 handler - DCD UART1_Handler ;44, irq28 UART1 handler - DCD USART0_Handler ;45, irq29 USART0 handler - DCD USART1_Handler ;46, irq30 USART1 handler - DCD LPUART0_Handler ;47, irq31 LPUART0 handler - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; Default interrupt handlers. -;; - THUMB - - PUBWEAK Reset_Handler - SECTION .text:CODE:NOROOT:REORDER(2) -Reset_Handler - 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 DebugMon_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -DebugMon_Handler - B DebugMon_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 WWDG_IWDG_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -WWDG_IWDG_Handler - B WWDG_IWDG_Handler - - PUBWEAK LVD_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -LVD_Handler - B LVD_Handler - - PUBWEAK RTC_TEMP_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -RTC_TEMP_Handler - B RTC_TEMP_Handler - - PUBWEAK CRYPT_TRNG_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -CRYPT_TRNG_Handler - B CRYPT_TRNG_Handler - - PUBWEAK CMU_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -CMU_Handler - B CMU_Handler - - PUBWEAK EXTI0_3_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -EXTI0_3_Handler - B EXTI0_3_Handler - - PUBWEAK EXTI4_7_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -EXTI4_7_Handler - B EXTI4_7_Handler - - PUBWEAK EXTI8_11_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -EXTI8_11_Handler - B EXTI8_11_Handler - - PUBWEAK EXTI12_15_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -EXTI12_15_Handler - B EXTI12_15_Handler - - PUBWEAK DMA_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -DMA_Handler - B DMA_Handler - - PUBWEAK CAN0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -CAN0_Handler - B CAN0_Handler - - PUBWEAK LPTIM0_SPI2_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -LPTIM0_SPI2_Handler - B LPTIM0_SPI2_Handler - - PUBWEAK ADC_ACMP_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -ADC_ACMP_Handler - B ADC_ACMP_Handler - - PUBWEAK AD16C4T0_BRK_UP_TRIG_COM_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -AD16C4T0_BRK_UP_TRIG_COM_Handler - B AD16C4T0_BRK_UP_TRIG_COM_Handler - - PUBWEAK AD16C4T0_CC_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -AD16C4T0_CC_Handler - B AD16C4T0_CC_Handler - - PUBWEAK BS16T0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -BS16T0_Handler - B BS16T0_Handler - - PUBWEAK GP16C2T0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C2T0_Handler - B GP16C2T0_Handler - - PUBWEAK GP16C2T1_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C2T1_Handler - B GP16C2T1_Handler - - PUBWEAK BS16T1_UART2_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -BS16T1_UART2_Handler - B BS16T1_UART2_Handler - - PUBWEAK BS16T2_UART3_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -BS16T2_UART3_Handler - B BS16T2_UART3_Handler - - PUBWEAK GP16C4T0_LCD_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -GP16C4T0_LCD_Handler - B GP16C4T0_LCD_Handler - - PUBWEAK BS16T3_DAC0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -BS16T3_DAC0_Handler - B BS16T3_DAC0_Handler - - PUBWEAK I2C0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -I2C0_Handler - B I2C0_Handler - - PUBWEAK I2C1_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -I2C1_Handler - B I2C1_Handler - - PUBWEAK SPI0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -SPI0_Handler - B SPI0_Handler - - PUBWEAK SPI1_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -SPI1_Handler - B SPI1_Handler - - PUBWEAK UART0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -UART0_Handler - B UART0_Handler - - PUBWEAK UART1_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -UART1_Handler - B UART1_Handler - - PUBWEAK USART0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -USART0_Handler - B USART0_Handler - - PUBWEAK USART1_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -USART1_Handler - B USART1_Handler - - PUBWEAK LPUART0_Handler - SECTION .text:CODE:NOROOT:REORDER(1) -LPUART0_Handler - B LPUART0_Handler - - END diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Startup/keil/startup_es32f033x.s b/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Startup/keil/startup_es32f033x.s deleted file mode 100644 index 11b29917a3..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/Startup/keil/startup_es32f033x.s +++ /dev/null @@ -1,335 +0,0 @@ -;******************************************************************************* -; file : startup_es32f033x.s -; description: es32f033x Device Startup File -; author : AE Team -; data : 29 Aug 2017 -; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. -;******************************************************************************* - -;Stack Configuration------------------------------------------------------------ -Stack_Size EQU 0x00000400 - AREA STACK, NOINIT, READWRITE, ALIGN=3 -Stack_Mem SPACE Stack_Size -__initial_sp -;------------------------------------------------------------------------------- - -;Heap Configuration------------------------------------------------------------- -Heap_Size EQU 0x00000000 - 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 - -__Vectors DCD __initial_sp ;0, load top of stack - DCD Reset_Handler ;1, reset handler - DCD NMI_Handler ;2, nmi handler - DCD HardFault_Handler ;3, hard fault handler - DCD 0 ;4, MPU Fault Handler - DCD 0 ;5, Bus Fault Handler - DCD 0 ;6, Usage Fault Handler - DCD 0 ;7, Reserved - DCD 0 ;8, Reserved - DCD 0 ;9, Reserved - DCD 0 ;10, Reserved - DCD SVC_Handler ;11, svcall handler - DCD DebugMon_Handler ;12, Debug Monitor Handler - DCD 0 ;13, Reserved - DCD PendSV_Handler ;14, pendsv handler - DCD SysTick_Handler ;15, systick handler - DCD WWDG_IWDG_Handler ;16, irq0 WWDG_IWDG handler - DCD LVD_Handler ;17, irq1 LVD handler - DCD RTC_TEMP_Handler ;18, irq2 RTC handler - DCD CRYPT_TRNG_Handler ;19, irq3 CRYPT handler - DCD CMU_Handler ;20, irq4 CMU handler - DCD EXTI0_3_Handler ;21, irq5 EXTI0_3 handler - DCD EXTI4_7_Handler ;22, irq6 EXTI4_7 handler - DCD EXTI8_11_Handler ;23, irq7 EXTI8_11 handler - DCD EXTI12_15_Handler ;24, irq8 EXTI12_15 handler - DCD DMA_Handler ;25, irq9 DMA handler - DCD CAN0_Handler ;26, irq10 CAN0_CRYPT_TRNG handler - DCD LPTIM0_SPI2_Handler ;27, irq11 LPTIM0_SPI2 handler - DCD ADC_ACMP_Handler ;28, irq12 ADC_ACMP handler - DCD AD16C4T0_BRK_UP_TRIG_COM_Handler ;29, irq13 AD16C4T0_BRK_UP_TRIG_COM handler - DCD AD16C4T0_CC_Handler ;30, irq14 AD16C4T0_CC handler - DCD BS16T0_Handler ;31, irq15 BS16T0 handler - DCD 0 ;32, irq16 Reserved - DCD GP16C2T0_Handler ;33, irq17 GP16C2T0 handler - DCD GP16C2T1_Handler ;34, irq18 GP16C2T1 handler - DCD BS16T1_UART2_Handler ;35, irq19 BS16T1_UART2 handler - DCD BS16T2_UART3_Handler ;36, irq20 BS16T2_UART3 handler - DCD GP16C4T0_LCD_Handler ;37, irq21 GP16C4T0_LCD handler - DCD BS16T3_DAC0_Handler ;38, irq22 BS16T3_DAC0 handler - DCD I2C0_Handler ;39, irq23 I2C0 handler - DCD I2C1_Handler ;40, irq24 I2C1 handler - DCD SPI0_Handler ;41, irq25 SPI0 handler - DCD SPI1_Handler ;42, irq26 SPI1 handler - DCD UART0_Handler ;43, irq27 UART0 handler - DCD UART1_Handler ;44, irq28 UART1 handler - DCD USART0_Handler ;45, irq29 USART0 handler - DCD USART1_Handler ;46, irq30 USART1 handler - DCD LPUART0_Handler ;47, irq31 LPUART0 handler - -;------------------------------------------------------------------------------- - AREA INT, CODE, READONLY ;code begin - -;Reset Handler---------------------------------------------- -Reset_Handler PROC - EXPORT Reset_Handler [WEAK] - IMPORT __main - LDR R0, =__main - BX R0 - NOP - ALIGN - ENDP - -;system int------------------------------------------------- -NMI_Handler PROC ;int 2 - EXPORT NMI_Handler [WEAK] - B . - ENDP - -HardFault_Handler \ - PROC ;int3 - EXPORT HardFault_Handler [WEAK] - B . - ENDP - -SVC_Handler \ - PROC ;int11 - EXPORT SVC_Handler [WEAK] - B . - ENDP - -DebugMon_Handler \ - PROC ;int12 - EXPORT DebugMon_Handler [WEAK] - B . - ENDP - -PendSV_Handler PROC ;int14 - EXPORT PendSV_Handler [WEAK] - B . - ENDP - -SysTick_Handler \ - PROC ;int15 - EXPORT SysTick_Handler [WEAK] - B . - ENDP - -;peripheral module int ----------------------------------------------- -WWDG_IWDG_Handler \ - PROC ;int16 - EXPORT WWDG_IWDG_Handler [WEAK] - B . - ENDP - -LVD_Handler \ - PROC ;int17 - EXPORT LVD_Handler [WEAK] - B . - ENDP - -RTC_TEMP_Handler \ - PROC ;int18 - EXPORT RTC_TEMP_Handler [WEAK] - B . - ENDP - -CRYPT_TRNG_Handler \ - PROC ;int19 - EXPORT CRYPT_TRNG_Handler [WEAK] - B . - ENDP - -CMU_Handler \ - PROC ;int20 - EXPORT CMU_Handler [WEAK] - B . - ENDP - -EXTI0_3_Handler \ - PROC ;int21 - EXPORT EXTI0_3_Handler [WEAK] - B . - ENDP - -EXTI4_7_Handler \ - PROC ;int22 - EXPORT EXTI4_7_Handler [WEAK] - B . - ENDP - -EXTI8_11_Handler \ - PROC ;int23 - EXPORT EXTI8_11_Handler [WEAK] - B . - ENDP - -EXTI12_15_Handler \ - PROC ;int24 - EXPORT EXTI12_15_Handler [WEAK] - B . - ENDP - -DMA_Handler \ - PROC ;int25 - EXPORT DMA_Handler [WEAK] - B . - ENDP - -CAN0_Handler \ - PROC ;int26 - EXPORT CAN0_Handler [WEAK] - B . - ENDP - -LPTIM0_SPI2_Handler \ - PROC ;int27 - EXPORT LPTIM0_SPI2_Handler [WEAK] - B . - ENDP - -ADC_ACMP_Handler \ - PROC ;int28 - EXPORT ADC_ACMP_Handler [WEAK] - B . - ENDP - -AD16C4T0_BRK_UP_TRIG_COM_Handler \ - PROC ;int29 - EXPORT AD16C4T0_BRK_UP_TRIG_COM_Handler [WEAK] - B . - ENDP - -AD16C4T0_CC_Handler \ - PROC ;int30 - EXPORT AD16C4T0_CC_Handler [WEAK] - B . - ENDP - -BS16T0_Handler \ - PROC ;int31 - EXPORT BS16T0_Handler [WEAK] - B . - ENDP - -GP16C2T0_Handler PROC ;int33 - EXPORT GP16C2T0_Handler [WEAK] - B . - ENDP - -GP16C2T1_Handler PROC ;int34 - EXPORT GP16C2T1_Handler [WEAK] - B . - ENDP - -BS16T1_UART2_Handler \ - PROC ;int35 - EXPORT BS16T1_UART2_Handler [WEAK] - B . - ENDP - -BS16T2_UART3_Handler \ - PROC ;int36 - EXPORT BS16T2_UART3_Handler [WEAK] - B . - ENDP - -GP16C4T0_LCD_Handler \ - PROC ;int37 - EXPORT GP16C4T0_LCD_Handler [WEAK] - B . - ENDP - -BS16T3_DAC0_Handler \ - PROC ;int38 - EXPORT BS16T3_DAC0_Handler [WEAK] - B . - ENDP - -I2C0_Handler \ - PROC ;int39 - EXPORT I2C0_Handler [WEAK] - B . - ENDP - -I2C1_Handler \ - PROC ;int40 - EXPORT I2C1_Handler [WEAK] - B . - ENDP - -SPI0_Handler \ - PROC ;int41 - EXPORT SPI0_Handler [WEAK] - B . - ENDP - -SPI1_Handler \ - PROC ;int42 - EXPORT SPI1_Handler [WEAK] - B . - ENDP - -UART0_Handler \ - PROC ;int43 - EXPORT UART0_Handler [WEAK] - B . - ENDP - -UART1_Handler \ - PROC ;int44 - EXPORT UART1_Handler [WEAK] - B . - ENDP - -USART0_Handler \ - PROC ;int45 - EXPORT USART0_Handler [WEAK] - B . - ENDP - -USART1_Handler \ - PROC ;int46 - EXPORT USART1_Handler [WEAK] - B . - ENDP - -LPUART0_Handler \ - PROC ;int47 - EXPORT LPUART0_Handler [WEAK] - B . - ENDP - -; User Initial Stack & Heap----------------------------------------------------- - ALIGN - 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/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/System/system_es32f033x.c b/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/System/system_es32f033x.c deleted file mode 100644 index 25df7e5a37..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Device/EastSoft/ES32F033x/System/system_es32f033x.c +++ /dev/null @@ -1,28 +0,0 @@ -/** - ********************************************************************************* - * - * @file system_es32f033x.c - * @brief CMSIS Cortex-M0 Device Peripheral Access Layer - * - * @version V1.0 - * @date 6 Dec 2018 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "utils.h" - - -/** - * @brief Configuring system clock before startup. - * @note This function must be used after reset. - * @retval None - */ -void system_init (void) -{ - /* do nothing */ -} \ No newline at end of file diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_common_tables.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_common_tables.h deleted file mode 100644 index 8742a56991..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_common_tables.h +++ /dev/null @@ -1,136 +0,0 @@ -/* ---------------------------------------------------------------------- -* Copyright (C) 2010-2014 ARM Limited. All rights reserved. -* -* $Date: 19. October 2015 -* $Revision: V.1.4.5 a -* -* Project: CMSIS DSP Library -* Title: arm_common_tables.h -* -* Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions -* -* Target Processor: Cortex-M4/Cortex-M3 -* -* 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 ARM LIMITED 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 OWNER 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. -* -------------------------------------------------------------------- */ - -#ifndef _ARM_COMMON_TABLES_H -#define _ARM_COMMON_TABLES_H - -#include "arm_math.h" - -extern const uint16_t armBitRevTable[1024]; -extern const q15_t armRecipTableQ15[64]; -extern const q31_t armRecipTableQ31[64]; -/* extern const q31_t realCoefAQ31[1024]; */ -/* extern const q31_t realCoefBQ31[1024]; */ -extern const float32_t twiddleCoef_16[32]; -extern const float32_t twiddleCoef_32[64]; -extern const float32_t twiddleCoef_64[128]; -extern const float32_t twiddleCoef_128[256]; -extern const float32_t twiddleCoef_256[512]; -extern const float32_t twiddleCoef_512[1024]; -extern const float32_t twiddleCoef_1024[2048]; -extern const float32_t twiddleCoef_2048[4096]; -extern const float32_t twiddleCoef_4096[8192]; -#define twiddleCoef twiddleCoef_4096 -extern const q31_t twiddleCoef_16_q31[24]; -extern const q31_t twiddleCoef_32_q31[48]; -extern const q31_t twiddleCoef_64_q31[96]; -extern const q31_t twiddleCoef_128_q31[192]; -extern const q31_t twiddleCoef_256_q31[384]; -extern const q31_t twiddleCoef_512_q31[768]; -extern const q31_t twiddleCoef_1024_q31[1536]; -extern const q31_t twiddleCoef_2048_q31[3072]; -extern const q31_t twiddleCoef_4096_q31[6144]; -extern const q15_t twiddleCoef_16_q15[24]; -extern const q15_t twiddleCoef_32_q15[48]; -extern const q15_t twiddleCoef_64_q15[96]; -extern const q15_t twiddleCoef_128_q15[192]; -extern const q15_t twiddleCoef_256_q15[384]; -extern const q15_t twiddleCoef_512_q15[768]; -extern const q15_t twiddleCoef_1024_q15[1536]; -extern const q15_t twiddleCoef_2048_q15[3072]; -extern const q15_t twiddleCoef_4096_q15[6144]; -extern const float32_t twiddleCoef_rfft_32[32]; -extern const float32_t twiddleCoef_rfft_64[64]; -extern const float32_t twiddleCoef_rfft_128[128]; -extern const float32_t twiddleCoef_rfft_256[256]; -extern const float32_t twiddleCoef_rfft_512[512]; -extern const float32_t twiddleCoef_rfft_1024[1024]; -extern const float32_t twiddleCoef_rfft_2048[2048]; -extern const float32_t twiddleCoef_rfft_4096[4096]; - - -/* floating-point bit reversal tables */ -#define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 ) -#define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 ) -#define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 ) -#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 ) -#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 ) -#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 ) -#define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800) -#define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808) -#define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032) - -extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH]; - -/* fixed-point bit reversal tables */ -#define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 ) -#define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 ) -#define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 ) -#define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 ) -#define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 ) -#define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 ) -#define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 ) -#define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984) -#define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032) - -extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH]; -extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH]; - -/* Tables for Fast Math Sine and Cosine */ -extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1]; -extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1]; -extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1]; - -#endif /* ARM_COMMON_TABLES_H */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_const_structs.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_const_structs.h deleted file mode 100644 index 726d06eb69..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_const_structs.h +++ /dev/null @@ -1,79 +0,0 @@ -/* ---------------------------------------------------------------------- -* Copyright (C) 2010-2014 ARM Limited. All rights reserved. -* -* $Date: 19. March 2015 -* $Revision: V.1.4.5 -* -* Project: CMSIS DSP Library -* Title: arm_const_structs.h -* -* Description: This file has constant structs that are initialized for -* user convenience. For example, some can be given as -* arguments to the arm_cfft_f32() function. -* -* Target Processor: Cortex-M4/Cortex-M3 -* -* 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 ARM LIMITED 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 OWNER 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. -* -------------------------------------------------------------------- */ - -#ifndef _ARM_CONST_STRUCTS_H -#define _ARM_CONST_STRUCTS_H - -#include "arm_math.h" -#include "arm_common_tables.h" - - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; - extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; - - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; - extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; - - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; - extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; - -#endif diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_math.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_math.h deleted file mode 100644 index d33f8a9b3b..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/arm_math.h +++ /dev/null @@ -1,7154 +0,0 @@ -/* ---------------------------------------------------------------------- -* Copyright (C) 2010-2015 ARM Limited. All rights reserved. -* -* $Date: 20. October 2015 -* $Revision: V1.4.5 b -* -* Project: CMSIS DSP Library -* Title: arm_math.h -* -* Description: Public header file for CMSIS DSP Library -* -* Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0 -* -* 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 ARM LIMITED 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 OWNER 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. - * -------------------------------------------------------------------- */ - -/** - \mainpage CMSIS DSP Software Library - * - * Introduction - * ------------ - * - * This user manual describes the CMSIS DSP software library, - * a suite of common signal processing functions for use on Cortex-M processor based devices. - * - * The library is divided into a number of functions each covering a specific category: - * - Basic math functions - * - Fast math functions - * - Complex math functions - * - Filters - * - Matrix functions - * - Transforms - * - Motor control functions - * - Statistical functions - * - Support functions - * - Interpolation functions - * - * The library has separate functions for operating on 8-bit integers, 16-bit integers, - * 32-bit integer and 32-bit floating-point values. - * - * Using the Library - * ------------ - * - * The library installer contains prebuilt versions of the libraries in the Lib folder. - * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7) - * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7) - * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7) - * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7) - * - arm_cortexM7l_math.lib (Little endian on Cortex-M7) - * - arm_cortexM7b_math.lib (Big endian on Cortex-M7) - * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4) - * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4) - * - arm_cortexM4l_math.lib (Little endian on Cortex-M4) - * - arm_cortexM4b_math.lib (Big endian on Cortex-M4) - * - arm_cortexM3l_math.lib (Little endian on Cortex-M3) - * - arm_cortexM3b_math.lib (Big endian on Cortex-M3) - * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+) - * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+) - * - * The library functions are declared in the public file arm_math.h which is placed in the Include folder. - * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single - * public header file arm_math.h for Cortex-M7/M4/M3/M0/M0+ with little endian and big endian. Same header file will be used for floating point unit(FPU) variants. - * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or - * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. - * - * Examples - * -------- - * - * The library ships with a number of examples which demonstrate how to use the library functions. - * - * Toolchain Support - * ------------ - * - * The library has been developed and tested with MDK-ARM version 5.14.0.0 - * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. - * - * Building the Library - * ------------ - * - * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the CMSIS\\DSP_Lib\\Source\\ARM folder. - * - arm_cortexM_math.uvprojx - * - * - * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above. - * - * Pre-processor Macros - * ------------ - * - * Each library project have differant pre-processor macros. - * - * - UNALIGNED_SUPPORT_DISABLE: - * - * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access - * - * - ARM_MATH_BIG_ENDIAN: - * - * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. - * - * - ARM_MATH_MATRIX_CHECK: - * - * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices - * - * - ARM_MATH_ROUNDING: - * - * Define macro ARM_MATH_ROUNDING for rounding on support functions - * - * - ARM_MATH_CMx: - * - * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target - * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and - * ARM_MATH_CM7 for building the library on cortex-M7. - * - * - __FPU_PRESENT: - * - * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries - * - *
- * CMSIS-DSP in ARM::CMSIS Pack - * ----------------------------- - * - * The following files relevant to CMSIS-DSP are present in the ARM::CMSIS Pack directories: - * |File/Folder |Content | - * |------------------------------|------------------------------------------------------------------------| - * |\b CMSIS\\Documentation\\DSP | This documentation | - * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) | - * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions | - * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library | - * - *
- * Revision History of CMSIS-DSP - * ------------ - * Please refer to \ref ChangeLog_pg. - * - * Copyright Notice - * ------------ - * - * Copyright (C) 2010-2015 ARM Limited. All rights reserved. - */ - - -/** - * @defgroup groupMath Basic Math Functions - */ - -/** - * @defgroup groupFastMath Fast Math Functions - * This set of functions provides a fast approximation to sine, cosine, and square root. - * As compared to most of the other functions in the CMSIS math library, the fast math functions - * operate on individual values and not arrays. - * There are separate functions for Q15, Q31, and floating-point data. - * - */ - -/** - * @defgroup groupCmplxMath Complex Math Functions - * This set of functions operates on complex data vectors. - * The data in the complex arrays is stored in an interleaved fashion - * (real, imag, real, imag, ...). - * In the API functions, the number of samples in a complex array refers - * to the number of complex values; the array contains twice this number of - * real values. - */ - -/** - * @defgroup groupFilters Filtering Functions - */ - -/** - * @defgroup groupMatrix Matrix Functions - * - * This set of functions provides basic matrix math operations. - * The functions operate on matrix data structures. For example, - * the type - * definition for the floating-point matrix structure is shown - * below: - *
- *     typedef struct
- *     {
- *       uint16_t numRows;     // number of rows of the matrix.
- *       uint16_t numCols;     // number of columns of the matrix.
- *       float32_t *pData;     // points to the data of the matrix.
- *     } arm_matrix_instance_f32;
- * 
- * There are similar definitions for Q15 and Q31 data types. - * - * The structure specifies the size of the matrix and then points to - * an array of data. The array is of size numRows X numCols - * and the values are arranged in row order. That is, the - * matrix element (i, j) is stored at: - *
- *     pData[i*numCols + j]
- * 
- * - * \par Init Functions - * There is an associated initialization function for each type of matrix - * data structure. - * The initialization function sets the values of the internal structure fields. - * Refer to the function arm_mat_init_f32(), arm_mat_init_q31() - * and arm_mat_init_q15() for floating-point, Q31 and Q15 types, respectively. - * - * \par - * Use of the initialization function is optional. However, if initialization function is used - * then the instance structure cannot be placed into a const data section. - * To place the instance structure in a const data - * section, manually initialize the data structure. For example: - *
- * arm_matrix_instance_f32 S = {nRows, nColumns, pData};
- * arm_matrix_instance_q31 S = {nRows, nColumns, pData};
- * arm_matrix_instance_q15 S = {nRows, nColumns, pData};
- * 
- * where nRows specifies the number of rows, nColumns - * specifies the number of columns, and pData points to the - * data array. - * - * \par Size Checking - * By default all of the matrix functions perform size checking on the input and - * output matrices. For example, the matrix addition function verifies that the - * two input matrices and the output matrix all have the same number of rows and - * columns. If the size check fails the functions return: - *
- *     ARM_MATH_SIZE_MISMATCH
- * 
- * Otherwise the functions return - *
- *     ARM_MATH_SUCCESS
- * 
- * There is some overhead associated with this matrix size checking. - * The matrix size checking is enabled via the \#define - *
- *     ARM_MATH_MATRIX_CHECK
- * 
- * within the library project settings. By default this macro is defined - * and size checking is enabled. By changing the project settings and - * undefining this macro size checking is eliminated and the functions - * run a bit faster. With size checking disabled the functions always - * return ARM_MATH_SUCCESS. - */ - -/** - * @defgroup groupTransforms Transform Functions - */ - -/** - * @defgroup groupController Controller Functions - */ - -/** - * @defgroup groupStats Statistics Functions - */ -/** - * @defgroup groupSupport Support Functions - */ - -/** - * @defgroup groupInterpolation Interpolation Functions - * These functions perform 1- and 2-dimensional interpolation of data. - * Linear interpolation is used for 1-dimensional data and - * bilinear interpolation is used for 2-dimensional data. - */ - -/** - * @defgroup groupExamples Examples - */ -#ifndef _ARM_MATH_H -#define _ARM_MATH_H - -/* ignore some GCC warnings */ -#if defined ( __GNUC__ ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -#define __CMSIS_GENERIC /* disable NVIC and Systick functions */ - -#if defined(ARM_MATH_CM7) - #include "core_cm7.h" -#elif defined (ARM_MATH_CM4) - #include "core_cm4.h" -#elif defined (ARM_MATH_CM3) - #include "core_cm3.h" -#elif defined (ARM_MATH_CM0) - #include "core_cm0.h" - #define ARM_MATH_CM0_FAMILY -#elif defined (ARM_MATH_CM0PLUS) - #include "core_cm0plus.h" - #define ARM_MATH_CM0_FAMILY -#else - #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0" -#endif - -#undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ -#include "string.h" -#include "math.h" -#ifdef __cplusplus -extern "C" -{ -#endif - - - /** - * @brief Macros required for reciprocal calculation in Normalized LMS - */ - -#define DELTA_Q31 (0x100) -#define DELTA_Q15 0x5 -#define INDEX_MASK 0x0000003F -#ifndef PI -#define PI 3.14159265358979f -#endif - - /** - * @brief Macros required for SINE and COSINE Fast math approximations - */ - -#define FAST_MATH_TABLE_SIZE 512 -#define FAST_MATH_Q31_SHIFT (32 - 10) -#define FAST_MATH_Q15_SHIFT (16 - 10) -#define CONTROLLER_Q31_SHIFT (32 - 9) -#define TABLE_SIZE 256 -#define TABLE_SPACING_Q31 0x400000 -#define TABLE_SPACING_Q15 0x80 - - /** - * @brief Macros required for SINE and COSINE Controller functions - */ - /* 1.31(q31) Fixed value of 2/360 */ - /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ -#define INPUT_SPACING 0xB60B61 - - /** - * @brief Macro for Unaligned Support - */ -#ifndef UNALIGNED_SUPPORT_DISABLE - #define ALIGN4 -#else - #if defined (__GNUC__) - #define ALIGN4 __attribute__((aligned(4))) - #else - #define ALIGN4 __align(4) - #endif -#endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ - - /** - * @brief Error status returned by some functions in the library. - */ - - typedef enum - { - ARM_MATH_SUCCESS = 0, /**< No error */ - ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ - ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ - ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ - ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ - ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ - ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ - } arm_status; - - /** - * @brief 8-bit fractional data type in 1.7 format. - */ - typedef int8_t q7_t; - - /** - * @brief 16-bit fractional data type in 1.15 format. - */ - typedef int16_t q15_t; - - /** - * @brief 32-bit fractional data type in 1.31 format. - */ - typedef int32_t q31_t; - - /** - * @brief 64-bit fractional data type in 1.63 format. - */ - typedef int64_t q63_t; - - /** - * @brief 32-bit floating-point type definition. - */ - typedef float float32_t; - - /** - * @brief 64-bit floating-point type definition. - */ - typedef double float64_t; - - /** - * @brief definition to read/write two 16 bit values. - */ -#if defined __CC_ARM - #define __SIMD32_TYPE int32_t __packed - #define CMSIS_UNUSED __attribute__((unused)) - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __SIMD32_TYPE int32_t - #define CMSIS_UNUSED __attribute__((unused)) - -#elif defined __GNUC__ - #define __SIMD32_TYPE int32_t - #define CMSIS_UNUSED __attribute__((unused)) - -#elif defined __ICCARM__ - #define __SIMD32_TYPE int32_t __packed - #define CMSIS_UNUSED - -#elif defined __CSMC__ - #define __SIMD32_TYPE int32_t - #define CMSIS_UNUSED - -#elif defined __TASKING__ - #define __SIMD32_TYPE __unaligned int32_t - #define CMSIS_UNUSED - -#else - #error Unknown compiler -#endif - -#define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) -#define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) -#define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) -#define __SIMD64(addr) (*(int64_t **) & (addr)) - -#if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) - /** - * @brief definition to pack two 16 bit values. - */ -#define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ - (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) -#define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ - (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) - -#endif - - - /** - * @brief definition to pack four 8 bit values. - */ -#ifndef ARM_MATH_BIG_ENDIAN - -#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ - (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ - (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ - (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) -#else - -#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ - (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ - (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ - (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) - -#endif - - - /** - * @brief Clips Q63 to Q31 values. - */ - static __INLINE q31_t clip_q63_to_q31( - q63_t x) - { - return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? - ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; - } - - /** - * @brief Clips Q63 to Q15 values. - */ - static __INLINE q15_t clip_q63_to_q15( - q63_t x) - { - return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? - ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); - } - - /** - * @brief Clips Q31 to Q7 values. - */ - static __INLINE q7_t clip_q31_to_q7( - q31_t x) - { - return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? - ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; - } - - /** - * @brief Clips Q31 to Q15 values. - */ - static __INLINE q15_t clip_q31_to_q15( - q31_t x) - { - return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? - ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; - } - - /** - * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. - */ - - static __INLINE q63_t mult32x64( - q63_t x, - q31_t y) - { - return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + - (((q63_t) (x >> 32) * y))); - } - -/* - #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM ) - #define __CLZ __clz - #endif - */ -/* note: function can be removed when all toolchain support __CLZ for Cortex-M0 */ -#if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ) - static __INLINE uint32_t __CLZ( - q31_t data); - - static __INLINE uint32_t __CLZ( - q31_t data) - { - uint32_t count = 0; - uint32_t mask = 0x80000000; - - while((data & mask) == 0) - { - count += 1u; - mask = mask >> 1u; - } - - return (count); - } -#endif - - /** - * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. - */ - - static __INLINE uint32_t arm_recip_q31( - q31_t in, - q31_t * dst, - q31_t * pRecipTable) - { - q31_t out; - uint32_t tempVal; - uint32_t index, i; - uint32_t signBits; - - if(in > 0) - { - signBits = ((uint32_t) (__CLZ( in) - 1)); - } - else - { - signBits = ((uint32_t) (__CLZ(-in) - 1)); - } - - /* Convert input sample to 1.31 format */ - in = (in << signBits); - - /* calculation of index for initial approximated Val */ - index = (uint32_t)(in >> 24); - index = (index & INDEX_MASK); - - /* 1.31 with exp 1 */ - out = pRecipTable[index]; - - /* calculation of reciprocal value */ - /* running approximation for two iterations */ - for (i = 0u; i < 2u; i++) - { - tempVal = (uint32_t) (((q63_t) in * out) >> 31); - tempVal = 0x7FFFFFFFu - tempVal; - /* 1.31 with exp 1 */ - /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */ - out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30); - } - - /* write output */ - *dst = out; - - /* return num of signbits of out = 1/in value */ - return (signBits + 1u); - } - - - /** - * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. - */ - static __INLINE uint32_t arm_recip_q15( - q15_t in, - q15_t * dst, - q15_t * pRecipTable) - { - q15_t out = 0; - uint32_t tempVal = 0; - uint32_t index = 0, i = 0; - uint32_t signBits = 0; - - if(in > 0) - { - signBits = ((uint32_t)(__CLZ( in) - 17)); - } - else - { - signBits = ((uint32_t)(__CLZ(-in) - 17)); - } - - /* Convert input sample to 1.15 format */ - in = (in << signBits); - - /* calculation of index for initial approximated Val */ - index = (uint32_t)(in >> 8); - index = (index & INDEX_MASK); - - /* 1.15 with exp 1 */ - out = pRecipTable[index]; - - /* calculation of reciprocal value */ - /* running approximation for two iterations */ - for (i = 0u; i < 2u; i++) - { - tempVal = (uint32_t) (((q31_t) in * out) >> 15); - tempVal = 0x7FFFu - tempVal; - /* 1.15 with exp 1 */ - out = (q15_t) (((q31_t) out * tempVal) >> 14); - /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */ - } - - /* write output */ - *dst = out; - - /* return num of signbits of out = 1/in value */ - return (signBits + 1); - } - - - /* - * @brief C custom defined intrinisic function for only M0 processors - */ -#if defined(ARM_MATH_CM0_FAMILY) - static __INLINE q31_t __SSAT( - q31_t x, - uint32_t y) - { - int32_t posMax, negMin; - uint32_t i; - - posMax = 1; - for (i = 0; i < (y - 1); i++) - { - posMax = posMax * 2; - } - - if(x > 0) - { - posMax = (posMax - 1); - - if(x > posMax) - { - x = posMax; - } - } - else - { - negMin = -posMax; - - if(x < negMin) - { - x = negMin; - } - } - return (x); - } -#endif /* end of ARM_MATH_CM0_FAMILY */ - - - /* - * @brief C custom defined intrinsic function for M3 and M0 processors - */ -#if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) - - /* - * @brief C custom defined QADD8 for M3 and M0 processors - */ - static __INLINE uint32_t __QADD8( - uint32_t x, - uint32_t y) - { - q31_t r, s, t, u; - - r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; - s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; - t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; - u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; - - return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); - } - - - /* - * @brief C custom defined QSUB8 for M3 and M0 processors - */ - static __INLINE uint32_t __QSUB8( - uint32_t x, - uint32_t y) - { - q31_t r, s, t, u; - - r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; - s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; - t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; - u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; - - return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); - } - - - /* - * @brief C custom defined QADD16 for M3 and M0 processors - */ - static __INLINE uint32_t __QADD16( - uint32_t x, - uint32_t y) - { -/* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */ - q31_t r = 0, s = 0; - - r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHADD16 for M3 and M0 processors - */ - static __INLINE uint32_t __SHADD16( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined QSUB16 for M3 and M0 processors - */ - static __INLINE uint32_t __QSUB16( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHSUB16 for M3 and M0 processors - */ - static __INLINE uint32_t __SHSUB16( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined QASX for M3 and M0 processors - */ - static __INLINE uint32_t __QASX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHASX for M3 and M0 processors - */ - static __INLINE uint32_t __SHASX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined QSAX for M3 and M0 processors - */ - static __INLINE uint32_t __QSAX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; - s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SHSAX for M3 and M0 processors - */ - static __INLINE uint32_t __SHSAX( - uint32_t x, - uint32_t y) - { - q31_t r, s; - - r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; - s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; - - return ((uint32_t)((s << 16) | (r ))); - } - - - /* - * @brief C custom defined SMUSDX for M3 and M0 processors - */ - static __INLINE uint32_t __SMUSDX( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); - } - - /* - * @brief C custom defined SMUADX for M3 and M0 processors - */ - static __INLINE uint32_t __SMUADX( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); - } - - - /* - * @brief C custom defined QADD for M3 and M0 processors - */ - static __INLINE int32_t __QADD( - int32_t x, - int32_t y) - { - return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y))); - } - - - /* - * @brief C custom defined QSUB for M3 and M0 processors - */ - static __INLINE int32_t __QSUB( - int32_t x, - int32_t y) - { - return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y))); - } - - - /* - * @brief C custom defined SMLAD for M3 and M0 processors - */ - static __INLINE uint32_t __SMLAD( - uint32_t x, - uint32_t y, - uint32_t sum) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + - ( ((q31_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLADX for M3 and M0 processors - */ - static __INLINE uint32_t __SMLADX( - uint32_t x, - uint32_t y, - uint32_t sum) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + - ( ((q31_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLSDX for M3 and M0 processors - */ - static __INLINE uint32_t __SMLSDX( - uint32_t x, - uint32_t y, - uint32_t sum) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + - ( ((q31_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLALD for M3 and M0 processors - */ - static __INLINE uint64_t __SMLALD( - uint32_t x, - uint32_t y, - uint64_t sum) - { -/* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */ - return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + - ( ((q63_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMLALDX for M3 and M0 processors - */ - static __INLINE uint64_t __SMLALDX( - uint32_t x, - uint32_t y, - uint64_t sum) - { -/* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */ - return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + - ( ((q63_t)sum ) ) )); - } - - - /* - * @brief C custom defined SMUAD for M3 and M0 processors - */ - static __INLINE uint32_t __SMUAD( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); - } - - - /* - * @brief C custom defined SMUSD for M3 and M0 processors - */ - static __INLINE uint32_t __SMUSD( - uint32_t x, - uint32_t y) - { - return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) - - ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); - } - - - /* - * @brief C custom defined SXTB16 for M3 and M0 processors - */ - static __INLINE uint32_t __SXTB16( - uint32_t x) - { - return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) | - ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) )); - } - -#endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */ - - - /** - * @brief Instance structure for the Q7 FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - } arm_fir_instance_q7; - - /** - * @brief Instance structure for the Q15 FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - } arm_fir_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - } arm_fir_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of filter coefficients in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - } arm_fir_instance_f32; - - - /** - * @brief Processing function for the Q7 FIR filter. - * @param[in] S points to an instance of the Q7 FIR filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_q7( - const arm_fir_instance_q7 * S, - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q7 FIR filter. - * @param[in,out] S points to an instance of the Q7 FIR structure. - * @param[in] numTaps Number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed. - */ - void arm_fir_init_q7( - arm_fir_instance_q7 * S, - uint16_t numTaps, - q7_t * pCoeffs, - q7_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 FIR filter. - * @param[in] S points to an instance of the Q15 FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_q15( - const arm_fir_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q15 FIR filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_fast_q15( - const arm_fir_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 FIR filter. - * @param[in,out] S points to an instance of the Q15 FIR filter structure. - * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed at a time. - * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if - * numTaps is not a supported value. - */ - arm_status arm_fir_init_q15( - arm_fir_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 FIR filter. - * @param[in] S points to an instance of the Q31 FIR filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_q31( - const arm_fir_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q31 FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_fast_q31( - const arm_fir_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR filter. - * @param[in,out] S points to an instance of the Q31 FIR structure. - * @param[in] numTaps Number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed at a time. - */ - void arm_fir_init_q31( - arm_fir_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point FIR filter. - * @param[in] S points to an instance of the floating-point FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_f32( - const arm_fir_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point FIR filter. - * @param[in,out] S points to an instance of the floating-point FIR filter structure. - * @param[in] numTaps Number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of samples that are processed at a time. - */ - void arm_fir_init_f32( - arm_fir_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 Biquad cascade filter. - */ - typedef struct - { - int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ - q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ - int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ - } arm_biquad_casd_df1_inst_q15; - - /** - * @brief Instance structure for the Q31 Biquad cascade filter. - */ - typedef struct - { - uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ - q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ - uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ - } arm_biquad_casd_df1_inst_q31; - - /** - * @brief Instance structure for the floating-point Biquad cascade filter. - */ - typedef struct - { - uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ - float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_casd_df1_inst_f32; - - - /** - * @brief Processing function for the Q15 Biquad cascade filter. - * @param[in] S points to an instance of the Q15 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_q15( - const arm_biquad_casd_df1_inst_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 Biquad cascade filter. - * @param[in,out] S points to an instance of the Q15 Biquad cascade structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format - */ - void arm_biquad_cascade_df1_init_q15( - arm_biquad_casd_df1_inst_q15 * S, - uint8_t numStages, - q15_t * pCoeffs, - q15_t * pState, - int8_t postShift); - - - /** - * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q15 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_fast_q15( - const arm_biquad_casd_df1_inst_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 Biquad cascade filter - * @param[in] S points to an instance of the Q31 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_q31( - const arm_biquad_casd_df1_inst_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q31 Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_fast_q31( - const arm_biquad_casd_df1_inst_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 Biquad cascade filter. - * @param[in,out] S points to an instance of the Q31 Biquad cascade structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format - */ - void arm_biquad_cascade_df1_init_q31( - arm_biquad_casd_df1_inst_q31 * S, - uint8_t numStages, - q31_t * pCoeffs, - q31_t * pState, - int8_t postShift); - - - /** - * @brief Processing function for the floating-point Biquad cascade filter. - * @param[in] S points to an instance of the floating-point Biquad cascade structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df1_f32( - const arm_biquad_casd_df1_inst_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point Biquad cascade filter. - * @param[in,out] S points to an instance of the floating-point Biquad cascade structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_df1_init_f32( - arm_biquad_casd_df1_inst_f32 * S, - uint8_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Instance structure for the floating-point matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - float32_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_f32; - - - /** - * @brief Instance structure for the floating-point matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - float64_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_f64; - - /** - * @brief Instance structure for the Q15 matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - q15_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_q15; - - /** - * @brief Instance structure for the Q31 matrix structure. - */ - typedef struct - { - uint16_t numRows; /**< number of rows of the matrix. */ - uint16_t numCols; /**< number of columns of the matrix. */ - q31_t *pData; /**< points to the data of the matrix. */ - } arm_matrix_instance_q31; - - - /** - * @brief Floating-point matrix addition. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_add_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix addition. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_add_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix addition. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_add_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point, complex, matrix multiplication. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_cmplx_mult_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15, complex, matrix multiplication. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_cmplx_mult_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst, - q15_t * pScratch); - - - /** - * @brief Q31, complex, matrix multiplication. - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_cmplx_mult_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix transpose. - * @param[in] pSrc points to the input matrix - * @param[out] pDst points to the output matrix - * @return The function returns either ARM_MATH_SIZE_MISMATCH - * or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_trans_f32( - const arm_matrix_instance_f32 * pSrc, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix transpose. - * @param[in] pSrc points to the input matrix - * @param[out] pDst points to the output matrix - * @return The function returns either ARM_MATH_SIZE_MISMATCH - * or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_trans_q15( - const arm_matrix_instance_q15 * pSrc, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix transpose. - * @param[in] pSrc points to the input matrix - * @param[out] pDst points to the output matrix - * @return The function returns either ARM_MATH_SIZE_MISMATCH - * or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_trans_q31( - const arm_matrix_instance_q31 * pSrc, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix multiplication - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix multiplication - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @param[in] pState points to the array for storing intermediate results - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst, - q15_t * pState); - - - /** - * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @param[in] pState points to the array for storing intermediate results - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_fast_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst, - q15_t * pState); - - - /** - * @brief Q31 matrix multiplication - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_mult_fast_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix subtraction - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_sub_f32( - const arm_matrix_instance_f32 * pSrcA, - const arm_matrix_instance_f32 * pSrcB, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix subtraction - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_sub_q15( - const arm_matrix_instance_q15 * pSrcA, - const arm_matrix_instance_q15 * pSrcB, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix subtraction - * @param[in] pSrcA points to the first input matrix structure - * @param[in] pSrcB points to the second input matrix structure - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_sub_q31( - const arm_matrix_instance_q31 * pSrcA, - const arm_matrix_instance_q31 * pSrcB, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Floating-point matrix scaling. - * @param[in] pSrc points to the input matrix - * @param[in] scale scale factor - * @param[out] pDst points to the output matrix - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_scale_f32( - const arm_matrix_instance_f32 * pSrc, - float32_t scale, - arm_matrix_instance_f32 * pDst); - - - /** - * @brief Q15 matrix scaling. - * @param[in] pSrc points to input matrix - * @param[in] scaleFract fractional portion of the scale factor - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to output matrix - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_scale_q15( - const arm_matrix_instance_q15 * pSrc, - q15_t scaleFract, - int32_t shift, - arm_matrix_instance_q15 * pDst); - - - /** - * @brief Q31 matrix scaling. - * @param[in] pSrc points to input matrix - * @param[in] scaleFract fractional portion of the scale factor - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to output matrix structure - * @return The function returns either - * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. - */ - arm_status arm_mat_scale_q31( - const arm_matrix_instance_q31 * pSrc, - q31_t scaleFract, - int32_t shift, - arm_matrix_instance_q31 * pDst); - - - /** - * @brief Q31 matrix initialization. - * @param[in,out] S points to an instance of the floating-point matrix structure. - * @param[in] nRows number of rows in the matrix. - * @param[in] nColumns number of columns in the matrix. - * @param[in] pData points to the matrix data array. - */ - void arm_mat_init_q31( - arm_matrix_instance_q31 * S, - uint16_t nRows, - uint16_t nColumns, - q31_t * pData); - - - /** - * @brief Q15 matrix initialization. - * @param[in,out] S points to an instance of the floating-point matrix structure. - * @param[in] nRows number of rows in the matrix. - * @param[in] nColumns number of columns in the matrix. - * @param[in] pData points to the matrix data array. - */ - void arm_mat_init_q15( - arm_matrix_instance_q15 * S, - uint16_t nRows, - uint16_t nColumns, - q15_t * pData); - - - /** - * @brief Floating-point matrix initialization. - * @param[in,out] S points to an instance of the floating-point matrix structure. - * @param[in] nRows number of rows in the matrix. - * @param[in] nColumns number of columns in the matrix. - * @param[in] pData points to the matrix data array. - */ - void arm_mat_init_f32( - arm_matrix_instance_f32 * S, - uint16_t nRows, - uint16_t nColumns, - float32_t * pData); - - - - /** - * @brief Instance structure for the Q15 PID Control. - */ - typedef struct - { - q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ -#ifdef ARM_MATH_CM0_FAMILY - q15_t A1; - q15_t A2; -#else - q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ -#endif - q15_t state[3]; /**< The state array of length 3. */ - q15_t Kp; /**< The proportional gain. */ - q15_t Ki; /**< The integral gain. */ - q15_t Kd; /**< The derivative gain. */ - } arm_pid_instance_q15; - - /** - * @brief Instance structure for the Q31 PID Control. - */ - typedef struct - { - q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ - q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ - q31_t A2; /**< The derived gain, A2 = Kd . */ - q31_t state[3]; /**< The state array of length 3. */ - q31_t Kp; /**< The proportional gain. */ - q31_t Ki; /**< The integral gain. */ - q31_t Kd; /**< The derivative gain. */ - } arm_pid_instance_q31; - - /** - * @brief Instance structure for the floating-point PID Control. - */ - typedef struct - { - float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ - float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ - float32_t A2; /**< The derived gain, A2 = Kd . */ - float32_t state[3]; /**< The state array of length 3. */ - float32_t Kp; /**< The proportional gain. */ - float32_t Ki; /**< The integral gain. */ - float32_t Kd; /**< The derivative gain. */ - } arm_pid_instance_f32; - - - - /** - * @brief Initialization function for the floating-point PID Control. - * @param[in,out] S points to an instance of the PID structure. - * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. - */ - void arm_pid_init_f32( - arm_pid_instance_f32 * S, - int32_t resetStateFlag); - - - /** - * @brief Reset function for the floating-point PID Control. - * @param[in,out] S is an instance of the floating-point PID Control structure - */ - void arm_pid_reset_f32( - arm_pid_instance_f32 * S); - - - /** - * @brief Initialization function for the Q31 PID Control. - * @param[in,out] S points to an instance of the Q15 PID structure. - * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. - */ - void arm_pid_init_q31( - arm_pid_instance_q31 * S, - int32_t resetStateFlag); - - - /** - * @brief Reset function for the Q31 PID Control. - * @param[in,out] S points to an instance of the Q31 PID Control structure - */ - - void arm_pid_reset_q31( - arm_pid_instance_q31 * S); - - - /** - * @brief Initialization function for the Q15 PID Control. - * @param[in,out] S points to an instance of the Q15 PID structure. - * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. - */ - void arm_pid_init_q15( - arm_pid_instance_q15 * S, - int32_t resetStateFlag); - - - /** - * @brief Reset function for the Q15 PID Control. - * @param[in,out] S points to an instance of the q15 PID Control structure - */ - void arm_pid_reset_q15( - arm_pid_instance_q15 * S); - - - /** - * @brief Instance structure for the floating-point Linear Interpolate function. - */ - typedef struct - { - uint32_t nValues; /**< nValues */ - float32_t x1; /**< x1 */ - float32_t xSpacing; /**< xSpacing */ - float32_t *pYData; /**< pointer to the table of Y values */ - } arm_linear_interp_instance_f32; - - /** - * @brief Instance structure for the floating-point bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - float32_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_f32; - - /** - * @brief Instance structure for the Q31 bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - q31_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_q31; - - /** - * @brief Instance structure for the Q15 bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - q15_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_q15; - - /** - * @brief Instance structure for the Q15 bilinear interpolation function. - */ - typedef struct - { - uint16_t numRows; /**< number of rows in the data table. */ - uint16_t numCols; /**< number of columns in the data table. */ - q7_t *pData; /**< points to the data table. */ - } arm_bilinear_interp_instance_q7; - - - /** - * @brief Q7 vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_q7( - q7_t * pSrcA, - q7_t * pSrcB, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Floating-point vector multiplication. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_mult_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix2_instance_q15; - -/* Deprecated */ - arm_status arm_cfft_radix2_init_q15( - arm_cfft_radix2_instance_q15 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix2_q15( - const arm_cfft_radix2_instance_q15 * S, - q15_t * pSrc); - - - /** - * @brief Instance structure for the Q15 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q15_t *pTwiddle; /**< points to the twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix4_instance_q15; - -/* Deprecated */ - arm_status arm_cfft_radix4_init_q15( - arm_cfft_radix4_instance_q15 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix4_q15( - const arm_cfft_radix4_instance_q15 * S, - q15_t * pSrc); - - /** - * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q31_t *pTwiddle; /**< points to the Twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix2_instance_q31; - -/* Deprecated */ - arm_status arm_cfft_radix2_init_q31( - arm_cfft_radix2_instance_q31 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix2_q31( - const arm_cfft_radix2_instance_q31 * S, - q31_t * pSrc); - - /** - * @brief Instance structure for the Q31 CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - q31_t *pTwiddle; /**< points to the twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - } arm_cfft_radix4_instance_q31; - -/* Deprecated */ - void arm_cfft_radix4_q31( - const arm_cfft_radix4_instance_q31 * S, - q31_t * pSrc); - -/* Deprecated */ - arm_status arm_cfft_radix4_init_q31( - arm_cfft_radix4_instance_q31 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the floating-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - float32_t *pTwiddle; /**< points to the Twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - float32_t onebyfftLen; /**< value of 1/fftLen. */ - } arm_cfft_radix2_instance_f32; - -/* Deprecated */ - arm_status arm_cfft_radix2_init_f32( - arm_cfft_radix2_instance_f32 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix2_f32( - const arm_cfft_radix2_instance_f32 * S, - float32_t * pSrc); - - /** - * @brief Instance structure for the floating-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ - uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ - float32_t *pTwiddle; /**< points to the Twiddle factor table. */ - uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ - float32_t onebyfftLen; /**< value of 1/fftLen. */ - } arm_cfft_radix4_instance_f32; - -/* Deprecated */ - arm_status arm_cfft_radix4_init_f32( - arm_cfft_radix4_instance_f32 * S, - uint16_t fftLen, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - -/* Deprecated */ - void arm_cfft_radix4_f32( - const arm_cfft_radix4_instance_f32 * S, - float32_t * pSrc); - - /** - * @brief Instance structure for the fixed-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ - const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t bitRevLength; /**< bit reversal table length. */ - } arm_cfft_instance_q15; - -void arm_cfft_q15( - const arm_cfft_instance_q15 * S, - q15_t * p1, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the fixed-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ - const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t bitRevLength; /**< bit reversal table length. */ - } arm_cfft_instance_q31; - -void arm_cfft_q31( - const arm_cfft_instance_q31 * S, - q31_t * p1, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the floating-point CFFT/CIFFT function. - */ - typedef struct - { - uint16_t fftLen; /**< length of the FFT. */ - const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ - const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ - uint16_t bitRevLength; /**< bit reversal table length. */ - } arm_cfft_instance_f32; - - void arm_cfft_f32( - const arm_cfft_instance_f32 * S, - float32_t * p1, - uint8_t ifftFlag, - uint8_t bitReverseFlag); - - /** - * @brief Instance structure for the Q15 RFFT/RIFFT function. - */ - typedef struct - { - uint32_t fftLenReal; /**< length of the real FFT. */ - uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ - uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ - uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ - q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ - const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ - } arm_rfft_instance_q15; - - arm_status arm_rfft_init_q15( - arm_rfft_instance_q15 * S, - uint32_t fftLenReal, - uint32_t ifftFlagR, - uint32_t bitReverseFlag); - - void arm_rfft_q15( - const arm_rfft_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst); - - /** - * @brief Instance structure for the Q31 RFFT/RIFFT function. - */ - typedef struct - { - uint32_t fftLenReal; /**< length of the real FFT. */ - uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ - uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ - uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ - q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ - const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ - } arm_rfft_instance_q31; - - arm_status arm_rfft_init_q31( - arm_rfft_instance_q31 * S, - uint32_t fftLenReal, - uint32_t ifftFlagR, - uint32_t bitReverseFlag); - - void arm_rfft_q31( - const arm_rfft_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst); - - /** - * @brief Instance structure for the floating-point RFFT/RIFFT function. - */ - typedef struct - { - uint32_t fftLenReal; /**< length of the real FFT. */ - uint16_t fftLenBy2; /**< length of the complex FFT. */ - uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ - uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ - uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ - float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ - float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ - arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ - } arm_rfft_instance_f32; - - arm_status arm_rfft_init_f32( - arm_rfft_instance_f32 * S, - arm_cfft_radix4_instance_f32 * S_CFFT, - uint32_t fftLenReal, - uint32_t ifftFlagR, - uint32_t bitReverseFlag); - - void arm_rfft_f32( - const arm_rfft_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst); - - /** - * @brief Instance structure for the floating-point RFFT/RIFFT function. - */ -typedef struct - { - arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ - uint16_t fftLenRFFT; /**< length of the real sequence */ - float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ - } arm_rfft_fast_instance_f32 ; - -arm_status arm_rfft_fast_init_f32 ( - arm_rfft_fast_instance_f32 * S, - uint16_t fftLen); - -void arm_rfft_fast_f32( - arm_rfft_fast_instance_f32 * S, - float32_t * p, float32_t * pOut, - uint8_t ifftFlag); - - /** - * @brief Instance structure for the floating-point DCT4/IDCT4 function. - */ - typedef struct - { - uint16_t N; /**< length of the DCT4. */ - uint16_t Nby2; /**< half of the length of the DCT4. */ - float32_t normalize; /**< normalizing factor. */ - float32_t *pTwiddle; /**< points to the twiddle factor table. */ - float32_t *pCosFactor; /**< points to the cosFactor table. */ - arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ - arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ - } arm_dct4_instance_f32; - - - /** - * @brief Initialization function for the floating-point DCT4/IDCT4. - * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure. - * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure. - * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure. - * @param[in] N length of the DCT4. - * @param[in] Nby2 half of the length of the DCT4. - * @param[in] normalize normalizing factor. - * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if fftLenReal is not a supported transform length. - */ - arm_status arm_dct4_init_f32( - arm_dct4_instance_f32 * S, - arm_rfft_instance_f32 * S_RFFT, - arm_cfft_radix4_instance_f32 * S_CFFT, - uint16_t N, - uint16_t Nby2, - float32_t normalize); - - - /** - * @brief Processing function for the floating-point DCT4/IDCT4. - * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure. - * @param[in] pState points to state buffer. - * @param[in,out] pInlineBuffer points to the in-place input and output buffer. - */ - void arm_dct4_f32( - const arm_dct4_instance_f32 * S, - float32_t * pState, - float32_t * pInlineBuffer); - - - /** - * @brief Instance structure for the Q31 DCT4/IDCT4 function. - */ - typedef struct - { - uint16_t N; /**< length of the DCT4. */ - uint16_t Nby2; /**< half of the length of the DCT4. */ - q31_t normalize; /**< normalizing factor. */ - q31_t *pTwiddle; /**< points to the twiddle factor table. */ - q31_t *pCosFactor; /**< points to the cosFactor table. */ - arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ - arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ - } arm_dct4_instance_q31; - - - /** - * @brief Initialization function for the Q31 DCT4/IDCT4. - * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure. - * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure - * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure - * @param[in] N length of the DCT4. - * @param[in] Nby2 half of the length of the DCT4. - * @param[in] normalize normalizing factor. - * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. - */ - arm_status arm_dct4_init_q31( - arm_dct4_instance_q31 * S, - arm_rfft_instance_q31 * S_RFFT, - arm_cfft_radix4_instance_q31 * S_CFFT, - uint16_t N, - uint16_t Nby2, - q31_t normalize); - - - /** - * @brief Processing function for the Q31 DCT4/IDCT4. - * @param[in] S points to an instance of the Q31 DCT4 structure. - * @param[in] pState points to state buffer. - * @param[in,out] pInlineBuffer points to the in-place input and output buffer. - */ - void arm_dct4_q31( - const arm_dct4_instance_q31 * S, - q31_t * pState, - q31_t * pInlineBuffer); - - - /** - * @brief Instance structure for the Q15 DCT4/IDCT4 function. - */ - typedef struct - { - uint16_t N; /**< length of the DCT4. */ - uint16_t Nby2; /**< half of the length of the DCT4. */ - q15_t normalize; /**< normalizing factor. */ - q15_t *pTwiddle; /**< points to the twiddle factor table. */ - q15_t *pCosFactor; /**< points to the cosFactor table. */ - arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ - arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ - } arm_dct4_instance_q15; - - - /** - * @brief Initialization function for the Q15 DCT4/IDCT4. - * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure. - * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure. - * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure. - * @param[in] N length of the DCT4. - * @param[in] Nby2 half of the length of the DCT4. - * @param[in] normalize normalizing factor. - * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. - */ - arm_status arm_dct4_init_q15( - arm_dct4_instance_q15 * S, - arm_rfft_instance_q15 * S_RFFT, - arm_cfft_radix4_instance_q15 * S_CFFT, - uint16_t N, - uint16_t Nby2, - q15_t normalize); - - - /** - * @brief Processing function for the Q15 DCT4/IDCT4. - * @param[in] S points to an instance of the Q15 DCT4 structure. - * @param[in] pState points to state buffer. - * @param[in,out] pInlineBuffer points to the in-place input and output buffer. - */ - void arm_dct4_q15( - const arm_dct4_instance_q15 * S, - q15_t * pState, - q15_t * pInlineBuffer); - - - /** - * @brief Floating-point vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q7 vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_q7( - q7_t * pSrcA, - q7_t * pSrcB, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector addition. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_add_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Floating-point vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q7 vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_q7( - q7_t * pSrcA, - q7_t * pSrcB, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector subtraction. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in each vector - */ - void arm_sub_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a floating-point vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scale scale factor to be applied - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_f32( - float32_t * pSrc, - float32_t scale, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a Q7 vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scaleFract fractional portion of the scale value - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_q7( - q7_t * pSrc, - q7_t scaleFract, - int8_t shift, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a Q15 vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scaleFract fractional portion of the scale value - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_q15( - q15_t * pSrc, - q15_t scaleFract, - int8_t shift, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Multiplies a Q31 vector by a scalar. - * @param[in] pSrc points to the input vector - * @param[in] scaleFract fractional portion of the scale value - * @param[in] shift number of bits to shift the result by - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_scale_q31( - q31_t * pSrc, - q31_t scaleFract, - int8_t shift, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q7 vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_q7( - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Floating-point vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q15 vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Q31 vector absolute value. - * @param[in] pSrc points to the input buffer - * @param[out] pDst points to the output buffer - * @param[in] blockSize number of samples in each vector - */ - void arm_abs_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Dot product of floating-point vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_f32( - float32_t * pSrcA, - float32_t * pSrcB, - uint32_t blockSize, - float32_t * result); - - - /** - * @brief Dot product of Q7 vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_q7( - q7_t * pSrcA, - q7_t * pSrcB, - uint32_t blockSize, - q31_t * result); - - - /** - * @brief Dot product of Q15 vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_q15( - q15_t * pSrcA, - q15_t * pSrcB, - uint32_t blockSize, - q63_t * result); - - - /** - * @brief Dot product of Q31 vectors. - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] blockSize number of samples in each vector - * @param[out] result output result returned here - */ - void arm_dot_prod_q31( - q31_t * pSrcA, - q31_t * pSrcB, - uint32_t blockSize, - q63_t * result); - - - /** - * @brief Shifts the elements of a Q7 vector a specified number of bits. - * @param[in] pSrc points to the input vector - * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_shift_q7( - q7_t * pSrc, - int8_t shiftBits, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Shifts the elements of a Q15 vector a specified number of bits. - * @param[in] pSrc points to the input vector - * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_shift_q15( - q15_t * pSrc, - int8_t shiftBits, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Shifts the elements of a Q31 vector a specified number of bits. - * @param[in] pSrc points to the input vector - * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_shift_q31( - q31_t * pSrc, - int8_t shiftBits, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a floating-point vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_f32( - float32_t * pSrc, - float32_t offset, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a Q7 vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_q7( - q7_t * pSrc, - q7_t offset, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a Q15 vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_q15( - q15_t * pSrc, - q15_t offset, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Adds a constant offset to a Q31 vector. - * @param[in] pSrc points to the input vector - * @param[in] offset is the offset to be added - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_offset_q31( - q31_t * pSrc, - q31_t offset, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a floating-point vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a Q7 vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_q7( - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a Q15 vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Negates the elements of a Q31 vector. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] blockSize number of samples in the vector - */ - void arm_negate_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a floating-point vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a Q7 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_q7( - q7_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a Q15 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Copies the elements of a Q31 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_copy_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a floating-point vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_f32( - float32_t value, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a Q7 vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_q7( - q7_t value, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a Q15 vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_q15( - q15_t value, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Fills a constant value into a Q31 vector. - * @param[in] value input value to be filled - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_fill_q31( - q31_t value, - q31_t * pDst, - uint32_t blockSize); - - -/** - * @brief Convolution of floating-point sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. - */ - void arm_conv_f32( - float32_t * pSrcA, - uint32_t srcALen, - float32_t * pSrcB, - uint32_t srcBLen, - float32_t * pDst); - - - /** - * @brief Convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - */ - void arm_conv_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - -/** - * @brief Convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. - */ - void arm_conv_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_fast_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - */ - void arm_conv_fast_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Convolution of Q31 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_fast_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Convolution of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). - */ - void arm_conv_opt_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Convolution of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. - */ - void arm_conv_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst); - - - /** - * @brief Partial convolution of floating-point sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_f32( - float32_t * pSrcA, - uint32_t srcALen, - float32_t * pSrcB, - uint32_t srcBLen, - float32_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Partial convolution of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_fast_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_fast_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - uint32_t firstIndex, - uint32_t numPoints, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Partial convolution of Q31 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_fast_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Partial convolution of Q7 sequences - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_opt_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - uint32_t firstIndex, - uint32_t numPoints, - q15_t * pScratch1, - q15_t * pScratch2); - - -/** - * @brief Partial convolution of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data - * @param[in] firstIndex is the first output sample to start with. - * @param[in] numPoints is the number of output points to be computed. - * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. - */ - arm_status arm_conv_partial_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - uint32_t firstIndex, - uint32_t numPoints); - - - /** - * @brief Instance structure for the Q15 FIR decimator. - */ - typedef struct - { - uint8_t M; /**< decimation factor. */ - uint16_t numTaps; /**< number of coefficients in the filter. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - } arm_fir_decimate_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR decimator. - */ - typedef struct - { - uint8_t M; /**< decimation factor. */ - uint16_t numTaps; /**< number of coefficients in the filter. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - } arm_fir_decimate_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR decimator. - */ - typedef struct - { - uint8_t M; /**< decimation factor. */ - uint16_t numTaps; /**< number of coefficients in the filter. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - } arm_fir_decimate_instance_f32; - - - /** - * @brief Processing function for the floating-point FIR decimator. - * @param[in] S points to an instance of the floating-point FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_f32( - const arm_fir_decimate_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point FIR decimator. - * @param[in,out] S points to an instance of the floating-point FIR decimator structure. - * @param[in] numTaps number of coefficients in the filter. - * @param[in] M decimation factor. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * blockSize is not a multiple of M. - */ - arm_status arm_fir_decimate_init_f32( - arm_fir_decimate_instance_f32 * S, - uint16_t numTaps, - uint8_t M, - float32_t * pCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 FIR decimator. - * @param[in] S points to an instance of the Q15 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_q15( - const arm_fir_decimate_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q15 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_fast_q15( - const arm_fir_decimate_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 FIR decimator. - * @param[in,out] S points to an instance of the Q15 FIR decimator structure. - * @param[in] numTaps number of coefficients in the filter. - * @param[in] M decimation factor. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * blockSize is not a multiple of M. - */ - arm_status arm_fir_decimate_init_q15( - arm_fir_decimate_instance_q15 * S, - uint16_t numTaps, - uint8_t M, - q15_t * pCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 FIR decimator. - * @param[in] S points to an instance of the Q31 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_q31( - const arm_fir_decimate_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - /** - * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. - * @param[in] S points to an instance of the Q31 FIR decimator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_decimate_fast_q31( - arm_fir_decimate_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR decimator. - * @param[in,out] S points to an instance of the Q31 FIR decimator structure. - * @param[in] numTaps number of coefficients in the filter. - * @param[in] M decimation factor. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * blockSize is not a multiple of M. - */ - arm_status arm_fir_decimate_init_q31( - arm_fir_decimate_instance_q31 * S, - uint16_t numTaps, - uint8_t M, - q31_t * pCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 FIR interpolator. - */ - typedef struct - { - uint8_t L; /**< upsample factor. */ - uint16_t phaseLength; /**< length of each polyphase filter component. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ - q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ - } arm_fir_interpolate_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR interpolator. - */ - typedef struct - { - uint8_t L; /**< upsample factor. */ - uint16_t phaseLength; /**< length of each polyphase filter component. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ - q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ - } arm_fir_interpolate_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR interpolator. - */ - typedef struct - { - uint8_t L; /**< upsample factor. */ - uint16_t phaseLength; /**< length of each polyphase filter component. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ - float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ - } arm_fir_interpolate_instance_f32; - - - /** - * @brief Processing function for the Q15 FIR interpolator. - * @param[in] S points to an instance of the Q15 FIR interpolator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_interpolate_q15( - const arm_fir_interpolate_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 FIR interpolator. - * @param[in,out] S points to an instance of the Q15 FIR interpolator structure. - * @param[in] L upsample factor. - * @param[in] numTaps number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * the filter length numTaps is not a multiple of the interpolation factor L. - */ - arm_status arm_fir_interpolate_init_q15( - arm_fir_interpolate_instance_q15 * S, - uint8_t L, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 FIR interpolator. - * @param[in] S points to an instance of the Q15 FIR interpolator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_interpolate_q31( - const arm_fir_interpolate_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR interpolator. - * @param[in,out] S points to an instance of the Q31 FIR interpolator structure. - * @param[in] L upsample factor. - * @param[in] numTaps number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * the filter length numTaps is not a multiple of the interpolation factor L. - */ - arm_status arm_fir_interpolate_init_q31( - arm_fir_interpolate_instance_q31 * S, - uint8_t L, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point FIR interpolator. - * @param[in] S points to an instance of the floating-point FIR interpolator structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_interpolate_f32( - const arm_fir_interpolate_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point FIR interpolator. - * @param[in,out] S points to an instance of the floating-point FIR interpolator structure. - * @param[in] L upsample factor. - * @param[in] numTaps number of filter coefficients in the filter. - * @param[in] pCoeffs points to the filter coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] blockSize number of input samples to process per call. - * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if - * the filter length numTaps is not a multiple of the interpolation factor L. - */ - arm_status arm_fir_interpolate_init_f32( - arm_fir_interpolate_instance_f32 * S, - uint8_t L, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the high precision Q31 Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ - q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ - } arm_biquad_cas_df1_32x64_ins_q31; - - - /** - * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cas_df1_32x64_q31( - const arm_biquad_cas_df1_32x64_ins_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format - */ - void arm_biquad_cas_df1_32x64_init_q31( - arm_biquad_cas_df1_32x64_ins_q31 * S, - uint8_t numStages, - q31_t * pCoeffs, - q63_t * pState, - uint8_t postShift); - - - /** - * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ - float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_cascade_df2T_instance_f32; - - /** - * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ - float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_cascade_stereo_df2T_instance_f32; - - /** - * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. - */ - typedef struct - { - uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ - float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ - float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ - } arm_biquad_cascade_df2T_instance_f64; - - - /** - * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in] S points to an instance of the filter data structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df2T_f32( - const arm_biquad_cascade_df2T_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels - * @param[in] S points to an instance of the filter data structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_stereo_df2T_f32( - const arm_biquad_cascade_stereo_df2T_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in] S points to an instance of the filter data structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_biquad_cascade_df2T_f64( - const arm_biquad_cascade_df2T_instance_f64 * S, - float64_t * pSrc, - float64_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in,out] S points to an instance of the filter data structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_df2T_init_f32( - arm_biquad_cascade_df2T_instance_f32 * S, - uint8_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in,out] S points to an instance of the filter data structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_stereo_df2T_init_f32( - arm_biquad_cascade_stereo_df2T_instance_f32 * S, - uint8_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. - * @param[in,out] S points to an instance of the filter data structure. - * @param[in] numStages number of 2nd order stages in the filter. - * @param[in] pCoeffs points to the filter coefficients. - * @param[in] pState points to the state buffer. - */ - void arm_biquad_cascade_df2T_init_f64( - arm_biquad_cascade_df2T_instance_f64 * S, - uint8_t numStages, - float64_t * pCoeffs, - float64_t * pState); - - - /** - * @brief Instance structure for the Q15 FIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of filter stages. */ - q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ - } arm_fir_lattice_instance_q15; - - /** - * @brief Instance structure for the Q31 FIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of filter stages. */ - q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ - } arm_fir_lattice_instance_q31; - - /** - * @brief Instance structure for the floating-point FIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of filter stages. */ - float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ - } arm_fir_lattice_instance_f32; - - - /** - * @brief Initialization function for the Q15 FIR lattice filter. - * @param[in] S points to an instance of the Q15 FIR lattice structure. - * @param[in] numStages number of filter stages. - * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. - * @param[in] pState points to the state buffer. The array is of length numStages. - */ - void arm_fir_lattice_init_q15( - arm_fir_lattice_instance_q15 * S, - uint16_t numStages, - q15_t * pCoeffs, - q15_t * pState); - - - /** - * @brief Processing function for the Q15 FIR lattice filter. - * @param[in] S points to an instance of the Q15 FIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_fir_lattice_q15( - const arm_fir_lattice_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 FIR lattice filter. - * @param[in] S points to an instance of the Q31 FIR lattice structure. - * @param[in] numStages number of filter stages. - * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. - * @param[in] pState points to the state buffer. The array is of length numStages. - */ - void arm_fir_lattice_init_q31( - arm_fir_lattice_instance_q31 * S, - uint16_t numStages, - q31_t * pCoeffs, - q31_t * pState); - - - /** - * @brief Processing function for the Q31 FIR lattice filter. - * @param[in] S points to an instance of the Q31 FIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_fir_lattice_q31( - const arm_fir_lattice_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - -/** - * @brief Initialization function for the floating-point FIR lattice filter. - * @param[in] S points to an instance of the floating-point FIR lattice structure. - * @param[in] numStages number of filter stages. - * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. - * @param[in] pState points to the state buffer. The array is of length numStages. - */ - void arm_fir_lattice_init_f32( - arm_fir_lattice_instance_f32 * S, - uint16_t numStages, - float32_t * pCoeffs, - float32_t * pState); - - - /** - * @brief Processing function for the floating-point FIR lattice filter. - * @param[in] S points to an instance of the floating-point FIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] blockSize number of samples to process. - */ - void arm_fir_lattice_f32( - const arm_fir_lattice_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 IIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of stages in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ - q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ - q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ - } arm_iir_lattice_instance_q15; - - /** - * @brief Instance structure for the Q31 IIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of stages in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ - q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ - q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ - } arm_iir_lattice_instance_q31; - - /** - * @brief Instance structure for the floating-point IIR lattice filter. - */ - typedef struct - { - uint16_t numStages; /**< number of stages in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ - float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ - float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ - } arm_iir_lattice_instance_f32; - - - /** - * @brief Processing function for the floating-point IIR lattice filter. - * @param[in] S points to an instance of the floating-point IIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_f32( - const arm_iir_lattice_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point IIR lattice filter. - * @param[in] S points to an instance of the floating-point IIR lattice structure. - * @param[in] numStages number of stages in the filter. - * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. - * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. - * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_init_f32( - arm_iir_lattice_instance_f32 * S, - uint16_t numStages, - float32_t * pkCoeffs, - float32_t * pvCoeffs, - float32_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 IIR lattice filter. - * @param[in] S points to an instance of the Q31 IIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_q31( - const arm_iir_lattice_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 IIR lattice filter. - * @param[in] S points to an instance of the Q31 IIR lattice structure. - * @param[in] numStages number of stages in the filter. - * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. - * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. - * @param[in] pState points to the state buffer. The array is of length numStages+blockSize. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_init_q31( - arm_iir_lattice_instance_q31 * S, - uint16_t numStages, - q31_t * pkCoeffs, - q31_t * pvCoeffs, - q31_t * pState, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 IIR lattice filter. - * @param[in] S points to an instance of the Q15 IIR lattice structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data. - * @param[in] blockSize number of samples to process. - */ - void arm_iir_lattice_q15( - const arm_iir_lattice_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - -/** - * @brief Initialization function for the Q15 IIR lattice filter. - * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure. - * @param[in] numStages number of stages in the filter. - * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages. - * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. - * @param[in] pState points to state buffer. The array is of length numStages+blockSize. - * @param[in] blockSize number of samples to process per call. - */ - void arm_iir_lattice_init_q15( - arm_iir_lattice_instance_q15 * S, - uint16_t numStages, - q15_t * pkCoeffs, - q15_t * pvCoeffs, - q15_t * pState, - uint32_t blockSize); - - - /** - * @brief Instance structure for the floating-point LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - float32_t mu; /**< step size that controls filter coefficient updates. */ - } arm_lms_instance_f32; - - - /** - * @brief Processing function for floating-point LMS filter. - * @param[in] S points to an instance of the floating-point LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_f32( - const arm_lms_instance_f32 * S, - float32_t * pSrc, - float32_t * pRef, - float32_t * pOut, - float32_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for floating-point LMS filter. - * @param[in] S points to an instance of the floating-point LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to the coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_init_f32( - arm_lms_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - float32_t mu, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q15 LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q15_t mu; /**< step size that controls filter coefficient updates. */ - uint32_t postShift; /**< bit shift applied to coefficients. */ - } arm_lms_instance_q15; - - - /** - * @brief Initialization function for the Q15 LMS filter. - * @param[in] S points to an instance of the Q15 LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to the coefficient buffer. - * @param[in] pState points to the state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_init_q15( - arm_lms_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - q15_t mu, - uint32_t blockSize, - uint32_t postShift); - - - /** - * @brief Processing function for Q15 LMS filter. - * @param[in] S points to an instance of the Q15 LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_q15( - const arm_lms_instance_q15 * S, - q15_t * pSrc, - q15_t * pRef, - q15_t * pOut, - q15_t * pErr, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q31 LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q31_t mu; /**< step size that controls filter coefficient updates. */ - uint32_t postShift; /**< bit shift applied to coefficients. */ - } arm_lms_instance_q31; - - - /** - * @brief Processing function for Q31 LMS filter. - * @param[in] S points to an instance of the Q15 LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_q31( - const arm_lms_instance_q31 * S, - q31_t * pSrc, - q31_t * pRef, - q31_t * pOut, - q31_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for Q31 LMS filter. - * @param[in] S points to an instance of the Q31 LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_init_q31( - arm_lms_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - q31_t mu, - uint32_t blockSize, - uint32_t postShift); - - - /** - * @brief Instance structure for the floating-point normalized LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - float32_t mu; /**< step size that control filter coefficient updates. */ - float32_t energy; /**< saves previous frame energy. */ - float32_t x0; /**< saves previous input sample. */ - } arm_lms_norm_instance_f32; - - - /** - * @brief Processing function for floating-point normalized LMS filter. - * @param[in] S points to an instance of the floating-point normalized LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_f32( - arm_lms_norm_instance_f32 * S, - float32_t * pSrc, - float32_t * pRef, - float32_t * pOut, - float32_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for floating-point normalized LMS filter. - * @param[in] S points to an instance of the floating-point LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_init_f32( - arm_lms_norm_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - float32_t mu, - uint32_t blockSize); - - - /** - * @brief Instance structure for the Q31 normalized LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q31_t mu; /**< step size that controls filter coefficient updates. */ - uint8_t postShift; /**< bit shift applied to coefficients. */ - q31_t *recipTable; /**< points to the reciprocal initial value table. */ - q31_t energy; /**< saves previous frame energy. */ - q31_t x0; /**< saves previous input sample. */ - } arm_lms_norm_instance_q31; - - - /** - * @brief Processing function for Q31 normalized LMS filter. - * @param[in] S points to an instance of the Q31 normalized LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_q31( - arm_lms_norm_instance_q31 * S, - q31_t * pSrc, - q31_t * pRef, - q31_t * pOut, - q31_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for Q31 normalized LMS filter. - * @param[in] S points to an instance of the Q31 normalized LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_norm_init_q31( - arm_lms_norm_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - q31_t mu, - uint32_t blockSize, - uint8_t postShift); - - - /** - * @brief Instance structure for the Q15 normalized LMS filter. - */ - typedef struct - { - uint16_t numTaps; /**< Number of coefficients in the filter. */ - q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ - q15_t mu; /**< step size that controls filter coefficient updates. */ - uint8_t postShift; /**< bit shift applied to coefficients. */ - q15_t *recipTable; /**< Points to the reciprocal initial value table. */ - q15_t energy; /**< saves previous frame energy. */ - q15_t x0; /**< saves previous input sample. */ - } arm_lms_norm_instance_q15; - - - /** - * @brief Processing function for Q15 normalized LMS filter. - * @param[in] S points to an instance of the Q15 normalized LMS filter structure. - * @param[in] pSrc points to the block of input data. - * @param[in] pRef points to the block of reference data. - * @param[out] pOut points to the block of output data. - * @param[out] pErr points to the block of error data. - * @param[in] blockSize number of samples to process. - */ - void arm_lms_norm_q15( - arm_lms_norm_instance_q15 * S, - q15_t * pSrc, - q15_t * pRef, - q15_t * pOut, - q15_t * pErr, - uint32_t blockSize); - - - /** - * @brief Initialization function for Q15 normalized LMS filter. - * @param[in] S points to an instance of the Q15 normalized LMS filter structure. - * @param[in] numTaps number of filter coefficients. - * @param[in] pCoeffs points to coefficient buffer. - * @param[in] pState points to state buffer. - * @param[in] mu step size that controls filter coefficient updates. - * @param[in] blockSize number of samples to process. - * @param[in] postShift bit shift applied to coefficients. - */ - void arm_lms_norm_init_q15( - arm_lms_norm_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - q15_t mu, - uint32_t blockSize, - uint8_t postShift); - - - /** - * @brief Correlation of floating-point sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_f32( - float32_t * pSrcA, - uint32_t srcALen, - float32_t * pSrcB, - uint32_t srcBLen, - float32_t * pDst); - - - /** - * @brief Correlation of Q15 sequences - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - */ - void arm_correlate_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch); - - - /** - * @brief Correlation of Q15 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - - void arm_correlate_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - - void arm_correlate_fast_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst); - - - /** - * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - * @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - */ - void arm_correlate_fast_opt_q15( - q15_t * pSrcA, - uint32_t srcALen, - q15_t * pSrcB, - uint32_t srcBLen, - q15_t * pDst, - q15_t * pScratch); - - - /** - * @brief Correlation of Q31 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_fast_q31( - q31_t * pSrcA, - uint32_t srcALen, - q31_t * pSrcB, - uint32_t srcBLen, - q31_t * pDst); - - - /** - * @brief Correlation of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. - * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). - */ - void arm_correlate_opt_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst, - q15_t * pScratch1, - q15_t * pScratch2); - - - /** - * @brief Correlation of Q7 sequences. - * @param[in] pSrcA points to the first input sequence. - * @param[in] srcALen length of the first input sequence. - * @param[in] pSrcB points to the second input sequence. - * @param[in] srcBLen length of the second input sequence. - * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. - */ - void arm_correlate_q7( - q7_t * pSrcA, - uint32_t srcALen, - q7_t * pSrcB, - uint32_t srcBLen, - q7_t * pDst); - - - /** - * @brief Instance structure for the floating-point sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_f32; - - /** - * @brief Instance structure for the Q31 sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_q31; - - /** - * @brief Instance structure for the Q15 sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_q15; - - /** - * @brief Instance structure for the Q7 sparse FIR filter. - */ - typedef struct - { - uint16_t numTaps; /**< number of coefficients in the filter. */ - uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ - q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ - q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ - uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ - int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ - } arm_fir_sparse_instance_q7; - - - /** - * @brief Processing function for the floating-point sparse FIR filter. - * @param[in] S points to an instance of the floating-point sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_f32( - arm_fir_sparse_instance_f32 * S, - float32_t * pSrc, - float32_t * pDst, - float32_t * pScratchIn, - uint32_t blockSize); - - - /** - * @brief Initialization function for the floating-point sparse FIR filter. - * @param[in,out] S points to an instance of the floating-point sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_f32( - arm_fir_sparse_instance_f32 * S, - uint16_t numTaps, - float32_t * pCoeffs, - float32_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q31 sparse FIR filter. - * @param[in] S points to an instance of the Q31 sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_q31( - arm_fir_sparse_instance_q31 * S, - q31_t * pSrc, - q31_t * pDst, - q31_t * pScratchIn, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q31 sparse FIR filter. - * @param[in,out] S points to an instance of the Q31 sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_q31( - arm_fir_sparse_instance_q31 * S, - uint16_t numTaps, - q31_t * pCoeffs, - q31_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q15 sparse FIR filter. - * @param[in] S points to an instance of the Q15 sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] pScratchOut points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_q15( - arm_fir_sparse_instance_q15 * S, - q15_t * pSrc, - q15_t * pDst, - q15_t * pScratchIn, - q31_t * pScratchOut, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q15 sparse FIR filter. - * @param[in,out] S points to an instance of the Q15 sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_q15( - arm_fir_sparse_instance_q15 * S, - uint16_t numTaps, - q15_t * pCoeffs, - q15_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Processing function for the Q7 sparse FIR filter. - * @param[in] S points to an instance of the Q7 sparse FIR structure. - * @param[in] pSrc points to the block of input data. - * @param[out] pDst points to the block of output data - * @param[in] pScratchIn points to a temporary buffer of size blockSize. - * @param[in] pScratchOut points to a temporary buffer of size blockSize. - * @param[in] blockSize number of input samples to process per call. - */ - void arm_fir_sparse_q7( - arm_fir_sparse_instance_q7 * S, - q7_t * pSrc, - q7_t * pDst, - q7_t * pScratchIn, - q31_t * pScratchOut, - uint32_t blockSize); - - - /** - * @brief Initialization function for the Q7 sparse FIR filter. - * @param[in,out] S points to an instance of the Q7 sparse FIR structure. - * @param[in] numTaps number of nonzero coefficients in the filter. - * @param[in] pCoeffs points to the array of filter coefficients. - * @param[in] pState points to the state buffer. - * @param[in] pTapDelay points to the array of offset times. - * @param[in] maxDelay maximum offset time supported. - * @param[in] blockSize number of samples that will be processed per block. - */ - void arm_fir_sparse_init_q7( - arm_fir_sparse_instance_q7 * S, - uint16_t numTaps, - q7_t * pCoeffs, - q7_t * pState, - int32_t * pTapDelay, - uint16_t maxDelay, - uint32_t blockSize); - - - /** - * @brief Floating-point sin_cos function. - * @param[in] theta input value in degrees - * @param[out] pSinVal points to the processed sine output. - * @param[out] pCosVal points to the processed cos output. - */ - void arm_sin_cos_f32( - float32_t theta, - float32_t * pSinVal, - float32_t * pCosVal); - - - /** - * @brief Q31 sin_cos function. - * @param[in] theta scaled input value in degrees - * @param[out] pSinVal points to the processed sine output. - * @param[out] pCosVal points to the processed cosine output. - */ - void arm_sin_cos_q31( - q31_t theta, - q31_t * pSinVal, - q31_t * pCosVal); - - - /** - * @brief Floating-point complex conjugate. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_conj_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t numSamples); - - /** - * @brief Q31 complex conjugate. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_conj_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex conjugate. - * @param[in] pSrc points to the input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_conj_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @brief Floating-point complex magnitude squared - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_squared_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex magnitude squared - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_squared_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex magnitude squared - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_squared_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @ingroup groupController - */ - - /** - * @defgroup PID PID Motor Control - * - * A Proportional Integral Derivative (PID) controller is a generic feedback control - * loop mechanism widely used in industrial control systems. - * A PID controller is the most commonly used type of feedback controller. - * - * This set of functions implements (PID) controllers - * for Q15, Q31, and floating-point data types. The functions operate on a single sample - * of data and each call to the function returns a single processed value. - * S points to an instance of the PID control data structure. in - * is the input sample value. The functions return the output value. - * - * \par Algorithm: - *
-   *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
-   *    A0 = Kp + Ki + Kd
-   *    A1 = (-Kp ) - (2 * Kd )
-   *    A2 = Kd  
- * - * \par - * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant - * - * \par - * \image html PID.gif "Proportional Integral Derivative Controller" - * - * \par - * The PID controller calculates an "error" value as the difference between - * the measured output and the reference input. - * The controller attempts to minimize the error by adjusting the process control inputs. - * The proportional value determines the reaction to the current error, - * the integral value determines the reaction based on the sum of recent errors, - * and the derivative value determines the reaction based on the rate at which the error has been changing. - * - * \par Instance Structure - * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. - * A separate instance structure must be defined for each PID Controller. - * There are separate instance structure declarations for each of the 3 supported data types. - * - * \par Reset Functions - * There is also an associated reset function for each data type which clears the state array. - * - * \par Initialization Functions - * There is also an associated initialization function for each data type. - * The initialization function performs the following operations: - * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. - * - Zeros out the values in the state buffer. - * - * \par - * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. - * - * \par Fixed-Point Behavior - * Care must be taken when using the fixed-point versions of the PID Controller functions. - * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup PID - * @{ - */ - - /** - * @brief Process function for the floating-point PID Control. - * @param[in,out] S is an instance of the floating-point PID Control structure - * @param[in] in input sample to process - * @return out processed output sample. - */ - static __INLINE float32_t arm_pid_f32( - arm_pid_instance_f32 * S, - float32_t in) - { - float32_t out; - - /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ - out = (S->A0 * in) + - (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); - - /* Update state */ - S->state[1] = S->state[0]; - S->state[0] = in; - S->state[2] = out; - - /* return to application */ - return (out); - - } - - /** - * @brief Process function for the Q31 PID Control. - * @param[in,out] S points to an instance of the Q31 PID Control structure - * @param[in] in input sample to process - * @return out processed output sample. - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 64-bit accumulator. - * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. - * Thus, if the accumulator result overflows it wraps around rather than clip. - * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. - * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. - */ - static __INLINE q31_t arm_pid_q31( - arm_pid_instance_q31 * S, - q31_t in) - { - q63_t acc; - q31_t out; - - /* acc = A0 * x[n] */ - acc = (q63_t) S->A0 * in; - - /* acc += A1 * x[n-1] */ - acc += (q63_t) S->A1 * S->state[0]; - - /* acc += A2 * x[n-2] */ - acc += (q63_t) S->A2 * S->state[1]; - - /* convert output to 1.31 format to add y[n-1] */ - out = (q31_t) (acc >> 31u); - - /* out += y[n-1] */ - out += S->state[2]; - - /* Update state */ - S->state[1] = S->state[0]; - S->state[0] = in; - S->state[2] = out; - - /* return to application */ - return (out); - } - - - /** - * @brief Process function for the Q15 PID Control. - * @param[in,out] S points to an instance of the Q15 PID Control structure - * @param[in] in input sample to process - * @return out processed output sample. - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using a 64-bit internal accumulator. - * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. - * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. - * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. - * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. - * Lastly, the accumulator is saturated to yield a result in 1.15 format. - */ - static __INLINE q15_t arm_pid_q15( - arm_pid_instance_q15 * S, - q15_t in) - { - q63_t acc; - q15_t out; - -#ifndef ARM_MATH_CM0_FAMILY - __SIMD32_TYPE *vstate; - - /* Implementation of PID controller */ - - /* acc = A0 * x[n] */ - acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in); - - /* acc += A1 * x[n-1] + A2 * x[n-2] */ - vstate = __SIMD32_CONST(S->state); - acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)*vstate, (uint64_t)acc); -#else - /* acc = A0 * x[n] */ - acc = ((q31_t) S->A0) * in; - - /* acc += A1 * x[n-1] + A2 * x[n-2] */ - acc += (q31_t) S->A1 * S->state[0]; - acc += (q31_t) S->A2 * S->state[1]; -#endif - - /* acc += y[n-1] */ - acc += (q31_t) S->state[2] << 15; - - /* saturate the output */ - out = (q15_t) (__SSAT((acc >> 15), 16)); - - /* Update state */ - S->state[1] = S->state[0]; - S->state[0] = in; - S->state[2] = out; - - /* return to application */ - return (out); - } - - /** - * @} end of PID group - */ - - - /** - * @brief Floating-point matrix inverse. - * @param[in] src points to the instance of the input floating-point matrix structure. - * @param[out] dst points to the instance of the output floating-point matrix structure. - * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. - * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. - */ - arm_status arm_mat_inverse_f32( - const arm_matrix_instance_f32 * src, - arm_matrix_instance_f32 * dst); - - - /** - * @brief Floating-point matrix inverse. - * @param[in] src points to the instance of the input floating-point matrix structure. - * @param[out] dst points to the instance of the output floating-point matrix structure. - * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. - * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. - */ - arm_status arm_mat_inverse_f64( - const arm_matrix_instance_f64 * src, - arm_matrix_instance_f64 * dst); - - - - /** - * @ingroup groupController - */ - - /** - * @defgroup clarke Vector Clarke Transform - * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. - * Generally the Clarke transform uses three-phase currents Ia, Ib and Ic to calculate currents - * in the two-phase orthogonal stator axis Ialpha and Ibeta. - * When Ialpha is superposed with Ia as shown in the figure below - * \image html clarke.gif Stator current space vector and its components in (a,b). - * and Ia + Ib + Ic = 0, in this condition Ialpha and Ibeta - * can be calculated using only Ia and Ib. - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html clarkeFormula.gif - * where Ia and Ib are the instantaneous stator phases and - * pIalpha and pIbeta are the two coordinates of time invariant vector. - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Clarke transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup clarke - * @{ - */ - - /** - * - * @brief Floating-point Clarke transform - * @param[in] Ia input three-phase coordinate a - * @param[in] Ib input three-phase coordinate b - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - */ - static __INLINE void arm_clarke_f32( - float32_t Ia, - float32_t Ib, - float32_t * pIalpha, - float32_t * pIbeta) - { - /* Calculate pIalpha using the equation, pIalpha = Ia */ - *pIalpha = Ia; - - /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ - *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); - } - - - /** - * @brief Clarke transform for Q31 version - * @param[in] Ia input three-phase coordinate a - * @param[in] Ib input three-phase coordinate b - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the addition, hence there is no risk of overflow. - */ - static __INLINE void arm_clarke_q31( - q31_t Ia, - q31_t Ib, - q31_t * pIalpha, - q31_t * pIbeta) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - - /* Calculating pIalpha from Ia by equation pIalpha = Ia */ - *pIalpha = Ia; - - /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ - product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); - - /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ - product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); - - /* pIbeta is calculated by adding the intermediate products */ - *pIbeta = __QADD(product1, product2); - } - - /** - * @} end of clarke group - */ - - /** - * @brief Converts the elements of the Q7 vector to Q31 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_q7_to_q31( - q7_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - - /** - * @ingroup groupController - */ - - /** - * @defgroup inv_clarke Vector Inverse Clarke Transform - * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html clarkeInvFormula.gif - * where pIa and pIb are the instantaneous stator phases and - * Ialpha and Ibeta are the two coordinates of time invariant vector. - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Clarke transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup inv_clarke - * @{ - */ - - /** - * @brief Floating-point Inverse Clarke transform - * @param[in] Ialpha input two-phase orthogonal vector axis alpha - * @param[in] Ibeta input two-phase orthogonal vector axis beta - * @param[out] pIa points to output three-phase coordinate a - * @param[out] pIb points to output three-phase coordinate b - */ - static __INLINE void arm_inv_clarke_f32( - float32_t Ialpha, - float32_t Ibeta, - float32_t * pIa, - float32_t * pIb) - { - /* Calculating pIa from Ialpha by equation pIa = Ialpha */ - *pIa = Ialpha; - - /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ - *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta; - } - - - /** - * @brief Inverse Clarke transform for Q31 version - * @param[in] Ialpha input two-phase orthogonal vector axis alpha - * @param[in] Ibeta input two-phase orthogonal vector axis beta - * @param[out] pIa points to output three-phase coordinate a - * @param[out] pIb points to output three-phase coordinate b - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the subtraction, hence there is no risk of overflow. - */ - static __INLINE void arm_inv_clarke_q31( - q31_t Ialpha, - q31_t Ibeta, - q31_t * pIa, - q31_t * pIb) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - - /* Calculating pIa from Ialpha by equation pIa = Ialpha */ - *pIa = Ialpha; - - /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ - product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); - - /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ - product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); - - /* pIb is calculated by subtracting the products */ - *pIb = __QSUB(product2, product1); - } - - /** - * @} end of inv_clarke group - */ - - /** - * @brief Converts the elements of the Q7 vector to Q15 vector. - * @param[in] pSrc input pointer - * @param[out] pDst output pointer - * @param[in] blockSize number of samples to process - */ - void arm_q7_to_q15( - q7_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - - /** - * @ingroup groupController - */ - - /** - * @defgroup park Vector Park Transform - * - * Forward Park transform converts the input two-coordinate vector to flux and torque components. - * The Park transform can be used to realize the transformation of the Ialpha and the Ibeta currents - * from the stationary to the moving reference frame and control the spatial relationship between - * the stator vector current and rotor flux vector. - * If we consider the d axis aligned with the rotor flux, the diagram below shows the - * current vector and the relationship from the two reference frames: - * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html parkFormula.gif - * where Ialpha and Ibeta are the stator vector components, - * pId and pIq are rotor vector components and cosVal and sinVal are the - * cosine and sine values of theta (rotor flux position). - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Park transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup park - * @{ - */ - - /** - * @brief Floating-point Park transform - * @param[in] Ialpha input two-phase vector coordinate alpha - * @param[in] Ibeta input two-phase vector coordinate beta - * @param[out] pId points to output rotor reference frame d - * @param[out] pIq points to output rotor reference frame q - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - * - * The function implements the forward Park transform. - * - */ - static __INLINE void arm_park_f32( - float32_t Ialpha, - float32_t Ibeta, - float32_t * pId, - float32_t * pIq, - float32_t sinVal, - float32_t cosVal) - { - /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ - *pId = Ialpha * cosVal + Ibeta * sinVal; - - /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ - *pIq = -Ialpha * sinVal + Ibeta * cosVal; - } - - - /** - * @brief Park transform for Q31 version - * @param[in] Ialpha input two-phase vector coordinate alpha - * @param[in] Ibeta input two-phase vector coordinate beta - * @param[out] pId points to output rotor reference frame d - * @param[out] pIq points to output rotor reference frame q - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the addition and subtraction, hence there is no risk of overflow. - */ - static __INLINE void arm_park_q31( - q31_t Ialpha, - q31_t Ibeta, - q31_t * pId, - q31_t * pIq, - q31_t sinVal, - q31_t cosVal) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - q31_t product3, product4; /* Temporary variables used to store intermediate results */ - - /* Intermediate product is calculated by (Ialpha * cosVal) */ - product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); - - /* Intermediate product is calculated by (Ibeta * sinVal) */ - product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); - - - /* Intermediate product is calculated by (Ialpha * sinVal) */ - product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); - - /* Intermediate product is calculated by (Ibeta * cosVal) */ - product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); - - /* Calculate pId by adding the two intermediate products 1 and 2 */ - *pId = __QADD(product1, product2); - - /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ - *pIq = __QSUB(product4, product3); - } - - /** - * @} end of park group - */ - - /** - * @brief Converts the elements of the Q7 vector to floating-point vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q7_to_float( - q7_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @ingroup groupController - */ - - /** - * @defgroup inv_park Vector Inverse Park transform - * Inverse Park transform converts the input flux and torque components to two-coordinate vector. - * - * The function operates on a single sample of data and each call to the function returns the processed output. - * The library provides separate functions for Q31 and floating-point data types. - * \par Algorithm - * \image html parkInvFormula.gif - * where pIalpha and pIbeta are the stator vector components, - * Id and Iq are rotor vector components and cosVal and sinVal are the - * cosine and sine values of theta (rotor flux position). - * \par Fixed-Point Behavior - * Care must be taken when using the Q31 version of the Park transform. - * In particular, the overflow and saturation behavior of the accumulator used must be considered. - * Refer to the function specific documentation below for usage guidelines. - */ - - /** - * @addtogroup inv_park - * @{ - */ - - /** - * @brief Floating-point Inverse Park transform - * @param[in] Id input coordinate of rotor reference frame d - * @param[in] Iq input coordinate of rotor reference frame q - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - */ - static __INLINE void arm_inv_park_f32( - float32_t Id, - float32_t Iq, - float32_t * pIalpha, - float32_t * pIbeta, - float32_t sinVal, - float32_t cosVal) - { - /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ - *pIalpha = Id * cosVal - Iq * sinVal; - - /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ - *pIbeta = Id * sinVal + Iq * cosVal; - } - - - /** - * @brief Inverse Park transform for Q31 version - * @param[in] Id input coordinate of rotor reference frame d - * @param[in] Iq input coordinate of rotor reference frame q - * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha - * @param[out] pIbeta points to output two-phase orthogonal vector axis beta - * @param[in] sinVal sine value of rotation angle theta - * @param[in] cosVal cosine value of rotation angle theta - * - * Scaling and Overflow Behavior: - * \par - * The function is implemented using an internal 32-bit accumulator. - * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. - * There is saturation on the addition, hence there is no risk of overflow. - */ - static __INLINE void arm_inv_park_q31( - q31_t Id, - q31_t Iq, - q31_t * pIalpha, - q31_t * pIbeta, - q31_t sinVal, - q31_t cosVal) - { - q31_t product1, product2; /* Temporary variables used to store intermediate results */ - q31_t product3, product4; /* Temporary variables used to store intermediate results */ - - /* Intermediate product is calculated by (Id * cosVal) */ - product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); - - /* Intermediate product is calculated by (Iq * sinVal) */ - product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); - - - /* Intermediate product is calculated by (Id * sinVal) */ - product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); - - /* Intermediate product is calculated by (Iq * cosVal) */ - product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); - - /* Calculate pIalpha by using the two intermediate products 1 and 2 */ - *pIalpha = __QSUB(product1, product2); - - /* Calculate pIbeta by using the two intermediate products 3 and 4 */ - *pIbeta = __QADD(product4, product3); - } - - /** - * @} end of Inverse park group - */ - - - /** - * @brief Converts the elements of the Q31 vector to floating-point vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q31_to_float( - q31_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - /** - * @ingroup groupInterpolation - */ - - /** - * @defgroup LinearInterpolate Linear Interpolation - * - * Linear interpolation is a method of curve fitting using linear polynomials. - * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line - * - * \par - * \image html LinearInterp.gif "Linear interpolation" - * - * \par - * A Linear Interpolate function calculates an output value(y), for the input(x) - * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) - * - * \par Algorithm: - *
-   *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
-   *       where x0, x1 are nearest values of input x
-   *             y0, y1 are nearest values to output y
-   * 
- * - * \par - * This set of functions implements Linear interpolation process - * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single - * sample of data and each call to the function returns a single processed value. - * S points to an instance of the Linear Interpolate function data structure. - * x is the input sample value. The functions returns the output value. - * - * \par - * if x is outside of the table boundary, Linear interpolation returns first value of the table - * if x is below input range and returns last value of table if x is above range. - */ - - /** - * @addtogroup LinearInterpolate - * @{ - */ - - /** - * @brief Process function for the floating-point Linear Interpolation Function. - * @param[in,out] S is an instance of the floating-point Linear Interpolation structure - * @param[in] x input sample to process - * @return y processed output sample. - * - */ - static __INLINE float32_t arm_linear_interp_f32( - arm_linear_interp_instance_f32 * S, - float32_t x) - { - float32_t y; - float32_t x0, x1; /* Nearest input values */ - float32_t y0, y1; /* Nearest output values */ - float32_t xSpacing = S->xSpacing; /* spacing between input values */ - int32_t i; /* Index variable */ - float32_t *pYData = S->pYData; /* pointer to output table */ - - /* Calculation of index */ - i = (int32_t) ((x - S->x1) / xSpacing); - - if(i < 0) - { - /* Iniatilize output for below specified range as least output value of table */ - y = pYData[0]; - } - else if((uint32_t)i >= S->nValues) - { - /* Iniatilize output for above specified range as last output value of table */ - y = pYData[S->nValues - 1]; - } - else - { - /* Calculation of nearest input values */ - x0 = S->x1 + i * xSpacing; - x1 = S->x1 + (i + 1) * xSpacing; - - /* Read of nearest output values */ - y0 = pYData[i]; - y1 = pYData[i + 1]; - - /* Calculation of output */ - y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); - - } - - /* returns output value */ - return (y); - } - - - /** - * - * @brief Process function for the Q31 Linear Interpolation Function. - * @param[in] pYData pointer to Q31 Linear Interpolation table - * @param[in] x input sample to process - * @param[in] nValues number of table values - * @return y processed output sample. - * - * \par - * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. - * This function can support maximum of table size 2^12. - * - */ - static __INLINE q31_t arm_linear_interp_q31( - q31_t * pYData, - q31_t x, - uint32_t nValues) - { - q31_t y; /* output */ - q31_t y0, y1; /* Nearest output values */ - q31_t fract; /* fractional part */ - int32_t index; /* Index to read nearest output values */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - index = ((x & (q31_t)0xFFF00000) >> 20); - - if(index >= (int32_t)(nValues - 1)) - { - return (pYData[nValues - 1]); - } - else if(index < 0) - { - return (pYData[0]); - } - else - { - /* 20 bits for the fractional part */ - /* shift left by 11 to keep fract in 1.31 format */ - fract = (x & 0x000FFFFF) << 11; - - /* Read two nearest output values from the index in 1.31(q31) format */ - y0 = pYData[index]; - y1 = pYData[index + 1]; - - /* Calculation of y0 * (1-fract) and y is in 2.30 format */ - y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); - - /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ - y += ((q31_t) (((q63_t) y1 * fract) >> 32)); - - /* Convert y to 1.31 format */ - return (y << 1u); - } - } - - - /** - * - * @brief Process function for the Q15 Linear Interpolation Function. - * @param[in] pYData pointer to Q15 Linear Interpolation table - * @param[in] x input sample to process - * @param[in] nValues number of table values - * @return y processed output sample. - * - * \par - * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. - * This function can support maximum of table size 2^12. - * - */ - static __INLINE q15_t arm_linear_interp_q15( - q15_t * pYData, - q31_t x, - uint32_t nValues) - { - q63_t y; /* output */ - q15_t y0, y1; /* Nearest output values */ - q31_t fract; /* fractional part */ - int32_t index; /* Index to read nearest output values */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - index = ((x & (int32_t)0xFFF00000) >> 20); - - if(index >= (int32_t)(nValues - 1)) - { - return (pYData[nValues - 1]); - } - else if(index < 0) - { - return (pYData[0]); - } - else - { - /* 20 bits for the fractional part */ - /* fract is in 12.20 format */ - fract = (x & 0x000FFFFF); - - /* Read two nearest output values from the index */ - y0 = pYData[index]; - y1 = pYData[index + 1]; - - /* Calculation of y0 * (1-fract) and y is in 13.35 format */ - y = ((q63_t) y0 * (0xFFFFF - fract)); - - /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ - y += ((q63_t) y1 * (fract)); - - /* convert y to 1.15 format */ - return (q15_t) (y >> 20); - } - } - - - /** - * - * @brief Process function for the Q7 Linear Interpolation Function. - * @param[in] pYData pointer to Q7 Linear Interpolation table - * @param[in] x input sample to process - * @param[in] nValues number of table values - * @return y processed output sample. - * - * \par - * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. - * This function can support maximum of table size 2^12. - */ - static __INLINE q7_t arm_linear_interp_q7( - q7_t * pYData, - q31_t x, - uint32_t nValues) - { - q31_t y; /* output */ - q7_t y0, y1; /* Nearest output values */ - q31_t fract; /* fractional part */ - uint32_t index; /* Index to read nearest output values */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - if (x < 0) - { - return (pYData[0]); - } - index = (x >> 20) & 0xfff; - - if(index >= (nValues - 1)) - { - return (pYData[nValues - 1]); - } - else - { - /* 20 bits for the fractional part */ - /* fract is in 12.20 format */ - fract = (x & 0x000FFFFF); - - /* Read two nearest output values from the index and are in 1.7(q7) format */ - y0 = pYData[index]; - y1 = pYData[index + 1]; - - /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ - y = ((y0 * (0xFFFFF - fract))); - - /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ - y += (y1 * fract); - - /* convert y to 1.7(q7) format */ - return (q7_t) (y >> 20); - } - } - - /** - * @} end of LinearInterpolate group - */ - - /** - * @brief Fast approximation to the trigonometric sine function for floating-point data. - * @param[in] x input value in radians. - * @return sin(x). - */ - float32_t arm_sin_f32( - float32_t x); - - - /** - * @brief Fast approximation to the trigonometric sine function for Q31 data. - * @param[in] x Scaled input value in radians. - * @return sin(x). - */ - q31_t arm_sin_q31( - q31_t x); - - - /** - * @brief Fast approximation to the trigonometric sine function for Q15 data. - * @param[in] x Scaled input value in radians. - * @return sin(x). - */ - q15_t arm_sin_q15( - q15_t x); - - - /** - * @brief Fast approximation to the trigonometric cosine function for floating-point data. - * @param[in] x input value in radians. - * @return cos(x). - */ - float32_t arm_cos_f32( - float32_t x); - - - /** - * @brief Fast approximation to the trigonometric cosine function for Q31 data. - * @param[in] x Scaled input value in radians. - * @return cos(x). - */ - q31_t arm_cos_q31( - q31_t x); - - - /** - * @brief Fast approximation to the trigonometric cosine function for Q15 data. - * @param[in] x Scaled input value in radians. - * @return cos(x). - */ - q15_t arm_cos_q15( - q15_t x); - - - /** - * @ingroup groupFastMath - */ - - - /** - * @defgroup SQRT Square Root - * - * Computes the square root of a number. - * There are separate functions for Q15, Q31, and floating-point data types. - * The square root function is computed using the Newton-Raphson algorithm. - * This is an iterative algorithm of the form: - *
-   *      x1 = x0 - f(x0)/f'(x0)
-   * 
- * where x1 is the current estimate, - * x0 is the previous estimate, and - * f'(x0) is the derivative of f() evaluated at x0. - * For the square root function, the algorithm reduces to: - *
-   *     x0 = in/2                         [initial guess]
-   *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]
-   * 
- */ - - - /** - * @addtogroup SQRT - * @{ - */ - - /** - * @brief Floating-point square root function. - * @param[in] in input value. - * @param[out] pOut square root of input value. - * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if - * in is negative value and returns zero output for negative values. - */ - static __INLINE arm_status arm_sqrt_f32( - float32_t in, - float32_t * pOut) - { - if(in >= 0.0f) - { - -#if (__FPU_USED == 1) && defined ( __CC_ARM ) - *pOut = __sqrtf(in); -#elif (__FPU_USED == 1) && (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) - *pOut = __builtin_sqrtf(in); -#elif (__FPU_USED == 1) && defined(__GNUC__) - *pOut = __builtin_sqrtf(in); -#elif (__FPU_USED == 1) && defined ( __ICCARM__ ) && (__VER__ >= 6040000) - __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in)); -#else - *pOut = sqrtf(in); -#endif - - return (ARM_MATH_SUCCESS); - } - else - { - *pOut = 0.0f; - return (ARM_MATH_ARGUMENT_ERROR); - } - } - - - /** - * @brief Q31 square root function. - * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. - * @param[out] pOut square root of input value. - * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if - * in is negative value and returns zero output for negative values. - */ - arm_status arm_sqrt_q31( - q31_t in, - q31_t * pOut); - - - /** - * @brief Q15 square root function. - * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. - * @param[out] pOut square root of input value. - * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if - * in is negative value and returns zero output for negative values. - */ - arm_status arm_sqrt_q15( - q15_t in, - q15_t * pOut); - - /** - * @} end of SQRT group - */ - - - /** - * @brief floating-point Circular write function. - */ - static __INLINE void arm_circularWrite_f32( - int32_t * circBuffer, - int32_t L, - uint16_t * writeOffset, - int32_t bufferInc, - const int32_t * src, - int32_t srcInc, - uint32_t blockSize) - { - uint32_t i = 0u; - int32_t wOffset; - - /* Copy the value of Index pointer that points - * to the current location where the input samples to be copied */ - wOffset = *writeOffset; - - /* Loop over the blockSize */ - i = blockSize; - - while(i > 0u) - { - /* copy the input sample to the circular buffer */ - circBuffer[wOffset] = *src; - - /* Update the input pointer */ - src += srcInc; - - /* Circularly update wOffset. Watch out for positive and negative value */ - wOffset += bufferInc; - if(wOffset >= L) - wOffset -= L; - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *writeOffset = (uint16_t)wOffset; - } - - - - /** - * @brief floating-point Circular Read function. - */ - static __INLINE void arm_circularRead_f32( - int32_t * circBuffer, - int32_t L, - int32_t * readOffset, - int32_t bufferInc, - int32_t * dst, - int32_t * dst_base, - int32_t dst_length, - int32_t dstInc, - uint32_t blockSize) - { - uint32_t i = 0u; - int32_t rOffset, dst_end; - - /* Copy the value of Index pointer that points - * to the current location from where the input samples to be read */ - rOffset = *readOffset; - dst_end = (int32_t) (dst_base + dst_length); - - /* Loop over the blockSize */ - i = blockSize; - - while(i > 0u) - { - /* copy the sample from the circular buffer to the destination buffer */ - *dst = circBuffer[rOffset]; - - /* Update the input pointer */ - dst += dstInc; - - if(dst == (int32_t *) dst_end) - { - dst = dst_base; - } - - /* Circularly update rOffset. Watch out for positive and negative value */ - rOffset += bufferInc; - - if(rOffset >= L) - { - rOffset -= L; - } - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *readOffset = rOffset; - } - - - /** - * @brief Q15 Circular write function. - */ - static __INLINE void arm_circularWrite_q15( - q15_t * circBuffer, - int32_t L, - uint16_t * writeOffset, - int32_t bufferInc, - const q15_t * src, - int32_t srcInc, - uint32_t blockSize) - { - uint32_t i = 0u; - int32_t wOffset; - - /* Copy the value of Index pointer that points - * to the current location where the input samples to be copied */ - wOffset = *writeOffset; - - /* Loop over the blockSize */ - i = blockSize; - - while(i > 0u) - { - /* copy the input sample to the circular buffer */ - circBuffer[wOffset] = *src; - - /* Update the input pointer */ - src += srcInc; - - /* Circularly update wOffset. Watch out for positive and negative value */ - wOffset += bufferInc; - if(wOffset >= L) - wOffset -= L; - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *writeOffset = (uint16_t)wOffset; - } - - - /** - * @brief Q15 Circular Read function. - */ - static __INLINE void arm_circularRead_q15( - q15_t * circBuffer, - int32_t L, - int32_t * readOffset, - int32_t bufferInc, - q15_t * dst, - q15_t * dst_base, - int32_t dst_length, - int32_t dstInc, - uint32_t blockSize) - { - uint32_t i = 0; - int32_t rOffset, dst_end; - - /* Copy the value of Index pointer that points - * to the current location from where the input samples to be read */ - rOffset = *readOffset; - - dst_end = (int32_t) (dst_base + dst_length); - - /* Loop over the blockSize */ - i = blockSize; - - while(i > 0u) - { - /* copy the sample from the circular buffer to the destination buffer */ - *dst = circBuffer[rOffset]; - - /* Update the input pointer */ - dst += dstInc; - - if(dst == (q15_t *) dst_end) - { - dst = dst_base; - } - - /* Circularly update wOffset. Watch out for positive and negative value */ - rOffset += bufferInc; - - if(rOffset >= L) - { - rOffset -= L; - } - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *readOffset = rOffset; - } - - - /** - * @brief Q7 Circular write function. - */ - static __INLINE void arm_circularWrite_q7( - q7_t * circBuffer, - int32_t L, - uint16_t * writeOffset, - int32_t bufferInc, - const q7_t * src, - int32_t srcInc, - uint32_t blockSize) - { - uint32_t i = 0u; - int32_t wOffset; - - /* Copy the value of Index pointer that points - * to the current location where the input samples to be copied */ - wOffset = *writeOffset; - - /* Loop over the blockSize */ - i = blockSize; - - while(i > 0u) - { - /* copy the input sample to the circular buffer */ - circBuffer[wOffset] = *src; - - /* Update the input pointer */ - src += srcInc; - - /* Circularly update wOffset. Watch out for positive and negative value */ - wOffset += bufferInc; - if(wOffset >= L) - wOffset -= L; - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *writeOffset = (uint16_t)wOffset; - } - - - /** - * @brief Q7 Circular Read function. - */ - static __INLINE void arm_circularRead_q7( - q7_t * circBuffer, - int32_t L, - int32_t * readOffset, - int32_t bufferInc, - q7_t * dst, - q7_t * dst_base, - int32_t dst_length, - int32_t dstInc, - uint32_t blockSize) - { - uint32_t i = 0; - int32_t rOffset, dst_end; - - /* Copy the value of Index pointer that points - * to the current location from where the input samples to be read */ - rOffset = *readOffset; - - dst_end = (int32_t) (dst_base + dst_length); - - /* Loop over the blockSize */ - i = blockSize; - - while(i > 0u) - { - /* copy the sample from the circular buffer to the destination buffer */ - *dst = circBuffer[rOffset]; - - /* Update the input pointer */ - dst += dstInc; - - if(dst == (q7_t *) dst_end) - { - dst = dst_base; - } - - /* Circularly update rOffset. Watch out for positive and negative value */ - rOffset += bufferInc; - - if(rOffset >= L) - { - rOffset -= L; - } - - /* Decrement the loop counter */ - i--; - } - - /* Update the index pointer */ - *readOffset = rOffset; - } - - - /** - * @brief Sum of the squares of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_q31( - q31_t * pSrc, - uint32_t blockSize, - q63_t * pResult); - - - /** - * @brief Sum of the squares of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Sum of the squares of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_q15( - q15_t * pSrc, - uint32_t blockSize, - q63_t * pResult); - - - /** - * @brief Sum of the squares of the elements of a Q7 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_power_q7( - q7_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Mean value of a Q7 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_q7( - q7_t * pSrc, - uint32_t blockSize, - q7_t * pResult); - - - /** - * @brief Mean value of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Mean value of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Mean value of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_mean_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Variance of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_var_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Variance of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_var_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Variance of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_var_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Root Mean Square of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_rms_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Root Mean Square of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_rms_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Root Mean Square of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_rms_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Standard deviation of the elements of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_std_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult); - - - /** - * @brief Standard deviation of the elements of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_std_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult); - - - /** - * @brief Standard deviation of the elements of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output value. - */ - void arm_std_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult); - - - /** - * @brief Floating-point complex magnitude - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_f32( - float32_t * pSrc, - float32_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex magnitude - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_q31( - q31_t * pSrc, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex magnitude - * @param[in] pSrc points to the complex input vector - * @param[out] pDst points to the real output vector - * @param[in] numSamples number of complex samples in the input vector - */ - void arm_cmplx_mag_q15( - q15_t * pSrc, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q15 complex dot product - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] numSamples number of complex samples in each vector - * @param[out] realResult real part of the result returned here - * @param[out] imagResult imaginary part of the result returned here - */ - void arm_cmplx_dot_prod_q15( - q15_t * pSrcA, - q15_t * pSrcB, - uint32_t numSamples, - q31_t * realResult, - q31_t * imagResult); - - - /** - * @brief Q31 complex dot product - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] numSamples number of complex samples in each vector - * @param[out] realResult real part of the result returned here - * @param[out] imagResult imaginary part of the result returned here - */ - void arm_cmplx_dot_prod_q31( - q31_t * pSrcA, - q31_t * pSrcB, - uint32_t numSamples, - q63_t * realResult, - q63_t * imagResult); - - - /** - * @brief Floating-point complex dot product - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[in] numSamples number of complex samples in each vector - * @param[out] realResult real part of the result returned here - * @param[out] imagResult imaginary part of the result returned here - */ - void arm_cmplx_dot_prod_f32( - float32_t * pSrcA, - float32_t * pSrcB, - uint32_t numSamples, - float32_t * realResult, - float32_t * imagResult); - - - /** - * @brief Q15 complex-by-real multiplication - * @param[in] pSrcCmplx points to the complex input vector - * @param[in] pSrcReal points to the real input vector - * @param[out] pCmplxDst points to the complex output vector - * @param[in] numSamples number of samples in each vector - */ - void arm_cmplx_mult_real_q15( - q15_t * pSrcCmplx, - q15_t * pSrcReal, - q15_t * pCmplxDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex-by-real multiplication - * @param[in] pSrcCmplx points to the complex input vector - * @param[in] pSrcReal points to the real input vector - * @param[out] pCmplxDst points to the complex output vector - * @param[in] numSamples number of samples in each vector - */ - void arm_cmplx_mult_real_q31( - q31_t * pSrcCmplx, - q31_t * pSrcReal, - q31_t * pCmplxDst, - uint32_t numSamples); - - - /** - * @brief Floating-point complex-by-real multiplication - * @param[in] pSrcCmplx points to the complex input vector - * @param[in] pSrcReal points to the real input vector - * @param[out] pCmplxDst points to the complex output vector - * @param[in] numSamples number of samples in each vector - */ - void arm_cmplx_mult_real_f32( - float32_t * pSrcCmplx, - float32_t * pSrcReal, - float32_t * pCmplxDst, - uint32_t numSamples); - - - /** - * @brief Minimum value of a Q7 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] result is output pointer - * @param[in] index is the array index of the minimum value in the input buffer. - */ - void arm_min_q7( - q7_t * pSrc, - uint32_t blockSize, - q7_t * result, - uint32_t * index); - - - /** - * @brief Minimum value of a Q15 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output pointer - * @param[in] pIndex is the array index of the minimum value in the input buffer. - */ - void arm_min_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult, - uint32_t * pIndex); - - - /** - * @brief Minimum value of a Q31 vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output pointer - * @param[out] pIndex is the array index of the minimum value in the input buffer. - */ - void arm_min_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult, - uint32_t * pIndex); - - - /** - * @brief Minimum value of a floating-point vector. - * @param[in] pSrc is input pointer - * @param[in] blockSize is the number of samples to process - * @param[out] pResult is output pointer - * @param[out] pIndex is the array index of the minimum value in the input buffer. - */ - void arm_min_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a Q7 vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_q7( - q7_t * pSrc, - uint32_t blockSize, - q7_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a Q15 vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_q15( - q15_t * pSrc, - uint32_t blockSize, - q15_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a Q31 vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_q31( - q31_t * pSrc, - uint32_t blockSize, - q31_t * pResult, - uint32_t * pIndex); - - -/** - * @brief Maximum value of a floating-point vector. - * @param[in] pSrc points to the input buffer - * @param[in] blockSize length of the input vector - * @param[out] pResult maximum value returned here - * @param[out] pIndex index of maximum value returned here - */ - void arm_max_f32( - float32_t * pSrc, - uint32_t blockSize, - float32_t * pResult, - uint32_t * pIndex); - - - /** - * @brief Q15 complex-by-complex multiplication - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_mult_cmplx_q15( - q15_t * pSrcA, - q15_t * pSrcB, - q15_t * pDst, - uint32_t numSamples); - - - /** - * @brief Q31 complex-by-complex multiplication - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_mult_cmplx_q31( - q31_t * pSrcA, - q31_t * pSrcB, - q31_t * pDst, - uint32_t numSamples); - - - /** - * @brief Floating-point complex-by-complex multiplication - * @param[in] pSrcA points to the first input vector - * @param[in] pSrcB points to the second input vector - * @param[out] pDst points to the output vector - * @param[in] numSamples number of complex samples in each vector - */ - void arm_cmplx_mult_cmplx_f32( - float32_t * pSrcA, - float32_t * pSrcB, - float32_t * pDst, - uint32_t numSamples); - - - /** - * @brief Converts the elements of the floating-point vector to Q31 vector. - * @param[in] pSrc points to the floating-point input vector - * @param[out] pDst points to the Q31 output vector - * @param[in] blockSize length of the input vector - */ - void arm_float_to_q31( - float32_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the floating-point vector to Q15 vector. - * @param[in] pSrc points to the floating-point input vector - * @param[out] pDst points to the Q15 output vector - * @param[in] blockSize length of the input vector - */ - void arm_float_to_q15( - float32_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the floating-point vector to Q7 vector. - * @param[in] pSrc points to the floating-point input vector - * @param[out] pDst points to the Q7 output vector - * @param[in] blockSize length of the input vector - */ - void arm_float_to_q7( - float32_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q31 vector to Q15 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q31_to_q15( - q31_t * pSrc, - q15_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q31 vector to Q7 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q31_to_q7( - q31_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q15 vector to floating-point vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q15_to_float( - q15_t * pSrc, - float32_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q15 vector to Q31 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q15_to_q31( - q15_t * pSrc, - q31_t * pDst, - uint32_t blockSize); - - - /** - * @brief Converts the elements of the Q15 vector to Q7 vector. - * @param[in] pSrc is input pointer - * @param[out] pDst is output pointer - * @param[in] blockSize is the number of samples to process - */ - void arm_q15_to_q7( - q15_t * pSrc, - q7_t * pDst, - uint32_t blockSize); - - - /** - * @ingroup groupInterpolation - */ - - /** - * @defgroup BilinearInterpolate Bilinear Interpolation - * - * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. - * The underlying function f(x, y) is sampled on a regular grid and the interpolation process - * determines values between the grid points. - * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. - * Bilinear interpolation is often used in image processing to rescale images. - * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. - * - * Algorithm - * \par - * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. - * For floating-point, the instance structure is defined as: - *
-   *   typedef struct
-   *   {
-   *     uint16_t numRows;
-   *     uint16_t numCols;
-   *     float32_t *pData;
-   * } arm_bilinear_interp_instance_f32;
-   * 
- * - * \par - * where numRows specifies the number of rows in the table; - * numCols specifies the number of columns in the table; - * and pData points to an array of size numRows*numCols values. - * The data table pTable is organized in row order and the supplied data values fall on integer indexes. - * That is, table element (x,y) is located at pTable[x + y*numCols] where x and y are integers. - * - * \par - * Let (x, y) specify the desired interpolation point. Then define: - *
-   *     XF = floor(x)
-   *     YF = floor(y)
-   * 
- * \par - * The interpolated output point is computed as: - *
-   *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
-   *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))
-   *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)
-   *           + f(XF+1, YF+1) * (x-XF)*(y-YF)
-   * 
- * Note that the coordinates (x, y) contain integer and fractional components. - * The integer components specify which portion of the table to use while the - * fractional components control the interpolation processor. - * - * \par - * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. - */ - - /** - * @addtogroup BilinearInterpolate - * @{ - */ - - - /** - * - * @brief Floating-point bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate. - * @param[in] Y interpolation coordinate. - * @return out interpolated value. - */ - static __INLINE float32_t arm_bilinear_interp_f32( - const arm_bilinear_interp_instance_f32 * S, - float32_t X, - float32_t Y) - { - float32_t out; - float32_t f00, f01, f10, f11; - float32_t *pData = S->pData; - int32_t xIndex, yIndex, index; - float32_t xdiff, ydiff; - float32_t b1, b2, b3, b4; - - xIndex = (int32_t) X; - yIndex = (int32_t) Y; - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 || yIndex > (S->numCols - 1)) - { - return (0); - } - - /* Calculation of index for two nearest points in X-direction */ - index = (xIndex - 1) + (yIndex - 1) * S->numCols; - - - /* Read two nearest points in X-direction */ - f00 = pData[index]; - f01 = pData[index + 1]; - - /* Calculation of index for two nearest points in Y-direction */ - index = (xIndex - 1) + (yIndex) * S->numCols; - - - /* Read two nearest points in Y-direction */ - f10 = pData[index]; - f11 = pData[index + 1]; - - /* Calculation of intermediate values */ - b1 = f00; - b2 = f01 - f00; - b3 = f10 - f00; - b4 = f00 - f01 - f10 + f11; - - /* Calculation of fractional part in X */ - xdiff = X - xIndex; - - /* Calculation of fractional part in Y */ - ydiff = Y - yIndex; - - /* Calculation of bi-linear interpolated output */ - out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; - - /* return to application */ - return (out); - } - - - /** - * - * @brief Q31 bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate in 12.20 format. - * @param[in] Y interpolation coordinate in 12.20 format. - * @return out interpolated value. - */ - static __INLINE q31_t arm_bilinear_interp_q31( - arm_bilinear_interp_instance_q31 * S, - q31_t X, - q31_t Y) - { - q31_t out; /* Temporary output */ - q31_t acc = 0; /* output */ - q31_t xfract, yfract; /* X, Y fractional parts */ - q31_t x1, x2, y1, y2; /* Nearest output values */ - int32_t rI, cI; /* Row and column indices */ - q31_t *pYData = S->pData; /* pointer to output table values */ - uint32_t nCols = S->numCols; /* num of rows */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - rI = ((X & (q31_t)0xFFF00000) >> 20); - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - cI = ((Y & (q31_t)0xFFF00000) >> 20); - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) - { - return (0); - } - - /* 20 bits for the fractional part */ - /* shift left xfract by 11 to keep 1.31 format */ - xfract = (X & 0x000FFFFF) << 11u; - - /* Read two nearest output values from the index */ - x1 = pYData[(rI) + (int32_t)nCols * (cI) ]; - x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1]; - - /* 20 bits for the fractional part */ - /* shift left yfract by 11 to keep 1.31 format */ - yfract = (Y & 0x000FFFFF) << 11u; - - /* Read two nearest output values from the index */ - y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ]; - y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1]; - - /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ - out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); - acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); - - /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ - out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); - acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); - - /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ - out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); - acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); - - /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ - out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); - acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); - - /* Convert acc to 1.31(q31) format */ - return ((q31_t)(acc << 2)); - } - - - /** - * @brief Q15 bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate in 12.20 format. - * @param[in] Y interpolation coordinate in 12.20 format. - * @return out interpolated value. - */ - static __INLINE q15_t arm_bilinear_interp_q15( - arm_bilinear_interp_instance_q15 * S, - q31_t X, - q31_t Y) - { - q63_t acc = 0; /* output */ - q31_t out; /* Temporary output */ - q15_t x1, x2, y1, y2; /* Nearest output values */ - q31_t xfract, yfract; /* X, Y fractional parts */ - int32_t rI, cI; /* Row and column indices */ - q15_t *pYData = S->pData; /* pointer to output table values */ - uint32_t nCols = S->numCols; /* num of rows */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - rI = ((X & (q31_t)0xFFF00000) >> 20); - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - cI = ((Y & (q31_t)0xFFF00000) >> 20); - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) - { - return (0); - } - - /* 20 bits for the fractional part */ - /* xfract should be in 12.20 format */ - xfract = (X & 0x000FFFFF); - - /* Read two nearest output values from the index */ - x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; - x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; - - /* 20 bits for the fractional part */ - /* yfract should be in 12.20 format */ - yfract = (Y & 0x000FFFFF); - - /* Read two nearest output values from the index */ - y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; - y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; - - /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ - - /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ - /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ - out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u); - acc = ((q63_t) out * (0xFFFFF - yfract)); - - /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ - out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u); - acc += ((q63_t) out * (xfract)); - - /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ - out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u); - acc += ((q63_t) out * (yfract)); - - /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ - out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u); - acc += ((q63_t) out * (yfract)); - - /* acc is in 13.51 format and down shift acc by 36 times */ - /* Convert out to 1.15 format */ - return ((q15_t)(acc >> 36)); - } - - - /** - * @brief Q7 bilinear interpolation. - * @param[in,out] S points to an instance of the interpolation structure. - * @param[in] X interpolation coordinate in 12.20 format. - * @param[in] Y interpolation coordinate in 12.20 format. - * @return out interpolated value. - */ - static __INLINE q7_t arm_bilinear_interp_q7( - arm_bilinear_interp_instance_q7 * S, - q31_t X, - q31_t Y) - { - q63_t acc = 0; /* output */ - q31_t out; /* Temporary output */ - q31_t xfract, yfract; /* X, Y fractional parts */ - q7_t x1, x2, y1, y2; /* Nearest output values */ - int32_t rI, cI; /* Row and column indices */ - q7_t *pYData = S->pData; /* pointer to output table values */ - uint32_t nCols = S->numCols; /* num of rows */ - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - rI = ((X & (q31_t)0xFFF00000) >> 20); - - /* Input is in 12.20 format */ - /* 12 bits for the table index */ - /* Index value calculation */ - cI = ((Y & (q31_t)0xFFF00000) >> 20); - - /* Care taken for table outside boundary */ - /* Returns zero output when values are outside table boundary */ - if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) - { - return (0); - } - - /* 20 bits for the fractional part */ - /* xfract should be in 12.20 format */ - xfract = (X & (q31_t)0x000FFFFF); - - /* Read two nearest output values from the index */ - x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; - x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; - - /* 20 bits for the fractional part */ - /* yfract should be in 12.20 format */ - yfract = (Y & (q31_t)0x000FFFFF); - - /* Read two nearest output values from the index */ - y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; - y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; - - /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ - out = ((x1 * (0xFFFFF - xfract))); - acc = (((q63_t) out * (0xFFFFF - yfract))); - - /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ - out = ((x2 * (0xFFFFF - yfract))); - acc += (((q63_t) out * (xfract))); - - /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ - out = ((y1 * (0xFFFFF - xfract))); - acc += (((q63_t) out * (yfract))); - - /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ - out = ((y2 * (yfract))); - acc += (((q63_t) out * (xfract))); - - /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ - return ((q7_t)(acc >> 40)); - } - - /** - * @} end of BilinearInterpolate group - */ - - -/* SMMLAR */ -#define multAcc_32x32_keep32_R(a, x, y) \ - a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) - -/* SMMLSR */ -#define multSub_32x32_keep32_R(a, x, y) \ - a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) - -/* SMMULR */ -#define mult_32x32_keep32_R(a, x, y) \ - a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) - -/* SMMLA */ -#define multAcc_32x32_keep32(a, x, y) \ - a += (q31_t) (((q63_t) x * y) >> 32) - -/* SMMLS */ -#define multSub_32x32_keep32(a, x, y) \ - a -= (q31_t) (((q63_t) x * y) >> 32) - -/* SMMUL */ -#define mult_32x32_keep32(a, x, y) \ - a = (q31_t) (((q63_t) x * y ) >> 32) - - -#if defined ( __CC_ARM ) - /* Enter low optimization region - place directly above function definition */ - #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7) - #define LOW_OPTIMIZATION_ENTER \ - _Pragma ("push") \ - _Pragma ("O1") - #else - #define LOW_OPTIMIZATION_ENTER - #endif - - /* Exit low optimization region - place directly after end of function definition */ - #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7) - #define LOW_OPTIMIZATION_EXIT \ - _Pragma ("pop") - #else - #define LOW_OPTIMIZATION_EXIT - #endif - - /* Enter low optimization region - place directly above function definition */ - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - - /* Exit low optimization region - place directly after end of function definition */ - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define LOW_OPTIMIZATION_ENTER - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined(__GNUC__) - #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined(__ICCARM__) - /* Enter low optimization region - place directly above function definition */ - #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7) - #define LOW_OPTIMIZATION_ENTER \ - _Pragma ("optimize=low") - #else - #define LOW_OPTIMIZATION_ENTER - #endif - - /* Exit low optimization region - place directly after end of function definition */ - #define LOW_OPTIMIZATION_EXIT - - /* Enter low optimization region - place directly above function definition */ - #if defined( ARM_MATH_CM4 ) || defined( ARM_MATH_CM7) - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ - _Pragma ("optimize=low") - #else - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #endif - - /* Exit low optimization region - place directly after end of function definition */ - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined(__CSMC__) - #define LOW_OPTIMIZATION_ENTER - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#elif defined(__TASKING__) - #define LOW_OPTIMIZATION_ENTER - #define LOW_OPTIMIZATION_EXIT - #define IAR_ONLY_LOW_OPTIMIZATION_ENTER - #define IAR_ONLY_LOW_OPTIMIZATION_EXIT - -#endif - - -#ifdef __cplusplus -} -#endif - - -#if defined ( __GNUC__ ) -#pragma GCC diagnostic pop -#endif - -#endif /* _ARM_MATH_H */ - -/** - * - * End of file. - */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_armcc.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_armcc.h deleted file mode 100644 index 74c49c67de..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_armcc.h +++ /dev/null @@ -1,734 +0,0 @@ -/**************************************************************************//** - * @file cmsis_armcc.h - * @brief CMSIS Cortex-M Core Function/Instruction Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#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 - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ - */ - -/* intrinsic void __enable_irq(); */ -/* 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 (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - -/** - \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)1); -} - -#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */ - - -#if (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) - -/** - \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 (__FPU_PRESENT == 1U) && (__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 (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - register uint32_t __regfpscr __ASM("fpscr"); - __regfpscr = (fpscr); -#endif -} - -#endif /* (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) */ - - - -/*@} 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 integer value. - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV __rev - - -/** - \brief Reverse byte order (16 bit) - \details Reverses the byte order in two unsigned short values. - \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 in signed short value - \details Reverses the byte order in a signed short value with sign extension to integer. - \param [in] value Value to reverse - \return Reversed value - */ -#ifndef __NO_EMBEDDED_ASM -__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_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] value Value to rotate - \param [in] value 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 (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - #define __RBIT __rbit -#else -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */ - - result = value; /* r will be reversed bits of v; first get LSB of v */ - for (value >>= 1U; value; 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 (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - -/** - \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) - -#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */ - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -#if (__CORTEX_M >= 0x04U) /* only for Cortex-M4 and above */ - -#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 /* (__CORTEX_M >= 0x04) */ -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#endif /* __CMSIS_ARMCC_H */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_armcc_V6.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_armcc_V6.h deleted file mode 100644 index cd13240ce3..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_armcc_V6.h +++ /dev/null @@ -1,1800 +0,0 @@ -/**************************************************************************//** - * @file cmsis_armcc_V6.h - * @brief CMSIS Cortex-M Core Function/Instruction Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#ifndef __CMSIS_ARMCC_V6_H -#define __CMSIS_ARMCC_V6_H - - -/* ########################### 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. - */ -__attribute__((always_inline)) __STATIC_INLINE 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. - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_CONTROL(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_IPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get IPSR Register (non-secure) - \details Returns the content of the non-secure IPSR Register when in secure state. - \return IPSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_IPSR_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Get APSR Register - \details Returns the content of the APSR Register. - \return APSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_APSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get APSR Register (non-secure) - \details Returns the content of the non-secure APSR Register when in secure state. - \return APSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_APSR_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Get xPSR Register - \details Returns the content of the xPSR Register. - \return xPSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get xPSR Register (non-secure) - \details Returns the content of the non-secure xPSR Register when in secure state. - \return xPSR Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_xPSR_NS(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Get Process Stack Pointer - \details Returns the current value of the Process Stack Pointer (PSP). - \return PSP Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSP_NS(void) -{ - register 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : "sp"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : "sp"); -} -#endif - - -/** - \brief Get Main Stack Pointer - \details Returns the current value of the Main Stack Pointer (MSP). - \return MSP Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSP_NS(void) -{ - register 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : "sp"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : "sp"); -} -#endif - - -/** - \brief Get Priority Mask - \details Returns the current state of the priority mask bit from the Priority Mask Register. - \return Priority Mask value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) -{ - __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); -} -#endif - - -#if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */ - -/** - \brief Enable FIQ - \details Enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__((always_inline)) __STATIC_INLINE 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. - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI(uint32_t value) -{ - __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_NS(uint32_t value) -{ - __ASM volatile ("MSR basepri_ns, %0" : : "r" (value) : "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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value) -{ - __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set Base Priority with condition (non_secure) - \details Assigns the given value to the non-secure Base Priority register when in secure state only if BASEPRI masking is disabled, - or the new value increases the BASEPRI priority level. - \param [in] basePri Base Priority value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_MAX_NS(uint32_t value) -{ - __ASM volatile ("MSR basepri_max_ns, %0" : : "r" (value) : "memory"); -} -#endif - - -/** - \brief Get Fault Mask - \details Returns the current value of the Fault Mask register. - \return Fault Mask register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); -} - - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); -} -#endif - - -#endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */ - - -#if (__ARM_ARCH_8M__ == 1U) - -/** - \brief Get Process Stack Pointer Limit - \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). - \return PSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSPLIM(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psplim" : "=r" (result) ); - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Get Process Stack Pointer Limit (non-secure) - \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. - \return PSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSPLIM_NS(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Process Stack Pointer Limit - \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). - \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) -{ - __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Set Process Stack Pointer (non-secure) - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) -{ - __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); -} -#endif - - -/** - \brief Get Main Stack Pointer Limit - \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). - \return MSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSPLIM(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msplim" : "=r" (result) ); - - return(result); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Get Main Stack Pointer Limit (non-secure) - \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. - \return MSPLIM Register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSPLIM_NS(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); - return(result); -} -#endif - - -/** - \brief Set Main Stack Pointer Limit - \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). - \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) -{ - __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); -} - - -#if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */ -/** - \brief Set Main Stack Pointer Limit (non-secure) - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) -{ - __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); -} -#endif - -#endif /* (__ARM_ARCH_8M__ == 1U) */ - - -#if ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=4 */ - -/** - \brief Get FPSCR - \details eturns the current value of the Floating Point Status/Control register. - \return Floating Point Status/Control register value - */ -#define __get_FPSCR __builtin_arm_get_fpscr -#if 0 -__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - uint32_t result; - - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} -#endif - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Get FPSCR (non-secure) - \details Returns the current value of the non-secure Floating Point Status/Control register when in secure state. - \return Floating Point Status/Control register value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FPSCR_NS(void) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - uint32_t result; - - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMRS %0, fpscr_ns" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} -#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 - */ -#define __set_FPSCR __builtin_arm_set_fpscr -#if 0 -__attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} -#endif - -#if (__ARM_FEATURE_CMSE == 3U) -/** - \brief Set FPSCR (non-secure) - \details Assigns the given value to the non-secure Floating Point Status/Control register when in secure state. - \param [in] fpscr Floating Point Status/Control value to set - */ -__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FPSCR_NS(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */ - __ASM volatile ("VMSR fpscr_ns, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} -#endif - -#endif /* ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */ - - - -/*@} 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 integer value. - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV __builtin_bswap32 - - -/** - \brief Reverse byte order (16 bit) - \details Reverses the byte order in two unsigned short values. - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV16 __builtin_bswap16 /* ToDo: ARMCC_V6: check if __builtin_bswap16 could be used */ -#if 0 -__attribute__((always_inline)) __STATIC_INLINE 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); -} -#endif - - -/** - \brief Reverse byte order in signed short value - \details Reverses the byte order in a signed short value with sign extension to integer. - \param [in] value Value to reverse - \return Reversed value - */ - /* ToDo: ARMCC_V6: check if __builtin_bswap16 could be used */ -__attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value) -{ - int32_t result; - - __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -} - - -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) -{ - 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 - */ - /* ToDo: ARMCC_V6: check if __builtin_arm_rbit is supported */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - -#if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */ - __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); -#else - int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */ - - result = value; /* r will be reversed bits of v; first get LSB of v */ - for (value >>= 1U; value; 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 - */ -#define __CLZ __builtin_clz - - -#if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */ - -/** - \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 - - -/** - \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*/ -#define __SSAT(ARG1,ARG2) \ -({ \ - 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] value Value to be saturated - \param [in] sat Bit position to saturate to (0..31) - \return Saturated value - */ -#define __USAT __builtin_arm_usat -#if 0 -#define __USAT(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) -#endif - - -/** - \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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *ptr) -{ - __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); -} - -#endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */ - - -#if (__ARM_ARCH_8M__ == 1U) - -/** - \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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 /* (__ARM_ARCH_8M__ == 1U) */ - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -#if (__ARM_FEATURE_DSP == 1U) /* ToDo: ARMCC_V6: This should be ARCH >= ARMv7-M + SIMD */ - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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) \ -({ \ - uint32_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; \ - }) - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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); -} - -__attribute__((always_inline)) __STATIC_INLINE 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 __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; \ - }) - -__attribute__((always_inline)) __STATIC_INLINE uint32_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 == 1U) */ -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#endif /* __CMSIS_ARMCC_V6_H */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_gcc.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_gcc.h deleted file mode 100644 index bb89fbba9e..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/cmsis_gcc.h +++ /dev/null @@ -1,1373 +0,0 @@ -/**************************************************************************//** - * @file cmsis_gcc.h - * @brief CMSIS Cortex-M Core Function/Instruction Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#ifndef __CMSIS_GCC_H -#define __CMSIS_GCC_H - -/* ignore some GCC warnings */ -#if defined ( __GNUC__ ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#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. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Control Register - \details Writes the given value to the Control Register. - \param [in] control Control Register value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); -} - - -/** - \brief Get IPSR Register - \details Returns the content of the IPSR Register. - \return IPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); - return(result); -} - - -/** - \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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); -} - - -/** - \brief Get Main Stack Pointer - \details Returns the current value of the Main Stack Pointer (MSP). - \return MSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); - return(result); -} - - -/** - \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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); -} - - -/** - \brief Get Priority Mask - \details Returns the current state of the priority mask bit from the Priority Mask Register. - \return Priority Mask value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Priority Mask - \details Assigns the given value to the Priority Mask Register. - \param [in] priMask Priority Mask - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); -} - - -#if (__CORTEX_M >= 0x03U) - -/** - \brief Enable FIQ - \details Enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Base Priority - \details Assigns the given value to the Base Priority register. - \param [in] basePri Base Priority value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) -{ - __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); -} - - -/** - \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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value) -{ - __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory"); -} - - -/** - \brief Get Fault Mask - \details Returns the current value of the Fault Mask register. - \return Fault Mask register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); - return(result); -} - - -/** - \brief Set Fault Mask - \details Assigns the given value to the Fault Mask register. - \param [in] faultMask Fault Mask value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); -} - -#endif /* (__CORTEX_M >= 0x03U) */ - - -#if (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) - -/** - \brief Get FPSCR - \details Returns the current value of the Floating Point Status/Control register. - \return Floating Point Status/Control register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - uint32_t result; - - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U) - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} - -#endif /* (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) */ - - - -/*@} 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. - */ -__attribute__((always_inline)) __STATIC_INLINE void __NOP(void) -{ - __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. - */ -__attribute__((always_inline)) __STATIC_INLINE void __WFI(void) -{ - __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. - */ -__attribute__((always_inline)) __STATIC_INLINE void __WFE(void) -{ - __ASM volatile ("wfe"); -} - - -/** - \brief Send Event - \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -__attribute__((always_inline)) __STATIC_INLINE void __SEV(void) -{ - __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. - */ -__attribute__((always_inline)) __STATIC_INLINE 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. - */ -__attribute__((always_inline)) __STATIC_INLINE 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. - */ -__attribute__((always_inline)) __STATIC_INLINE void __DMB(void) -{ - __ASM volatile ("dmb 0xF":::"memory"); -} - - -/** - \brief Reverse byte order (32 bit) - \details Reverses the byte order in integer value. - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__((always_inline)) __STATIC_INLINE 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 in two unsigned short values. - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__((always_inline)) __STATIC_INLINE 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 in signed short value - \details Reverses the byte order in a signed short value with sign extension to integer. - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value) -{ -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - return (short)__builtin_bswap16(value); -#else - int32_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] value Value to rotate - \param [in] value Number of Bits to rotate - \return Rotated value - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) -{ - 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 - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - -#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); -#else - int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */ - - result = value; /* r will be reversed bits of v; first get LSB of v */ - for (value >>= 1U; value; 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 - */ -#define __CLZ __builtin_clz - - -#if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) - -/** - \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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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. - */ -__attribute__((always_inline)) __STATIC_INLINE void __CLREX(void) -{ - __ASM volatile ("clrex" ::: "memory"); -} - - -/** - \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(ARG1,ARG2) \ -({ \ - uint32_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] value Value to be saturated - \param [in] sat Bit position to saturate to (0..31) - \return Saturated value - */ -#define __USAT(ARG1,ARG2) \ -({ \ - 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 - */ -__attribute__((always_inline)) __STATIC_INLINE 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) - */ -__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrbt %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 ("ldrbt %0, [%1]" : "=r" (result) : "r" (addr) : "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) - */ -__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrht %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 ("ldrht %0, [%1]" : "=r" (result) : "r" (addr) : "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) - */ -__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *addr) -{ - uint32_t result; - - __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*addr) ); - 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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *addr) -{ - __ASM volatile ("strbt %1, %0" : "=Q" (*addr) : "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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *addr) -{ - __ASM volatile ("strht %1, %0" : "=Q" (*addr) : "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 - */ -__attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *addr) -{ - __ASM volatile ("strt %1, %0" : "=Q" (*addr) : "r" (value) ); -} - -#endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */ - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -#if (__CORTEX_M >= 0x04U) /* only for Cortex-M4 and above */ - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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; \ - }) - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) -{ - uint32_t result; - - __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); - return(result); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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); -} - -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 __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; \ - }) - -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_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 /* (__CORTEX_M >= 0x04) */ -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#if defined ( __GNUC__ ) -#pragma GCC diagnostic pop -#endif - -#endif /* __CMSIS_GCC_H */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cm0.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cm0.h deleted file mode 100644 index 711dad5517..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cm0.h +++ /dev/null @@ -1,798 +0,0 @@ -/**************************************************************************//** - * @file core_cm0.h - * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CM0_H_GENERIC -#define __CORE_CM0_H_GENERIC - -#include - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup Cortex_M0 - @{ - */ - -/* CMSIS CM0 definitions */ -#define __CM0_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __CM0_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \ - __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x00U) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __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_PCS_VFP - #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 ( __TMS470__ ) - #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 "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#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 - - IO Type Qualifiers 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 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_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. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((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. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((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 Cortex-M0 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. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* 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 External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - 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))); - } - else - { - 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))); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \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)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__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 */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0334/libraries/CMSIS/Include/core_cm0plus.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cm0plus.h deleted file mode 100644 index b04aa39053..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cm0plus.h +++ /dev/null @@ -1,914 +0,0 @@ -/**************************************************************************//** - * @file core_cm0plus.h - * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CM0PLUS_H_GENERIC -#define __CORE_CM0PLUS_H_GENERIC - -#include - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup Cortex-M0+ - @{ - */ - -/* CMSIS CM0+ definitions */ -#define __CM0PLUS_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __CM0PLUS_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \ - __CM0PLUS_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x00U) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __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_PCS_VFP - #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 ( __TMS470__ ) - #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 "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#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 - - IO Type Qualifiers 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 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 */ -#if (__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 (__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 (__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 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. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((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. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((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 Cortex-M0+ 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 (__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. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* 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 External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - 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))); - } - else - { - 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))); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \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)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__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 */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0334/libraries/CMSIS/Include/core_cmFunc.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmFunc.h deleted file mode 100644 index 652a48af07..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmFunc.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************//** - * @file core_cmFunc.h - * @brief CMSIS Cortex-M Core Function Access Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CMFUNC_H -#define __CORE_CMFUNC_H - - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ -*/ - -/*------------------ RealView Compiler -----------------*/ -#if defined ( __CC_ARM ) - #include "cmsis_armcc.h" - -/*------------------ ARM Compiler V6 -------------------*/ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #include "cmsis_armcc_V6.h" - -/*------------------ GNU Compiler ----------------------*/ -#elif defined ( __GNUC__ ) - #include "cmsis_gcc.h" - -/*------------------ ICC Compiler ----------------------*/ -#elif defined ( __ICCARM__ ) - #include - -/*------------------ TI CCS Compiler -------------------*/ -#elif defined ( __TMS470__ ) - #include - -/*------------------ 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. - */ - -/*------------------ COSMIC Compiler -------------------*/ -#elif defined ( __CSMC__ ) - #include - -#endif - -/*@} end of CMSIS_Core_RegAccFunctions */ - -#endif /* __CORE_CMFUNC_H */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmInstr.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmInstr.h deleted file mode 100644 index f474b0e6f3..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmInstr.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************//** - * @file core_cmInstr.h - * @brief CMSIS Cortex-M Core Instruction Access Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CMINSTR_H -#define __CORE_CMINSTR_H - - -/* ########################## Core Instruction Access ######################### */ -/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface - Access to dedicated instructions - @{ -*/ - -/*------------------ RealView Compiler -----------------*/ -#if defined ( __CC_ARM ) - #include "cmsis_armcc.h" - -/*------------------ ARM Compiler V6 -------------------*/ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #include "cmsis_armcc_V6.h" - -/*------------------ GNU Compiler ----------------------*/ -#elif defined ( __GNUC__ ) - #include "cmsis_gcc.h" - -/*------------------ ICC Compiler ----------------------*/ -#elif defined ( __ICCARM__ ) - #include - -/*------------------ TI CCS Compiler -------------------*/ -#elif defined ( __TMS470__ ) - #include - -/*------------------ 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. - */ - -/*------------------ COSMIC Compiler -------------------*/ -#elif defined ( __CSMC__ ) - #include - -#endif - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - -#endif /* __CORE_CMINSTR_H */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmSimd.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmSimd.h deleted file mode 100644 index 66bf5c2a72..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_cmSimd.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************//** - * @file core_cmSimd.h - * @brief CMSIS Cortex-M SIMD Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_CMSIMD_H -#define __CORE_CMSIMD_H - -#ifdef __cplusplus - extern "C" { -#endif - - -/* ################### Compiler specific Intrinsics ########################### */ -/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics - Access to dedicated SIMD instructions - @{ -*/ - -/*------------------ RealView Compiler -----------------*/ -#if defined ( __CC_ARM ) - #include "cmsis_armcc.h" - -/*------------------ ARM Compiler V6 -------------------*/ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #include "cmsis_armcc_V6.h" - -/*------------------ GNU Compiler ----------------------*/ -#elif defined ( __GNUC__ ) - #include "cmsis_gcc.h" - -/*------------------ ICC Compiler ----------------------*/ -#elif defined ( __ICCARM__ ) - #include - -/*------------------ TI CCS Compiler -------------------*/ -#elif defined ( __TMS470__ ) - #include - -/*------------------ 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. - */ - -/*------------------ COSMIC Compiler -------------------*/ -#elif defined ( __CSMC__ ) - #include - -#endif - -/*@} end of group CMSIS_SIMD_intrinsics */ - - -#ifdef __cplusplus -} -#endif - -#endif /* __CORE_CMSIMD_H */ diff --git a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_sc000.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_sc000.h deleted file mode 100644 index 514dbd81b9..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_sc000.h +++ /dev/null @@ -1,926 +0,0 @@ -/**************************************************************************//** - * @file core_sc000.h - * @brief CMSIS SC000 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_SC000_H_GENERIC -#define __CORE_SC000_H_GENERIC - -#include - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup SC000 - @{ - */ - -/* CMSIS SC000 definitions */ -#define __SC000_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __SC000_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \ - __SC000_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_SC (000U) /*!< Cortex secure core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __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_PCS_VFP - #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 ( __TMS470__ ) - #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 "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#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 - - IO Type Qualifiers 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 (__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. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((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. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((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 SC000 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 (__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. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* 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 External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - 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))); - } - else - { - 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))); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \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)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); - } -} - - -/** - \brief System Reset - \details Initiates a system reset request to reset the MCU. - */ -__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 */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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/essemi/es32f0334/libraries/CMSIS/Include/core_sc300.h b/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_sc300.h deleted file mode 100644 index 8bd18aa318..0000000000 --- a/bsp/essemi/es32f0334/libraries/CMSIS/Include/core_sc300.h +++ /dev/null @@ -1,1745 +0,0 @@ -/**************************************************************************//** - * @file core_sc300.h - * @brief CMSIS SC300 Core Peripheral Access Layer Header File - * @version V4.30 - * @date 20. October 2015 - ******************************************************************************/ -/* Copyright (c) 2009 - 2015 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #pragma clang system_header /* treat file as system include file */ -#endif - -#ifndef __CORE_SC300_H_GENERIC -#define __CORE_SC300_H_GENERIC - -#include - -#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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** - \ingroup SC3000 - @{ - */ - -/* CMSIS SC300 definitions */ -#define __SC300_CMSIS_VERSION_MAIN (0x04U) /*!< [31:16] CMSIS HAL main version */ -#define __SC300_CMSIS_VERSION_SUB (0x1EU) /*!< [15:0] CMSIS HAL sub version */ -#define __SC300_CMSIS_VERSION ((__SC300_CMSIS_VERSION_MAIN << 16U) | \ - __SC300_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_SC (300U) /*!< Cortex secure core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __TMS470__ ) - #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __CSMC__ ) - #define __packed - #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ - #define __INLINE inline /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */ - #define __STATIC_INLINE static inline - -#else - #error Unknown compiler -#endif - -/** __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_PCS_VFP - #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 ( __TMS470__ ) - #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 "core_cmInstr.h" /* Core Instruction Access */ -#include "core_cmFunc.h" /* Core Function Access */ - -#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 4U - #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 - - IO Type Qualifiers 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:15; /*!< bit: 9..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_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 RSERVED1[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 */ - -/* 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 */ - uint32_t RESERVED1[1U]; -} 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[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 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 */ - __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 -{ - __IOM 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 */ - __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 (__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. - \return Masked and shifted value. -*/ -#define _VAL2FLD(field, value) ((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. - \return Masked and shifted bit field value. -*/ -#define _FLD2VAL(field, value) ((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 Cortex-M3 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 (__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. - @{ - */ - -/** - \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 External Interrupt - \details Enables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Disable External Interrupt - \details Disables a device-specific interrupt in the NVIC interrupt controller. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Pending Interrupt - \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Pending Interrupt - \details Sets the pending bit of an external interrupt. - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Clear Pending Interrupt - \details Clears the pending bit of an external interrupt. - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); -} - - -/** - \brief Get Active Interrupt - \details Reads the active register in NVIC and returns the active bit. - \param [in] IRQn Interrupt number. - \return 0 Interrupt status is not active. - \return 1 Interrupt status is active. - */ -__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn) -{ - return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); -} - - -/** - \brief Set Interrupt Priority - \details Sets the priority of an interrupt. - \note The priority cannot be set for every core interrupt. - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if ((int32_t)(IRQn) < 0) - { - SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } - else - { - NVIC->IP[((uint32_t)(int32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); - } -} - - -/** - \brief Get Interrupt Priority - \details Reads the priority of an interrupt. - The interrupt number can be positive to specify an external (device specific) interrupt, - or negative to specify an internal (core) interrupt. - \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)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); - } - else - { - return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)] >> (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 System Reset - \details Initiates a system reset request to reset the MCU. - */ -__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 */ - - - -/* ################################## SysTick function ############################################ */ -/** - \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - 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 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/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/EASTSOFT_ES32F033x_ALD.chm b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/EASTSOFT_ES32F033x_ALD.chm deleted file mode 100644 index 9f5df67080..0000000000 Binary files a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/EASTSOFT_ES32F033x_ALD.chm and /dev/null differ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_acmp.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_acmp.h deleted file mode 100644 index 2bbe7437d0..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_acmp.h +++ /dev/null @@ -1,338 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_acmp.h - * @brief Header file of ACMP module driver. - * - * @version V1.0 - * @date 13 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_ACMP_H__ -#define __ALD_ACMP_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup ACMP - * @{ - */ - -/** @defgroup ACMP_Public_Types ACMP Public Types - * @{ - */ - -/** - * @brief Acmp interrupt - */ -typedef enum { - ACMP_IT_EDGE = (1U << 0), /**< Edge interrupt bit */ - ACMP_IT_WARMUP = (1U << 1), /**< Warm up interrupt bit */ -} acmp_it_t; - -/** - * @brief Acmp interrupt - */ -typedef enum { - ACMP_FLAG_EDGE = (1U << 0), /**< Edge interrupt flag */ - ACMP_FLAG_WARMUP = (1U << 1), /**< Warm up interrupt flag */ -} acmp_flag_t; - -/** - * @brief Acmp interrupt flag - */ -typedef enum { - ACMP_STATUS_EDGE = (1U << 0), /**< Edge interrupt flag */ - ACMP_STATUS_WARMUP = (1U << 1), /**< Warm up interrupt flag */ -} acmp_status_t; - -/** - * @brief Acmp positive input - */ -typedef enum { - ACMP_POS_CH0 = 0U, /**< Channel 0 as positive input */ - ACMP_POS_CH1 = 1U, /**< Channel 1 as positive input */ - ACMP_POS_CH2 = 2U, /**< Channel 2 as positive input */ - ACMP_POS_CH3 = 3U, /**< Channel 3 as positive input */ - ACMP_POS_CH4 = 4U, /**< Channel 4 as positive input */ - ACMP_POS_CH5 = 5U, /**< Channel 5 as positive input */ - ACMP_POS_CH6 = 6U, /**< Channel 6 as positive input */ - ACMP_POS_CH7 = 7U, /**< Channel 7 as positive input */ -} acmp_pos_input_t; - -/** - * @brief Acmp negative input - */ -typedef enum { - ACMP_NEG_CH0 = 0U, /**< Channel 0 as negative input */ - ACMP_NEG_CH1 = 1U, /**< Channel 1 as negative input */ - ACMP_NEG_CH2 = 2U, /**< Channel 2 as negative input */ - ACMP_NEG_CH3 = 3U, /**< Channel 3 as negative input */ - ACMP_NEG_CH4 = 4U, /**< Channel 4 as negative input */ - ACMP_NEG_CH5 = 5U, /**< Channel 5 as negative input */ - ACMP_NEG_CH6 = 6U, /**< Channel 6 as negative input */ - ACMP_NEG_CH7 = 7U, /**< Channel 7 as negative input */ - ACMP_NEG_1V25 = 8U, /**< 1.25v as negative input */ - ACMP_NEG_2V5 = 9U, /**< 2.5v as negative input */ - ACMP_NEG_VDD = 10U, /**< VDD as negative input */ -} acmp_neg_input_t; - -/** - * @brief Acmp mode - */ -typedef enum { - ACMP_ULTRA_LOW_POWER = 0U, /**< Ultra low power mode */ - ACMP_LOW_POWER = 1U, /**< Low power mode */ - ACMP_MIDDLE_POWER = 2U, /**< Middle power mode */ - ACMP_HIGH_POWER = 3U, /**< High power mode */ -} acmp_mode_t; - -/** - * @brief Acmp warm-up time - */ -typedef enum { - ACMP_4_PCLK = 0U, /**< 4 hfperclk cycles */ - ACMP_8_PCLK = 1U, /**< 4 hfperclk cycles */ - ACMP_16_PCLK = 2U, /**< 4 hfperclk cycles */ - ACMP_32_PCLK = 3U, /**< 4 hfperclk cycles */ - ACMP_64_PCLK = 4U, /**< 4 hfperclk cycles */ - ACMP_128_PCLK = 5U, /**< 4 hfperclk cycles */ - ACMP_256_PCLK = 6U, /**< 4 hfperclk cycles */ - ACMP_512_PCLK = 7U, /**< 4 hfperclk cycles */ -} acmp_warm_time_t; - -/** - * @brief Acmp hysteresis level - */ -typedef enum { - ACMP_HYST_0 = 0U, /**< No hysteresis */ - ACMP_HYST_15 = 1U, /**< 15mV hysteresis */ - ACMP_HYST_22 = 2U, /**< 22mV hysteresis */ - ACMP_HYST_29 = 3U, /**< 29mV hysteresis */ - ACMP_HYST_36 = 4U, /**< 36mV hysteresis */ - ACMP_HYST_43 = 5U, /**< 43mV hysteresis */ - ACMP_HYST_50 = 6U, /**< 50mV hysteresis */ - ACMP_HYST_57 = 7U, /**< 57mV hysteresis */ -} acmp_hystsel_t; - -/** - * @brief Acmp inactive state - */ -typedef enum { - ACMP_INACTVAL_LOW = 0U, /**< The inactive value is 0 */ - ACMP_INACTVAL_HIGH = 1U, /**< The inactive value is 1 */ -} acmp_inactval_t; - -/** - * @brief which edges set up interrupt - */ -typedef enum { - ACMP_EDGE_NONE = 0U, /**< Disable EDGE interrupt */ - ACMP_EDGE_FALL = 1U, /**< Falling edges set EDGE interrupt */ - ACMP_EDGE_RISE = 2U, /**< rise edges set EDGE interrupt */ - ACMP_EDGE_ALL = 3U, /**< Falling edges and rise edges set EDGE interrupt */ -} acmp_edge_t; - -/** - * @brief Acmp output function - */ -typedef enum { - ACMP_OUT_DISABLE = 0U, /**< Disable acmp output */ - ACMP_OUT_ENABLE = 1U, /**< Enable acmp output */ -} acmp_out_func_t; - -/** - * @brief Acmp warm-up interrupt function - */ -typedef enum { - ACMP_WARM_DISABLE = 0U, /**< Disable acmp warm-up interrupt */ - ACMP_WARM_ENABLE = 1U, /**< Enable acmp warm-up interrupt */ -} acmp_warm_it_func; - -/** - * @brief Acmp gpio output invert - */ -typedef enum { - ACMP_GPIO_NO_INV = 0U, /**< Acmp output to gpio is not inverted */ - ACMP_GPIO_INV = 1U, /**< Acmp output to gpio is inverted */ -} acmp_invert_t; - -/** - * @brief Acmp output config structure definition - */ -typedef struct { - acmp_out_func_t out_func; /**< Acmp output function */ - acmp_invert_t gpio_inv; /**< If invert gpio output */ -} acmp_output_config_t; - -/** - * @brief Acmp init structure definition - */ -typedef struct { - acmp_mode_t mode; /**< Acmp operation mode */ - acmp_warm_time_t warm_time; /**< Acmp warm up time */ - acmp_hystsel_t hystsel; /**< Acmp hysteresis level */ - acmp_warm_it_func warm_func; /**< Acmp warm-up interrupt enable/disable */ - acmp_pos_input_t pos_port; /**< Acmp positive port select */ - acmp_neg_input_t neg_port; /**< Acmp negative port select */ - acmp_inactval_t inactval; /**< Acmp inavtive output value */ - acmp_edge_t edge; /** Select edges to set interrupt flag */ - uint8_t vdd_level; /** Select scaling factor for CDD reference level, MAX is 63 */ -} acmp_init_t; - -/** - * @brief ACMP Handle Structure definition - */ -typedef struct acmp_handle_s { - ACMP_TypeDef *perh; /**< Register base address */ - acmp_init_t init; /**< ACMP required parameters */ - lock_state_t lock; /**< Locking object */ - - void (*acmp_warmup_cplt_cbk)(struct acmp_handle_s *arg); /**< Acmp warm-up complete callback */ - void (*acmp_edge_cplt_cbk)(struct acmp_handle_s *arg); /**< Acmp edge trigger callback */ -} acmp_handle_t; -/** - * @} - */ - -/** @defgroup ACMP_Public_Macros ACMP Public Macros - * @{ - */ -#define ACMP_ENABLE(handle) (SET_BIT((handle)->perh->CON, ACMP_CON_EN_MSK)) -#define ACMP_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON, ACMP_CON_EN_MSK)) -/** - * @} - */ - -/** @defgroup ACMP_Private_Macros ACMP Private Macros - * @{ - */ -#define IS_ACMP_TYPE(x) (((x) == ACMP0) || \ - ((x) == ACMP1)) -#define IS_ACMP_MODE_TYPE(x) (((x) == ACMP_ULTRA_LOW_POWER) || \ - ((x) == ACMP_LOW_POWER) || \ - ((x) == ACMP_MIDDLE_POWER) || \ - ((x) == ACMP_HIGH_POWER)) -#define IS_ACMP_IT_TYPE(x) (((x) == ACMP_IT_EDGE) || \ - ((x) == ACMP_IT_WARMUP)) -#define IS_ACMP_FLAG_TYPE(x) (((x) == ACMP_FLAG_EDGE) || \ - ((x) == ACMP_FLAG_WARMUP)) -#define IS_ACMP_STATUS_TYPE(x) (((x) == ACMP_STATUS_EDGE) || \ - ((x) == ACMP_STATUS_WARMUP)) -#define IS_ACMP_POS_INPUT_TYPE(x) (((x) == ACMP_POS_CH0) || \ - ((x) == ACMP_POS_CH1) || \ - ((x) == ACMP_POS_CH2) || \ - ((x) == ACMP_POS_CH3) || \ - ((x) == ACMP_POS_CH4) || \ - ((x) == ACMP_POS_CH5) || \ - ((x) == ACMP_POS_CH6) || \ - ((x) == ACMP_POS_CH7)) -#define IS_ACMP_NEG_INPUT_TYPE(x) (((x) == ACMP_NEG_CH0) || \ - ((x) == ACMP_NEG_CH1) || \ - ((x) == ACMP_NEG_CH2) || \ - ((x) == ACMP_NEG_CH3) || \ - ((x) == ACMP_NEG_CH4) || \ - ((x) == ACMP_NEG_CH5) || \ - ((x) == ACMP_NEG_CH6) || \ - ((x) == ACMP_NEG_CH7) || \ - ((x) == ACMP_NEG_1V25) || \ - ((x) == ACMP_NEG_2V5) || \ - ((x) == ACMP_NEG_VDD)) -#define IS_ACMP_WARM_UP_TIME_TYPE(x) (((x) == ACMP_4_PCLK) || \ - ((x) == ACMP_8_PCLK) || \ - ((x) == ACMP_16_PCLK) || \ - ((x) == ACMP_32_PCLK) || \ - ((x) == ACMP_64_PCLK) || \ - ((x) == ACMP_128_PCLK) || \ - ((x) == ACMP_256_PCLK) || \ - ((x) == ACMP_512_PCLK)) -#define IS_ACMP_HYSTSEL_TYPE(x) (((x) == ACMP_HYST_0) || \ - ((x) == ACMP_HYST_15) || \ - ((x) == ACMP_HYST_22) || \ - ((x) == ACMP_HYST_29) || \ - ((x) == ACMP_HYST_36) || \ - ((x) == ACMP_HYST_43) || \ - ((x) == ACMP_HYST_50) || \ - ((x) == ACMP_HYST_57)) -#define IS_ACMP_INACTVAL_TYPE(x) (((x) == ACMP_INACTVAL_LOW) || \ - ((x) == ACMP_INACTVAL_HIGH)) -#define IS_ACMP_EDGE_TYPE(x) (((x) == ACMP_EDGE_NONE) || \ - ((x) == ACMP_EDGE_FALL) || \ - ((x) == ACMP_EDGE_RISE) || \ - ((x) == ACMP_EDGE_ALL)) -#define IS_ACMP_OUT_FUNC_TYPE(x) (((x) == ACMP_OUT_DISABLE) || \ - ((x) == ACMP_OUT_ENABLE)) -#define IS_ACMP_INVERT_TYPE(x) (((x) == ACMP_GPIO_NO_INV) || \ - ((x) == ACMP_GPIO_INV)) -#define IS_ACMP_WARM_FUNC_TYPE(x) (((x) == ACMP_WARM_DISABLE) || \ - ((x) == ACMP_WARM_ENABLE)) -/** - * @} - */ - -/** @addtogroup ACMP_Public_Functions - * @{ - */ - -/** @addtogroup ACMP_Public_Functions_Group1 - * @{ - */ -ald_status_t ald_acmp_init(acmp_handle_t *hperh); - -/** - * @} - */ - -/** @addtogroup ACMP_Public_Functions_Group2 - * @{ - */ -ald_status_t ald_acmp_interrupt_config(acmp_handle_t *hperh, acmp_it_t it, type_func_t state); -ald_status_t ald_acmp_set_interrupt_mask(acmp_handle_t *hperh, acmp_it_t it); -it_status_t ald_acmp_get_it_status(acmp_handle_t *hperh, acmp_it_t it); -it_status_t ald_acmp_get_flag_status(acmp_handle_t *hperh, acmp_flag_t it); -ald_status_t ald_acmp_clear_flag_status(acmp_handle_t *hperh, acmp_flag_t it); -flag_status_t ald_acmp_get_status(acmp_handle_t *hperh, acmp_status_t flag); - -/** - * @} - */ - -/** @addtogroup ACMP_Public_Functions_Group3 - * @{ - */ -void ald_acmp_irq_handler(acmp_handle_t *hperh); -ald_status_t ald_acmp_out_config(acmp_handle_t *hperh, acmp_output_config_t *config); -uint8_t ald_acmp_out_result(acmp_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus - extern "C" } -#endif - -#endif diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_adc.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_adc.h deleted file mode 100644 index b5f9532f8d..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_adc.h +++ /dev/null @@ -1,546 +0,0 @@ -/** - ****************************************************************************** - * @file ald_adc.h - * @brief Header file of ADC Module library. - * - * @version V1.0 - * @date 15 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ****************************************************************************** - */ - -#ifndef __ALD_ADC_H__ -#define __ALD_ADC_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" -#include "ald_pis.h" -#include "ald_timer.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup ADC - * @{ - */ - -/** @defgroup ADC_Pubulic_Types ADC Pubulic Types - * @{ - */ - -/** - * @brief ADC State structures definition - */ -typedef enum { - ADC_STATE_RESET = 0x0U, /**< ADC not yet initialized or disabled */ - ADC_STATE_READY = 0x1U, /**< ADC peripheral ready for use */ - ADC_STATE_BUSY = 0x2U, /**< ADC is busy to internal process */ - ADC_STATE_TIMEOUT = 0x4U, /**< TimeOut occurrence */ - ADC_STATE_ERROR = 0x8U, /**< Internal error occurrence */ - ADC_STATE_BUSY_N = 0x10U, /**< Normal channel busy */ - ADC_STATE_BUSY_I = 0x20U, /**< Insert channel busy */ - ADC_STATE_BUSY_WDG = 0x40U, /**< Insert channel busy */ -} adc_state_t; - -/** - *@brief ADC Error Code - */ -typedef enum { - ADC_ERROR_NONE = 0x0U, /**< No error */ - ADC_ERROR_INTERNAL = 0x1U, /**< ADC IP internal error*/ - ADC_ERROR_OVR = 0x2U, /**< Overrun error */ - ADC_ERROR_DMA = 0x4U, /**< DMA transfer error */ -} adc_error_t; - -/** - *@brief ADC data alignment - */ -typedef enum { - ADC_DATAALIGN_RIGHT = 0x0U, /**< ADC data alignment right */ - ADC_DATAALIGN_LEFT = 0x1U, /**< ADC data alignment left */ -} adc_align_t; - -/** - *@brief ADC config hannal trigger the EOC IT mode - */ -typedef enum { - ADC_NCHESEL_MODE_ALL = 0x0U, /**< ADC set RCHE after convert sequence finish */ - ADC_NCHESEL_MODE_ONE = 0x1U, /**< ADC set RCHE after one convert finish */ -} adc_nchesel_t; - -/** - *@brief ADC channels - */ -typedef enum { - ADC_CHANNEL_0 = 0x0U, /**< ADC channel 0 */ - ADC_CHANNEL_1 = 0x1U, /**< ADC channel 1 */ - ADC_CHANNEL_2 = 0x2U, /**< ADC channel 2 */ - ADC_CHANNEL_3 = 0x3U, /**< ADC channel 3 */ - ADC_CHANNEL_4 = 0x4U, /**< ADC channel 4 */ - ADC_CHANNEL_5 = 0x5U, /**< ADC channel 5 */ - ADC_CHANNEL_6 = 0x6U, /**< ADC channel 6 */ - ADC_CHANNEL_7 = 0x7U, /**< ADC channel 7 */ - ADC_CHANNEL_8 = 0x8U, /**< ADC channel 8 */ - ADC_CHANNEL_9 = 0x9U, /**< ADC channel 9 */ - ADC_CHANNEL_10 = 0xAU, /**< ADC channel 10 */ - ADC_CHANNEL_11 = 0xBU, /**< ADC channel 11 */ - ADC_CHANNEL_12 = 0xCU, /**< ADC channel 12 */ - ADC_CHANNEL_13 = 0xDU, /**< ADC channel 13 */ - ADC_CHANNEL_14 = 0xEU, /**< ADC channel 14 */ - ADC_CHANNEL_15 = 0xFU, /**< ADC channel 15 */ - ADC_CHANNEL_16 = 0x10U, /**< ADC channel 16 */ - ADC_CHANNEL_17 = 0x11U, /**< ADC channel 17 */ - ADC_CHANNEL_18 = 0x12U, /**< ADC channel 18 */ - ADC_CHANNEL_19 = 0x13U, /**< ADC channel 19 */ -} adc_channel_t; - -/** - *@brief ADC sampling times - */ -typedef enum { - ADC_SAMPLETIME_1 = 0x0U, /**< ADC sampling times 1 clk */ - ADC_SAMPLETIME_2 = 0x1U, /**< ADC sampling times 2 clk */ - ADC_SAMPLETIME_4 = 0x2U, /**< ADC sampling times 4 clk */ - ADC_SAMPLETIME_15 = 0x3U, /**< ADC sampling times 15 clk */ -} adc_samp_t; - -/** - *@brief ADC index channel in normal group - */ -typedef enum { - ADC_NCH_IDX_1 = 0x1U, /**< ADC normal channel index 1 */ - ADC_NCH_IDX_2 = 0x2U, /**< ADC normal channel index 2 */ - ADC_NCH_IDX_3 = 0x3U, /**< ADC normal channel index 3 */ - ADC_NCH_IDX_4 = 0x4U, /**< ADC normal channel index 4 */ - ADC_NCH_IDX_5 = 0x5U, /**< ADC normal channel index 5 */ - ADC_NCH_IDX_6 = 0x6U, /**< ADC normal channel index 6 */ - ADC_NCH_IDX_7 = 0x7U, /**< ADC normal channel index 7 */ - ADC_NCH_IDX_8 = 0x8U, /**< ADC normal channel index 8 */ - ADC_NCH_IDX_9 = 0x9U, /**< ADC normal channel index 9 */ - ADC_NCH_IDX_10 = 0xAU, /**< ADC normal channel index 10 */ - ADC_NCH_IDX_11 = 0xBU, /**< ADC normal channel index 11 */ - ADC_NCH_IDX_12 = 0xCU, /**< ADC normal channel index 12 */ - ADC_NCH_IDX_13 = 0xDU, /**< ADC normal channel index 13 */ - ADC_NCH_IDX_14 = 0xEU, /**< ADC normal channel index 14 */ - ADC_NCH_IDX_15 = 0xFU, /**< ADC normal channel index 15 */ - ADC_NCH_IDX_16 = 0x10U, /**< ADC normal channel index 16 */ -} adc_nch_idx_t; - -/** - * @brief ADC index channel in insert group - */ -typedef enum { - ADC_ICH_IDX_1 = 0x1U, /**< ADC insert channel index 1 */ - ADC_ICH_IDX_2 = 0x2U, /**< ADC insert channel index 2 */ - ADC_ICH_IDX_3 = 0x3U, /**< ADC insert channel index 3 */ - ADC_ICH_IDX_4 = 0x4U, /**< ADC insert channel index 4 */ -} adc_ich_idx_t; - -/** - * @brief ADC analog watchdog mode - */ -typedef enum { - ADC_ANAWTD_NONE = 0x0U, /**< No watch dog */ - ADC_ANAWTD_SING_NM = 0x800200U, /**< One normal channel watch dog */ - ADC_ANAWTD_SING_IST = 0x400200U, /**< One insert channel watch dog */ - ADC_ANAWTD_SING_NMIST = 0xC00200U, /**< One normal and insert channel watch dog */ - ADC_ANAWTD_ALL_NM = 0x800000U, /**< All normal channel watch dog */ - ADC_ANAWTD_ALL_IST = 0x400000U, /**< All insert channel watch dog */ - ADC_ANAWTD_ALL_NMIST = 0xC00000U, /**< All normal and insert channel watch dog */ -} adc_ana_wdg_t; - -/** - * @brief ADC Event type - */ -typedef enum { - ADC_AWD_EVENT = (1U << 0), /**< ADC analog watch dog event */ -} adc_event_type_t; - -/** - * @brief ADC interrupts definition - */ -typedef enum { - ADC_IT_NCH = (1U << 5), /**< ADC it normal */ - ADC_IT_AWD = (1U << 6), /**< ADC it awd */ - ADC_IT_ICH = (1U << 7), /**< ADC it insert */ - ADC_IT_OVR = (1U << 26), /**< ADC it overring */ -} adc_it_t; - -/** - * @brief ADC flags definition - */ -typedef enum { - ADC_FLAG_AWD = (1U << 0), /**perh->CON1, ADC_CON1_ADCEN_MSK)) -#define ADC_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON1, ADC_CON1_ADCEN_MSK)) -#define ADC_NH_TRIG_BY_SOFT(handle) (SET_BIT((handle)->perh->CON1, ADC_CON1_NCHTRG_MSK)) -#define ADC_IH_TRIG_BY_SOFT(handle) (SET_BIT((handle)->perh->CON1, ADC_CON1_ICHTRG_MSK)) -#define ADC_RESET_HANDLE_STATE(handle) ((handle)->state = ADC_STATE_RESET) -#define ADC_VREF_OUT_ENABLE(handle) (SET_BIT((handle)->perh->CCR, ADC_CCR_VREFOEN_MSK)) -#define ADC_VREF_OUT_DISABLE(handle) (CLEAR_BIT((handle)->perh->CCR, ADC_CCR_VREFOEN_MSK)) -#define ADC_SPEED_HIGH_ENABLE(handle) (SET_BIT((handle)->perh->CCR, ADC_CCR_PWRMODSEL_MSK)) -#define ADC_SPEED_HIGH_DISABLE(handle) (CLEAR_BIT((handle)->perh->CCR, ADC_CCR_PWRMODSEL_MSK)) -#define ADC_CALIBRATE_ENABLE(handle) (SET_BIT((handle)->perh->CCR, ADC_CCR_TRMEN_MSK)) -#define ADC_CALIBRATE_DISABLE(handle) (CLEAR_BIT((handle)->perh->CCR, ADC_CCR_TRMEN_MSK)) -/** - * @} - */ - -/** @defgroup ADC_Private_Macros ADC Private Macros - * @{ - */ -#define IS_ADC_ICH_IDX_TYPE(x) ((x) <= ADC_ICH_IDX_4) -#define IS_ADC_NCH_IDX_TYPE(x) ((x) <= ADC_NCH_IDX_16) -#define IS_ADC_SAMPLING_TIMES_TYPE(x) (((x) == ADC_SAMPLETIME_1) || \ - ((x) == ADC_SAMPLETIME_2) || \ - ((x) == ADC_SAMPLETIME_4) || \ - ((x) == ADC_SAMPLETIME_15)) -#define IS_ADC_CHANNELS_TYPE(x) ((x) <= ADC_CHANNEL_19) -#define IS_ADC_DATA_ALIGN_TYPE(x) (((x) == ADC_DATAALIGN_RIGHT) || \ - ((x) == ADC_DATAALIGN_LEFT)) -#define IS_ADC_ANALOG_WTD_MODE_TYPE(x) (((x) == ADC_ANAWTD_NONE) || \ - ((x) == ADC_ANAWTD_SING_NM) || \ - ((x) == ADC_ANAWTD_SING_IST) || \ - ((x) == ADC_ANAWTD_SING_NMIST) || \ - ((x) == ADC_ANAWTD_ALL_NM) || \ - ((x) == ADC_ANAWTD_ALL_IST) || \ - ((x) == ADC_ANAWTD_ALL_NMIST)) -#define IS_ADC_IT_TYPE(x) (((x) == ADC_IT_NCH) || \ - ((x) == ADC_IT_AWD) || \ - ((x) == ADC_IT_ICH) || \ - ((x) == ADC_IT_OVR )) -#define IS_ADC_FLAGS_TYPE(x) (((x) == ADC_FLAG_AWD) || \ - ((x) == ADC_FLAG_NCH) || \ - ((x) == ADC_FLAG_ICH) || \ - ((x) == ADC_FLAG_OVR) || \ - ((x) == ADC_FLAG_NCHS) || \ - ((x) == ADC_FLAG_ICHS)) -#define IS_ADC_CLK_DIV_TYPE(x) (((x) == ADC_CKDIV_1) || \ - ((x) == ADC_CKDIV_2) || \ - ((x) == ADC_CKDIV_4) || \ - ((x) == ADC_CKDIV_8) || \ - ((x) == ADC_CKDIV_16) || \ - ((x) == ADC_CKDIV_32) || \ - ((x) == ADC_CKDIV_64) || \ - ((x) == ADC_CKDIV_128)) -#define IS_ADC_NEG_REF_VOLTAGE_TYPE(x) (((x) == ADC_NEG_REF_VSS ) || \ - ((x) == ADC_NEG_REF_VREFN )) -#define IS_POS_REF_VOLTAGE_TYPE(x) (((x) == ADC_POS_REF_VDD) || \ - ((x) == ADC_POS_REF_VREEFP) || \ - ((x) == ADC_POS_REF_VREEFP_BUF)) -#define IS_ADC_NCH_NR_TYPE(x) ((x) <= ADC_NCH_NR_16) -#define IS_ADC_ICH_NR_TYPE(x) ((x) <= ADC_ICH_NR_4) -#define IS_ADC_DISC_MODE_TYPE(x) (((x) == ADC_ALL_DISABLE) || \ - ((x) == ADC_NCH_DISC_EN) || \ - ((x) == ADC_ICH_DISC_EN)) -#define IS_ADC_DISC_NR_TYPE(x) ((x) <= ADC_DISC_NR_8) -#define IS_ADC_CONV_BIT_TYPE(x) (((x) == ADC_CONV_BIT_12) || \ - ((x) == ADC_CONV_BIT_6) || \ - ((x) == ADC_CONV_BIT_8) || \ - ((x) == ADC_CONV_BIT_10)) -#define IS_ADC_TRIG_MODE_TYPE(x) (((x) == ADC_TRIG_SOFT) || \ - ((x) == ADC_TRIG_PIS) || \ - ((x) == ADC_TRIG_PIS_SOFT)) -#define IS_ADC_TYPE(x) (((x) == ADC0)) -#define IS_ADC_NCHESEL_MODE_TYPE(x) (((x) == ADC_NCHESEL_MODE_ALL) || \ - ((x) == ADC_NCHESEL_MODE_ONE)) -#define IS_ADC_EVENT_TYPE(x) ((x) == ADC_AWD_EVENT) -#define IS_ADC_IST_OFFSET_TYPE(x) ((x) <= 0xFFF) -#define IS_HTR_TYPE(x) ((x) <= 0xFFF) -#define IS_LTR_TYPE(x) ((x) <= 0xFFF) -/** - * @} - */ - -/** @addtogroup ADC_Public_Functions - * @{ - */ - -/** @addtogroup ADC_Public_Functions_Group1 - * @{ - */ -ald_status_t ald_adc_init(adc_handle_t *hperh); -ald_status_t ald_adc_reset(adc_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup ADC_Public_Functions_Group2 - * @{ - */ -ald_status_t ald_adc_normal_start(adc_handle_t *hperh); -ald_status_t ald_adc_normal_stop(adc_handle_t *hperh); -ald_status_t ald_adc_normal_poll_for_conversion(adc_handle_t *hperh, uint32_t timeout); -ald_status_t ald_adc_poll_for_event(adc_handle_t *hperh, adc_event_type_t event_type, uint32_t timeout); -ald_status_t ald_adc_normal_start_by_it(adc_handle_t *hperh); -ald_status_t ald_adc_normal_stop_by_it(adc_handle_t *hperh); -#ifdef ALD_DMA -ald_status_t ald_adc_start_by_dma(adc_handle_t *hperh, uint16_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_adc_stop_by_dma(adc_handle_t *hperh, uint8_t channel); -ald_status_t ald_adc_timer_trigger_adc_by_dma(adc_timer_config_t *config); -#endif -uint32_t ald_adc_normal_get_value(adc_handle_t *hperh); -uint32_t ald_adc_get_vdd_value(adc_handle_t *hperh); -ald_status_t ald_adc_insert_start(adc_handle_t *hperh); -ald_status_t ald_adc_insert_stop(adc_handle_t *hperh); -ald_status_t ald_adc_insert_poll_for_conversion(adc_handle_t *hperh, uint32_t timeout); -ald_status_t ald_adc_insert_start_by_it(adc_handle_t *hperh); -ald_status_t ald_adc_insert_stop_by_it(adc_handle_t *hperh); -uint32_t ald_adc_insert_get_value(adc_handle_t *hperh, adc_ich_idx_t ih_rank); -void ald_adc_irq_handler(adc_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup ADC_Public_Functions_Group3 - * @{ - */ -ald_status_t ald_adc_normal_channel_config(adc_handle_t *hperh, adc_nch_conf_t *config); -ald_status_t ald_adc_insert_channel_config(adc_handle_t *hperh, adc_ich_conf_t *config); -ald_status_t ald_adc_analog_wdg_config(adc_handle_t *hperh, adc_analog_wdg_conf_t *config); -void ald_adc_interrupt_config(adc_handle_t *hperh, adc_it_t it, type_func_t state); -it_status_t ald_adc_get_it_status(adc_handle_t *hperh, adc_it_t it); -flag_status_t ald_adc_get_flag_status(adc_handle_t *hperh, adc_flag_t flag); -void ald_adc_clear_flag_status(adc_handle_t *hperh, adc_flag_t flag); -/** - * @} - */ - -/** @addtogroup ADC_Public_Functions_Group4 - * @{ - */ -uint32_t ald_adc_get_state(adc_handle_t *hperh); -uint32_t ald_adc_get_error(adc_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus - extern "C" } -#endif - -#endif /* __ALD_ADC_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_bkpc.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_bkpc.h deleted file mode 100644 index cbaa1c88f8..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_bkpc.h +++ /dev/null @@ -1,171 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_bkpc.h - * @brief Header file of BKPC module driver. - * - * @version V1.0 - * @date 15 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_BKPC_H__ -#define __ALD_BKPC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup BKPC - * @{ - */ - -/** @defgroup BKPC_Public_Macros BKPC Public Macros - * @{ - */ -#define BKPC_LOCK() (WRITE_REG(BKPC->PROT, 0U)) -#define BKPC_UNLOCK() (WRITE_REG(BKPC->PROT, 0x9669AA55U)) -#define BKPC_LRC_ENABLE() \ -do { \ - BKPC_UNLOCK(); \ - SET_BIT(BKPC->CR, BKPC_CR_LRCEN_MSK); \ - BKPC_LOCK(); \ -} while (0) -#define BKPC_LRC_DISABLE() \ -do { \ - BKPC_UNLOCK(); \ - CLEAR_BIT(BKPC->CR, BKPC_CR_LRCEN_MSK); \ - BKPC_LOCK(); \ -} while (0) -#define BKPC_LOSM_ENABLE() \ -do { \ - BKPC_UNLOCK(); \ - SET_BIT(BKPC->CR, BKPC_CR_LOSMEN_MSK); \ - BKPC_LOCK(); \ -} while (0) -#define BKPC_LOSM_DISABLE() \ -do { \ - BKPC_UNLOCK(); \ - CLEAR_BIT(BKPC->CR, BKPC_CR_LOSMEN_MSK);\ - BKPC_LOCK(); \ -} while (0) -#define BKPC_LOSC_ENABLE() \ -do { \ - BKPC_UNLOCK(); \ - SET_BIT(BKPC->CR, BKPC_CR_LOSCEN_MSK); \ - BKPC_LOCK(); \ -} while (0) -#define BKPC_LOSC_DISABLE() \ -do { \ - BKPC_UNLOCK(); \ - CLEAR_BIT(BKPC->CR, BKPC_CR_LOSCEN_MSK);\ - BKPC_LOCK(); \ -} while (0) -/** - * @} - */ - -/** @defgroup BKPC_Public_Types BKPC Public Types - * @{ - */ -/** - * @brief BKPC ldo output select - */ -typedef enum { - BKPC_LDO_OUTPUT_1_6 = 0x0U, /**< 1.6V */ - BKPC_LDO_OUTPUT_1_3 = 0x1U, /**< 1.3V */ - BKPC_LDO_OUTPUT_1_4 = 0x2U, /**< 1.4V */ - BKPC_LDO_OUTPUT_1_5 = 0x4U, /**< 1.5V */ -} bkpc_ldo_output_t; - -/** - * @brief Standby wakeup port select - */ -typedef enum { - PMU_STANDBY_PORT_SEL_PA0 = 0x0U, /**< Wakeup by PA0 */ - PMU_STANDBY_PORT_SEL_PA1 = 0x1U, /**< Wakeup by PA1 */ - PMU_STANDBY_PORT_SEL_PA2 = 0x2U, /**< Wakeup by PA2 */ - PMU_STANDBY_PORT_SEL_PA3 = 0x3U, /**< Wakeup by PA3 */ - PMU_STANDBY_PORT_SEL_NONE = 0xFU, /**< Wakeup by other source */ -} bkpc_wakeup_port_t; - -/** - * @brief Standby wakeup level - */ -typedef enum { - PMU_STANDBY_LEVEL_HIGH = 0x0U, /**< High level */ - PMU_STANDBY_LEVEL_LOW = 0x1U, /**< Low level */ -} bkpc_wakeup_level_t; -/** - * @} - */ - -/** - * @defgroup BKPC_Private_Macros BKPC Private Macros - * @{ - */ -#define IS_BKPC_LDO_OUTPUT(x) (((x) == BKPC_LDO_OUTPUT_1_6) || \ - ((x) == BKPC_LDO_OUTPUT_1_3) || \ - ((x) == BKPC_LDO_OUTPUT_1_4) || \ - ((x) == BKPC_LDO_OUTPUT_1_5)) -#define IS_BKPC_WAKEUP_PORT(x) (((x) == PMU_STANDBY_PORT_SEL_PA0) || \ - ((x) == PMU_STANDBY_PORT_SEL_PA1) || \ - ((x) == PMU_STANDBY_PORT_SEL_PA2) || \ - ((x) == PMU_STANDBY_PORT_SEL_PA3) || \ - ((x) == PMU_STANDBY_PORT_SEL_NONE)) -#define IS_BKPC_WAKEUP_LEVEL(x) (((x) == PMU_STANDBY_LEVEL_HIGH) || \ - ((x) == PMU_STANDBY_LEVEL_LOW)) -#define IS_BKPC_RAM_IDX(x) ((x) < 32) -/** - * @} - */ - -/** @addtogroup BKPC_Public_Functions - * @{ - */ -/** @addtogroup BKPC_Public_Functions_Group1 - * @{ - */ -/* control functions */ -extern void ald_bkpc_standby_wakeup_config(bkpc_wakeup_port_t port, bkpc_wakeup_level_t level); -extern void ald_bkpc_ldo_config(bkpc_ldo_output_t output, type_func_t state); -/** - * @} - */ -/** @addtogroup BKPC_Public_Functions_Group2 - * @{ - */ -/* IO operation functions */ -extern void ald_bkpc_write_ram(uint8_t idx, uint32_t value); -extern uint32_t ald_bkpc_read_ram(uint8_t idx); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_BKPC_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_calc.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_calc.h deleted file mode 100644 index 283417d843..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_calc.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_calc.h - * @brief Header file of CALC module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_CALC_H__ -#define __ALD_CALC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup CALC - * @{ - */ - -/** @addtogroup CALC_Public_Functions - * @{ - */ -extern uint32_t ald_calc_sqrt(uint32_t data); -extern uint32_t ald_calc_div(uint32_t dividend, uint32_t divisor, uint32_t *remainder); -extern int32_t ald_calc_div_sign(int32_t dividend, int32_t divisor, int32_t *remainder); -extern flag_status_t ald_calc_get_dz_status(void); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_CALC_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_cmu.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_cmu.h deleted file mode 100644 index 648b3c2b50..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_cmu.h +++ /dev/null @@ -1,651 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_cmu.h - * @brief Header file of CMU module driver. - * - * @version V1.0 - * @date 22 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_CMU_H__ -#define __ALD_CMU_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" -#include "ald_syscfg.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup CMU - * @{ - */ - -/** @defgroup CMU_Public_Macros CMU Public Macros - * @{ - */ -#define CMU_LOSC_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(CMU->CLKENR, CMU_CLKENR_LOSCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LOSC_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(CMU->CLKENR, CMU_CLKENR_LOSCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LRC_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(CMU->CLKENR, CMU_CLKENR_LRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LRC_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(CMU->CLKENR, CMU_CLKENR_LRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_ULRC_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(CMU->CLKENR, CMU_CLKENR_ULRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_ULRC_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(CMU->CLKENR, CMU_CLKENR_ULRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) - -/* Low power mode control */ -#define CMU_LP_LRC_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(CMU->LPENR, CMU_LPENR_LRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LP_LRC_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(CMU->LPENR, CMU_LPENR_LRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LP_LOSC_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(CMU->LPENR, CMU_LPENR_LOSCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LP_LOSC_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(CMU->LPENR, CMU_LPENR_LOSCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LP_HRC_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(CMU->LPENR, CMU_LPENR_HRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LP_HRC_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(CMU->LPENR, CMU_LPENR_HRCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LP_HOSC_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(CMU->LPENR, CMU_LPENR_HOSCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define CMU_LP_HOSC_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(CMU->LPENR, CMU_LPENR_HOSCEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -/** - * @} - */ - - -/** @defgroup CMU_Public_Types CMU Public Types - * @{ - */ -/** - * @brief CMU state structure definition - */ -typedef enum { - CMU_CLOCK_HRC = 0x1U, /**< HRC */ - CMU_CLOCK_LRC = 0x2U, /**< LRC */ - CMU_CLOCK_LOSC = 0x3U, /**< LOSC */ - CMU_CLOCK_PLL1 = 0x4U, /**< PLL1 */ - CMU_CLOCK_HOSC = 0x5U, /**< HOSC */ -} cmu_clock_t; - -/** - * @brief PLL1 output clock - */ -typedef enum { - CMU_PLL1_OUTPUT_32M = 0x0U, /**< x8 (32MHz) */ - CMU_PLL1_OUTPUT_48M = 0x1U, /**< x12 (48MHz) */ -} cmu_pll1_output_t; - -/** - * @brief PLL1 referance clock - */ -typedef enum { - CMU_PLL1_INPUT_HRC_6 = 0x0U, /**< HRC / 6 */ - CMU_PLL1_INPUT_PLL2 = 0x1U, /**< PLL2 */ - CMU_PLL1_INPUT_HOSC = 0x2U, /**< HOSC / 1 */ - CMU_PLL1_INPUT_HOSC_2 = 0x3U, /**< HOSC / 2 */ - CMU_PLL1_INPUT_HOSC_3 = 0x4U, /**< HOSC / 3 */ - CMU_PLL1_INPUT_HOSC_4 = 0x5U, /**< HOSC / 4 */ - CMU_PLL1_INPUT_HOSC_5 = 0x6U, /**< HOSC / 5 */ - CMU_PLL1_INPUT_HOSC_6 = 0x7U, /**< HOSC / 6 */ -} cmu_pll1_input_t; - -/** - * @brief HOSC range - */ -typedef enum { - CMU_HOSC_2M = 0x0U, /**< 0~2MHz */ - CMU_HOSC_4M = 0x1U, /**< 2~4MHz */ - CMU_HOSC_8M = 0x2U, /**< 4~8MHz */ - CMU_HOSC_16M = 0x3U, /**< 8~16MHz */ - CMU_HOSC_24M = 0x4U, /**< 16~24MHz */ -} cmu_hosc_range_t; - -/** - * @brief Auto-calibrate input - */ -typedef enum { - CMU_AUTO_CALIB_INPUT_LOSE = 0x0U, /**< LOSC */ - CMU_AUTO_CALIB_INPUT_HOSE = 0x1U, /**< HOSC */ -} cmu_auto_calib_input_t; - -/** - * @brief Auto-calibrate output - */ -typedef enum { - CMU_AUTO_CALIB_OUTPUT_24M = 0x0U, /**< HOSC 24MHz */ - CMU_AUTO_CALIB_OUTPUT_2M = 0x1U, /**< HOSC 2MHz */ -} cmu_auto_calib_output_t; - -/** - * @brief Safe clock source type - */ -typedef enum { - CMU_SAFE_CLK_HOSC = 0x0U, /**< HOSC */ - CMU_SAFE_CLK_LOSC = 0x1U, /**< LOSC */ - CMU_SAFE_CLK_PLL = 0x2U, /**< PLL */ -} cmu_clock_safe_type_t; - -/** - * @brief Frequency division select bit - */ -typedef enum { - CMU_DIV_1 = 0x0U, /**< Division by 1 */ - CMU_DIV_2 = 0x1U, /**< Division by 2 */ - CMU_DIV_4 = 0x2U, /**< Division by 4 */ - CMU_DIV_8 = 0x3U, /**< Division by 8 */ - CMU_DIV_16 = 0x4U, /**< Division by 16 */ - CMU_DIV_32 = 0x5U, /**< Division by 32 */ - CMU_DIV_64 = 0x6U, /**< Division by 64 */ - CMU_DIV_128 = 0x7U, /**< Division by 128 */ - CMU_DIV_256 = 0x8U, /**< Division by 256 */ - CMU_DIV_512 = 0x9U, /**< Division by 512 */ - CMU_DIV_1024 = 0xAU, /**< Division by 1024 */ - CMU_DIV_2048 = 0xBU, /**< Division by 2048 */ - CMU_DIV_4096 = 0xCU, /**< Division by 4096 */ -} cmu_div_t; - -/** - * @brief Bus type - */ -typedef enum { - CMU_HCLK_1 = 0x0U, /**< AHB1 bus */ - CMU_SYS = 0x1U, /**< SYS bus */ - CMU_PCLK_1 = 0x2U, /**< APB1 bus */ - CMU_PCLK_2 = 0x3U, /**< APB2 bus */ -} cmu_bus_t; - -/** - * @brief Output high clock select - */ -typedef enum { - CMU_OUTPUT_HIGH_SEL_HOSC = 0x0U, /**< Select HOSC */ - CMU_OUTPUT_HIGH_SEL_LOSC = 0x1U, /**< Select LOSC */ - CMU_OUTPUT_HIGH_SEL_HRC = 0x2U, /**< Select HRC */ - CMU_OUTPUT_HIGH_SEL_LRC = 0x3U, /**< Select LRC */ - CMU_OUTPUT_HIGH_SEL_HOSM = 0x4U, /**< Select HOSM */ - CMU_OUTPUT_HIGH_SEL_PLL1 = 0x5U, /**< Select PLL1 */ - CMU_OUTPUT_HIGH_SEL_PLL2 = 0x6U, /**< Select PLL2 */ - CMU_OUTPUT_HIGH_SEL_SYSCLK = 0x7U, /**< Select SYSCLK */ -} cmu_output_high_sel_t; - -/** - * @brief Output frequency division - */ -typedef enum { - CMU_OUTPUT_DIV_1 = 0x0U, /**< Division by 1 */ - CMU_OUTPUT_DIV_2 = 0x1U, /**< Division by 2 */ - CMU_OUTPUT_DIV_4 = 0x2U, /**< Division by 4 */ - CMU_OUTPUT_DIV_8 = 0x3U, /**< Division by 8 */ - CMU_OUTPUT_DIV_16 = 0x4U, /**< Division by 16 */ - CMU_OUTPUT_DIV_32 = 0x5U, /**< Division by 32 */ - CMU_OUTPUT_DIV_64 = 0x6U, /**< Division by 64 */ - CMU_OUTPUT_DIV_128 = 0x7U, /**< Division by 128 */ -} cmu_output_high_div_t; - -/** - * @brief Output low clock select - */ -typedef enum { - CMU_OUTPUT_LOW_SEL_LOSC = 0x0U, /**< Select LOSC */ - CMU_OUTPUT_LOW_SEL_LRC = 0x1U, /**< Select LRC */ - CMU_OUTPUT_LOW_SEL_LOSM = 0x2U, /**< Select LOSM */ - CMU_OUTPUT_LOW_SEL_BUZZ = 0x3U, /**< Select BUZZ */ - CMU_OUTPUT_LOW_SEL_ULRC = 0x4U, /**< Select ULRC */ -} cmu_output_low_sel_t; - -/** - * @brief BUZZ frequency division - */ -typedef enum { - CMU_BUZZ_DIV_2 = 0x0U, /**< Division by 2 */ - CMU_BUZZ_DIV_4 = 0x1U, /**< Division by 4 */ - CMU_BUZZ_DIV_8 = 0x2U, /**< Division by 8 */ - CMU_BUZZ_DIV_16 = 0x3U, /**< Division by 16 */ - CMU_BUZZ_DIV_32 = 0x4U, /**< Division by 32 */ - CMU_BUZZ_DIV_64 = 0x5U, /**< Division by 64 */ - CMU_BUZZ_DIV_128 = 0x6U, /**< Division by 128 */ - CMU_BUZZ_DIV_256 = 0x7U, /**< Division by 256 */ -} cmu_buzz_div_t; - -/** - * @brief Low power peripheral clock select - */ -typedef enum { - CMU_LP_PERH_CLOCK_SEL_PCLK2 = 0x0U, /**< Select PCLK2 */ - CMU_LP_PERH_CLOCK_SEL_PLL1 = 0x1U, /**< Select PLL1 */ - CMU_LP_PERH_CLOCK_SEL_PLL2 = 0x2U, /**< Select PLL2 */ - CMU_LP_PERH_CLOCK_SEL_HRC = 0x3U, /**< Select HRC */ - CMU_LP_PERH_CLOCK_SEL_HOSC = 0x4U, /**< Select HOSC */ - CMU_LP_PERH_CLOCK_SEL_LRC = 0x5U, /**< Select LRC */ - CMU_LP_PERH_CLOCK_SEL_LOSC = 0x6U, /**< Select LOSC */ - CMU_LP_PERH_CLOCK_SEL_ULRC = 0x7U, /**< Select ULRC */ - CMU_LP_PERH_CLOCK_SEL_HRC_1M = 0x8U, /**< Select HRC down to 1MHz */ - CMU_LP_PERH_CLOCK_SEL_HOSC_1M = 0x9U, /**< Select HOSC down to 1MHz */ - CMU_LP_PERH_CLOCK_SEL_LOSM = 0xAU, /**< Select LOSM */ - CMU_LP_PERH_CLOCK_SEL_HOSM = 0xBU, /**< Select HOSM */ -} cmu_lp_perh_clock_sel_t; - -/** - * @brief LCD clock select - */ -typedef enum { - CMU_LCD_SEL_LOSM = 0x0U, /**< Select LOSM */ - CMU_LCD_SEL_LOSC = 0x1U, /**< Select LOSC */ - CMU_LCD_SEL_LRC = 0x2U, /**< Select LRC */ - CMU_LCD_SEL_ULRC = 0x3U, /**< Select ULRC */ - CMU_LCD_SEL_HRC_1M = 0x4U, /**< Select HRC down to 1MHz */ - CMU_LCD_SEL_HOSC_1M = 0x5U, /**< Select HOSC down to 1MHz */ -} cmu_lcd_clock_sel_t; - -/** - * @brief Peripheral clock enable/disable - * @verbatim - In this module, for the convenience of code maintenance, - TIMERx is used to indicate the sequence of the timer peripheral. - Different product series TIMERx represent different meanings: - 1. For ES32F065x series: - TIMER0 ----> AD16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - TIMER4 ----> BS16T1 - TIMER5 ----> BS16T2 - TIMER6 ----> GP16C4T0 - TIMER7 ----> BS16T3 - - 2. For ES32F033x/ES32F093x series: - TIMER0 ----> GP16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - TIMER4 ----> BS16T1 - TIMER5 ----> BS16T2 - TIMER6 ----> GP16C4T1 - TIMER7 ----> BS16T3 - @endverbatim - */ -typedef enum { - CMU_PERH_GPIO = (1U << 0), /**< GPIO */ - CMU_PERH_CRC = (1U << 1), /**< CRC */ - CMU_PERH_CALC = (1U << 2), /**< CALC */ - CMU_PERH_CRYPT = (1U << 3), /**< CRYPT */ - CMU_PERH_TRNG = (1U << 4), /**< TRNG */ - CMU_PERH_PIS = (1U << 5), /**< PIS */ - CMU_PERH_TIMER0 = (1U << 0) | (1U << 27), /**< TIMER0 */ - CMU_PERH_TIMER1 = (1U << 1) | (1U << 27), /**< TIMER1 */ - CMU_PERH_TIMER2 = (1U << 2) | (1U << 27), /**< TIMER2 */ - CMU_PERH_TIMER3 = (1U << 3) | (1U << 27), /**< TIMER3 */ - CMU_PERH_TIMER4 = (1U << 4) | (1U << 27), /**< TIMER4 */ - CMU_PERH_TIMER5 = (1U << 5) | (1U << 27), /**< TIMER5 */ - CMU_PERH_TIMER6 = (1U << 6) | (1U << 27), /**< TIMER6 */ - CMU_PERH_TIMER7 = (1U << 7) | (1U << 27), /**< TIMER7 */ - CMU_PERH_UART0 = (1U << 8) | (1U << 27), /**< UART0 */ - CMU_PERH_UART1 = (1U << 9) | (1U << 27), /**< UART1 */ - CMU_PERH_UART2 = (1U << 10) | (1U << 27), /**< UART2 */ - CMU_PERH_UART3 = (1U << 11) | (1U << 27), /**< UART3 */ - CMU_PERH_USART0 = (1U << 12) | (1U << 27), /**< USART0 */ - CMU_PERH_USART1 = (1U << 13) | (1U << 27), /**< USART1 */ - CMU_PERH_SPI0 = (1U << 16) | (1U << 27), /**< SPI0 */ - CMU_PERH_SPI1 = (1U << 17) | (1U << 27), /**< SPI1 */ - CMU_PERH_SPI2 = (1U << 18) | (1U << 27), /**< SPI2 */ - CMU_PERH_I2C0 = (1U << 20) | (1U << 27), /**< I2C0 */ - CMU_PERH_I2C1 = (1U << 21) | (1U << 27), /**< I2C1 */ - CMU_PERH_CAN = (1U << 24) | (1U << 27), /**< CAN */ - CMU_PERH_LPTIM0 = (1U << 0) | (1U << 28), /**< LPTIM0 */ - CMU_PERH_LPUART0 = (1U << 2) | (1U << 28), /**< LPUART0 */ - CMU_PERH_ADC0 = (1U << 4) | (1U << 28), /**< ADC0 */ - CMU_PERH_ADC1 = (1U << 5) | (1U << 28), /**< ADC1 */ - CMU_PERH_ACMP0 = (1U << 6) | (1U << 28), /**< ACMP0 */ - CMU_PERH_ACMP1 = (1U << 7) | (1U << 28), /**< ACMP1 */ - CMU_PERH_OPAMP = (1U << 8) | (1U << 28), /**< OPAMP */ - CMU_PERH_DAC0 = (1U << 9) | (1U << 28), /**< DAC0 */ - CMU_PERH_WWDT = (1U << 12) | (1U << 28), /**< WWDT */ - CMU_PERH_LCD = (1U << 13) | (1U << 28), /**< LCD */ - CMU_PERH_IWDT = (1U << 14) | (1U << 28), /**< IWDT */ - CMU_PERH_RTC = (1U << 15) | (1U << 28), /**< RTC */ - CMU_PERH_TSENSE = (1U << 16) | (1U << 28), /**< TSENSE */ - CMU_PERH_BKPC = (1U << 17) | (1U << 28), /**< BKPC */ - CMU_PERH_DBGC = (1U << 19) | (1U << 28), /**< DBGC */ - CMU_PERH_ALL = (0x7FFFFFFF), /**< ALL */ -} cmu_perh_t; - -/** - * @brief CMU interrupt type - */ -typedef enum { - CMU_LOSC_STOP = 0x0U, /**< LOSC STOP INTERRUPT */ - CMU_HOSC_STOP = 0x1U, /**< HOSC STOP INTERRUPT */ - CMU_PLL1_UNLOCK = 0x2U, /**< PLL1 UNLOCK INTERRUPT */ - CMU_LOSC_START = 0x3U, /**< LOSC START INTERRUPT */ - CMU_HOSC_START = 0x4U, /**< HOSC START INTERRUPT */ -} cmu_security_t; - -/** - * @brief CMU clock state type - */ -typedef enum { - CMU_CLOCK_STATE_HOSCACT = (1U << 0), /**< HOSC active */ - CMU_CLOCK_STATE_LOSCACT = (1U << 1), /**< LOSC active */ - CMU_CLOCK_STATE_HRCACT = (1U << 2), /**< HRC active */ - CMU_CLOCK_STATE_LRCACT = (1U << 3), /**< LRC active */ - CMU_CLOCK_STATE_ULRCACT = (1U << 4), /**< ULRC active */ - CMU_CLOCK_STATE_PLLACT = (1U << 8), /**< PLL active */ - CMU_CLOCK_STATE_HOSCRDY = (1U << 16), /**< HOSC ready */ - CMU_CLOCK_STATE_LOSCRDY = (1U << 17), /**< LOSC ready */ - CMU_CLOCK_STATE_HRCRDY = (1U << 18), /**< HRC ready */ - CMU_CLOCK_STATE_LRCRDY = (1U << 19), /**< LRC ready */ - CMU_CLOCK_STATE_PLLRDY = (1U << 24), /**< PLL ready */ -} cmu_clock_state_t; -/** - * @} - */ - -/** - * @defgroup CMU_Private_Macros CMU Private Macros - * @{ - */ -#define IS_CMU_CLOCK(x) (((x) == CMU_CLOCK_HRC) || \ - ((x) == CMU_CLOCK_LRC) || \ - ((x) == CMU_CLOCK_LOSC) || \ - ((x) == CMU_CLOCK_PLL1) || \ - ((x) == CMU_CLOCK_HOSC)) -#define IS_CMU_PLL1_OUTPUT(x) (((x) == CMU_PLL1_OUTPUT_32M) || \ - ((x) == CMU_PLL1_OUTPUT_48M)) -#define IS_CMU_PLL1_INPUT(x) (((x) == CMU_PLL1_INPUT_HRC_6) || \ - ((x) == CMU_PLL1_INPUT_PLL2) || \ - ((x) == CMU_PLL1_INPUT_HOSC) || \ - ((x) == CMU_PLL1_INPUT_HOSC_2) || \ - ((x) == CMU_PLL1_INPUT_HOSC_3) || \ - ((x) == CMU_PLL1_INPUT_HOSC_4) || \ - ((x) == CMU_PLL1_INPUT_HOSC_5) || \ - ((x) == CMU_PLL1_INPUT_HOSC_6)) -#define IS_CMU_HOSC_RANGE(x) (((x) == CMU_HOSC_2M) || \ - ((x) == CMU_HOSC_4M) || \ - ((x) == CMU_HOSC_8M) || \ - ((x) == CMU_HOSC_16M) || \ - ((x) == CMU_HOSC_24M)) -#define IS_CMU_DIV(x) (((x) == CMU_DIV_1) || \ - ((x) == CMU_DIV_2) || \ - ((x) == CMU_DIV_4) || \ - ((x) == CMU_DIV_8) || \ - ((x) == CMU_DIV_16) || \ - ((x) == CMU_DIV_32) || \ - ((x) == CMU_DIV_64) || \ - ((x) == CMU_DIV_128) || \ - ((x) == CMU_DIV_256) || \ - ((x) == CMU_DIV_512) || \ - ((x) == CMU_DIV_1024) || \ - ((x) == CMU_DIV_2048) || \ - ((x) == CMU_DIV_4096)) -#define IS_CMU_BUS(x) (((x) == CMU_HCLK_1) || \ - ((x) == CMU_SYS) || \ - ((x) == CMU_PCLK_1) || \ - ((x) == CMU_PCLK_2)) -#define IS_CMU_OUTPUT_HIGH_SEL(x) (((x) == CMU_OUTPUT_HIGH_SEL_HOSC) || \ - ((x) == CMU_OUTPUT_HIGH_SEL_LOSC) || \ - ((x) == CMU_OUTPUT_HIGH_SEL_HRC) || \ - ((x) == CMU_OUTPUT_HIGH_SEL_LRC) || \ - ((x) == CMU_OUTPUT_HIGH_SEL_HOSM) || \ - ((x) == CMU_OUTPUT_HIGH_SEL_PLL1) || \ - ((x) == CMU_OUTPUT_HIGH_SEL_PLL2) || \ - ((x) == CMU_OUTPUT_HIGH_SEL_SYSCLK)) -#define IS_CMU_OUTPUT_HIGH_DIV(x) (((x) == CMU_OUTPUT_DIV_1) || \ - ((x) == CMU_OUTPUT_DIV_2) || \ - ((x) == CMU_OUTPUT_DIV_4) || \ - ((x) == CMU_OUTPUT_DIV_8) || \ - ((x) == CMU_OUTPUT_DIV_16) || \ - ((x) == CMU_OUTPUT_DIV_32) || \ - ((x) == CMU_OUTPUT_DIV_64) || \ - ((x) == CMU_OUTPUT_DIV_128)) -#define IS_CMU_OUTPUT_LOW_SEL(x) (((x) == CMU_OUTPUT_LOW_SEL_LOSC) || \ - ((x) == CMU_OUTPUT_LOW_SEL_LRC ) || \ - ((x) == CMU_OUTPUT_LOW_SEL_LOSM) || \ - ((x) == CMU_OUTPUT_LOW_SEL_BUZZ) || \ - ((x) == CMU_OUTPUT_LOW_SEL_ULRC)) -#define IS_CMU_AUTO_CALIB_INPUT(x) (((x) == CMU_AUTO_CALIB_INPUT_LOSE) || \ - ((x) == CMU_AUTO_CALIB_INPUT_HOSE)) -#define IS_CMU_AUTO_CALIB_OUTPUT(x) (((x) == CMU_AUTO_CALIB_OUTPUT_24M) || \ - ((x) == CMU_AUTO_CALIB_OUTPUT_2M)) -#define IS_CMU_SAFE_CLOCK_TYPE(x) (((x) == CMU_SAFE_CLK_HOSC) || \ - ((x) == CMU_SAFE_CLK_LOSC) || \ - ((x) == CMU_SAFE_CLK_PLL)) -#define IS_CMU_BUZZ_DIV(x) (((x) == CMU_BUZZ_DIV_2) || \ - ((x) == CMU_BUZZ_DIV_4) || \ - ((x) == CMU_BUZZ_DIV_8) || \ - ((x) == CMU_BUZZ_DIV_16) || \ - ((x) == CMU_BUZZ_DIV_32) || \ - ((x) == CMU_BUZZ_DIV_64) || \ - ((x) == CMU_BUZZ_DIV_128) || \ - ((x) == CMU_BUZZ_DIV_256)) -#define IS_CMU_LP_PERH_CLOCK_SEL(x) (((x) == CMU_LP_PERH_CLOCK_SEL_PCLK2) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_PLL1) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_PLL2) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_HRC) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_HOSC) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_LRC) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_LOSC) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_ULRC) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_HRC_1M) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_HOSC_1M) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_LOSM) || \ - ((x) == CMU_LP_PERH_CLOCK_SEL_HOSM)) -#define IS_CMU_LCD_CLOCK_SEL(x) (((x) == CMU_LCD_SEL_LOSM) || \ - ((x) == CMU_LCD_SEL_LOSC) || \ - ((x) == CMU_LCD_SEL_LRC) || \ - ((x) == CMU_LCD_SEL_ULRC) || \ - ((x) == CMU_LCD_SEL_HRC_1M) || \ - ((x) == CMU_LCD_SEL_HOSC_1M)) -#define IS_CMU_PERH(x) (((x) == CMU_PERH_GPIO) || \ - ((x) == CMU_PERH_CRC) || \ - ((x) == CMU_PERH_CALC) || \ - ((x) == CMU_PERH_CRYPT) || \ - ((x) == CMU_PERH_TRNG) || \ - ((x) == CMU_PERH_PIS) || \ - ((x) == CMU_PERH_TIMER0) || \ - ((x) == CMU_PERH_TIMER1) || \ - ((x) == CMU_PERH_TIMER2) || \ - ((x) == CMU_PERH_TIMER3) || \ - ((x) == CMU_PERH_TIMER4) || \ - ((x) == CMU_PERH_TIMER5) || \ - ((x) == CMU_PERH_TIMER6) || \ - ((x) == CMU_PERH_TIMER7) || \ - ((x) == CMU_PERH_UART0) || \ - ((x) == CMU_PERH_UART1) || \ - ((x) == CMU_PERH_UART2) || \ - ((x) == CMU_PERH_UART3) || \ - ((x) == CMU_PERH_USART0) || \ - ((x) == CMU_PERH_USART1) || \ - ((x) == CMU_PERH_SPI0) || \ - ((x) == CMU_PERH_SPI1) || \ - ((x) == CMU_PERH_SPI2) || \ - ((x) == CMU_PERH_I2C0) || \ - ((x) == CMU_PERH_I2C1) || \ - ((x) == CMU_PERH_CAN) || \ - ((x) == CMU_PERH_LPTIM0) || \ - ((x) == CMU_PERH_LPUART0) || \ - ((x) == CMU_PERH_ADC0) || \ - ((x) == CMU_PERH_ADC1) || \ - ((x) == CMU_PERH_ACMP0) || \ - ((x) == CMU_PERH_ACMP1) || \ - ((x) == CMU_PERH_OPAMP) || \ - ((x) == CMU_PERH_DAC0) || \ - ((x) == CMU_PERH_WWDT) || \ - ((x) == CMU_PERH_LCD) || \ - ((x) == CMU_PERH_IWDT) || \ - ((x) == CMU_PERH_RTC) || \ - ((x) == CMU_PERH_TSENSE) || \ - ((x) == CMU_PERH_BKPC) || \ - ((x) == CMU_PERH_DBGC) || \ - ((x) == CMU_PERH_ALL)) -#define IS_CMU_CLOCK_STATE(x) (((x) == CMU_CLOCK_STATE_HOSCACT) || \ - ((x) == CMU_CLOCK_STATE_LOSCACT) || \ - ((x) == CMU_CLOCK_STATE_HRCACT) || \ - ((x) == CMU_CLOCK_STATE_LRCACT) || \ - ((x) == CMU_CLOCK_STATE_ULRCACT) || \ - ((x) == CMU_CLOCK_STATE_PLLACT) || \ - ((x) == CMU_CLOCK_STATE_HOSCRDY) || \ - ((x) == CMU_CLOCK_STATE_LOSCRDY) || \ - ((x) == CMU_CLOCK_STATE_HRCRDY) || \ - ((x) == CMU_CLOCK_STATE_LRCRDY) || \ - ((x) == CMU_CLOCK_STATE_PLLRDY)) -/** - * @} - */ - -/** @addtogroup CMU_Public_Functions - * @{ - */ -/** @addtogroup CMU_Public_Functions_Group1 - * @{ - */ -/* System clock configure */ -ald_status_t ald_cmu_clock_config_default(void); -ald_status_t ald_cmu_clock_config(cmu_clock_t clk, uint32_t clock); -void ald_cmu_pll1_config(cmu_pll1_input_t input, cmu_pll1_output_t output); -uint32_t ald_cmu_get_clock(void); -int32_t ald_cmu_auto_calib_clock(cmu_auto_calib_input_t input, cmu_auto_calib_output_t freq); -/** - * @} - */ - -/** @addtogroup CMU_Public_Functions_Group2 - * @{ - */ -/* BUS division control */ -void ald_cmu_div_config(cmu_bus_t bus, cmu_div_t div); -uint32_t ald_cmu_get_hclk1_clock(void); -uint32_t ald_cmu_get_sys_clock(void); -uint32_t ald_cmu_get_pclk1_clock(void); -uint32_t ald_cmu_get_pclk2_clock(void); -/** - * @} - */ - -/** @addtogroup CMU_Public_Functions_Group3 - * @{ - */ -/* Clock safe configure */ -void ald_cmu_hosc_safe_config(cmu_hosc_range_t clock, type_func_t status); -void ald_cmu_losc_safe_config(type_func_t status); -void ald_cmu_pll_safe_config(type_func_t status); -uint32_t ald_cmu_current_clock_source_get(cmu_clock_safe_type_t type); -flag_status_t ald_cmu_get_clock_state(cmu_clock_state_t sr); -void ald_cmu_irq_handler(void); -void ald_cmu_irq_cbk(cmu_security_t se); -/** - * @} - */ - -/** @addtogroup CMU_Public_Functions_Group4 - * @{ - */ -/* Clock output configure */ -void ald_cmu_output_high_clock_config(cmu_output_high_sel_t sel, - cmu_output_high_div_t div, type_func_t status); -void ald_cmu_output_low_clock_config(cmu_output_low_sel_t sel, type_func_t status); -/** - * @} - */ - -/** @addtogroup CMU_Public_Functions_Group5 - * @{ - */ -/* Peripheral Clock configure */ -void ald_cmu_buzz_config(cmu_buzz_div_t div, uint16_t dat, type_func_t status); -void ald_cmu_lptim0_clock_select(cmu_lp_perh_clock_sel_t clock); -void ald_cmu_lpuart0_clock_select(cmu_lp_perh_clock_sel_t clock); -void ald_cmu_lcd_clock_select(cmu_lcd_clock_sel_t clock); -void ald_cmu_perh_clock_config(cmu_perh_t perh, type_func_t status); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_CMU_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_conf.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_conf.h deleted file mode 100644 index 8d0931b38f..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_conf.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_conf.h - * @brief Enable/Disable the peripheral module. - * - * @version V1.0 - * @date 18 Apr 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - - -#ifndef __ALD_CONF_H__ -#define __ALD_CONF_H__ - - -#define ALD_DMA -#define ALD_GPIO -#define ALD_UART -#define ALD_LPUART -#define ALD_USART -#define ALD_SMARTCARD /* The ALD_SMARTCARD depend on ALD_USART */ -#define ALD_I2C -#define ALD_CMU -#define ALD_RMU -#define ALD_PMU -#define ALD_WDT -#define ALD_LCD -#define ALD_RTC -#define ALD_CAN -#define ALD_FLASH -#define ALD_ADC -#define ALD_CRC -#define ALD_CRYPT -#define ALD_TIMER -#define ALD_LPTIM -#define ALD_PIS -#define ALD_SPI -#define ALD_CALC -#define ALD_ACMP -#define ALD_OPAMP -#define ALD_TRNG -#define ALD_TEMP -#define ALD_BKPC -#define ALD_DAC -#define ALD_IAP - -#define TICK_INT_PRIORITY 3 - -#endif diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_crc.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_crc.h deleted file mode 100644 index 3ea24ea927..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_crc.h +++ /dev/null @@ -1,196 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_crc.h - * @brief Header file of CRC module driver. - * - * @version V1.0 - * @date 6 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_CRC_H__ -#define __ALD_CRC_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup CRC - * @{ - */ - -/** @defgroup CRC_Public_Types CRC Public Types - * @{ - */ - -/** - * @brief CRC mode - */ -typedef enum { - CRC_MODE_CCITT = 0U, /**< Ccitt */ - CRC_MODE_8 = 1U, /**< Crc8 */ - CRC_MODE_16 = 2U, /**< Crc16 */ - CRC_MODE_32 = 3U, /**< Crc32 */ -} crc_mode_t; - -/** - * @brief CRC input length - */ -typedef enum { - CRC_LEN_AUTO = 0U, /**< Auto */ - CRC_DATASIZE_8 = 1U, /**< Byte */ - CRC_DATASIZE_16 = 2U, /**< Half word */ - CRC_DATASIZE_32 = 3U, /**< Word */ -} crc_datasize_t; - -/** - * @brief CRC whether write error or no - */ -typedef enum { - CRC_WERR_NO = 0U, /**< No error */ - CRC_WERR_ERR = 1U, /**< Error */ -} crc_werr_t; - -/** - * @brief CRC state structures definition - */ -typedef enum { - CRC_STATE_RESET = 0x0U, /**< Peripheral is not initialized */ - CRC_STATE_READY = 0x1U, /**< Peripheral Initialized and ready for use */ - CRC_STATE_BUSY = 0x2U, /**< An internal process is ongoing */ - CRC_STATE_ERROR = 0x4U, /**< Error */ -} crc_state_t; - -/** - * @brief CRC init structure definition - */ -typedef struct { - crc_mode_t mode; /**< CRC mode */ - type_func_t data_rev; /**< CRC data reverse or no */ - type_func_t data_inv; /**< CRC data inverse or no */ - type_func_t chs_rev; /**< CRC check sum reverse or no */ - type_func_t chs_inv; /**< CRC check sum inverse or no */ - uint32_t seed; /**< CRC seed */ -} crc_init_t; - -/** - * @brief CRC Handle Structure definition - */ -typedef struct crc_handle_s { - CRC_TypeDef *perh; /**< Register base address */ - crc_init_t init; /**< CRC required parameters */ - uint8_t *cal_buf; /**< The pointer of preparing buffer */ - uint32_t *cal_res; /**< The pointer of result */ -#ifdef ALD_DMA - dma_handle_t hdma; /**< CRC DMA handle parameters */ -#endif - lock_state_t lock; /**< Locking object */ - crc_state_t state; /**< CRC operation state */ - - void (*cal_cplt_cbk)(struct crc_handle_s *arg); /**< Calculate completed callback */ - void (*err_cplt_cbk)(struct crc_handle_s *arg); /**< Calculate error callback */ -} crc_handle_t; -/** - * @} - */ - -/** @defgroup CRC_Public_Macros CRC Public Macros - * @{ - */ -#define CRC_ENABLE(handle) (SET_BIT((handle)->perh->CR, CRC_CR_EN_MSK)) -#define CRC_DISABLE(handle) (CLEAR_BIT((handle)->perh->CR, CRC_CR_EN_MSK)) -#define CRC_RESET(handle) (SET_BIT((handle)->perh->CR, CRC_CR_RST_MSK)) -#define CRC_DMA_ENABLE(handle) (SET_BIT((handle)->perh->CR, CRC_CR_DMAEN_MSK)) -#define CRC_DMA_DISABLE(handle) (CLEAR_BIT((handle)->perh->CR, CRC_CR_DMAEN_MSK)) -#define CRC_CLEAR_ERROR_FLAG(handle) (SET_BIT((handle)->perh->CR, CRC_CR_WERR_MSK)) -/** - * @} - */ - -/** @defgroup CRC_Private_Macros CRC Private Macros - * @{ - */ -#define IS_CRC(x) ((x) == CRC) -#define IS_CRC_MODE(x) (((x) == CRC_MODE_CCITT) || \ - ((x) == CRC_MODE_8) || \ - ((x) == CRC_MODE_16) || \ - ((x) == CRC_MODE_32)) -/** - * @} - */ - -/** @addtogroup CRC_Public_Functions - * @{ - */ - -/** @addtogroup CRC_Public_Functions_Group1 - * @{ - */ -ald_status_t ald_crc_init(crc_handle_t *hperh); -void ald_crc_reset(crc_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup CRC_Public_Functions_Group2 - * @{ - */ -uint32_t ald_crc_calculate(crc_handle_t *hperh, uint8_t *buf, uint32_t size); -uint32_t ald_crc_calculate_halfword(crc_handle_t *hperh, uint16_t *buf, uint32_t size); -uint32_t ald_crc_calculate_word(crc_handle_t *hperh, uint32_t *buf, uint32_t size); -/** - * @} - */ - -#ifdef ALD_DMA -/** @addtogroup CRC_Public_Functions_Group3 - * @{ - */ -ald_status_t ald_crc_calculate_by_dma(crc_handle_t *hperh, uint8_t *buf, uint32_t *res, uint16_t size, uint8_t channel); -ald_status_t ald_crc_calculate_halfword_by_dma(crc_handle_t *hperh, uint16_t *buf, uint32_t *res, uint16_t size, uint8_t channel); -ald_status_t ald_crc_calculate_word_by_dma(crc_handle_t *hperh, uint32_t *buf, uint32_t *res, uint16_t size, uint8_t channel); -ald_status_t ald_crc_dma_pause(crc_handle_t *hperh); -ald_status_t ald_crc_dma_resume(crc_handle_t *hperh); -ald_status_t ald_crc_dma_stop(crc_handle_t *hperh); -/** - * @} - */ -#endif -/** @addtogroup CRC_Public_Functions_Group4 - * @{ - */ -crc_state_t ald_crc_get_state(crc_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_CRC_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_crypt.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_crypt.h deleted file mode 100644 index 483c15a31e..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_crypt.h +++ /dev/null @@ -1,255 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_crypt.h - * @brief Header file of CRYPT module driver. - * - * @version V1.0 - * @date 7 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_CRYPT_H__ -#define __ALD_CRYPT_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup CRYPT - * @{ - */ - -/** @defgroup CRYPT_Public_Types CRYPT Public Types - * @{ - */ - -/** - * @brief CRYPT encrypt or decrypt select - */ -typedef enum { - CRYPT_DECRYPT = 0U, /**< Decrypt */ - CRYPT_ENCRYPT = 1U, /**< Encrypt */ -} crypt_encs_t; - -/** - * @brief CRYPT mode select - */ -typedef enum { - CRYPT_MODE_ECB = 0U, /**< ECB */ - CRYPT_MODE_CBC = 1U, /**< CBC */ - CRYPT_MODE_CTR = 2U, /**< CTR */ -} crypt_mode_t; - -/** - * @brief CRYPT data type - */ -typedef enum { - CRYPT_DATA_CHANGE_NO = 0U, /**< No exchange */ - CRYPT_DATA_CHANGE_16 = 1U, /**< 16bit exchange */ - CRYPT_DATA_CHANGE_8 = 2U, /**< 8bit exchange */ - CRYPT_DATA_CHANGE_1 = 3U, /**< 1bit exchange */ -} crypt_datatype_t; - -/** - * @brief CRYPT interrupt - */ -typedef enum { - CRYPT_IT_IT = 0x80U, /**< Interrupt */ -} crypt_it_t; - -/** - * @brief CRYPT interrupt flag - */ -typedef enum { - CRYPT_FLAG_AESIF = 0x1U, /**< Aes flag */ - CRYPT_FLAG_DONE = 0x100U, /**< Complete flag */ -} crypt_flag_t; - -/** - * @brief CRYPT state structures definition - */ -typedef enum { - CRYPT_STATE_RESET = 0x0U, /**< Peripheral is not initialized */ - CRYPT_STATE_READY = 0x1U, /**< Peripheral Initialized and ready for use */ - CRYPT_STATE_BUSY = 0x2U, /**< An internal process is ongoing */ - CRYPT_STATE_ERROR = 0x4U, /**< Error */ -} crypt_state_t; - -/** - * @brief CRYPT data type - */ -typedef enum { - DATA_32_BIT = 0U, /**< 32 bit data,don't swap */ - DATA_16_BIT = 1U, /**< 16 bit data,swap */ - DATA_8_BIT = 2U, /**< 8 bit data,swap */ - DATA_1_BIT = 3U, /**< 1 bit data, swap */ -} crypt_data_t; - -/** - * @brief CRYPT init structure definition - */ -typedef struct { - crypt_mode_t mode; /**< Crypt mode */ - crypt_data_t type; /**< Data type select */ -} crypt_init_t; - -/** - * @brief CRYPT Handle Structure definition - */ -typedef struct crypt_handle_s { - CRYPT_TypeDef *perh; /**< Register base address */ - crypt_init_t init; /**< CRYPT required parameters */ -#ifdef ALD_DMA - dma_handle_t hdma_m2p; /**< CRYPT DMA handle parameters memory to crypt module */ - dma_handle_t hdma_p2m; /**< CRYPT DMA handle parameters crypt module to memory */ -#endif - uint8_t *plain_text; /**< Pointer to plain text */ - uint8_t *cipher_text; /**< Pointer to cipher text */ - uint32_t size; /**< The size of crypt data buf */ - uint32_t count; /**< The count of crypt data buf */ - uint32_t step; /**< The step of once crypt 4(aes) */ - uint32_t dir; /**< ENCRYPT or DECRYPT */ - uint32_t iv[4]; /**< The iv of crypt */ - uint32_t key[4]; /**< The key of crypt */ - lock_state_t lock; /**< Locking object */ - crypt_state_t state; /**< CRYPT operation state */ - - void (*crypt_cplt_cbk)(struct crypt_handle_s *arg); /**< Crypt completed callback */ - void (*err_cplt_cbk)(struct crypt_handle_s *arg); /**< Crypt error callback */ -} crypt_handle_t; -/** - * @} - */ - -/** @defgroup CRYPT_Public_Macros CRYPT Public Macros - * @{ - */ -#define CRYPT_GO(handle) (SET_BIT((handle)->perh->CON, CRYPT_CON_GO_MSK)) -#define CRYPT_FIFOEN_ENABLE(handle) (SET_BIT((handle)->perh->CON, CRYPT_CON_FIFOEN_MSK)) -#define CRYPT_FIFOEN_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON, CRYPT_CON_FIFOEN_MSK)) -#define CRYPT_IVEN_ENABLE(handle) (SET_BIT((handle)->perh->CON, CRYPT_CON_IVEN_MSK)) -#define CRYPT_IVEN_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON, CRYPT_CON_IVEN_MSK)) -#define CRYPT_IE_ENABLE(handle) (SET_BIT((handle)->perh->CON, CRYPT_CON_IE_MSK)) -#define CRYPT_IE_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON, CRYPT_CON_IE_MSK)) -#define CRYPT_DMA_ENABLE(handle) (SET_BIT((handle)->perh->CON, CRYPT_CON_DMAEN_MSK)) -#define CRYPT_DMA_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON, CRYPT_CON_DMAEN_MSK)) -#define CRYPT_SETDIR(handle, dir) do {(handle)->perh->CON &= ~(0x1 << CRYPT_CON_ENCS_POS); \ - (handle)->perh->CON |= (dir << CRYPT_CON_ENCS_POS);} while (0) -#define CRYPT_WRITE_FIFO(handle, data) ((handle)->perh->FIFO = (data)) -#define CRYPT_READ_FIFO(handle) ((handle)->perh->FIFO) -/** - * @} - */ - -/** @defgroup CRYPT_Private_Macros CRYPT Private Macros - * @{ - */ -#define IS_CRYPT(x) ((x) == CRYPT) -#define IS_CRYPT_MODE(x) (((x) == CRYPT_MODE_ECB) || \ - ((x) == CRYPT_MODE_CBC) || \ - ((x) == CRYPT_MODE_CTR)) -#define IS_CRYPT_IT(x) ((x) == CRYPT_IT_IT) -#define IS_CRYPT_FLAG(x) (((x) == CRYPT_FLAG_AESIF) || \ - ((x) == CRYPT_FLAG_DONE)) -#define IS_CRYPT_IV_LEN(x) (((x) == IV_2_LEN) || \ - ((x) == IV_4_LEN)) -/** - * @} - */ - -/** @addtogroup CRYPT_Public_Functions - * @{ - */ - -/** @addtogroup CRYPT_Public_Functions_Group1 - * @{ - */ -ald_status_t ald_crypt_init(crypt_handle_t *hperh); -ald_status_t ald_crypt_write_key(crypt_handle_t *hperh, uint32_t *key); -ald_status_t ald_crypt_read_key(crypt_handle_t *hperh, uint32_t *key); -ald_status_t ald_crypt_write_ivr(crypt_handle_t *hperh, uint32_t *iv); -ald_status_t ald_crypt_read_ivr(crypt_handle_t *hperh, uint32_t *iv); -/** - * @} - */ - -/** @addtogroup CRYPT_Public_Functions_Group2 - * @{ - */ -ald_status_t ald_crypt_encrypt(crypt_handle_t *hperh, uint8_t *plain_text, uint8_t *cipher_text, uint32_t size); -ald_status_t ald_crypt_decrypt(crypt_handle_t *hperh, uint8_t *cipher_text, uint8_t *plain_text, uint32_t size); -ald_status_t ald_crypt_gcm_verify(crypt_handle_t *hperh, uint8_t *cipher_text, uint32_t size, uint8_t *aadata, uint32_t alen, uint8_t *tag); -ald_status_t ald_crypt_encrypt_by_it(crypt_handle_t *hperh, uint8_t *plain_text, uint8_t *cipher_text, uint32_t size); -ald_status_t ald_crypt_decrypt_by_it(crypt_handle_t *hperh, uint8_t *cipher_text, uint8_t *plain_text, uint32_t size); -#ifdef ALD_DMA -ald_status_t ald_crypt_encrypt_by_dma(crypt_handle_t *hperh, uint8_t *plain_text, - uint8_t *cipher_text, uint32_t size, uint8_t channel_m2p, uint8_t channel_p2m); -ald_status_t ald_crypt_decrypt_by_dma(crypt_handle_t *hperh, uint8_t *cipher_text, - uint8_t *plain_text, uint32_t size, uint8_t channel_m2p, uint8_t channel_p2m); -#endif -/** - * @} - */ - -/** @addtogroup CRYPT_Public_Functions_Group3 - * @{ - */ -#ifdef ALD_DMA -ald_status_t ald_crypt_dma_pause(crypt_handle_t *hperh); -ald_status_t ald_crypt_dma_resume(crypt_handle_t *hperh); -ald_status_t ald_crypt_dma_stop(crypt_handle_t *hperh); -#endif -void ald_crypt_irq_handler(crypt_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup CRYPT_Public_Functions_Group4 - * @{ - */ -void ald_crypt_interrupt_config(crypt_handle_t *hperh, crypt_it_t it, type_func_t state); -flag_status_t ald_crypt_get_flag_status(crypt_handle_t *hperh, crypt_flag_t flag); -void ald_crypt_clear_flag_status(crypt_handle_t *hperh, crypt_flag_t flag); -it_status_t ald_crypt_get_it_status(crypt_handle_t *hperh, crypt_it_t it); -/** - * @} - */ - -/** @addtogroup CRYPT_Public_Functions_Group5 - * @{ - */ -crypt_state_t ald_crypt_get_state(crypt_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_dbgc.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_dbgc.h deleted file mode 100644 index 3f695b7e8f..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_dbgc.h +++ /dev/null @@ -1,156 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_dbgc.h - * @brief DEBUGCON module driver. - * - * @version V1.0 - * @date 04 Jun 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_DBGC_H__ -#define __ALD_DBGC_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup DBGC DBGC - * @brief DBGC module driver - * @{ - */ - - - -/** @defgroup DBGC_Public_Types DBGC Public Types - * @{ - */ -/** - * @brief Debug mode select - */ -typedef enum { - DEBC_MODE_SLEEP = (1U << 0), /**< Sleep mode */ - DEBC_MODE_STOP1 = (1U << 1), /**< STOP1 mode */ - DEBC_MODE_STOP2 = (1U << 2), /**< STOP2 mode */ - DEBC_MODE_STANDBY = (1U << 3), /**< Standby mode */ -} dbgc_mode_t; - -/** - * @brief Debug peripheral select - */ -typedef enum { - DEBC_PERH_TIMER0 = (1U << 0), /**< AD16C4T0 */ - DEBC_PERH_TIMER1 = (1U << 1), /**< BS16T0 */ - DEBC_PERH_TIMER2 = (1U << 2), /**< GP16C2T0 */ - DEBC_PERH_TIMER3 = (1U << 3), /**< GP16C2T1 */ - DEBC_PERH_TIMER4 = (1U << 4), /**< BS16T1 */ - DEBC_PERH_TIMER5 = (1U << 5), /**< BS16T2 */ - DEBC_PERH_TIMER6 = (1U << 6), /**< GP16C4T0 */ - DEBC_PERH_TIMER7 = (1U << 7), /**< BS16T3 */ - DEBC_PERH_I2C0 = (1U << 8), /**< I2C0 SMBUS */ - DEBC_PERH_I2C1 = (1U << 9), /**< I2C1 SMBUS */ - DEBC_PERH_CAN = (1U << 12), /**< CAN */ - DEBC_PERH_LPTIM0 = (1U << 0) | (1U << 16), /**< LPTIM0 */ - DEBC_PERH_IWDT = (1U << 8) | (1U << 16), /**< IWDT */ - DEBC_PERH_WWDT = (1U << 9) | (1U << 16), /**< WWDT */ - DEBC_PERH_RTC = (1U << 10) | (1U << 16), /**< RTC */ -} dbgc_perh_t; -/** - * @} - */ - -/** @defgroup DBGC_Public_Functions DBGC Public Functions - * @{ - */ -/** - * @brief Gets version. - * @retval Version - */ -__INLINE uint32_t ald_dbgc_get_rev_id(void) -{ - return (DBGC->IDCODE >> 16); -} - -/** - * @brief Gets core id. - * @retval Core id - */ -__INLINE uint32_t ald_dbgc_get_core_id(void) -{ - return (DBGC->IDCODE >> 12) & 0xF; -} - -/** - * @brief Gets device id - * @retval device id - */ -__INLINE uint32_t ald_dbgc_get_device_id(void) -{ - return DBGC->IDCODE & 0xFFF; -} - -/** - * @brief Configures low power debug mode - * @param mode: The mode of low power. - * @param state: ENABLE/DISABLE - * @retval None - */ -__INLINE void ald_dbgc_mode_config(dbgc_mode_t mode, type_func_t state) -{ - if (state) - SET_BIT(DBGC->CR, mode); - else - CLEAR_BIT(DBGC->CR, mode); -} - -/** - * @brief Configures peripheral debug mode - * @param perh: The peripheral. - * @param state: ENABLE/DISABLE - * @retval None - */ -__INLINE void ald_dbgc_perh_config(dbgc_perh_t perh, type_func_t state) -{ - if ((perh >> 16) & 0x1) { - if (state) - SET_BIT(DBGC->APB2FZ, perh); - else - CLEAR_BIT(DBGC->APB2FZ, perh); - } - else { - if (state) - SET_BIT(DBGC->APB1FZ, perh); - else - CLEAR_BIT(DBGC->APB1FZ, perh); - } -} -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_dma.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_dma.h deleted file mode 100644 index 1fbebd56bf..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_dma.h +++ /dev/null @@ -1,421 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_dma.h - * @brief DMA module Library. - * - * @version V1.0 - * @date 09 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_DMA_H__ -#define __ALD_DMA_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup DMA - * @{ - */ - -/** - * @defgroup DMA_Public_Macros DMA Public Macros - * @{ - */ -#define DMA_CH_COUNT 6U -#define DMA_ERR 31U -/** - * @} - */ - -/** - * @defgroup DMA_Public_Types DMA Public Types - * @{ - */ - -/** - * @brief Input source to DMA channel - * @verbatim - In this module, for the convenience of code maintenance, - TIMERx is used to indicate the sequence of the timer peripheral. - Different product series TIMERx represent different meanings: - 1. For ES32F065x series: - TIMER0 ----> AD16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - TIMER4 ----> BS16T1 - TIMER5 ----> BS16T2 - TIMER6 ----> GP16C4T0 - TIMER7 ----> BS16T3 - - 2. For ES32F033x/ES32F093x series: - TIMER0 ----> GP16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - TIMER4 ----> BS16T1 - TIMER5 ----> BS16T2 - TIMER6 ----> GP16C4T1 - TIMER7 ----> BS16T3 - @endverbatim - */ -typedef enum { - DMA_MSEL_NONE = 0x0U, /**< NONE */ - DMA_MSEL_GPIO = 0x1U, /**< GPIO */ - DMA_MSEL_CRYPT = 0x2U, /**< CRYPT */ - DMA_MSEL_ACMP = 0x3U, /**< ACMP */ - DMA_MSEL_DAC0 = 0x4U, /**< DAC0 */ - DMA_MSEL_ADC0 = 0x6U, /**< ADC0 */ - DMA_MSEL_CRC = 0x7U, /**< CRC */ - DMA_MSEL_UART0 = 0x8U, /**< UART0 */ - DMA_MSEL_UART1 = 0x9U, /**< UART1 */ - DMA_MSEL_UART2 = 0xAU, /**< UART2 */ - DMA_MSEL_UART3 = 0xBU, /**< UART3 */ - DMA_MSEL_USART0 = 0xCU, /**< USART0 */ - DMA_MSEL_USART1 = 0xDU, /**< USART1 */ - DMA_MSEL_SPI0 = 0xEU, /**< SPI0 */ - DMA_MSEL_SPI1 = 0xFU, /**< SPI1 */ - DMA_MSEL_I2C0 = 0x10U, /**< I2C0 */ - DMA_MSEL_I2C1 = 0x11U, /**< I2C1 */ - DMA_MSEL_TIMER0 = 0x12U, /**< TIMER0 */ - DMA_MSEL_TIMER1 = 0x13U, /**< TIMER1 */ - DMA_MSEL_TIMER2 = 0x14U, /**< TIMER2 */ - DMA_MSEL_TIMER3 = 0x15U, /**< TIMER3 */ - DMA_MSEL_RTC = 0x16U, /**< RTC */ - DMA_MSEL_LPTIM0 = 0x17U, /**< LPTIM0 */ - DMA_MSEL_LPUART0 = 0x18U, /**< LPUART0 */ - DMA_MSEL_DMA = 0x19U, /**< DMA */ - DMA_MSEL_SPI2 = 0x1AU, /**< SPI2 */ - DMA_MSEL_TIMER4 = 0x1BU, /**< TIMER4 */ - DMA_MSEL_TIMER5 = 0x1CU, /**< TIMER5 */ - DMA_MSEL_TIMER6 = 0x1DU, /**< TIMER6 */ - DMA_MSEL_TIMER7 = 0x1EU, /**< TIMER7 */ - DMA_MSEL_ADC1 = 0x1FU, /**< ADC1 */ - DMA_MSEL_PIS = 0x20U, /**< PIS */ - DMA_MSEL_TRNG = 0x21U, /**< TRNG */ -} dma_msel_t; - -/** - * @brief Input signal to DMA channel - */ -typedef enum { - DMA_MSIGSEL_NONE = 0x0U, /**< NONE */ - DMA_MSIGSEL_EXTI_0 = 0x0U, /**< External interrupt 0 */ - DMA_MSIGSEL_EXTI_1 = 0x1U, /**< External interrupt 1 */ - DMA_MSIGSEL_EXTI_2 = 0x2U, /**< External interrupt 2 */ - DMA_MSIGSEL_EXTI_3 = 0x3U, /**< External interrupt 3 */ - DMA_MSIGSEL_EXTI_4 = 0x4U, /**< External interrupt 4 */ - DMA_MSIGSEL_EXTI_5 = 0x5U, /**< External interrupt 5 */ - DMA_MSIGSEL_EXTI_6 = 0x6U, /**< External interrupt 6 */ - DMA_MSIGSEL_EXTI_7 = 0x7U, /**< External interrupt 7 */ - DMA_MSIGSEL_EXTI_8 = 0x8U, /**< External interrupt 8 */ - DMA_MSIGSEL_EXTI_9 = 0x9U, /**< External interrupt 9 */ - DMA_MSIGSEL_EXTI_10 = 0xAU, /**< External interrupt 10 */ - DMA_MSIGSEL_EXTI_11 = 0xBU, /**< External interrupt 11 */ - DMA_MSIGSEL_EXTI_12 = 0xCU, /**< External interrupt 12 */ - DMA_MSIGSEL_EXTI_13 = 0xDU, /**< External interrupt 13 */ - DMA_MSIGSEL_EXTI_14 = 0xEU, /**< External interrupt 14 */ - DMA_MSIGSEL_EXTI_15 = 0xFU, /**< External interrupt 15 */ - DMA_MSIGSEL_CRYPT_WRITE = 0x0U, /**< CRYPT write mode */ - DMA_MSIGSEL_CRYPT_READ = 0x1U, /**< CRYPT read mode */ - DMA_MSIGSEL_CALC_WRITE = 0x0U, /**< CALC write mode */ - DMA_MSIGSEL_CALC_READ = 0x1U, /**< CALC read mode */ - DMA_MSIGSEL_DAC0_CH0 = 0x0U, /**< DAC0 channel 0 complete */ - DMA_MSIGSEL_DAC0_CH1 = 0x1U, /**< DAC0 channel 1 complete */ - DMA_MSIGSEL_ADC = 0x0U, /**< ADC mode */ - DMA_MSIGSEL_UART_TXEMPTY = 0x0U, /**< UART transmit */ - DMA_MSIGSEL_UART_RNR = 0x1U, /**< UART receive */ - DMA_MSIGSEL_USART_RNR = 0x0U, /**< USART reveive */ - DMA_MSIGSEL_USART_TXEMPTY = 0x1U, /**< USART transmit */ - DMA_MSIGSEL_SPI_RNR = 0x0U, /**< SPI receive */ - DMA_MSIGSEL_SPI_TXEMPTY = 0x1U, /**< SPI transmit */ - DMA_MSIGSEL_I2C_RNR = 0x0U, /**< I2C receive */ - DMA_MSIGSEL_I2C_TXEMPTY = 0x1U, /**< I2C transmit */ - DMA_MSIGSEL_TIMER_CH1 = 0x0U, /**< TIM channal 1 */ - DMA_MSIGSEL_TIMER_CH2 = 0x1U, /**< TIM channal 2 */ - DMA_MSIGSEL_TIMER_CH3 = 0x2U, /**< TIM channal 3 */ - DMA_MSIGSEL_TIMER_CH4 = 0x3U, /**< TIM channal 4 */ - DMA_MSIGSEL_TIMER_TRI = 0x4U, /**< TIM trigger */ - DMA_MSIGSEL_TIMER_COMP = 0x5U, /**< TIM compare */ - DMA_MSIGSEL_TIMER_UPDATE = 0x6U, /**< TIM update */ - DMA_MSIGSEL_LPUART_RNR = 0x0U, /**< LPUART receive */ - DMA_MSIGSEL_LPUART_TXEMPTY = 0x1U, /**< LPUART transmit */ - DMA_MSIGSEL_PIS_CH0 = 0x0U, /**< PIS channal 0 */ - DMA_MSIGSEL_PIS_CH1 = 0x1U, /**< PIS channal 1 */ - DMA_MSIGSEL_PIS_CH2 = 0x2U, /**< PIS channal 2 */ - DMA_MSIGSEL_PIS_CH3 = 0x3U, /**< PIS channal 3 */ - DMA_MSIGSEL_PIS_CH4 = 0x4U, /**< PIS channal 4 */ - DMA_MSIGSEL_PIS_CH5 = 0x5U, /**< PIS channal 5 */ - DMA_MSIGSEL_PIS_CH6 = 0x6U, /**< PIS channal 6 */ - DMA_MSIGSEL_PIS_CH7 = 0x7U, /**< PIS channal 7 */ - DMA_MSIGSEL_PIS_CH8 = 0x8U, /**< PIS channal 8 */ - DMA_MSIGSEL_PIS_CH9 = 0x9U, /**< PIS channal 9 */ - DMA_MSIGSEL_PIS_CH10 = 0xAU, /**< PIS channal 10 */ - DMA_MSIGSEL_PIS_CH11 = 0xBU, /**< PIS channal 11 */ - DMA_MSIGSEL_PIS_CH12 = 0xCU, /**< PIS channal 12 */ - DMA_MSIGSEL_PIS_CH13 = 0xDU, /**< PIS channal 13 */ - DMA_MSIGSEL_PIS_CH14 = 0xEU, /**< PIS channal 14 */ - DMA_MSIGSEL_PIS_CH15 = 0xFU, /**< PIS channal 15 */ -} dma_msigsel_t; - -/** - * @brief DMA Descriptor control type - */ -typedef union { - struct { - uint32_t cycle_ctrl :3; /**< DMA operating mode @ref dma_cycle_ctrl_t */ - uint32_t next_useburst :1; /**< Uses the alternate data structure when complete a DMA cycle */ - uint32_t n_minus_1 :10; /**< Represent the total number of DMA transfers that DMA cycle contains. */ - uint32_t R_power :4; /**< Control how many DMA transfers can occur before re-arbitrates. @ref dma_arbiter_config_t */ - uint32_t src_prot_ctrl :3; /**< Control the state of HPROT when reads the source data. */ - uint32_t dst_prot_ctrl :3; /**< Control the state of HPROT when writes the destination data */ - uint32_t src_size :2; /**< Source data size @ref dma_data_size_t */ - uint32_t src_inc :2; /**< Control the source address increment. @ref dma_data_inc_t */ - uint32_t dst_size :2; /**< Destination data size. @ref dma_data_size_t */ - uint32_t dst_inc :2; /**< Destination address increment. @ref dma_data_inc_t */ - }; - uint32_t word; -} dma_ctrl_t; - -/** - * @brief Channel control data structure - */ -typedef struct { - void *src; /**< Source data end pointer */ - void *dst; /**< Destination data end pointer */ - dma_ctrl_t ctrl; /**< Control data configuration @ref dma_ctrl_t */ - uint32_t use; /**< Reserve for user */ -} dma_descriptor_t; - -/** - * @brief data increment - */ -typedef enum { - DMA_DATA_INC_BYTE = 0x0U, /**< Address increment by byte */ - DMA_DATA_INC_HALFWORD = 0x1U, /**< Address increment by halfword */ - DMA_DATA_INC_WORD = 0x2U, /**< Address increment by word */ - DMA_DATA_INC_NONE = 0x3U, /**< No increment */ -} dma_data_inc_t; - -/** - * @brief Data size - */ -typedef enum { - DMA_DATA_SIZE_BYTE = 0x0U, /**< Byte */ - DMA_DATA_SIZE_HALFWORD = 0x1U, /**< Halfword */ - DMA_DATA_SIZE_WORD = 0x2U, /**< Word */ -} dma_data_size_t; - -/** - * @brief The operating mode of the DMA cycle - */ -typedef enum { - DMA_CYCLE_CTRL_NONE = 0x0U, /**< Stop */ - DMA_CYCLE_CTRL_BASIC = 0x1U, /**< Basic */ - DMA_CYCLE_CTRL_AUTO = 0x2U, /**< Auto-request */ - DMA_CYCLE_CTRL_PINGPONG = 0x3U, /**< Ping-pong */ - DMA_CYCLE_CTRL_MEM_SG_PRIMARY = 0x4U, /**< Memory scatter-gather using the primary structure */ - DMA_CYCLE_CTRL_MEM_SG_ALTERNATE = 0x5U, /**< Memory scatter-gather using the alternate structure */ - DMA_CYCLE_CTRL_PER_SG_PRIMARY = 0x6U, /**< Peripheral scatter-gather using the primary structure */ - DMA_CYCLE_CTRL_PER_SG_ALTERNATE = 0x7U, /**< Peripheral scatter-gather using the alternate structure */ -} dma_cycle_ctrl_t; - -/** - * @brief Control how many DMA transfers can occur - * before the controller re-arbitrates - */ -typedef enum { - DMA_R_POWER_1 = 0x0U, /**< Arbitrates after each DMA transfer */ - DMA_R_POWER_2 = 0x1U, /**< Arbitrates after 2 DMA transfer */ - DMA_R_POWER_4 = 0x2U, /**< Arbitrates after 4 DMA transfer */ - DMA_R_POWER_8 = 0x3U, /**< Arbitrates after 8 DMA transfer */ - DMA_R_POWER_16 = 0x4U, /**< Arbitrates after 16 DMA transfer */ - DMA_R_POWER_32 = 0x5U, /**< Arbitrates after 32 DMA transfer */ - DMA_R_POWER_64 = 0x6U, /**< Arbitrates after 64 DMA transfer */ - DMA_R_POWER_128 = 0x7U, /**< Arbitrates after 128 DMA transfer */ - DMA_R_POWER_256 = 0x8U, /**< Arbitrates after 256 DMA transfer */ - DMA_R_POWER_512 = 0x9U, /**< Arbitrates after 512 DMA transfer */ - DMA_R_POWER_1024 = 0xAU, /**< Arbitrates after 1024 DMA transfer */ -} dma_arbiter_config_t; - -/** - * @brief Callback function pointer and param - */ -typedef struct { - void (*cplt_cbk)(void *arg); /**< DMA transfers complete callback */ - void (*err_cbk)(void* arg); /**< DMA occurs error callback */ - void *cplt_arg; /**< The parameter of cplt_cbk() */ - void *err_arg; /**< The parameter of err_cbk() */ -} dma_call_back_t; - -/** - * @brief DMA channal configure structure - */ -typedef struct { - void *src; /**< Source data begin pointer */ - void *dst; /**< Destination data begin pointer */ - uint16_t size; /**< The total number of DMA transfers that DMA cycle contains */ - dma_data_size_t data_width; /**< Data width, @ref dma_data_size_t */ - dma_data_inc_t src_inc; /**< Source increment type. @ref dma_data_inc_t */ - dma_data_inc_t dst_inc; /**< Destination increment type. @ref dma_data_inc_t */ - dma_arbiter_config_t R_power; /**< Control how many DMA transfers can occur before re-arbitrates. @ref dma_arbiter_config_t */ - type_func_t primary; /**< Use primary descriptor or alternate descriptor */ - type_func_t burst; /**< Enable/Disable the useburst setting for this channel */ - type_func_t high_prio; /**< High priority or default priority */ - type_func_t interrupt; /**< Enable/disable interrupt */ - dma_msel_t msel; /**< Input source to DMA channel @ref dma_msel_t */ - dma_msigsel_t msigsel; /**< Input signal to DMA channel @ref dma_msigsel_t */ - uint8_t channel; /**< Channel index */ -} dma_config_t; - -/** - * @brief DMA handle structure definition - */ -typedef struct { - DMA_TypeDef *perh; /**< DMA registers base address */ - dma_config_t config; /**< Channel configure structure. @ref dma_config_t */ - void (*cplt_cbk)(void *arg); /**< DMA transfers complete callback */ - void (*err_cbk)(void *arg); /**< DMA bus occurs error callback */ - void *cplt_arg; /**< The parameter of cplt_cbk() */ - void *err_arg; /**< The parameter of err_cbk() */ -} dma_handle_t; - -/** - * @brief Descriptor complete state - */ -typedef enum { - DMA_DESCP_CPLT_PRI = 0x0U, /**< Primary descriptor has been completed */ - DMA_DESCP_CPLT_ALT = 0x1U, /**< Alternate descriptor has been completed */ - DMA_DESCP_CPLT_ALL = 0x2U, /**< Both primary and alternate descriptors have been completed */ -} dma_descrp_cplt_t; -/** - * @} - */ - -/** - * @defgroup DMA_Private_Macros DMA Private Macros - * @{ - */ -#define IS_DMA_MSEL_TYPE(x) ((x) <= DMA_MSEL_TRNG) -#define IS_DMA_MSIGSEL_TYPE(x) ((x) <= 0xF) -#define IS_DMA_DATAINC_TYPE(x) (((x) == DMA_DATA_INC_BYTE) || \ - ((x) == DMA_DATA_INC_HALFWORD) || \ - ((x) == DMA_DATA_INC_WORD) || \ - ((x) == DMA_DATA_INC_NONE)) -#define IS_DMA_DATASIZE_TYPE(x) (((x) == DMA_DATA_SIZE_BYTE) || \ - ((x) == DMA_DATA_SIZE_HALFWORD) || \ - ((x) == DMA_DATA_SIZE_WORD)) -#define IS_CYCLECTRL_TYPE(x) (((x) == DMA_CYCLE_CTRL_NONE) || \ - ((x) == DMA_CYCLE_CTRL_BASIC) || \ - ((x) == DMA_CYCLE_CTRL_AUTO) || \ - ((x) == DMA_CYCLE_CTRL_PINGPONG) || \ - ((x) == DMA_CYCLE_CTRL_MEM_SG_PRIMARY) || \ - ((x) == DMA_CYCLE_CTRL_MEM_SG_ALTERNATE) || \ - ((x) == DMA_CYCLE_CTRL_PER_SG_PRIMARY) || \ - ((x) == DMA_CYCLE_CTRL_PER_SG_ALTERNATE)) -#define IS_DMA_ARBITERCONFIG_TYPE(x) (((x) == DMA_R_POWER_1) || \ - ((x) == DMA_R_POWER_2) || \ - ((x) == DMA_R_POWER_4) || \ - ((x) == DMA_R_POWER_8) || \ - ((x) == DMA_R_POWER_16) || \ - ((x) == DMA_R_POWER_32) || \ - ((x) == DMA_R_POWER_64) || \ - ((x) == DMA_R_POWER_128) || \ - ((x) == DMA_R_POWER_256) || \ - ((x) == DMA_R_POWER_512) || \ - ((x) == DMA_R_POWER_1024)) -#define IS_DMA(x) ((x) == DMA0) -#define IS_DMA_CHANNEL(x) ((x) <= 5) -#define IS_DMA_DATA_SIZE(x) ((x) <= 1024) -#define IS_DMA_IT_TYPE(x) (((x) <= 5) || ((x) == 31)) -/** - * @} - */ - -/** - * @addtogroup DMA_Public_Functions - * @{ - */ - -/** @addtogroup DMA_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -extern void ald_dma_reset(DMA_TypeDef *DMAx); -extern void ald_dma_init(DMA_TypeDef *DMAx); -extern void ald_dma_config_struct(dma_config_t *p); -extern void ald_dma_config_sg_alt_desc(dma_descriptor_t *desc, dma_config_t *config, uint8_t memory); -/** - * @} - */ - - -/** @addtogroup DMA_Public_Functions_Group2 - * @{ - */ -/* Configure DMA channel functions */ -extern void ald_dma_config_auto(dma_handle_t *hperh); -extern void ald_dma_restart_auto(dma_handle_t *hperh, void *src, void *dst, uint16_t size); -extern void ald_dma_config_auto_easy(DMA_TypeDef *DMAx, void *src, void *dst, - uint16_t size, uint8_t channel, void (*cbk)(void *arg)); -extern void ald_dma_config_basic(dma_handle_t *hperh); -extern void ald_dma_restart_basic(dma_handle_t *hperh, void *src, void *dst, uint16_t size); -extern void ald_dma_config_basic_easy(DMA_TypeDef *DMAx, void *src, void *dst, uint16_t size, dma_msel_t msel, - dma_msigsel_t msigsel, uint8_t channel, void (*cbk)(void *arg)); -extern void ald_dma_config_ping_pong(DMA_TypeDef *DMAx, dma_config_t *config, - uint8_t first, void (*cbk)(void *arg)); -extern void ald_dma_config_sg_mem(DMA_TypeDef *DMAx, dma_descriptor_t *desc, - uint32_t nr, uint8_t channel, void (*cbk)(void *arg)); -extern void ald_dma_config_sg_per(DMA_TypeDef *DMAx, dma_descriptor_t *desc, uint32_t nr, uint8_t burst, - dma_msel_t msel, dma_msigsel_t msigsel, uint8_t channel, void (*cbk)(void *arg)); -/** - * @} - */ - -/** @addtogroup DMA_Public_Functions_Group3 - * @{ - */ -/* DMA control functions */ -extern void ald_dma_channel_config(DMA_TypeDef *DMAx, uint8_t channel, type_func_t state); -extern void ald_dma_interrupt_config(DMA_TypeDef *DMAx, uint8_t channel, type_func_t state); -extern it_status_t ald_dma_get_it_status(DMA_TypeDef *DMAx, uint8_t channel); -extern flag_status_t ald_dma_get_flag_status(DMA_TypeDef *DMAx, uint8_t channel); -extern void ald_dma_clear_flag_status(DMA_TypeDef *DMAx, uint8_t channel); -extern dma_descrp_cplt_t ald_dma_descriptor_cplt_get(DMA_TypeDef *DMAx, uint8_t channel); -extern void ald_dma_irq_handler(void); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /*__ALD_DMA_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_flash.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_flash.h deleted file mode 100644 index 8858b8b707..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_flash.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_flash.h - * @brief Header file of FLASH driver - * - * @version V1.0 - * @date 20 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_FLASH_H__ -#define __ALD_FLASH_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup FLASH - * @{ - */ - -/** - * @defgroup FLASH_Private_Macros FLASH Private Macros - * @{ - */ -#define FLASH_REG_UNLOCK() \ -do { \ - if (op_cmd == OP_FLASH) { \ - WRITE_REG(MSC->FLASHKEY, 0x8ACE0246U); \ - WRITE_REG(MSC->FLASHKEY, 0x9BDF1357U); \ - } \ - else { \ - WRITE_REG(MSC->INFOKEY, 0x7153BFD9U); \ - WRITE_REG(MSC->INFOKEY, 0x0642CEA8U); \ - } \ -} while (0) -#define FLASH_REQ() (SET_BIT(MSC->FLASHCR, MSC_FLASHCR_FLASHREQ_MSK)) -#define FLASH_REQ_FIN() (CLEAR_BIT(MSC->FLASHCR, MSC_FLASHCR_FLASHREQ_MSK)) -#define FLASH_IAP_ENABLE() (SET_BIT(MSC->FLASHCR, MSC_FLASHCR_IAPEN_MSK)) -#define FLASH_IAP_DISABLE() (CLEAR_BIT(MSC->FLASHCR, MSC_FLASHCR_IAPEN_MSK)) -#define FLASH_BASE_ADDR 0x00000000U -#define FLASH_PAGE_SIZE 1024UL -#define FLASH_WORD_SIZE 8UL -#define FLASH_TOTAL_SIZE 256UL -#define FLASH_PAGE_MASK (FLASH_PAGE_SIZE - 1) -#define FLASH_WORD_MASK (FLASH_WORD_SIZE - 1) -#define IS_FLASH_ADDRESS(ADDR) ((ADDR) < (FLASH_BASE_ADDR + FLASH_PAGE_SIZE * FLASH_TOTAL_SIZE)) -#define IS_4BYTES_ALIGN(ADDR) (((uint32_t)(ADDR) & 0x3) == 0 ? 1 : 0) -#define FLASH_PAGE_ADDR(ADDR) ((ADDR) & (~FLASH_PAGE_MASK)) -#define FLASH_PAGEEND_ADDR(ADDR) ((ADDR) | FLASH_PAGE_MASK) -#define FLASH_WORD_ADDR(ADDR) ((ADDR) & (~FLASH_WORD_MASK)) -#define FLASH_WORDEND_ADDR(ADDR) ((ADDR) | FLASH_WORD_MASK) -#define INFO_PAGE_SIZE 1024UL -#define INFO_PAGE_MASK (INFO_PAGE_SIZE - 1) -#define INFO_PAGE_ADDR(ADDR) ((ADDR) & (~INFO_PAGE_MASK)) - -#ifdef USE_FLASH_FIFO - #define FLASH_FIFO 1 -#else - #define FLASH_FIFO 0 -#endif -/** - * @} - */ - -/** @defgroup FLASH_Private_Types FLASH Private Types - * @{ - */ -typedef enum { - FLASH_CMD_AE = 0x000051AEU, /**< Program area erase all */ - FLASH_CMD_PE = 0x00005EA1U, /**< Page erase */ - FLASH_CMD_WP = 0x00005DA2U, /**< Word program */ - FLASH_CMD_DATAPE = 0x00005BA4U, /**< Data flash page page erase */ - FLASH_CMD_DATAWP = 0x00005AA5U, /**< Data flash word program */ -} flash_cmd_type; - -typedef enum { - OP_FLASH = 0U, /**< Operate Pragram area */ - OP_INFO = 1U, /**< Operate info area */ -} op_cmd_type; - -/** - * @} - */ -/** @addtogroup Flash_Private_Functions - * @{ - */ -ald_status_t flash_page_erase(uint32_t addr); -ald_status_t flash_word_program(uint32_t addr, uint32_t *data, uint32_t len, uint32_t fifo); -/** - * @} - */ - -/** @addtogroup Flash_Public_Functions - * @{ - */ -ald_status_t ald_flash_read(uint32_t *ram_addr, uint32_t addr, uint16_t len); -ald_status_t ald_flash_write(uint32_t addr, uint8_t *buf, uint16_t len); -ald_status_t ald_flash_erase(uint32_t addr, uint16_t len); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_FLASH_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_gpio.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_gpio.h deleted file mode 100644 index 336c90f977..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_gpio.h +++ /dev/null @@ -1,277 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_gpio.h - * @brief Header file of GPIO module driver - * - * @version V1.0 - * @date 07 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_GPIO_H__ -#define __ALD_GPIO_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup GPIO - * @{ - */ - -/** - * @defgroup GPIO_Public_Macros GPIO Public Macros - * @{ - */ -#define GPIO_PIN_0 (1U << 0) -#define GPIO_PIN_1 (1U << 1) -#define GPIO_PIN_2 (1U << 2) -#define GPIO_PIN_3 (1U << 3) -#define GPIO_PIN_4 (1U << 4) -#define GPIO_PIN_5 (1U << 5) -#define GPIO_PIN_6 (1U << 6) -#define GPIO_PIN_7 (1U << 7) -#define GPIO_PIN_8 (1U << 8) -#define GPIO_PIN_9 (1U << 9) -#define GPIO_PIN_10 (1U << 10) -#define GPIO_PIN_11 (1U << 11) -#define GPIO_PIN_12 (1U << 12) -#define GPIO_PIN_13 (1U << 13) -#define GPIO_PIN_14 (1U << 14) -#define GPIO_PIN_15 (1U << 15) -#define GPIO_PIN_ALL (0xFFFFU) -/** - * @} - */ - -/** - * @defgroup GPIO_Public_Types GPIO Public Types - * @{ - */ - -/** - * @brief GPIO mode - */ -typedef enum { - GPIO_MODE_CLOSE = 0x0U, /**< Digital close Analog open */ - GPIO_MODE_INPUT = 0x1U, /**< Input */ - GPIO_MODE_OUTPUT = 0x2U, /**< Output */ -} gpio_mode_t; - -/** - * @brief GPIO open-drain or push-pull - */ -typedef enum { - GPIO_PUSH_PULL = 0x0U, /**< Push-Pull */ - GPIO_OPEN_DRAIN = 0x2U, /**< Open-Drain. Can't output high level */ - GPIO_OPEN_SOURCE = 0x3U, /**< Open-Source. Can't output low level */ -} gpio_odos_t; - -/** - * @brief GPIO push-up or push-down - */ -typedef enum { - GPIO_FLOATING = 0x0U, /**< Floating */ - GPIO_PUSH_UP = 0x1U, /**< Push-Up */ - GPIO_PUSH_DOWN = 0x2U, /**< Push-Down */ - GPIO_PUSH_UP_DOWN = 0x3U, /**< Push-Up and Push-Down */ -} gpio_push_t; - -/** - * @brief GPIO output drive - */ -typedef enum { - GPIO_OUT_DRIVE_NORMAL = 0x0U, /**< Normal current flow */ - GPIO_OUT_DRIVE_STRONG = 0x1U, /**< Strong current flow */ -} gpio_out_drive_t; - -/** - * @brief GPIO filter - */ -typedef enum { - GPIO_FILTER_DISABLE = 0x0U, /**< Disable filter */ - GPIO_FILTER_ENABLE = 0x1U, /**< Enable filter */ -} gpio_filter_t; - -/** - * @brief GPIO type - */ -typedef enum { - GPIO_TYPE_CMOS = 0x0U, /**< CMOS Type */ - GPIO_TYPE_TTL = 0x1U, /**< TTL Type */ -} gpio_type_t; - -/** - * @brief GPIO functions - */ -typedef enum { - GPIO_FUNC_0 = 0U, /**< function #0 */ - GPIO_FUNC_1 = 1U, /**< function #1 */ - GPIO_FUNC_2 = 2U, /**< function #2 */ - GPIO_FUNC_3 = 3U, /**< function #3 */ - GPIO_FUNC_4 = 4U, /**< function #4 */ - GPIO_FUNC_5 = 5U, /**< function #5 */ - GPIO_FUNC_6 = 6U, /**< function #6 */ - GPIO_FUNC_7 = 7U, /**< function #7 */ -} gpio_func_t; - - -/** - * @brief GPIO Init Structure definition - */ -typedef struct { - gpio_mode_t mode; /**< Specifies the operating mode for the selected pins. - This parameter can be any value of @ref gpio_mode_t */ - gpio_odos_t odos; /**< Specifies the Open-Drain or Push-Pull for the selected pins. - This parameter can be a value of @ref gpio_odos_t */ - gpio_push_t pupd; /**< Specifies the Pull-up or Pull-Down for the selected pins. - This parameter can be a value of @ref gpio_push_t */ - gpio_out_drive_t odrv; /**< Specifies the output driver for the selected pins. - This parameter can be a value of @ref gpio_out_drive_t */ - gpio_filter_t flt; /**< Specifies the input filter for the selected pins. - This parameter can be a value of @ref gpio_filter_t */ - gpio_type_t type; /**< Specifies the type for the selected pins. - This parameter can be a value of @ref gpio_type_t */ - gpio_func_t func; /**< Specifies the function for the selected pins. - This parameter can be a value of @ref gpio_func_t */ -} gpio_init_t; - -/** - * @brief EXTI trigger style - */ -typedef enum { - EXTI_TRIGGER_RISING_EDGE = 0U, /**< Rising edge trigger */ - EXTI_TRIGGER_TRAILING_EDGE = 1U, /**< Trailing edge trigger */ - EXTI_TRIGGER_BOTH_EDGE = 2U, /**< Rising and trailing edge trigger */ -} exti_trigger_style_t; - -/** - * @brief EXTI filter clock select - */ -typedef enum { - EXTI_FILTER_CLOCK_10K = 0U, /**< cks = 10KHz */ - EXTI_FILTER_CLOCK_32K = 1U, /**< cks = 32KHz */ -} exti_filter_clock_t; - -/** - * @brief EXTI Init Structure definition - */ -typedef struct { - type_func_t filter; /**< Enable filter. */ - exti_filter_clock_t cks; /**< Filter clock select. */ - uint8_t filter_time; /**< Filter duration */ -} exti_init_t; -/** - * @} - */ - -/** - * @defgroup GPIO_Private_Macros GPIO Private Macros - * @{ - */ -#define PIN_MASK 0xFFFFU -#define UNLOCK_KEY 0x55AAU - -#define IS_GPIO_PIN(x) ((((x) & (uint16_t)0x00) == 0) && ((x) != (uint16_t)0x0)) -#define IS_GPIO_PORT(GPIOx) ((GPIOx == GPIOA) || \ - (GPIOx == GPIOB) || \ - (GPIOx == GPIOC) || \ - (GPIOx == GPIOD) || \ - (GPIOx == GPIOE) || \ - (GPIOx == GPIOF) || \ - (GPIOx == GPIOG) || \ - (GPIOx == GPIOH)) -#define IS_GPIO_MODE(x) (((x) == GPIO_MODE_CLOSE) || \ - ((x) == GPIO_MODE_INPUT) || \ - ((x) == GPIO_MODE_OUTPUT)) -#define IS_GPIO_ODOS(x) (((x) == GPIO_PUSH_PULL) || \ - ((x) == GPIO_OPEN_DRAIN) || \ - ((x) == GPIO_OPEN_SOURCE)) -#define IS_GPIO_PUPD(x) (((x) == GPIO_FLOATING) || \ - ((x) == GPIO_PUSH_UP) || \ - ((x) == GPIO_PUSH_DOWN) || \ - ((x) == GPIO_PUSH_UP_DOWN)) -#define IS_GPIO_ODRV(x) (((x) == GPIO_OUT_DRIVE_NORMAL) || \ - ((x) == GPIO_OUT_DRIVE_STRONG)) -#define IS_GPIO_FLT(x) (((x) == GPIO_FILTER_DISABLE) || \ - ((x) == GPIO_FILTER_ENABLE)) -#define IS_GPIO_TYPE(x) (((x) == GPIO_TYPE_TTL) || \ - ((x) == GPIO_TYPE_CMOS)) -#define IS_TRIGGER_STYLE(x) (((x) == EXTI_TRIGGER_RISING_EDGE) || \ - ((x) == EXTI_TRIGGER_TRAILING_EDGE) || \ - ((x) == EXTI_TRIGGER_BOTH_EDGE)) -#define IS_EXTI_FLTCKS_TYPE(x) (((x) == EXTI_FILTER_CLOCK_10K) || \ - ((x) == EXTI_FILTER_CLOCK_32K)) -#define IS_GPIO_FUNC(x) ((x) <= 7) -/** - * @} - */ - -/** @addtogroup GPIO_Public_Functions - * @{ - */ - -/** @addtogroup GPIO_Public_Functions_Group1 - * @{ - */ -void ald_gpio_init(GPIO_TypeDef *GPIOx, uint16_t pin, gpio_init_t *init); -void ald_gpio_init_default(GPIO_TypeDef *GPIOx, uint16_t pin); -void ald_gpio_func_default(GPIO_TypeDef *GPIOx); -void ald_gpio_exti_init(GPIO_TypeDef *GPIOx, uint16_t pin, exti_init_t *init); -/** - * @} - */ - -/** @addtogroup GPIO_Public_Functions_Group2 - * @{ - */ -uint8_t ald_gpio_read_pin(GPIO_TypeDef *GPIOx, uint16_t pin); -void ald_gpio_write_pin(GPIO_TypeDef *GPIOx, uint16_t pin, uint8_t val); -void ald_gpio_toggle_pin(GPIO_TypeDef *GPIOx, uint16_t pin); -void ald_gpio_toggle_dir(GPIO_TypeDef *GPIOx, uint16_t pin); -void ald_gpio_lock_pin(GPIO_TypeDef *GPIOx, uint16_t pin); -uint16_t ald_gpio_read_port(GPIO_TypeDef *GPIOx); -void ald_gpio_write_port(GPIO_TypeDef *GPIOx, uint16_t val); -/** - * @} - */ - -/** @addtogroup GPIO_Public_Functions_Group3 - * @{ - */ -void ald_gpio_exti_interrupt_config(uint16_t pin, exti_trigger_style_t style, type_func_t status); -flag_status_t ald_gpio_exti_get_flag_status(uint16_t pin); -void ald_gpio_exti_clear_flag_status(uint16_t pin); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_GPIO_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_i2c.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_i2c.h deleted file mode 100644 index f421ff168e..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_i2c.h +++ /dev/null @@ -1,513 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_i2c.h - * @brief Header file of I2C driver - * - * @version V1.0 - * @date 15 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_I2C_H__ -#define __ALD_I2C_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" -#include "ald_cmu.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup I2C - * @{ - */ - -/** @defgroup I2C_Public_Types I2C Public Types - * @{ - */ -/** - * @brief I2C Error Code - */ -typedef enum { - I2C_ERROR_NONE = 0x0U, /**< No error */ - I2C_ERROR_BERR = 0x1U, /**< Berr error */ - I2C_ERROR_ARLO = 0x2U, /**< Arlo error */ - I2C_ERROR_AF = 0x4U, /**< Af error */ - I2C_ERROR_OVR = 0x8U, /**< Ovr error */ - I2C_ERROR_DMA = 0x10U, /**< Dma error */ - I2C_ERROR_TIMEOUT = 0x20U, /**< Timeout error */ -} i2c_error_t; - -/** - * @brief I2C state structure definition - */ -typedef enum { - I2C_STATE_RESET = 0x0U, /**< Peripheral is not yet Initialized */ - I2C_STATE_READY = 0x1U, /**< Peripheral Initialized and ready for use */ - I2C_STATE_BUSY = 0x2U, /**< An internal process is ongoing */ - I2C_STATE_BUSY_TX = 0x3U, /**< Data Transmission process is ongoing */ - I2C_STATE_BUSY_RX = 0x4U, /**< Data Reception process is ongoing */ - I2C_STATE_TIMEOUT = 0x5U, /**< timeout state */ - I2C_STATE_ERROR = 0x6U, /**< Error */ -} i2c_state_t; - -/** - * @brief I2C Duty Cycle - */ -typedef enum { - I2C_DUTYCYCLE_2 = 0x0U, /**< duty cycle is 2 */ - I2C_DUTYCYCLE_16_9 = 0x4000U, /**< duty cycle is 16/9 */ -} i2c_duty_t; - -/** - * @brief I2C Addressing Mode - */ -typedef enum { - I2C_ADDR_7BIT = 0x1U, /**< 7 bit address */ - I2C_ADDR_10BIT = 0x2U, /**< 10 bit address */ -} i2c_addr_t; - -/** - * @brief I2C Dual Addressing Mode - */ -typedef enum { - I2C_DUALADDR_DISABLE = 0x0U, /**< dual address is disable */ - I2C_DUALADDR_ENABLE = 0x1U, /**< dual address is enable */ -} i2c_dual_addr_t; - -/** - * @brief I2C General Call Addressing mode - */ -typedef enum { - I2C_GENERALCALL_DISABLE = 0x0U, /**< feneral call address is disable */ - I2C_GENERALCALL_ENABLE = 0x40U, /**< feneral call address is enable */ -} i2c_general_addr_t; - -/** - * @brief I2C Nostretch Mode - */ -typedef enum { - I2C_NOSTRETCH_DISABLE = 0x0U, /**< Nostretch disable */ - I2C_NOSTRETCH_ENABLE = 0x80U, /**< Nostretch enable */ -} i2c_nostretch_t; - -/** - * @brief I2C Memory Address Size - */ -typedef enum { - I2C_MEMADD_SIZE_8BIT = 0x1U, /**< 8 bit memory address size */ - I2C_MEMADD_SIZE_16BIT = 0x10U, /**< 10 bit memory address size */ -} i2c_addr_size_t; - -/** - * @brief I2C Flag Definition - */ -typedef enum { - I2C_FLAG_SB = (1U << 0), - I2C_FLAG_ADDR = (1U << 1), - I2C_FLAG_BTF = (1U << 2), - I2C_FLAG_ADD10 = (1U << 3), - I2C_FLAG_STOPF = (1U << 4), - I2C_FLAG_RXNE = (1U << 6), - I2C_FLAG_TXE = (1U << 7), - I2C_FLAG_BERR = (1U << 8), - I2C_FLAG_ARLO = (1U << 9), - I2C_FLAG_AF = (1U << 10), - I2C_FLAG_OVR = (1U << 11), - I2C_FLAG_PECERR = (1U << 12), - I2C_FLAG_TIMEOUT = (1U << 14), - I2C_FLAG_SMBALERT = (1U << 15), - I2C_FLAG_MSL = (1U << 16), - I2C_FLAG_BUSY = (1U << 17), - I2C_FLAG_TRA = (1U << 18), - I2C_FLAG_GENCALL = (1U << 20), - I2C_FLAG_SMBDEFAULT = (1U << 21), - I2C_FLAG_SMBHOST = (1U << 22), - I2C_FLAG_DUALF = (1U << 23), -} i2c_flag_t; - -/** - * @brief I2C mode structure definition - */ -typedef enum -{ - I2C_MODE_NONE = 0x0U, /**< No I2C communication on going */ - I2C_MODE_MASTER = 0x10U, /**< I2C communication is in Master mode */ - I2C_MODE_SLAVE = 0x20U, /**< I2C communication is in Slave mode */ - I2C_MODE_MEM = 0x40U, /**< I2C communication is in Memory mode */ -} i2c_mode_t; - -/** - * @brief I2C Clock - */ -typedef enum { - I2C_STANDARD_MODE_MAX_CLK = 100000U, /**< Standard mode clock */ - I2C_FAST_MODE_MAX_CLK = 400000U, /**< Fast mode clock */ -} i2c_clock_t; - -/** - * @brief Interrupt Configuration Definition - */ -typedef enum { - I2C_IT_BUF = (1U << 10), /**< Buffer interrupt */ - I2C_IT_EVT = (1U << 9), /**< Event interrupt */ - I2C_IT_ERR = (1U << 8), /**< Error interrupt */ -} i2c_interrupt_t; - -/** - * @brief I2C CON1 Register - */ -typedef enum { - I2C_CON1_PEN = (1U << 0), /**< PEN BIT */ - I2C_CON1_PMOD = (1U << 1), /**< PMOD BIT */ - I2C_CON1_SMBMOD = (1U << 3), /**< SMBMOD BIT */ - I2C_CON1_ARPEN = (1U << 4), /**< ARPEN BIT */ - I2C_CON1_PECEN = (1U << 5), /**< PECEN BIT */ - I2C_CON1_GCEN = (1U << 6), /**< GCEN BIT */ - I2C_CON1_DISCS = (1U << 7), /**< DISCS BIT */ - I2C_CON1_START = (1U << 8), /**< START BIT */ - I2C_CON1_STOP = (1U << 9), /**< STOP BIT */ - I2C_CON1_ACKEN = (1U << 10), /**< ACKEN BIT */ - I2C_CON1_POSAP = (1U << 11), /**< POSAP BIT */ - I2C_CON1_TRPEC = (1U << 12), /**< TRPEC BIT */ - I2C_CON1_ALARM = (1U << 13), /**< ALARM BIT */ - I2C_CON1_SRST = (1U << 15), /**< SRST BIT */ -} i2c_con1_t; - -/** - * @brief I2C CON2 Register - */ -typedef enum { - I2C_CON2_CLKF = 0x3FU, /**< CLKF BITS */ - I2C_CON2_CLKF_0 = (1U << 0), /**< CLKF_0 BIT */ - I2C_CON2_CLKF_1 = (1U << 1), /**< CLKF_1 BIT */ - I2C_CON2_CLKF_2 = (1U << 2), /**< CLKF_2 BIT */ - I2C_CON2_CLKF_3 = (1U << 3), /**< CLKF_3 BIT */ - I2C_CON2_CLKF_4 = (1U << 4), /**< CLKF_4 BIT */ - I2C_CON2_CLKF_5 = (1U << 5), /**< CLKF_5 BIT */ - I2C_CON2_ERRIE = (1U << 8), /**< ERRIE BIT */ - I2C_CON2_EVTIE = (1U << 9), /**< EVTIE BIT */ - I2C_CON2_BUFIE = (1U << 10), /**< BUFIE BIT */ - I2C_CON2_DMAEN = (1U << 11), /**< DMAEN BIT */ - I2C_CON2_LDMA = (1U << 12), /**< LDMA BIT */ -} i2c_con2_t; - -/** - * @brief I2C ADDR1 Register - */ -typedef enum { - I2C_ADDR1_ADDH0 = (1U << 0), /**< ADDH0 BIT */ - I2C_ADDR1_ADDH1 = (1U << 1), /**< ADDH1 BIT */ - I2C_ADDR1_ADDH2 = (1U << 2), /**< ADDH2 BIT */ - I2C_ADDR1_ADDH3 = (1U << 3), /**< ADDH3 BIT */ - I2C_ADDR1_ADDH4 = (1U << 4), /**< ADDH4 BIT */ - I2C_ADDR1_ADDH5 = (1U << 5), /**< ADDH5 BIT */ - I2C_ADDR1_ADDH6 = (1U << 6), /**< ADDH6 BIT */ - I2C_ADDR1_ADDH7 = (1U << 7), /**< ADDH7 BIT */ - I2C_ADDR1_ADDH8 = (1U << 8), /**< ADDH8 BIT */ - I2C_ADDR1_ADDH9 = (1U << 9), /**< ADDH9 BIT */ - I2C_ADDR1_ADDTYPE = (1U << 15), /**< ADDTYPE BIT */ -} i2c_addr1_t; - -/** - * @brief I2C ADDR2 Register - */ -typedef enum { - I2C_ADDR2_DUALEN = (1U << 0), /**< DUALEN BIT */ - I2C_ADDR2_ADD = (1U << 1), /**< ADD BIT */ -} i2c_addr2_t; - -/** - * @brief I2C STAT1 Register - */ -typedef enum { - I2C_STAT1_SB = (1U << 0), /**< SB BIT */ - I2C_STAT1_ADDR = (1U << 1), /**< ADDR BIT */ - I2C_STAT1_BTC = (1U << 2), /**< BTC BIT */ - I2C_STAT1_SENDADD10 = (1U << 3), /**< SENDADD10 BIT */ - I2C_STAT1_DETSTP = (1U << 4), /**< DETSTP BIT */ - I2C_STAT1_RXBNE = (1U << 6), /**< RXBNE BIT */ - I2C_STAT1_TXBE = (1U << 7), /**< TXBE BIT */ - I2C_STAT1_BUSERR = (1U << 8), /**< BUSERR BIT */ - I2C_STAT1_LARB = (1U << 9), /**< LARB BIT */ - I2C_STAT1_ACKERR = (1U << 10), /**< ACKERR BIT */ - I2C_STAT1_ROUERR = (1U << 11), /**< ROUERR BIT */ - I2C_STAT1_PECERR = (1U << 12), /**< PECERR BIT */ - I2C_STAT1_SMBTO = (1U << 14), /**< SMBTO BIT */ - I2C_STAT1_SMBALARM = (1U << 15), /**< SMBALARM BIT */ -} i2c_stat1_t; - -/** - * @brief I2C STAT2 Register - */ -typedef enum { - I2C_STAT2_MASTER = (1U << 0), /**< MASTER BIT */ - I2C_STAT2_BSYF = (1U << 1), /**< BSYF BIT */ - I2C_STAT2_TRF = (1U << 2), /**< TRF BIT */ - I2C_STAT2_RXGCF = (1U << 4), /**< RXGCF BIT */ - I2C_STAT2_SMBDEF = (1U << 5), /**< SMBDEF BIT */ - I2C_STAT2_SMBHH = (1U << 6), /**< SMBHH BIT */ - I2C_STAT2_DUALF = (1U << 7), /**< DMF BIT */ - I2C_STAT2_PECV = (1U << 8), /**< PECV BIT */ -} i2c_stat2_t; - -/** - * @brief I2C CKCFG Register - */ -typedef enum { - I2C_CKCFG_CLKSET = 0xFFFU, /**< CLKSET BITS */ - I2C_CKCFG_DUTY = (1U << 14), /**< DUTY BIT */ - I2C_CKCFG_CLKMOD = (1U << 15), /**< CLKMOD BIT */ -} i2c_ckcfg_t; - -/** - * @brief I2C RT Register - */ -typedef enum { - I2C_RT_RISET = 0x3FU, /**< RISET BITS */ -} i2c_trise_t; - -/** - * @brief I2C Configuration Structure definition - */ -typedef struct { - uint32_t clk_speed; /**< Specifies the clock frequency */ - i2c_duty_t duty; /**< Specifies the I2C fast mode duty cycle */ - uint32_t own_addr1; /**< Specifies the first device own address */ - i2c_addr_t addr_mode; /**< Specifies addressing mode */ - i2c_dual_addr_t dual_addr; /**< Specifies if dual addressing mode is selected */ - uint32_t own_addr2; /**< Specifies the second device own address */ - i2c_general_addr_t general_call; /**< Specifies if general call mode is selected */ - i2c_nostretch_t no_stretch; /**< Specifies if nostretch mode is selected */ -} i2c_init_t; - -/** - * @brief I2C handle Structure definition - */ -typedef struct i2c_handle_s { - I2C_TypeDef *perh; /**< I2C registers base address */ - i2c_init_t init; /**< I2C communication parameters */ - uint8_t *p_buff; /**< Pointer to I2C transfer buffer */ - uint16_t xfer_size; /**< I2C transfer size */ - __IO uint16_t xfer_count; /**< I2C transfer counter */ -#ifdef ALD_DMA - dma_handle_t hdmatx; /**< I2C Tx DMA handle parameters */ - dma_handle_t hdmarx; /**< I2C Rx DMA handle parameters */ -#endif - lock_state_t lock; /**< I2C locking object */ - __IO i2c_state_t state; /**< I2C communication state */ - __IO i2c_mode_t mode; /**< I2C communication mode */ - __IO uint32_t error_code; /**< I2C Error code */ - - void (*master_tx_cplt_cbk)(struct i2c_handle_s *arg); /**< Master Tx completed callback */ - void (*master_rx_cplt_cbk)(struct i2c_handle_s *arg); /**< Master Rx completed callback */ - void (*slave_tx_cplt_cbk)(struct i2c_handle_s *arg); /**< Slave Tx completed callback */ - void (*slave_rx_cplt_cbk)(struct i2c_handle_s *arg); /**< Slave Rx completed callback */ - void (*mem_tx_cplt_cbk)(struct i2c_handle_s *arg); /**< Tx to Memory completed callback */ - void (*mem_rx_cplt_cbk)(struct i2c_handle_s *arg); /**< Rx from Memory completed callback */ - void (*error_callback)(struct i2c_handle_s *arg); /**< Error callback */ -} i2c_handle_t; - -/** - * @} - */ - -/** @defgroup I2C_Public_Macro I2C Public Macros - * @{ - */ -#define I2C_RESET_HANDLE_STATE(x) ((x)->state = I2C_STATE_RESET) -#define I2C_CLEAR_ADDRFLAG(x) \ -do { \ - __IO uint32_t tmpreg; \ - tmpreg = (x)->perh->STAT1; \ - tmpreg = (x)->perh->STAT2; \ - UNUSED(tmpreg); \ -} while (0) -#define __I2C_CLEAR_STOPFLAG(x) \ -do { \ - __IO uint32_t tmpreg; \ - tmpreg = (x)->perh->STAT1; \ - tmpreg = SET_BIT((x)->perh->CON1, I2C_CON1_PEN); \ - UNUSED(tmpreg); \ -} while (0) -#define I2C_ENABLE(x) (SET_BIT((x)->perh->CON1, I2C_CON1_PEN_MSK)) -#define I2C_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, I2C_CON1_PEN_MSK)) -/** - * @} - */ - -/** @defgroup I2C_Private_Macro I2C Private Macros - * @{ - */ -#define IS_I2C_TYPE(x) (((x) == I2C0) || \ - ((x) == I2C1)) -#define IS_I2C_ADDRESSING_MODE(x) (((x) == I2C_ADDR_7BIT) || \ - ((x) == I2C_ADDR_10BIT)) -#define IS_I2C_DUAL_ADDRESS(x) (((x) == I2C_DUALADDR_DISABLE) || \ - ((x) == I2C_DUALADDR_ENABLE)) -#define IS_I2C_GENERAL_CALL(x) (((x) == I2C_GENERALCALL_DISABLE) || \ - ((x) == I2C_GENERALCALL_ENABLE)) -#define IS_I2C_MEMADD_size(x) (((x) == I2C_MEMADD_SIZE_8BIT) || \ - ((x) == I2C_MEMADD_SIZE_16BIT)) -#define IS_I2C_NO_STRETCH(x) (((x) == I2C_NOSTRETCH_DISABLE) || \ - ((x) == I2C_NOSTRETCH_ENABLE)) -#define IS_I2C_OWN_ADDRESS1(x) (((x) & (uint32_t)(0xFFFFFC00)) == 0) -#define IS_I2C_OWN_ADDRESS2(x) (((x) & (uint32_t)(0xFFFFFF01)) == 0) -#define IS_I2C_CLOCK_SPEED(x) (((x) > 0) && ((x) <= I2C_FAST_MODE_MAX_CLK)) -#define IS_I2C_DUTY_CYCLE(x) (((x) == I2C_DUTYCYCLE_2) || \ - ((x) == I2C_DUTYCYCLE_16_9)) -#define IS_I2C_IT_TYPE(x) (((x) == I2C_IT_BUF) || \ - ((x) == I2C_IT_EVT) || \ - ((x) == I2C_IT_ERR)) -#define IS_I2C_FLAG(x) (((x) == I2C_FLAG_SB) || \ - ((x) == I2C_FLAG_ADDR) || \ - ((x) == I2C_FLAG_BTF) || \ - ((x) == I2C_FLAG_ADD10) || \ - ((x) == I2C_FLAG_STOPF) || \ - ((x) == I2C_FLAG_RXNE) || \ - ((x) == I2C_FLAG_TXE) || \ - ((x) == I2C_FLAG_BERR) || \ - ((x) == I2C_FLAG_ARLO) || \ - ((x) == I2C_FLAG_AF) || \ - ((x) == I2C_FLAG_OVR) || \ - ((x) == I2C_FLAG_PECERR) || \ - ((x) == I2C_FLAG_TIMEOUT) || \ - ((x) == I2C_FLAG_SMBALERT) || \ - ((x) == I2C_FLAG_MSL) || \ - ((x) == I2C_FLAG_BUSY) || \ - ((x) == I2C_FLAG_TRA) || \ - ((x) == I2C_FLAG_GENCALL) || \ - ((x) == I2C_FLAG_SMBDEFAULT) || \ - ((x) == I2C_FLAG_SMBHOST) || \ - ((x) == I2C_FLAG_DUALF)) - -#define I2C_FREQ_RANGE(x) ((x) / 1000000) -#define I2C_RISE_TIME(x, u) (((u) <= I2C_STANDARD_MODE_MAX_CLK) ? ((x) + 1) :\ - ((((x) * 300) / 1000) + 1)) -#define I2C_SPEED_STANDARD(x, y) (((((x) / ((y) << 1)) & I2C_CKCFG_CLKSET) < 4) ? 4:\ - ((x) / ((y) << 1))) -#define I2C_SPEED_FAST(x, y, z) (((z) == I2C_DUTYCYCLE_2) ? ((x) / ((y) * 3)) :\ - (((x) / ((y) * 25)) | I2C_DUTYCYCLE_16_9)) -#define I2C_SPEED(x, y, z) (((y) <= 100000) ? (I2C_SPEED_STANDARD((x), (y))) :\ - ((I2C_SPEED_FAST((x), (y), (z)) & I2C_CKCFG_CLKSET) == 0) ? 1 : \ - ((I2C_SPEED_FAST((x), (y), (z))) | I2C_CKCFG_CLKMOD)) -#define I2C_MEM_ADD_MSB(x) ((uint8_t)((uint16_t)(((uint16_t)((x) &\ - (uint16_t)(0xFF00))) >> 8))) -#define I2C_MEM_ADD_LSB(x) ((uint8_t)((uint16_t)((x) & (uint16_t)(0x00FF)))) -#define I2C_7BIT_ADD_WRITE(x) ((uint8_t)((x) & (~I2C_ADDR1_ADDH0))) -#define I2C_7BIT_ADD_READ(x) ((uint8_t)((x) | I2C_ADDR1_ADDH0)) -#define I2C_10BIT_ADDRESS(x) ((uint8_t)((uint16_t)((x) & (uint16_t)(0x00FF)))) -#define I2C_10BIT_HEADER_WRITE(x) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((x) &\ - (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF0)))) -#define I2C_10BIT_HEADER_READ(x) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((x) &\ - (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF1)))) -/** - * @} - */ - -/** @addtogroup I2C_Public_Functions - * @{ - */ - -/** @addtogroup I2C_Public_Functions_Group1 - * @{ - */ -ald_status_t ald_i2c_init(i2c_handle_t *hperh); -ald_status_t ald_i2c_reset(i2c_handle_t *hperh); - -/** - * @} - */ - -/** @addtogroup I2C_Public_Functions_Group2 - * @{ - */ - /** Blocking mode: Polling */ -ald_status_t ald_i2c_master_send(i2c_handle_t *hperh, uint16_t dev_addr, - uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_i2c_master_recv(i2c_handle_t *hperh, uint16_t dev_addr, - uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_i2c_slave_send(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_i2c_slave_recv(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_i2c_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_i2c_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_i2c_is_device_ready(i2c_handle_t *hperh, uint16_t dev_addr, uint32_t trials, uint32_t timeout); - - /** Non-Blocking mode: Interrupt */ -ald_status_t ald_i2c_master_send_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, uint16_t size); -ald_status_t ald_i2c_master_recv_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, uint16_t size); -ald_status_t ald_i2c_slave_send_by_it(i2c_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_i2c_slave_recv_by_it(i2c_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_i2c_mem_write_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size); -ald_status_t ald_i2c_mem_read_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size); - -#ifdef ALD_DMA - /** Non-Blocking mode: DMA */ -ald_status_t ald_i2c_master_send_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, - uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_i2c_master_recv_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, - uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_i2c_slave_send_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_i2c_slave_recv_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_i2c_mem_write_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, i2c_addr_size_t add_size, - uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size, uint8_t channel); -#endif -/** - * @} - */ - -/** @addtogroup I2C_Public_Functions_Group3 - * @{ - */ -i2c_state_t ald_i2c_get_state(i2c_handle_t *hperh); -uint32_t ald_i2c_get_error(i2c_handle_t *hperh); -flag_status_t ald_i2c_get_flag_status(i2c_handle_t *hperh, i2c_flag_t flag); -flag_status_t ald_i2c_get_it_status(i2c_handle_t *hperh, i2c_interrupt_t it); -void ald_i2c_clear_flag_status(i2c_handle_t *hperh, i2c_flag_t flag); -/** - * @} - */ - -/** @addtogroup I2C_Public_Functions_Group4 - * @{ - */ -void ald_i2c_interrupt_config(i2c_handle_t *hperh, i2c_interrupt_t it, type_func_t state); -void ald_i2c_ev_irq_handler(i2c_handle_t *hperh); -void ald_i2c_er_irq_handler(i2c_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_I2C_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_iap.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_iap.h deleted file mode 100644 index a777fca4a9..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_iap.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_iap.h - * @brief Header file of IAP module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_IAP_H__ -#define __ALD_IAP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup IAP - * @{ - */ - -/** - * @defgroup IAP_Private_Macros IAP Private Macros - * @{ - */ -#define IAP_WSP_ADDR 0x10000000U -#define IAP_PE_ADDR 0x10000004U -#define IAP_WP_ADDR 0x10000008U -#define IAP_DWP_ADDR 0x1000000cU -/** - * @} - */ - -/** @defgroup IAP_Private_Types IAP Private Types - * @{ - */ -typedef uint32_t (*IAP_PE)(uint32_t addr); -typedef uint32_t (*IAP_WP)(uint32_t addr, uint32_t data); -typedef uint32_t (*IAP_DWP)(uint32_t addr, uint32_t data_l, uint32_t data_h); -typedef uint32_t (*IAP_WSP)(uint32_t addr, uint8_t *data, uint32_t len, uint32_t erase); -/** - * @} - */ - -/** @addtogroup IAP_Public_Functions - * @{ - */ -uint32_t ald_iap_erase_page(uint32_t addr); -uint32_t ald_iap_program_word(uint32_t addr, uint32_t data); -uint32_t ald_iap_program_dword(uint32_t addr, uint32_t data_l, uint32_t data_h); -uint32_t ald_iap_program_words(uint32_t addr, uint8_t *data, uint32_t len, uint32_t erase); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_IAP_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lcd.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lcd.h deleted file mode 100644 index 9b14bdb67f..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lcd.h +++ /dev/null @@ -1,496 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_lcd.h - * @brief Header file of LCD module driver. - * - * @version V1.0 - * @date 29 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_LCD_H__ -#define __ALD_LCD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" -#include "ald_cmu.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup LCD - * @{ - */ - -/** @defgroup LCD_Public_Types LCD Public Types - * @{ - */ -/** - * @brief Lcd vlcd voltage type - */ -typedef enum { - LCD_VCHPS_3V2 = 0U, /**< 3.2V */ - LCD_VCHPS_3V8 = 1U, /**< 3.8V */ - LCD_VCHPS_4V8 = 2U, /**< 4.8V */ - LCD_VCHPS_5V4 = 3U, /**< 5.4V */ -} lcd_vchps_t; - -/** - * @brief Lcd function type - */ -typedef enum { - LCD_FUNC_DISABLE = 0U, /**< Lcd's function disable */ - LCD_FUNC_ENABLE = 1U, /**< Lcd's function enable */ -} lcd_func_t; - -/** - * @brief Lcd voltage type - */ -typedef enum { - LCD_VSEL_VDD = 0U, /**< VDD */ - LCD_VSEL_CP = 1U, /**< Charge pump output */ - LCD_VSEL_VLCD = 2U, /**< VLCD input */ -} lcd_vsel_t; - -/** - * @brief Lcd resistance select bit - */ -typedef enum { - LCD_RES_1MOHM = 0U, /**< 1M ohm */ - LCD_RES_2MOHM = 1U, /**< 2M ohm */ - LCD_RES_3MOHM = 2U, /**< 3M ohm */ -} lcd_res_t; - -/** - * @brief Lcd bias selector - */ -typedef enum { - LCD_BIAS_1_4 = 0U, /**< 1/4 bias */ - LCD_BIAS_1_2 = 2U, /**< 1/2 bias */ - LCD_BIAS_1_3 = 3U, /**< 1/3 bias */ -} lcd_bias_t; - -/** - * @brief Lcd duty - */ -typedef enum { - LCD_DUTY_STATIC = 0U, /**< Static duty (COM0) */ - LCD_DUTY_1_2 = 1U, /**< 1/2 duty (COM0~COM1) */ - LCD_DUTY_1_3 = 2U, /**< 1/3 duty (COM0~COM2) */ - LCD_DUTY_1_4 = 3U, /**< 1/4 duty (COM0~COM3) */ - LCD_DUTY_1_6 = 4U, /**< 1/6 duty (COM0~COM5) */ - LCD_DUTY_1_8 = 5U, /**< 1/8 duty (COM0~COM7) */ -} lcd_duty_t; - -/** - * @brief Lcd prescaler - */ -typedef enum { - LCD_PRS_1 = 0U, /**< CLKPRS = LCDCLK / 1 */ - LCD_PRS_2 = 1U, /**< CLKPRS = LCDCLK / 2 */ - LCD_PRS_4 = 2U, /**< CLKPRS = LCDCLK / 4 */ - LCD_PRS_8 = 3U, /**< CLKPRS = LCDCLK / 8 */ - LCD_PRS_16 = 4U, /**< CLKPRS = LCDCLK / 16 */ - LCD_PRS_32 = 5U, /**< CLKPRS = LCDCLK / 32 */ - LCD_PRS_64 = 6U, /**< CLKPRS = LCDCLK / 64 */ - LCD_PRS_128 = 7U, /**< CLKPRS = LCDCLK / 128 */ - LCD_PRS_256 = 8U, /**< CLKPRS = LCDCLK / 256 */ - LCD_PRS_512 = 9U, /**< CLKPRS = LCDCLK / 512 */ - LCD_PRS_1024 = 10U, /**< CLKPRS = LCDCLK / 1024 */ - LCD_PRS_2048 = 11U, /**< CLKPRS = LCDCLK / 2048 */ - LCD_PRS_4096 = 12U, /**< CLKPRS = LCDCLK / 4096 */ - LCD_PRS_8192 = 13U, /**< CLKPRS = LCDCLK / 8192 */ - LCD_PRS_16384 = 14U, /**< CLKPRS = LCDCLK / 16384 */ - LCD_PRS_32768 = 15U, /**< CLKPRS = LCDCLK / 32768 */ -} lcd_prs_t; - -/** - * @brief Lcd divider - */ -typedef enum { - LCD_DIV_16 = 0U, /**< DIVCLK = CLKPRS / 16 */ - LCD_DIV_17 = 1U, /**< DIVCLK = CLKPRS / 17 */ - LCD_DIV_18 = 2U, /**< DIVCLK = CLKPRS / 18 */ - LCD_DIV_19 = 3U, /**< DIVCLK = CLKPRS / 19 */ - LCD_DIV_20 = 4U, /**< DIVCLK = CLKPRS / 20 */ - LCD_DIV_21 = 5U, /**< DIVCLK = CLKPRS / 21 */ - LCD_DIV_22 = 6U, /**< DIVCLK = CLKPRS / 22 */ - LCD_DIV_23 = 7U, /**< DIVCLK = CLKPRS / 23 */ - LCD_DIV_24 = 8U, /**< DIVCLK = CLKPRS / 24 */ - LCD_DIV_25 = 9U, /**< DIVCLK = CLKPRS / 25 */ - LCD_DIV_26 = 10U, /**< DIVCLK = CLKPRS / 26 */ - LCD_DIV_27 = 11U, /**< DIVCLK = CLKPRS / 27 */ - LCD_DIV_28 = 12U, /**< DIVCLK = CLKPRS / 28 */ - LCD_DIV_29 = 13U, /**< DIVCLK = CLKPRS / 29 */ - LCD_DIV_30 = 14U, /**< DIVCLK = CLKPRS / 30 */ - LCD_DIV_31 = 15U, /**< DIVCLK = CLKPRS / 31 */ -} lcd_div_t; - -/** - * @brief Lcd blink mode - */ -typedef enum { - LCD_BLINK_OFF = 0U, /**< Blink disabled */ - LCD_BLINK_SEG0_COM0 = 1U, /**< Blink enabled on SEG0, COM0 */ - LCD_BLINK_SEG0_COMX2 = 2U, /**< Blink enabled on SEG0, COMx2 */ - LCD_BLINK_ALLSEG_ALLCOM = 3U, /**< Blink enabled on all SEG and all COM */ -} lcd_blink_t; - -/** - * @brief Lcd blink frequency - */ -typedef enum { - LCD_BLFRQ_8 = 0U, /**< DIVCLK / 8 */ - LCD_BLFRQ_16 = 1U, /**< DIVCLK / 16 */ - LCD_BLFRQ_32 = 2U, /**< DIVCLK / 32 */ - LCD_BLFRQ_64 = 3U, /**< DIVCLK / 64 */ - LCD_BLFRQ_128 = 4U, /**< DIVCLK / 128 */ - LCD_BLFRQ_256 = 5U, /**< DIVCLK / 256 */ - LCD_BLFRQ_512 = 6U, /**< DIVCLK / 512 */ - LCD_BLFRQ_1024 = 7U, /**< DIVCLK / 1024 */ -} lcd_blfrq_t; - -/** - * @brief Lcd dead time - */ -typedef enum { - LCD_DEAD_TIME_NONE = 0U, /**< No dead time */ - LCD_DEAD_TIME_1_DIVCLK = 1U, /**< Dead time is 1 divclk */ - LCD_DEAD_TIME_2_DIVCLK = 2U, /**< Dead time is 2 divclk */ - LCD_DEAD_TIME_3_DIVCLK = 3U, /**< Dead time is 3 divclk */ - LCD_DEAD_TIME_4_DIVCLK = 4U, /**< Dead time is 4 divclk */ - LCD_DEAD_TIME_5_DIVCLK = 5U, /**< Dead time is 5 divclk */ - LCD_DEAD_TIME_6_DIVCLK = 6U, /**< Dead time is 6 divclk */ - LCD_DEAD_TIME_7_DIVCLK = 7U, /**< Dead time is 7 divclk */ -} lcd_dead_t; - -/** - * @brief Lcd pulse keep time - */ -typedef enum { - LCD_PON_NONE = 0U, /**< No pulse keep time */ - LCD_PON_1_PRSCLK = 1U, /**< Pulse keep 1 prsclk */ - LCD_PON_2_PRSCLK = 2U, /**< Pulse keep 2 prsclk */ - LCD_PON_3_PRSCLK = 3U, /**< Pulse keep 3 prsclk */ - LCD_PON_4_PRSCLK = 4U, /**< Pulse keep 4 prsclk */ - LCD_PON_5_PRSCLK = 5U, /**< Pulse keep 5 prsclk */ - LCD_PON_6_PRSCLK = 6U, /**< Pulse keep 6 prsclk */ - LCD_PON_7_PRSCLK = 7U, /**< Pulse keep 7 prsclk */ -} lcd_pluse_on_t; - -/** - * @brief Lcd vgs select - */ -typedef enum { - LCD_VGS_0 = 0U, /**< Grey level display voltage is 30/45 vlcd */ - LCD_VGS_1 = 1U, /**< Grey level display voltage is 31/45 vlcd */ - LCD_VGS_2 = 2U, /**< Grey level display voltage is 32/45 vlcd */ - LCD_VGS_3 = 3U, /**< Grey level display voltage is 33/45 vlcd */ - LCD_VGS_4 = 4U, /**< Grey level display voltage is 34/45 vlcd */ - LCD_VGS_5 = 5U, /**< Grey level display voltage is 35/45 vlcd */ - LCD_VGS_6 = 6U, /**< Grey level display voltage is 36/45 vlcd */ - LCD_VGS_7 = 7U, /**< Grey level display voltage is 37/45 vlcd */ - LCD_VGS_8 = 8U, /**< Grey level display voltage is 38/45 vlcd */ - LCD_VGS_9 = 9U, /**< Grey level display voltage is 39/45 vlcd */ - LCD_VGS_10 = 10U, /**< Grey level display voltage is 40/45 vlcd */ - LCD_VGS_11 = 11U, /**< Grey level display voltage is 41/45 vlcd */ - LCD_VGS_12 = 12U, /**< Grey level display voltage is 42/45 vlcd */ - LCD_VGS_13 = 13U, /**< Grey level display voltage is 43/45 vlcd */ - LCD_VGS_14 = 14U, /**< Grey level display voltage is 44/45 vlcd */ - LCD_VGS_15 = 15U, /**< Grey level display voltage is equal to vlcd */ -} lcd_vgs_t; - -/** - * @brief Lcd wave choose - */ -typedef enum { - LCD_WAVE_A = 0U, /**< Wave type is A */ - LCD_WAVE_B = 1U, /**< Wave type is B */ -} lcd_wfs_t; - -/** - * @brief Lcd status select bit - */ -typedef enum { - LCD_STATUS_RDY = (1U << 0), /**< VLCD voltage state flag */ - LCD_STATUS_ENS = (1U << 1), /**< LCD Enable state flag*/ - LCD_STATUS_UDR = (1U << 2), /**< Update display request state flag */ - LCD_STATUS_FCRSF = (1U << 3), /**< LCD frame control sync flag */ - LCD_STATUS_ALL = 0xFFFFFFFU, /**< All flag */ -} lcd_status_t; - -/** - * @brief Lcd interrupt type - */ -typedef enum { - LCD_IT_SOF = (1U << 0), /**< Start of frame interrupt enable */ - LCD_IT_UDD = (1U << 1), /**< Update display done interrupt enable*/ -} lcd_it_t; - -/** - * @brief Lcd interrupt flag - */ -typedef enum { - LCD_FLAG_SOF = (1U << 0), /**< Start of frame interrupt enable flag*/ - LCD_FLAG_UDD = (1U << 1), /**< Update display done interrupt enable flag*/ -} lcd_flag_t; - -/** - * @brief Lcd interrupt type - */ -typedef enum { - SEG_0_TO_31 = 0U, /**< Segment 0 to 31 to be set */ - SEG_32_TO_59 = 1U, /**< Segment 32 to 59 to be set */ -} lcd_seg_t; - -/** - * @brief Lcd configure - */ -typedef struct -{ - lcd_vsel_t lcd_vsel; /**< Lcd power choose */ - lcd_vchps_t lcd_vchps; /**< Charge pump voltage choose */ - lcd_func_t lcd_vbufld; /**< Low drive mode function */ - lcd_func_t lcd_vbufhd; /**< High drive mode function */ - uint32_t lcd_dsld; /**< Low drive mode level */ - uint32_t lcd_dshd; /**< High drive mode level */ - lcd_res_t lcd_resld; /**< Low dirve mode resistance choose */ - lcd_res_t lcd_reshd; /**< High dirve mode resistance choose */ - lcd_bias_t lcd_bias; /**< LCD bias */ - lcd_duty_t lcd_duty; /**< LCD duty */ - lcd_wfs_t lcd_wfs; /**< Wave choose */ - lcd_prs_t lcd_prs; /**< Lcd clock prs */ - lcd_div_t lcd_div; /**< Lcd div */ - lcd_dead_t lcd_dead; /**< Lcd dead time */ - lcd_pluse_on_t lcd_pon; /**< Lcd pluse on time */ - lcd_vgs_t lcd_vgs; /**< Lcd gray level display voltage */ - cmu_lcd_clock_sel_t clock; /**< Lcd clock choose */ -} lcd_init_t; - -/** - * @brief Lcd handle Structure definition - */ -typedef struct lcd_handle_s { - LCD_TypeDef *perh; /**< LCD registers base address */ - lcd_init_t init; /**< LCD initialize parameters */ - lock_state_t lock; /**< Locking object */ - - void (*display_cplt_cbk)(struct lcd_handle_s *arg); /**< Display completed callback */ - void (*frame_start_cbk)(struct lcd_handle_s *arg); /**< Frame start callback */ -} lcd_handle_t; - -/** - * @} - */ - -/** @defgroup LCD_Public_Macro LCD Public Macros - * @{ - */ -#define LCD_HD_ENABLE(x) (SET_BIT((x)->perh->FCR, LCD_FCR_HD_MSK)) -#define LCD_HD_DISABLE(x) (CLEAR_BIT((x)->perh->FCR, LCD_FCR_HD_MSK)) -/** - * @} - */ - -/** - * @defgroup LCD_Private_Macros LCD Private Macros - * @{ - */ -#define IS_LCD_PERH_TYPE(x) ((x) == LCD) -#define IS_LCD_VCHPS_TYPE(x) (((x) == LCD_VCHPS_3V2) || \ - ((x) == LCD_VCHPS_3V8) || \ - ((x) == LCD_VCHPS_4V8) || \ - ((x) == LCD_VCHPS_5V4)) -#define IS_LCD_VSEL_TYPE(x) (((x) == LCD_VSEL_VDD) || \ - ((x) == LCD_VSEL_CP) || \ - ((x) == LCD_VSEL_VLCD)) -#define IS_LCD_FUNC_TYPE(x) (((x) == LCD_FUNC_DISABLE) || \ - ((x) == LCD_FUNC_ENABLE)) -#define IS_LCD_LEVEL_TYPE(x) (((x) > 0) | ((x) <= 0xF)) -#define IS_LCD_RES_TYPE(x) (((x) == LCD_RES_1MOHM) || \ - ((x) == LCD_RES_2MOHM) || \ - ((x) == LCD_RES_3MOHM)) -#define IS_LCD_BIAS_TYPE(x) (((x) == LCD_BIAS_1_4) || \ - ((x) == LCD_BIAS_1_2) || \ - ((x) == LCD_BIAS_1_3)) -#define IS_LCD_DUTY_TYPE(x) (((x) == LCD_DUTY_STATIC) || \ - ((x) == LCD_DUTY_1_2) || \ - ((x) == LCD_DUTY_1_3) || \ - ((x) == LCD_DUTY_1_4) || \ - ((x) == LCD_DUTY_1_6) || \ - ((x) == LCD_DUTY_1_8)) -#define IS_LCD_WFS_TYPE(x) (((x) == LCD_WAVE_A) || \ - ((x) == LCD_WAVE_B)) -#define IS_LCD_PRS_TYPE(x) (((x) == LCD_PRS_1) || \ - ((x) == LCD_PRS_2) || \ - ((x) == LCD_PRS_4) || \ - ((x) == LCD_PRS_8) || \ - ((x) == LCD_PRS_16) || \ - ((x) == LCD_PRS_32) || \ - ((x) == LCD_PRS_64) || \ - ((x) == LCD_PRS_128) || \ - ((x) == LCD_PRS_256) || \ - ((x) == LCD_PRS_512) || \ - ((x) == LCD_PRS_1024) || \ - ((x) == LCD_PRS_2048) || \ - ((x) == LCD_PRS_4096) || \ - ((x) == LCD_PRS_8192) || \ - ((x) == LCD_PRS_16384) || \ - ((x) == LCD_PRS_32768)) -#define IS_LCD_DIV_TYPE(x) (((x) == LCD_DIV_16) || \ - ((x) == LCD_DIV_17) || \ - ((x) == LCD_DIV_18) || \ - ((x) == LCD_DIV_19) || \ - ((x) == LCD_DIV_20) || \ - ((x) == LCD_DIV_21) || \ - ((x) == LCD_DIV_22) || \ - ((x) == LCD_DIV_23) || \ - ((x) == LCD_DIV_24) || \ - ((x) == LCD_DIV_25) || \ - ((x) == LCD_DIV_26) || \ - ((x) == LCD_DIV_27) || \ - ((x) == LCD_DIV_28) || \ - ((x) == LCD_DIV_29) || \ - ((x) == LCD_DIV_30) || \ - ((x) == LCD_DIV_31)) -#define IS_LCD_BLINK_MODE(x) (((x) == LCD_BLINK_OFF) || \ - ((x) == LCD_BLINK_SEG0_COM0) || \ - ((x) == LCD_BLINK_SEG0_COMX2) || \ - ((x) == LCD_BLINK_ALLSEG_ALLCOM)) -#define IS_LCD_BLFRQ_TYPE(x) (((x) == LCD_BLFRQ_8) || \ - ((x) == LCD_BLFRQ_16) || \ - ((x) == LCD_BLFRQ_32) || \ - ((x) == LCD_BLFRQ_64) || \ - ((x) == LCD_BLFRQ_128) || \ - ((x) == LCD_BLFRQ_256) || \ - ((x) == LCD_BLFRQ_512) || \ - ((x) == LCD_BLFRQ_1024)) -#define IS_LCD_STATUS_TYPE(x) (((x) == LCD_STATUS_RDY) || \ - ((x) == LCD_STATUS_ENS) || \ - ((x) == LCD_STATUS_UDR) || \ - ((x) == LCD_STATUS_FCRSF) || \ - ((x) == LCD_STATUS_ALL)) -#define IS_LCD_CLEARFLAG_TYPE(x)(((x) == LCD_FLAG_SOF) || \ - ((x) == LCD_FLAG_UDD) || \ - ((x) == LCD_STATUS_ALL)) -#define IS_LCD_IT_TYPE(x) (((x) == LCD_IT_SOF) || \ - ((x) == LCD_IT_UDD)) -#define IS_LCD_FLAG_TYPE(x) (((x) == LCD_FLAG_SOF) || \ - ((x) == LCD_FLAG_UDD)) -#define IS_LCD_SEG_TYPE(x) (((x) == SEG_0_TO_31) || \ - ((x) == SEG_32_TO_59)) -#define IS_LCD_DEAD_TYPE(x) (((x) == LCD_DEAD_TIME_NONE) || \ - ((x) == LCD_DEAD_TIME_1_DIVCLK) || \ - ((x) == LCD_DEAD_TIME_2_DIVCLK) || \ - ((x) == LCD_DEAD_TIME_3_DIVCLK) || \ - ((x) == LCD_DEAD_TIME_4_DIVCLK) || \ - ((x) == LCD_DEAD_TIME_5_DIVCLK) || \ - ((x) == LCD_DEAD_TIME_6_DIVCLK) || \ - ((x) == LCD_DEAD_TIME_7_DIVCLK)) -#define IS_LCD_PON_TYPE(x) (((x) == LCD_PON_NONE) || \ - ((x) == LCD_PON_1_PRSCLK) || \ - ((x) == LCD_PON_2_PRSCLK) || \ - ((x) == LCD_PON_3_PRSCLK) || \ - ((x) == LCD_PON_4_PRSCLK) || \ - ((x) == LCD_PON_5_PRSCLK) || \ - ((x) == LCD_PON_6_PRSCLK) || \ - ((x) == LCD_PON_7_PRSCLK)) -#define IS_LCD_VGS_TYPE(x) (((x) == LCD_VGS_0) || \ - ((x) == LCD_VGS_1) || \ - ((x) == LCD_VGS_2) || \ - ((x) == LCD_VGS_3) || \ - ((x) == LCD_VGS_4) || \ - ((x) == LCD_VGS_5) || \ - ((x) == LCD_VGS_6) || \ - ((x) == LCD_VGS_7) || \ - ((x) == LCD_VGS_8) || \ - ((x) == LCD_VGS_9) || \ - ((x) == LCD_VGS_10) || \ - ((x) == LCD_VGS_11) || \ - ((x) == LCD_VGS_12) || \ - ((x) == LCD_VGS_13) || \ - ((x) == LCD_VGS_14) || \ - ((x) == LCD_VGS_15)) -#define IS_LCD_BUFFER_TYPE(x) ((x) <= 15) - -/** - * @} - */ - -/** @addtogroup LCD_Public_Functions - * @{ - */ - -/** - * @addtogroup LCD_Public_Functions_Group1 - * @{ - */ -/* Initialization and enable functions */ -ald_status_t ald_lcd_init(lcd_handle_t *hperh); -ald_status_t ald_lcd_cmd(lcd_handle_t *hperh, type_func_t state); -/** - * @} - */ - -/** - * @addtogroup LCD_Public_Functions_Group2 - * @{ - */ -/* Config output and blink function */ -ald_status_t ald_lcd_blink_config(lcd_handle_t *hperh, lcd_blink_t blink_mode, lcd_blfrq_t blink_freq); -ald_status_t ald_lcd_write(lcd_handle_t *hperh, uint8_t buf, uint32_t buf_data); -ald_status_t ald_lcd_write_seg(lcd_handle_t *hperh, lcd_seg_t seg, uint32_t seg_data); -/** - * @} - */ - -/** - * @addtogroup LCD_Public_Functions_Group3 - * @{ - */ -/* Query lcd status function */ -uint32_t ald_lcd_get_status(lcd_handle_t *hperh, lcd_status_t lcd_flag); -/** - * @} - */ - -/** - * @addtogroup LCD_Public_Functions_Group4 - * @{ - */ -/* Interrupt function */ -ald_status_t ald_lcd_interrupt_config(lcd_handle_t *hperh, lcd_it_t it, type_func_t state); -flag_status_t ald_lcd_get_it_status(lcd_handle_t *hperh, lcd_it_t it); -it_status_t ald_lcd_get_flag_status(lcd_handle_t *hperh, lcd_flag_t flag); -ald_status_t ald_lcd_clear_flag_status(lcd_handle_t *hperh, lcd_flag_t flag); -void ald_lcd_irq_handler(lcd_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_LCD_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lptim.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lptim.h deleted file mode 100644 index dc570df1c5..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lptim.h +++ /dev/null @@ -1,370 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_lptim.c - * @brief LPTIM module driver. - * This is the common part of the LPTIM initialization - * - * @version V1.0 - * @date 09 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_LPTIM_H__ -#define __ALD_LPTIM_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_cmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup LPTIM - * @{ - */ - -/** @defgroup LPTIM_Public_Types LPTIM Public Types - * @{ - */ - -/** - * @brief LPTIM clock select - */ -typedef enum { - LPTIM_CKSEL_INTERNAL = 0U, /**< Select internal clock */ - LPTIM_CKSEL_EXTERNAL = 1U, /**< Select external clock */ -} lptim_cksel_t; - -/** - * @brief LPTIM clock pol - */ -typedef enum { - LPTIM_CKPOL_RISING = 0U, /**< using rising edge */ - LPTIM_CKPOL_FALLING = 1U, /**< using falling edge */ -} lptim_ckpol_t; - -/** - * @brief LPTIM clock fliter - */ -typedef enum { - LPTIM_CKFLT_0 = 0U, /**< not clock filter */ - LPTIM_CKFLT_2 = 1U, /**< 2 cycle filter */ - LPTIM_CKFLT_4 = 2U, /**< 4 cycle filter */ - LPTIM_CKFLT_8 = 3U, /**< 8 cycle filter */ -} lptim_ckflt_t; - -/** - * @brief LPTIM trigger fliter - */ -typedef enum { - LPTIM_TRGFLT_0 = 0U, /**< not clock filter */ - LPTIM_TRGFLT_2 = 1U, /**< 2 cycle filter */ - LPTIM_TRGFLT_4 = 2U, /**< 4 cycle filter */ - LPTIM_TRGFLT_8 = 3U, /**< 8 cycle filter */ -} lptim_trgflt_t; - -/** - * @brief LPTIM prescaler - */ -typedef enum { - LPTIM_PRESC_1 = 0U, /**< No prescaler is used */ - LPTIM_PRESC_2 = 1U, /**< Clock is divided by 2 */ - LPTIM_PRESC_4 = 2U, /**< Clock is divided by 4 */ - LPTIM_PRESC_8 = 3U, /**< Clock is divided by 8 */ - LPTIM_PRESC_16 = 4U, /**< Clock is divided by 16 */ - LPTIM_PRESC_32 = 5U, /**< Clock is divided by 32 */ - LPTIM_PRESC_64 = 6U, /**< Clock is divided by 64 */ - LPTIM_PRESC_128 = 7U, /**< Clock is divided by 128 */ -} lptim_presc_t; - -/** - * @brief LPTIM trig select - */ -typedef enum { - LPTIM_TRIGSEL_EXT0 = 0U, /**< Trigger select external channel 0 */ - LPTIM_TRIGSEL_EXT1 = 1U, /**< Trigger select external channel 1 */ - LPTIM_TRIGSEL_EXT2 = 2U, /**< Trigger select external channel 2 */ - LPTIM_TRIGSEL_EXT3 = 3U, /**< Trigger select external channel 3 */ - LPTIM_TRIGSEL_EXT4 = 4U, /**< Trigger select external channel 4 */ - LPTIM_TRIGSEL_EXT5 = 5U, /**< Trigger select external channel 5 */ - LPTIM_TRIGSEL_EXT6 = 6U, /**< Trigger select external channel 6 */ - LPTIM_TRIGSEL_EXT7 = 7U, /**< Trigger select external channel 7 */ -} lptim_trigsel_t; - -/** - * @brief LPTIM start mode select - */ -typedef enum { - LPTIM_MODE_SINGLE = 0U, /**< Start single mode */ - LPTIM_MODE_CONTINUOUS = 1U, /**< Start continuous mode */ -} lptim_mode_t; - -/** - * @brief LPTIM trig en - */ -typedef enum { - LPTIM_TRIGEN_SW = 0U, /**< software trigger */ - LPTIM_TRIGEN_RISING = 1U, /**< rising edge trigger */ - LPTIM_TRIGEN_FALLING = 2U, /**< falling edge trigger */ - LPTIM_TRIGEN_BOTH = 3U, /**< rising and falling edge trigger */ -} lptim_trigen_t; - -/** - * @brief LPTIM wave - */ -typedef enum { - LPTIM_WAVE_NONE = 0U, /**< Output close */ - LPTIM_WAVE_TOGGLE = 1U, /**< Output toggle */ - LPTIM_WAVE_PULSE = 2U, /**< Output pulse */ - LPTIM_WAVE_PWM = 3U, /**< Output PWM */ -} lptim_wave_t; - -/** - * @brief LPTIM interrupt - */ -typedef enum { - LPTIM_IT_CMPMAT = 1U, /**< Compare interrupt bit */ - LPTIM_IT_ARRMAT = 2U, /**< Update interrupt bit */ - LPTIM_IT_EXTTRIG = 4U, /**< external trigger interrupt bit */ -} lptim_it_t; - -/** - * @brief LPTIM Interrupt flag - */ -typedef enum { - LPTIM_FLAG_CMPMAT = 1U, /**< Compare interrupt flag */ - LPTIM_FLAG_ARRMAT = 2U, /**< Update interrupt flag */ - LPTIM_FLAG_EXTTRIG = 4U, /**< Update interrupt flag */ -} lptim_flag_t; - -/** - * @brief LPTIM state structures definition - */ -typedef enum { - LPTIM_STATE_RESET = 0x00U, /**< Peripheral not yet initialized or disabled */ - LPTIM_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - LPTIM_STATE_BUSY = 0x02U, /**< An internal process is ongoing */ - LPTIM_STATE_TIMEOUT = 0x03U, /**< Timeout state */ - LPTIM_STATE_ERROR = 0x04U, /**< Reception process is ongoing */ -} lptim_state_t; - -/** - * @brief LPTIM Init Structure definition - */ -typedef struct { - lptim_presc_t psc; /**< Specifies the prescaler value */ - uint16_t arr; /**< Specifies the update value */ - uint16_t cmp; /**< Specifies the compare value */ - cmu_lp_perh_clock_sel_t clock; /**< Specifies the clock choose */ - lptim_mode_t mode; /**< Specifies the start mode */ -} lptim_init_t; - -/** - * @brief LPTIM trigger Structure definition - */ -typedef struct { - lptim_trigen_t mode; /**< Specifies the trigger mode */ - lptim_trigsel_t sel; /**< Specifies the trigger source select */ -} lptim_trigger_init_t; - -/** - * @brief LPTIM trigger Structure definition - */ -typedef struct { - lptim_cksel_t sel; /**< Specifies the clock select */ - lptim_ckpol_t polarity; /**< Specifies the clock polarity */ -} lptim_clock_source_init_t; - -/** - * @brief LPTIM Handle Structure definition - */ -typedef struct lptim_handle_s { - LPTIM_TypeDef *perh; /**< Register base address */ - lptim_init_t init; /**< LPTIM Time required parameters */ - lock_state_t lock; /**< Locking object */ - lptim_state_t state; /**< LPTIM operation state */ - - void (*trig_cbk)(struct lptim_handle_s *arg); /**< Trigger callback */ - void (*update_cbk)(struct lptim_handle_s *arg); /**< Update callback */ - void (*cmp_cbk)(struct lptim_handle_s *arg); /**< Compare callback */ -} lptim_handle_t; -/** - * @} - */ - -/** @defgroup LPTIM_Public_Macros LPTIM Public Macros - * @{ - */ -#define LPTIM_ENABLE(x) (SET_BIT((x)->perh->CON1, LP16T_CON1_ENABLE_MSK)) -#define LPTIM_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, LP16T_CON1_ENABLE_MSK)) -#define LPTIM_CNTSTART(x) (SET_BIT((x)->perh->CON1, LP16T_CON1_CNTSTRT_MSK)) -#define LPTIM_SNGSTART(x) (SET_BIT((x)->perh->CON1, LP16T_CON1_SNGSTRT_MSK)) -#define LPTIM_UPDATE_ENABLE(x) (SET_BIT((x)->perh->UPDATE, LP16T_UPDATE_UDIS_MSK)) -#define LPTIM_UPDATE_DISABLE(x) (CLEAR_BIT((x)->perh->UPDATE, LP16T_UPDATE_UDIS_MSK)) -#define LPTIM_PRELOAD_IMM(x) (SET_BIT((x)->perh->CR0, LP16T_CON0_PRELOAD_MSK)) -#define LPTIM_PRELOAD_WAIT(x) (CLEAR_BIT((x)->perh->CR0, LP16T_CON0_PRELOAD_MSK)) -#define LPTIM_WAVEPOL_NORMAL(x) (MODIFY_REG((x)->perh->CR0, LP16T_CON0_WAVE_MSK, 0 << LP16T_CON0_WAVE_POSS)) -#define LPTIM_WAVEPOL_INVERSE(x) (MODIFY_REG((x)->perh->CR0, LP16T_CON0_WAVE_MSK, 1 << LP16T_CON0_WAVE_POSS)) -/** - * @} - */ - -/** @defgroup LPTIM_Private_Macros LPTIM Private Macros - * @{ - */ -#define IS_LPTIM(x) ((x) == LPTIM0) -#define IS_LPTIM_CKSEL(x) (((x) == LPTIM_CKSEL_INTERNAL) || \ - ((x) == LPTIM_CKSEL_EXTERNAL)) -#define IS_LPTIM_CKPOL(x) (((x) == LPTIM_CKPOL_RISING) || \ - ((x) == LPTIM_CKPOL_FALLING)) -#define IS_LPTIM_MODE(x) (((x) == LPTIM_MODE_SINGLE) || \ - ((x) == LPTIM_MODE_CONTINUOUS)) -#define IS_LPTIM_CKFLT(x) (((x) == LPTIM_CKFLT_0) || \ - ((x) == LPTIM_CKFLT_2) || \ - ((x) == LPTIM_CKFLT_4) || \ - ((x) == LPTIM_CKFLT_8)) -#define IS_LPTIM_TRGFLT(x) (((x) == LPTIM_TRGFLT_0) || \ - ((x) == LPTIM_TRGFLT_2) || \ - ((x) == LPTIM_TRGFLT_4) || \ - ((x) == LPTIM_TRGFLT_8)) -#define IS_LPTIM_PRESC(x) (((x) == LPTIM_PRESC_1) || \ - ((x) == LPTIM_PRESC_2) || \ - ((x) == LPTIM_PRESC_4) || \ - ((x) == LPTIM_PRESC_8) || \ - ((x) == LPTIM_PRESC_16) || \ - ((x) == LPTIM_PRESC_32) || \ - ((x) == LPTIM_PRESC_64) || \ - ((x) == LPTIM_PRESC_128)) -#define IS_LPTIM_TRIGSEL(x) (((x) == LPTIM_TRIGSEL_EXT0) || \ - ((x) == LPTIM_TRIGSEL_EXT1) || \ - ((x) == LPTIM_TRIGSEL_EXT2) || \ - ((x) == LPTIM_TRIGSEL_EXT3) || \ - ((x) == LPTIM_TRIGSEL_EXT4) || \ - ((x) == LPTIM_TRIGSEL_EXT5) || \ - ((x) == LPTIM_TRIGSEL_EXT6) || \ - ((x) == LPTIM_TRIGSEL_EXT7)) -#define IS_LPTIM_TRIGEN(x) (((x) == LPTIM_TRIGEN_SW) || \ - ((x) == LPTIM_TRIGEN_RISING) || \ - ((x) == LPTIM_TRIGEN_FALLING) || \ - ((x) == LPTIM_TRIGEN_BOTH)) -#define IS_LPTIM_IT(x) (((x) == LPTIM_IT_CMPMAT) || \ - ((x) == LPTIM_IT_ARRMAT) || \ - ((x) == LPTIM_IT_EXTTRIG)) -#define IS_LPTIM_FLAG(x) (((x) == LPTIM_FLAG_CMPMAT) || \ - ((x) == LPTIM_FLAG_ARRMAT) || \ - ((x) == LPTIM_FLAG_EXTTRIG)) -/** - * @} - */ - -/** @addtogroup LPTIM_Public_Functions - * @{ - */ - -/** @addtogroup LPTIM_Public_Functions_Group1 - * @{ - */ -void ald_lptim_reset(lptim_handle_t *hperh); -void ald_lptim_trigger_config(lptim_handle_t *hperh, lptim_trigger_init_t *config); -void ald_lptim_clock_source_config(lptim_handle_t *hperh, lptim_clock_source_init_t *config); -void ald_lptim_trigger_filter_config(lptim_handle_t *hperh, lptim_trgflt_t flt); -void ald_lptim_clock_filter_config(lptim_handle_t *hperh, lptim_ckflt_t flt); -/** - * @} - */ - -/** @addtogroup LPTIM_Public_Functions_Group2 - * @{ - */ -ald_status_t ald_lptim_base_init(lptim_handle_t *hperh); -void ald_lptim_base_start(lptim_handle_t *hperh); -void ald_lptim_base_stop(lptim_handle_t *hperh); -void ald_lptim_base_start_by_it(lptim_handle_t *hperh); -void ald_lptim_base_stop_by_it(lptim_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup LPTIM_Public_Functions_Group3 - * @{ - */ -ald_status_t ald_lptim_toggle_init(lptim_handle_t *hperh); -void ald_lptim_toggle_start(lptim_handle_t *hperh); -void ald_lptim_toggle_stop(lptim_handle_t *hperh); -void ald_lptim_toggle_start_by_it(lptim_handle_t *hperh); -void ald_lptim_toggle_stop_by_it(lptim_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup LPTIM_Public_Functions_Group4 - * @{ - */ -ald_status_t ald_lptim_pulse_init(lptim_handle_t *hperh); -void ald_lptim_pulse_start(lptim_handle_t *hperh); -void ald_lptim_pulse_stop(lptim_handle_t *hperh); -void ald_lptim_pulse_start_by_it(lptim_handle_t *hperh); -void ald_lptim_pulse_stop_by_it(lptim_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup LPTIM_Public_Functions_Group5 - * @{ - */ -ald_status_t ald_lptim_pwm_init(lptim_handle_t *hperh); -void ald_lptim_pwm_start(lptim_handle_t *hperh); -void ald_lptim_pwm_stop(lptim_handle_t *hperh); -void ald_lptim_pwm_start_by_it(lptim_handle_t *hperh); -void ald_lptim_pwm_stop_by_it(lptim_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup LPTIM_Public_Functions_Group6 - * @{ - */ -void ald_lptim_irq_handler(lptim_handle_t *hperh); -void ald_lptim_interrupt_config(lptim_handle_t *hperh, lptim_it_t it, type_func_t state); -it_status_t ald_lptim_get_it_status(lptim_handle_t *hperh, lptim_it_t it); -flag_status_t ald_lptim_get_flag_status(lptim_handle_t *hperh, lptim_flag_t flag); -void ald_lptim_clear_flag_status(lptim_handle_t *hperh, lptim_flag_t flag); -/** - * @} - */ - -/** @addtogroup LPTIM_Public_Functions_Group7 - * @{ - */ -lptim_state_t ald_lptim_get_state(lptim_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_LPTIM_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lpuart.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lpuart.h deleted file mode 100644 index fe9d619159..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_lpuart.h +++ /dev/null @@ -1,468 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_lpuart.h - * @brief Header file of Low Power UART module library. - * - * @version V1.0 - * @date 30 May 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_LPUART_H__ -#define __ALD_LPUART_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" -#include "ald_cmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup LPUART - * @{ - */ - -/** - * @defgroup LPUART_Public_Macros LPUART Public Macros - * @{ - */ - -/** - * @defgroup LPUART_Public_Macros1 LPUART FIFO Reset - * @{ - */ -#define LPUART_FIFO_TX_RESET(hperh) (SET_BIT((hperh)->perh->FIFOCON, LPUART_FIFOCON_TXRESET_MSK)) -#define LPUART_FIFO_RX_RESET(hperh) (SET_BIT((hperh)->perh->FIFOCON, LPUART_FIFOCON_RXRESET_MSK)) -/** - * @} - */ -/** - * @defgroup LPUART_Public_Macros2 LPUART RS485 RX Enable - * @{ - */ -#define LPUART_RS485_RX_DISABLE(hperh) (SET_BIT((hperh)->perh->FIFOCON, LPUART_FIFOCON_NMPMRXDIS_MSK)) -#define LPUART_RS485_RX_ENABLE(hperh) (CLEAR_BIT((hperh)->perh->FIFOCON, LPUART_FIFOCON_NMPMRXDIS_MSK)) -/** - * @} - */ -/** - * @defgroup LPUART_Public_Macros4 LPUART LoopMode Enable - * @{ - */ -#define LPUART_LPBMOD_ENABLE(hperh) (SET_BIT((hperh)->perh->CON0, LPUART_CON0_LPBMOD_MSK)) -#define LPUART_LPBMOD_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->CON0, LPUART_CON0_LPBMOD_MSK)) -/** - * @} - */ -/** - * @defgroup LPUART_Public_Macros5 LPUART IrDA TX Enable - * @{ - */ -#define LPUART_IRTX_ENABLE(hperh) (SET_BIT((hperh)->perh->CON1, LPUART_CON1_IRTXE_MSK)) -#define LPUART_IRTX_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->CON1, LPUART_CON1_IRTXE_MSK)) -/** - * @} - */ -/** - * @defgroup LPUART_Public_Macros6 LPUART IRWIDTH Enable - * @{ - */ -#define LPUART_IRWIDTH_DISABLE(hperh) (SET_BIT((hperh)->perh->CON1, LPUART_CON1_IRWIDTH_MSK)) -#define LPUART_IRWIDTH_ENABLE(hperh) (CLEAR_BIT((hperh)->perh->CON1, LPUART_CON1_IRWIDTH_MSK)) -/** - * @} - */ -/** - * @defgroup LPUART_Public_Macros7 LPUART CTS/RTS Enable - * @{ - */ -#define LPUART_CTS_ENABLE(hperh) (SET_BIT((hperh)->perh->CON0, LPUART_CON0_ATCTSE_MSK)) -#define LPUART_CTS_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->CON0, LPUART_CON0_ATCTSE_MSK)) -#define LPUART_RTS_ENABLE(hperh) (SET_BIT((hperh)->perh->CON0, LPUART_CON0_ATRTSE_MSK)) -#define LPUART_RTS_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->CON0, LPUART_CON0_ATRTSE_MSK)) -/** - * @} - */ -/** - * @defgroup LPUART_Public_Macros8 LPUART CTS/RTS Polarity - * @{ - */ -#define LPUART_CTS_POL_LOW(hperh) (SET_BIT((hperh)->perh->CON0, LPUART_CON0_CTSPOL_MSK)) -#define LPUART_CTS_POL_HIGH(hperh) (CLEAR_BIT((hperh)->perh->CON0, LPUART_CON0_CTSPOL_MSK)) -#define LPUART_RTS_POL_LOW(hperh) (SET_BIT((hperh)->perh->CON0, LPUART_CON0_RTSPOL_MSK)) -#define LPUART_RTS_POL_HIGH(hperh) (CLEAR_BIT((hperh)->perh->CON0, LPUART_CON0_RTSPOL_MSK)) -/** - * @} - */ -/** - * @defgroup LPUART_Public_Macros10 LPUART Update Enable - * @{ - */ -#define LPUART_UPDATE_ENABLE(hperh) (CLEAR_BIT((hperh)->perh->UPDATE, LPUART_UPDATE_UDIS_MSK)) -#define LPUART_UPDATE_DISABLE(hperh) (SET_BIT((hperh)->perh->UPDATE, LPUART_UPDATE_UDIS_MSK)) -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup LPUART_Public_Types LPUART Public Types - * @{ - */ -/** - * @brief LPUART Word Length - */ -typedef enum { - LPUART_WORD_LENGTH_5B = 0x0U, /**< 5-bits */ - LPUART_WORD_LENGTH_6B = 0x1U, /**< 6-bits */ - LPUART_WORD_LENGTH_7B = 0x2U, /**< 7-bits */ - LPUART_WORD_LENGTH_8B = 0x3U, /**< 8-bits */ - LPUART_WORD_LENGTH_9B = 0x4U, /**< 9-bits */ -} lpuart_word_length_t; - -/** - * @brief LPUART Stop Bits - */ -typedef enum { - LPUART_STOP_BITS_1 = 0x0U, /**< 1-bits */ - LPUART_STOP_BITS_2 = 0x1U, /**< 2-bits */ -} lpuart_stop_bits_t; - -/** - * @brief LPUART Parity - */ -typedef enum { - LPUART_PARITY_NONE = 0x0U, /**< Not parity */ - LPUART_PARITY_ODD = 0x1U, /**< Odd parity */ - LPUART_PARITY_EVEN = 0x3U, /**< Even parity */ -} lpuart_parity_t; - -/** - * @brief LPUART Mode - */ -typedef enum { - LPUART_MODE_UART = 0x0U, /**< UART */ - LPUART_MODE_IrDA = 0x2U, /**< IrDA */ - LPUART_MODE_RS485 = 0x3U, /**< RS485 */ -} lpuart_mode_t; - -/** - * @brief LPUART Hardware Flow Control - */ -typedef enum { - LPUART_HW_FLOW_CTL_NONE = 0x0U, /**< None */ - LPUART_HW_FLOW_CTL_RTS = 0x1U, /**< RTS */ - LPUART_HW_FLOW_CTL_CTS = 0x2U, /**< CTS */ - LPUART_HW_FLOW_CTL_RTS_CTS = 0x3U, /**< RTS & CTS */ -} lpuart_hw_flow_ctl_t; - -/** - * @brief ALD LPUART State - */ -typedef enum { - LPUART_STATE_RESET = 0x00U, /**< Peripheral is not initialized */ - LPUART_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - LPUART_STATE_BUSY = 0x02U, /**< an internal process is ongoing */ - LPUART_STATE_BUSY_TX = 0x11U, /**< Data Transmission process is ongoing */ - LPUART_STATE_BUSY_RX = 0x21U, /**< Data Reception process is ongoing */ - LPUART_STATE_BUSY_TX_RX = 0x31U, /**< Data Transmission Reception process is ongoing */ - LPUART_STATE_TIMEOUT = 0x03U, /**< Timeout state */ - LPUART_STATE_ERROR = 0x04U, /**< Error */ -} lpuart_state_t; - -/** - * @brief LPUART Error Codes - */ -typedef enum { - LPUART_ERROR_NONE = ((uint32_t)0x00U), /**< No error */ - LPUART_ERROR_PE = ((uint32_t)0x01U), /**< Parity error */ - LPUART_ERROR_NE = ((uint32_t)0x02U), /**< Noise error */ - LPUART_ERROR_FE = ((uint32_t)0x04U), /**< frame error */ - LPUART_ERROR_ORE = ((uint32_t)0x08U), /**< Overrun error */ - LPUART_ERROR_DMA = ((uint32_t)0x10U), /**< DMA transfer error */ -} lpuart_error_t; - -/** - * @brief LPUART Init structure definition - */ -typedef struct { - uint32_t baud; /**< Specifies the lpuart communication baud rate */ - lpuart_word_length_t word_length; /**< Specifies the number of data bits transmitted or received in a frame */ - lpuart_stop_bits_t stop_bits; /**< Specifies the number of stop bits transmitted */ - lpuart_parity_t parity; /**< Specifies the parity mode */ - lpuart_mode_t mode; /**< Specifies uart mode */ - lpuart_hw_flow_ctl_t fctl; /**< Specifies wether the hardware flow control mode is enabled or disabled */ - cmu_lp_perh_clock_sel_t clock; /**< Specifies clock, only support LOSC and LRC */ -} lpuart_init_t; - -/** - * @brief LPUART handle structure definition - */ -typedef struct lpuart_handle_s { - LPUART_TypeDef *perh; /**< LPUART registers base address */ - lpuart_init_t init; /**< LPUART communication parameters */ - uint8_t *tx_buf; /**< Pointer to LPUART Tx transfer Buffer */ - uint16_t tx_size; /**< LPUART Tx Transfer size */ - uint16_t tx_count; /**< LPUART Tx Transfer Counter */ - uint8_t *rx_buf; /**< Pointer to LPUART Rx transfer Buffer */ - uint16_t rx_size; /**< LPUART Rx Transfer size */ - uint16_t rx_count; /**< LPUART Rx Transfer Counter */ -#ifdef ALD_DMA - dma_handle_t hdmatx; /**< LPUART Tx DMA Handle parameters */ - dma_handle_t hdmarx; /**< LPUART Rx DMA Handle parameters */ -#endif - lock_state_t lock; /**< Locking object */ - lpuart_state_t state; /**< LPUART communication state */ - lpuart_error_t err_code; /**< LPUART Error code */ - - void (*tx_cplt_cbk)(struct lpuart_handle_s *arg); /**< Tx completed callback */ - void (*rx_cplt_cbk)(struct lpuart_handle_s *arg); /**< Rx completed callback */ - void (*error_cbk)(struct lpuart_handle_s *arg); /**< error callback */ -} lpuart_handle_t; - -/** - * @brief LPUART RS485 Configure Structure definition - */ -typedef struct { - type_func_t RS485_NMM; /**< Normal Point Mode */ - type_func_t RS485_AAD; /**< Auto-Address Detect */ - type_func_t RS485_AUD; /**< Auto-Direction Mode */ - type_func_t RS485_ADD_DET; /**< Eable/Disable Address Detect */ - uint8_t RS485_ADDCMP; /**< Address for compare */ -} lpuart_rs485_config_t; - -/** - * @brief LPUART DMA Requests - */ -typedef enum { - LPUART_DMA_REQ_TX = 0x0U, /**< TX dma */ - LPUART_DMA_REQ_RX = 0x1U, /**< RX dma */ -} lpuart_dma_req_t; - -/** - * @brief LPUART RXFIFO size - */ -typedef enum { - LPUART_RXFIFO_1BYTE = 0x0U, /**< 1-Byte */ - LPUART_RXFIFO_4BYTE = 0x1U, /**< 4-Bytes */ - LPUART_RXFIFO_8BYTE = 0x2U, /**< 8-Bytes */ - LPUART_RXFIFO_14BYTE = 0x3U, /**< 14-Bytes */ -} lpuart_rxfifo_t; - -/** - * @brief LPUART Interrupts Types - */ -typedef enum { - LPUART_IT_RBR = (1U << 0), /**< RBR */ - LPUART_IT_TBEMP = (1U << 1), /**< TBEMP */ - LPUART_IT_CTSDET = (1U << 2), /**< CTSDET */ - LPUART_IT_RXTO = (1U << 3), /**< RXTO */ - LPUART_IT_RXOV = (1U << 4), /**< RXOV */ - LPUART_IT_TXOV = (1U << 5), /**< TXOV */ - LPUART_IT_CTSWK = (1U << 7), /**< CTSWK */ - LPUART_IT_DATWK = (1U << 8), /**< DATWK */ - LPUART_IT_PERR = (1U << 9), /**< PERR */ - LPUART_IT_FERR = (1U << 10), /**< FERR */ - LPUART_IT_BRKERR = (1U << 11), /**< BRKERR */ - LPUART_IT_ADET = (1U << 12), /**< ADET */ - LPUART_IT_TC = (1U << 15), /**< TC */ -} lpuart_it_t; - -/** - * @brief LPUART Flags Types - */ -typedef enum { - LPUART_IF_RBR = (1U << 0), /**< RBR */ - LPUART_IF_TBEMP = (1U << 1), /**< TBEMP */ - LPUART_IF_CTSDET = (1U << 2), /**< CTSDET */ - LPUART_IF_RXTO = (1U << 3), /**< RXTO */ - LPUART_IF_RXOV = (1U << 4), /**< RXOV */ - LPUART_IF_TXOV = (1U << 5), /**< TXOV */ - LPUART_IF_CTSWK = (1U << 7), /**< CTSWK */ - LPUART_IF_DATWK = (1U << 8), /**< DATWK */ - LPUART_IF_PERR = (1U << 9), /**< PERR */ - LPUART_IF_FERR = (1U << 10), /**< FERR */ - LPUART_IF_BRKERR = (1U << 11), /**< BRKERR */ - LPUART_IF_ADET = (1U << 12), /**< ADET */ - LPUART_IF_TC = (1U << 15), /**< TC */ -} lpuart_flag_t; - -/** - * @brief LPUART Status Types - */ -typedef enum { - LPUART_STAT_RXEMP = (1U << 6), /**< RX FIFO empty */ - LPUART_STAT_RXFULL = (1U << 7), /**< RX FIFO full */ - LPUART_STAT_TXEMP = (1U << 14), /**< TX FIFO empty */ - LPUART_STAT_TXFULL = (1U << 15), /**< TX FIFO full */ - LPUART_STAT_TXIDLE = (1U << 16), /**< TX idle */ - LPUART_STAT_CTSSTAT = (1U << 17), /**< CTS status */ - LPUART_STAT_RTSSTAT = (1U << 18), /**< RTS status */ -} lpuart_status_t; -/** - * @} - */ - -/** @defgroup LPUART_Private_Macros LPUART Private Macros - * @{ - */ -#define IS_LPUART(x) ((x) == LPUART0) -#define IS_LPUART_DATA(x) ((x) <= 0x1FF) -#define IS_LPUART_BAUDRATE(x) (((x) > 0) && ((x) <= 115200)) -#define IS_LPUART_WORD_LENGTH(x) (((x) == LPUART_WORD_LENGTH_5B) || \ - ((x) == LPUART_WORD_LENGTH_6B) || \ - ((x) == LPUART_WORD_LENGTH_7B) || \ - ((x) == LPUART_WORD_LENGTH_8B) || \ - ((x) == LPUART_WORD_LENGTH_9B)) -#define IS_LPUART_STOPBITS(x) (((x) == LPUART_STOP_BITS_1) || \ - ((x) == LPUART_STOP_BITS_2)) -#define IS_LPUART_PARITY(x) (((x) == LPUART_PARITY_NONE) || \ - ((x) == LPUART_PARITY_ODD) || \ - ((x) == LPUART_PARITY_EVEN)) -#define IS_LPUART_MODE(x) (((x) == LPUART_MODE_UART) || \ - ((x) == LPUART_MODE_IrDA) || \ - ((x) == LPUART_MODE_RS485)) -#define IS_LPUART_HARDWARE_FLOW_CONTROL(x)\ - (((x) == LPUART_HW_FLOW_CTL_NONE) || \ - ((x) == LPUART_HW_FLOW_CTL_RTS) || \ - ((x) == LPUART_HW_FLOW_CTL_CTS) || \ - ((x) == LPUART_HW_FLOW_CTL_RTS_CTS)) -#define IS_LPUART_DMAREQ(x) (((x) == LPUART_DMA_REQ_TX) || ((x) == LPUART_DMA_REQ_RX)) -#define IS_LPUART_RXFIFO(x) (((x) == LPUART_RXFIFO_1BYTE) || \ - ((x) == LPUART_RXFIFO_4BYTE) || \ - ((x) == LPUART_RXFIFO_8BYTE) || \ - ((x) == LPUART_RXFIFO_14BYTE)) -#define IS_LPUART_IT(x) (((x) == LPUART_IT_RBR) || \ - ((x) == LPUART_IT_TBEMP) || \ - ((x) == LPUART_IT_CTSDET) || \ - ((x) == LPUART_IT_RXTO) || \ - ((x) == LPUART_IT_RXOV) || \ - ((x) == LPUART_IT_TXOV) || \ - ((x) == LPUART_IT_CTSWK) || \ - ((x) == LPUART_IT_DATWK) || \ - ((x) == LPUART_IT_PERR) || \ - ((x) == LPUART_IT_FERR) || \ - ((x) == LPUART_IT_BRKERR) || \ - ((x) == LPUART_IT_ADET) || \ - ((x) == LPUART_IT_TC)) -#define IS_LPUART_IF(x) (((x) == LPUART_IF_RBR) || \ - ((x) == LPUART_IF_TBEMP) || \ - ((x) == LPUART_IF_CTSDET) || \ - ((x) == LPUART_IF_RXTO) || \ - ((x) == LPUART_IF_RXOV) || \ - ((x) == LPUART_IF_TXOV) || \ - ((x) == LPUART_IF_CTSWK) || \ - ((x) == LPUART_IF_DATWK) || \ - ((x) == LPUART_IF_PERR) || \ - ((x) == LPUART_IF_FERR) || \ - ((x) == LPUART_IF_BRKERR) || \ - ((x) == LPUART_IF_ADET) || \ - ((x) == LPUART_IF_TC)) -#define IS_LPUART_STAT(x) (((x) == LPUART_STAT_RXEMP) || \ - ((x) == LPUART_STAT_RXFULL) || \ - ((x) == LPUART_STAT_TXEMP) || \ - ((x) == LPUART_STAT_TXFULL) || \ - ((x) == LPUART_STAT_TXIDLE) || \ - ((x) == LPUART_STAT_CTSSTAT) || \ - ((x) == LPUART_STAT_RTSSTAT)) - -#define LPUART_STATE_TX_MASK (1U << 4) -#define LPUART_STATE_RX_MASK (1U << 5) -/** - * @} - */ - -/** @addtogroup LPUART_Public_Functions - * @{ - */ - -/** @addtogroup LPUART_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -void ald_lpuart_init(lpuart_handle_t *hperh); -void ald_lpuart_reset(lpuart_handle_t *hperh); -void ald_lpuart_rs485_config(lpuart_handle_t *hperh, lpuart_rs485_config_t *config); -/** - * @} - */ - -/** @addtogroup LPUART_Public_Functions_Group2 - * @{ - */ -/* IO operation functions */ -ald_status_t ald_lpuart_send(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_lpuart_recv(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_lpuart_send_by_it(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_lpuart_recv_by_it(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size); -#ifdef ALD_DMA -ald_status_t ald_lpuart_send_by_dma(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_lpuart_recv_by_dma(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_lpuart_dma_pause(lpuart_handle_t *hperh); -ald_status_t ald_lpuart_dma_resume(lpuart_handle_t *hperh); -ald_status_t ald_lpuart_dma_stop(lpuart_handle_t *hperh); -#endif -void ald_lpuart_irq_handler(lpuart_handle_t *hperh); - -/** - * @} - */ - -/** @addtogroup LPUART_Public_Functions_Group3 - * @{ - */ -/* Peripheral Control functions */ -void ald_lpuart_interrupt_config(lpuart_handle_t *hperh, lpuart_it_t it, type_func_t status); -void ald_lpuart_tx_interval_config(lpuart_handle_t *hperh, uint8_t val); -void ald_lpuart_dma_req_config(lpuart_handle_t *hperh, lpuart_dma_req_t req, type_func_t status); -void ald_lpuart_rx_fifo_it_config(lpuart_handle_t *hperh, lpuart_rxfifo_t config); -void ald_lpuart_rx_fifo_rts_config(lpuart_handle_t *hperh, lpuart_rxfifo_t config); -ald_status_t ald_lpuart_rs485_send_addr(lpuart_handle_t *hperh, uint16_t addr, uint32_t timeout); -flag_status_t ald_lpuart_get_status(lpuart_handle_t *hperh, lpuart_status_t flag); -flag_status_t ald_lpuart_get_flag_status(lpuart_handle_t *hperh, lpuart_flag_t flag); -void ald_lpuart_clear_flag_status(lpuart_handle_t *hperh, lpuart_flag_t flag); -it_status_t ald_lpuart_get_it_status(lpuart_handle_t *hperh, lpuart_it_t it); -/** - * @} - */ - -/** @addtogroup LPUART_Public_Functions_Group4 - * @{ - */ -/* Peripheral State and Errors functions */ -lpuart_state_t ald_lpuart_get_state(lpuart_handle_t *hperh); -uint32_t ald_lpuart_get_error(lpuart_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_LPUART_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_pis.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_pis.h deleted file mode 100644 index c17b03cfd9..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_pis.h +++ /dev/null @@ -1,637 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_pis.h - * @brief Header file of PIS driver. - * - * @version V1.0 - * @date 27 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_PIS_H__ -#define __ALD_PIS_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup PIS - * @{ - */ - -/** @defgroup PIS_Public_Types PIS Public Types - * @{ - */ -/** - * @brief Producer entry - * @verbatim - In this module, for the convenience of code maintenance, - TIMERx is used to indicate the sequence of the timer peripheral. - Different product series TIMERx represent different meanings: - 1. For ES32F065x series: - TIMER0 ----> AD16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - - 2. For ES32F033x/ES32F093x series: - TIMER0 ----> GP16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - @endverbatim - */ -typedef enum { - PIS_NON = 0x0U, /**< No async */ - PIS_GPIO_PIN0 = 0x10U, /**< Pin0, level,support async */ - PIS_GPIO_PIN1 = 0x11U, /**< Pin1, level,support async */ - PIS_GPIO_PIN2 = 0x12U, /**< Pin2, level,support async */ - PIS_GPIO_PIN3 = 0x13U, /**< Pin3, level,support async */ - PIS_GPIO_PIN4 = 0x14U, /**< Pin4, level,support async */ - PIS_GPIO_PIN5 = 0x15U, /**< Pin5, level,support async */ - PIS_GPIO_PIN6 = 0x16U, /**< Pin6, level,support async */ - PIS_GPIO_PIN7 = 0x17U, /**< Pin7, level,support async */ - PIS_GPIO_PIN8 = 0x18U, /**< Pin8, level,support async */ - PIS_GPIO_PIN9 = 0x19U, /**< Pin9, level,support async */ - PIS_GPIO_PIN10 = 0x1aU, /**< Pin10, level,support async */ - PIS_GPIO_PIN11 = 0x1bU, /**< Pin11, level,support async */ - PIS_GPIO_PIN12 = 0x1cU, /**< Pin12, level,support async */ - PIS_GPIO_PIN13 = 0x1dU, /**< Pin13, level,support async */ - PIS_GPIO_PIN14 = 0x1eU, /**< Pin14, level,support async */ - PIS_GPIO_PIN15 = 0x1fU, /**< Pin15, level,support async */ - PIS_ACMP_OUT0 = 0x30U, /**< Acmp0 output, level,support async */ - PIS_ACMP_OUT1 = 0x31U, /**< Acmp1 output, level,support async */ - PIS_DAC0_CH0 = 0x40U, /**< Dac0 channel 0, pclk2 pulse,support async */ - PIS_DAC0_CH1 = 0x41U, /**< Dac0 channel 1, pclk2 pulse,support async */ - PIS_ADC0_INJECT = 0x60U, /**< Adc0 inject, pclk2 pulse,support async */ - PIS_ADC0_REGULAT = 0x61U, /**< Adc0 regulat, pclk2 pulse,support async */ - PIS_ADC0_WINDOW = 0x62U, /**< Adc0 window, no have */ - PIS_LVD = 0x70U, /**< Lvd, level,support async */ - PIS_UART0_ASY_SEND = 0x80U, /**< Uart0 asy send, pulse,support async */ - PIS_UART0_ASY_RECV = 0x81U, /**< Uart0 asy recv, pulse,support async */ - PIS_UART0_IRDAOUT = 0x82U, /**< Uart0 irdaout, level,support async */ - PIS_UART0_RTSOUT = 0x83U, /**< Uart0 rtsout, level,support async */ - PIS_UART0_TXOUT = 0x84U, /**< Uart0 txout, level,support async */ - PIS_UART0_SYN_SEND = 0x85U, /**< Uart0 syn send, pulse,support async */ - PIS_UART0_SYN_RECV = 0x86U, /**< Uart0 syn recv, pulse,support async */ - PIS_UART1_ASY_SEND = 0x90U, /**< Uart1 asy send, pulse,support async */ - PIS_UART1_ASY_RECV = 0x91U, /**< Uart1 asy recv, pulse,support async */ - PIS_UART1_IRDA = 0x92U, /**< Uart1 irdaout, level,support async */ - PIS_UART1_RTS = 0x93U, /**< Uart1 rtsout, level,support async */ - PIS_UART1_TXOUT = 0x94U, /**< Uart1 txout, level,support async */ - PIS_UART1_SYN_SEND = 0x95U, /**< Uart1 syn send, pulse,support async */ - PIS_UART1_SYN_RECV = 0x96U, /**< Uart1 syn recv, pulse,support async */ - PIS_UART2_ASY_SEND = 0xa0U, /**< Uart2 asy send, pulse,support async */ - PIS_UART2_ASY_RECV = 0xa1U, /**< Uart2 asy recv, pulse,support async */ - PIS_UART2_IRDA = 0xa2U, /**< Uart2 irdaout, level,support async */ - PIS_UART2_RTS = 0xa3U, /**< Uart2 rtsout, level,support async */ - PIS_UART2_TXOUT = 0xa4U, /**< Uart2 txout, level,support async */ - PIS_UART2_SYN_SEND = 0xa5U, /**< Uart2 syn send, pulse,support async */ - PIS_UART2_SYN_RECV = 0xa6U, /**< Uart2 syn recv, pulse,support async */ - PIS_UART3_ASY_SEND = 0xb1U, /**< Uart3 asy send, pulse,support async */ - PIS_UART3_ASY_RECV = 0xb2U, /**< Uart3 asy recv, pulse,support async */ - PIS_UART3_IRDA = 0xb3U, /**< Uart3 irdaout, level,support async */ - PIS_UART3_RTS = 0xb4U, /**< Uart3 rtsout, level,support async */ - PIS_UART3_TXOUT = 0xb5U, /**< Uart3 txout, level,support async */ - PIS_UART3_SYN_SEND = 0xb6U, /**< Uart3 syn send, pulse,support async */ - PIS_UART3_SYN_RECV = 0xb7U, /**< Uart3 syn recv, pulse,support async */ - PIS_EUART0_RECV = 0xc0U, /**< Euart0 recv, plck1 pulse */ - PIS_EUART0_SEND = 0xc1U, /**< Euart0 send, plck1 pulse */ - PIS_EUART0_TXOUT = 0xc2U, /**< Euart0 txout, plck1 level */ - PIS_EUART1_RECV = 0xd0U, /**< Euart1 recv, plck1 pulse */ - PIS_EUART1_SEND = 0xd1U, /**< Euart1 send, plck1 pulse */ - PIS_EUART1_TXOUT = 0xd2U, /**< Euart1 txout, plck1 level */ - PIS_SPI0_RECV = 0xe0U, /**< Spi0 recv, plck1 pulse */ - PIS_SPI0_SEND = 0xe1U, /**< Spi0 send, plck1 pulse */ - PIS_SPI0_NE = 0xe2U, /**< Spi0 ne, plck1 level */ - PIS_SPI1_RECV = 0xf0U, /**< Spi1 recv, plck1 pulse */ - PIS_SPI1_SEND = 0xf1U, /**< Spi1 send, plck1 pulse */ - PIS_SPI1_NE = 0xf2U, /**< Spi1 ne, plck1 level */ - PIS_I2C0_RECV = 0x100U, /**< I2c0 recv, plck1 level */ - PIS_I2C0_SEND = 0x101U, /**< I2c0 send, plck1 level */ - PIS_I2C1_RECV = 0x110U, /**< I2c1 recv, plck1 level */ - PIS_I2C1_SEND = 0x111U, /**< I2c1 send, plck1 level */ - PIS_TIMER0_UPDATA = 0x120U, /**< Timer0 updata, plck1 pulse */ - PIS_TIMER0_TRIG = 0x121U, /**< Timer0 trig, plck1 pulse */ - PIS_TIMER0_INPUT = 0x122U, /**< Timer0 input, plck1 pulse */ - PIS_TIMER0_OUTPUT = 0x123U, /**< Timer0 output, plck1 pulse */ - PIS_TIMER1_UPDATA = 0x130U, /**< Timer1 updata, plck1 pulse */ - PIS_TIMER1_TRIG = 0x131U, /**< Timer1 trig, plck1 pulse */ - PIS_TIMER1_INPUT = 0x132U, /**< Timer1 input, plck1 pulse */ - PIS_TIMER1_OUTPUT = 0x133U, /**< Timer1 output, plck1 pulse */ - PIS_TIMER2_UPDATA = 0x140U, /**< Timer2 updata, plck1 pulse */ - PIS_TIMER2_TRIG = 0x141U, /**< Timer2 trig, plck1 pulse */ - PIS_TIMER2_INPUT = 0x142U, /**< Timer2 input, plck1 pulse */ - PIS_TIMER2_OUTPUT = 0x143U, /**< Timer2 output, plck1 pulse */ - PIS_TIMER3_UPDATA = 0x150U, /**< Timer0 updata, plck1 pulse */ - PIS_TIMER3_TRIG = 0x151U, /**< Timer0 trig, plck1 pulse */ - PIS_TIMER3_INPUT = 0x152U, /**< Timer0 input, plck1 pulse */ - PIS_TIMER3_OUTPUT = 0x153U, /**< Timer0 output, plck1 pulse */ - PIS_RTC_CLOCK = 0x160U, /**< Rtc clock, pulse,support async */ - PIS_RTC_ALARM = 0x161U, /**< Rtc alarm, pulse,support async */ - PIS_LPTIM0_SYN_UPDATA = 0x170U, /**< Lptimer0 syn updata, pulse,support async */ - PIS_LPTIM0_ASY_UPDATA = 0x171U, /**< Lptimer0 asy updata, pulse,support async */ - PIS_LPUART0_ASY_RECV = 0x180U, /**< Lpuart0 asy recv, pulse,support async */ - PIS_LPUART0_ASY_SEND = 0x181U, /**< Lpuart0 asy send, pulse,support async */ - PIS_LPUART0_SYN_RECV = 0x182U, /**< Lpuart0 syn recv, pulse,support async */ - PIS_LPUART0_SYN_SEND = 0x183U, /**< Lpuart0 syn recv, pulse,support async */ - PIS_DMA = 0x190U, /**< Dma, pulse,support async */ - PIS_ADC1_INJECT = 0x1a0U, /**< Adc1 inject, pclk2 pulse,support async */ - PIS_ADC1_REGULAT = 0x1a1U, /**< Adc1 regulat, pclk2 pulse,support async */ - PIS_ADC1_WINDOW = 0x1a2U, /**< Adc1 window, no have */ -} pis_src_t; - -/** - * @brief Consumer entry - */ -typedef enum { - PIS_CH0_TIMER0_BRKIN = 0x0400U, /**< Timer0 brkin */ - PIS_CH0_SPI1_CLK = 0x0F10U, /**< Spi1 clk */ - PIS_CH0_LPTIM0_EXT0 = 0x0030U, /**< Lptimer0 ext0 */ - PIS_CH0_ADC1_NORMAL = 0x0030U, /**< Adc1 normal */ - PIS_CH1_TIMER0_CH1IN = 0x0001U, /**< Timer0 ch1in */ - PIS_CH1_TIMER2_CH1IN = 0x1001U, /**< Timer2 ch1in */ - PIS_CH1_TIMER3_CH1IN = 0x1801U, /**< Timer3 ch1in */ - PIS_CH1_LPTIM0_EXT1 = 0x0031U, /**< Lptime0 ext1 */ - PIS_CH1_UART0_RX_IRDA = 0x0011U, /**< Uart0 rx irda */ - PIS_CH1_ADC1_INSERT = 0x0031U, /**< Adc1 insert */ - PIS_CH2_TIMER0_CH2IN = 0x0102U, /**< Timer0 ch2in */ - PIS_CH2_TIMER2_CH2IN = 0x1102U, /**< Timer2 ch2in */ - PIS_CH2_TIMER3_CH2IN = 0x1902U, /**< Timer3 ch2in */ - PIS_CH2_LPTIM0_EXT2 = 0x0032U, /**< Lptime0 ext2 */ - PIS_CH2_UART1_RX_IRDA = 0x0112U, /**< Uart1 rx irda */ - PIS_CH3_TIMER0_CH3IN = 0x0203U, /**< Timer0 ch3in */ - PIS_CH3_LPTIM0_EXT3 = 0x0033U, /**< Lptime0 ext3 */ - PIS_CH3_UART2_RX_IRDA = 0x0213U, /**< Uart2 rx irda */ - PIS_CH4_TIMER0_CH4IN = 0x0004U, /**< Timer0 ch4in */ - PIS_CH4_TIMER0_ITR0 = 0x0034U, /**< Timer0 itr0 */ - PIS_CH4_TIMER2_ITR0 = 0x0034U, /**< Timer2 itr0 */ - PIS_CH4_TIMER3_ITR0 = 0x0034U, /**< Timer3 itr0 */ - PIS_CH4_LPTIM0_EXT4 = 0x0434U, /**< Lptime0 ext4 */ - PIS_CH4_UART3_RX_IRDA = 0x0314U, /**< Uart3 rx irda */ - PIS_CH5_SPI0_RX = 0x0C15U, /**< Spi0 rx */ - PIS_CH5_LPTIM0_EXT5 = 0x0035U, /**< Lptime0 ext5 */ - PIS_CH5_EUART0_RX = 0x0615U, /**< Euart0 rx */ - PIS_CH5_TIMER0_ITR1 = 0x0035U, /**< Timer0 itr1 */ - PIS_CH5_TIMER2_ITR1 = 0x0035U, /**< Timer2 itr1 */ - PIS_CH5_TIMER3_ITR1 = 0x0035U, /**< Timer3 itr1 */ - PIS_CH6_SPI0_CLK = 0x0D16U, /**< Spi0 clk */ - PIS_CH6_ADC0_NORMAL = 0x0036U, /**< Adc0 normal */ - PIS_CH6_LPTIM0_EXT6 = 0x0036U, /**< Lptime0 ext6 */ - PIS_CH6_EUART1_RX = 0x0716U, /**< Euart1 rx */ - PIS_CH6_TIMER0_ITR2 = 0x0036U, /**< Timer0 itr2 */ - PIS_CH6_TIMER2_ITR2 = 0x0036U, /**< Timer2 itr2 */ - PIS_CH6_TIMER3_ITR2 = 0x0036U, /**< Timer3 itr2 */ - PIS_CH6_DAC_CH1 = 0x0036U, /**< Dac channel 1 */ - PIS_CH7_SPI1_RX = 0x0E17U, /**< Spi1 rx */ - PIS_CH7_ADC0_INSERT = 0x0037U, /**< Adc0 insert */ - PIS_CH7_LPTIM0_EXT7 = 0x0037U, /**< Lptime0 ext7 */ - PIS_CH7_DMA = 0x0037U, /**< Dma */ - PIS_CH7_TIMER0_ITR3 = 0x0037U, /**< Timer0 itr3 */ - PIS_CH7_TIMER2_ITR3 = 0x0037U, /**< Timer2 itr3 */ - PIS_CH7_TIMER3_ITR3 = 0x0037U, /**< Timer3 itr3 */ - PIS_CH7_LPUART_RX = 0x0817U, /**< Lpuart rx */ - PIS_CH7_DAC_CH0 = 0x0037U, /**< Dac channel 0 */ -} pis_trig_t; - -/** - * @brief Clock select - */ -typedef enum { - PIS_CLK_PCLK1 = 0U, /**< Pclock1 */ - PIS_CLK_PCLK2 = 1U, /**< Pclock2 */ - PIS_CLK_SYS = 2U, /**< Sys clock */ - PIS_CLK_LP = 3U, /**< Low power clock */ -} pis_clock_t; - -/** - * @brief Level select - */ -typedef enum { - PIS_EDGE_NONE = 0U, /**< None edge */ - PIS_EDGE_UP = 1U, /**< Up edge */ - PIS_EDGE_DOWN = 2U, /**< Down edge */ - PIS_EDGE_UP_DOWN = 3U, /**< Up and down edge */ -} pis_edge_t; - -/** - * @brief Output style - */ -typedef enum { - PIS_OUT_LEVEL = 0U, /**< Level */ - PIS_OUT_PULSE = 1U, /**< Pulse */ -} pis_output_t; -/** - * @brief Sync select - */ -typedef enum { - PIS_SYN_DIRECT = 0U, /**< Direct */ - PIS_SYN_ASY_PCLK1 = 1U, /**< Asy pclk1 */ - PIS_SYN_ASY_PCLK2 = 2U, /**< Asy pclk2 */ - PIS_SYN_ASY_PCLK = 3U, /**< Asy pclk */ - PIS_SYN_PCLK2_PCLK1 = 4U, /**< Pclk2 to pclk1 */ - PIS_SYN_PCLK1_PCLK2 = 5U, /**< Pclk1 to pclk2 */ - PIS_SYN_PCLK12_SYS = 6U, /**< Pclk1 or pclk2 to sysclk */ -} pis_syncsel_t; - -/** - * @brief Pis channel - */ -typedef enum { - PIS_CH_0 = 0U, /**< Channel 0 */ - PIS_CH_1 = 1U, /**< Channel 1 */ - PIS_CH_2 = 2U, /**< Channel 2 */ - PIS_CH_3 = 3U, /**< Channel 3 */ - PIS_CH_4 = 4U, /**< Channel 4 */ - PIS_CH_5 = 5U, /**< Channel 5 */ - PIS_CH_6 = 6U, /**< Channel 6 */ - PIS_CH_7 = 7U, /**< Channel 7 */ -} pis_ch_t; - -/** - * @brief Pis output channel - */ -typedef enum { - PIS_OUT_CH_0 = 0U, /**< Channel 0 */ - PIS_OUT_CH_1 = 1U, /**< Channel 1 */ - PIS_OUT_CH_2 = 2U, /**< Channel 2 */ - PIS_OUT_CH_3 = 3U, /**< Channel 3 */ -} pis_out_ch_t; - -/** - * @brief Indirect value,no care of it. - */ -typedef enum { - PIS_CON_0 = 0U, /**< Con 0 */ - PIS_CON_1 = 1U, /**< Con 1 */ - PIS_CON_NONE = 2U, /**< None */ -} pis_con_t; - -/** - * @brief PIS state structures definition - */ -typedef enum { - PIS_STATE_RESET = 0x00U, /**< Peripheral is not initialized */ - PIS_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - PIS_STATE_BUSY = 0x02U, /**< An internal process is ongoing */ - PIS_STATE_TIMEOUT = 0x03U, /**< Timeout state */ - PIS_STATE_ERROR = 0x04U, /**< Error */ -} pis_state_t; - -/** - * @brief PIS modulate target - */ -typedef enum { - PIS_UART0_TX = 0U, /**< Modulate uart0 tx */ - PIS_UART1_TX = 1U, /**< Modulate uart1 tx */ - PIS_UART2_TX = 2U, /**< Modulate uart2 tx */ - PIS_UART3_TX = 3U, /**< Modulate uart3 tx */ - PIS_LPUART0_TX = 4U, /**< Modulate lpuart0 tx */ -} pis_modu_targ_t; - -/** - * @brief PIS modulate level - */ -typedef enum { - PIS_LOW_LEVEL = 0U, /**< Modulate low level */ - PIS_HIGH_LEVEL = 1U, /**< Modulate high level */ -} pis_modu_level_t; - -/** - * @brief PIS modulate source - * @note ES32F065x: - * AD16C4T0--TIMER0 - * GP16C4T0--TIMER6 - * GP16C2T0--TIMER2 - * GP16C2T1--TIMER3 - * BS16T0----TIMER1 - * BS16T1----TIMER4 - * BS16T2----TIMER5 - * BS16T3----TIMER7 - * - * ES32F033x: - * ES32F093x: - * GP16C4T0--TIMER0 - * GP16C4T1--TIMER6 - * GP16C2T0--TIMER2 - * GP16C2T1--TIMER3 - * BS16T0----TIMER1 - * BS16T1----TIMER4 - * BS16T2----TIMER5 - * BS16T3----TIMER7 - */ -typedef enum { - PIS_SRC_NONE = 0U, /**< Stop modulate */ - PIS_SRC_TIMER0 = 1U, /**< Modulate source is TIMER0 */ - PIS_SRC_TIMER1 = 2U, /**< Modulate source is TIMER1 */ - PIS_SRC_TIMER2 = 3U, /**< Modulate source is TIMER2 */ - PIS_SRC_TIMER3 = 4U, /**< Modulate source is TIMER3 */ - PIS_SRC_TIMER6 = 5U, /**< Modulate source is TIMER6 */ - PIS_SRC_TIMER7 = 6U, /**< Modulate source is TIMER7 */ - PIS_SRC_LPTIM0 = 7U, /**< Modulate source is LPTIM0 */ - PIS_SRC_BUZ = 8U, /**< Modulate source is buz */ -} pis_modu_src_t; - -/** - * @brief PIS modulate channel - */ -typedef enum { - PIS_TIMER_CH1 = 0U, /**< Src is TIMERx and choose channel 1 */ - PIS_TIMER_CH2 = 1U, /**< Src is TIMERx and choose channel 2 */ - PIS_TIMER_CH3 = 2U, /**< Src is TIMERx and choose channel 3 */ - PIS_TIMER_CH4 = 3U, /**< Src is TIMERx and choose channel 4 */ -} pis_modu_channel_t; - -/** - * @brief PIS init structure definition - */ -typedef struct { - pis_src_t producer_src; /**< Producer entry */ - pis_clock_t producer_clk; /**< Producer module clock */ - pis_edge_t producer_edge; /**< Producer module pin output edge */ - pis_trig_t consumer_trig; /**< Consumer entry */ - pis_clock_t consumer_clk; /**< Consumer clock */ -} pis_init_t; - -/** - * @brief PIS modulate config structure definition - */ -typedef struct { - pis_modu_targ_t target; /**< Modulate target */ - pis_modu_level_t level; /**< Modulate level */ - pis_modu_src_t src; /**< Modulate src */ - pis_modu_channel_t channel; /**< Modulate channel */ -} pis_modulate_config_t; - -/** - * @brief PIS Handle Structure definition - */ -typedef struct pis_handle_s { - PIS_TypeDef *perh; /**< Register base address */ - pis_init_t init; /**< PIS required parameters */ - pis_ch_t consumer_ch; /**< Indirect value, no care of it */ - pis_con_t consumer_con; /**< Indirect value, no care of it */ - uint8_t consumer_pos; /**< Indirect value, no care of it */ - uint32_t check_info; /**< When destroy a handle ,user need check whether is right that ready to destroy */ - lock_state_t lock; /**< Locking object */ - pis_state_t state; /**< PIS operation state */ -} pis_handle_t; -/** - * @} - */ - - -/** @defgroup PIS_Private_Macros PIS Private Macros - * @{ - */ -#define IS_PIS(x) (((x) == PIS)) -#define IS_PIS_SRC(x) (((x) == PIS_NON) || \ - ((x) == PIS_GPIO_PIN0) || \ - ((x) == PIS_GPIO_PIN1) || \ - ((x) == PIS_GPIO_PIN2) || \ - ((x) == PIS_GPIO_PIN3) || \ - ((x) == PIS_GPIO_PIN4) || \ - ((x) == PIS_GPIO_PIN5) || \ - ((x) == PIS_GPIO_PIN6) || \ - ((x) == PIS_GPIO_PIN7) || \ - ((x) == PIS_GPIO_PIN8) || \ - ((x) == PIS_GPIO_PIN9) || \ - ((x) == PIS_GPIO_PIN10) || \ - ((x) == PIS_GPIO_PIN11) || \ - ((x) == PIS_GPIO_PIN12) || \ - ((x) == PIS_GPIO_PIN13) || \ - ((x) == PIS_GPIO_PIN14) || \ - ((x) == PIS_GPIO_PIN15) || \ - ((x) == PIS_ACMP_OUT0) || \ - ((x) == PIS_ACMP_OUT1) || \ - ((x) == PIS_DAC0_CH1) || \ - ((x) == PIS_ACMP_OUT1) || \ - ((x) == PIS_ADC0_INJECT) || \ - ((x) == PIS_ADC0_REGULAT) || \ - ((x) == PIS_ADC0_WINDOW) || \ - ((x) == PIS_LVD) || \ - ((x) == PIS_UART0_ASY_SEND) || \ - ((x) == PIS_UART0_ASY_RECV) || \ - ((x) == PIS_UART0_IRDAOUT) || \ - ((x) == PIS_UART0_RTSOUT) || \ - ((x) == PIS_UART0_TXOUT) || \ - ((x) == PIS_UART0_SYN_SEND) || \ - ((x) == PIS_UART0_SYN_RECV) || \ - ((x) == PIS_UART1_ASY_SEND) || \ - ((x) == PIS_UART1_ASY_RECV) || \ - ((x) == PIS_UART1_IRDA) || \ - ((x) == PIS_UART1_RTS) || \ - ((x) == PIS_UART1_TXOUT) || \ - ((x) == PIS_UART1_SYN_SEND) || \ - ((x) == PIS_UART1_SYN_RECV) || \ - ((x) == PIS_UART2_ASY_SEND) || \ - ((x) == PIS_UART2_ASY_RECV) || \ - ((x) == PIS_UART2_IRDA) || \ - ((x) == PIS_UART2_RTS) || \ - ((x) == PIS_UART2_TXOUT) || \ - ((x) == PIS_UART2_SYN_SEND) || \ - ((x) == PIS_UART2_SYN_RECV) || \ - ((x) == PIS_UART3_ASY_SEND) || \ - ((x) == PIS_UART3_ASY_RECV) || \ - ((x) == PIS_UART3_IRDA) || \ - ((x) == PIS_UART3_RTS) || \ - ((x) == PIS_UART3_TXOUT) || \ - ((x) == PIS_UART3_SYN_SEND) || \ - ((x) == PIS_UART3_SYN_RECV) || \ - ((x) == PIS_EUART0_RECV) || \ - ((x) == PIS_EUART0_SEND) || \ - ((x) == PIS_EUART0_TXOUT) || \ - ((x) == PIS_EUART1_RECV) || \ - ((x) == PIS_EUART1_SEND) || \ - ((x) == PIS_EUART1_TXOUT) || \ - ((x) == PIS_SPI0_RECV) || \ - ((x) == PIS_SPI0_SEND) || \ - ((x) == PIS_SPI0_NE) || \ - ((x) == PIS_SPI1_RECV) || \ - ((x) == PIS_SPI1_SEND) || \ - ((x) == PIS_SPI1_NE) || \ - ((x) == PIS_I2C0_RECV) || \ - ((x) == PIS_I2C0_SEND) || \ - ((x) == PIS_I2C1_RECV) || \ - ((x) == PIS_I2C1_SEND) || \ - ((x) == PIS_TIMER0_UPDATA) || \ - ((x) == PIS_TIMER0_TRIG) || \ - ((x) == PIS_TIMER0_INPUT) || \ - ((x) == PIS_TIMER0_OUTPUT) || \ - ((x) == PIS_TIMER1_UPDATA) || \ - ((x) == PIS_TIMER1_TRIG) || \ - ((x) == PIS_TIMER1_INPUT) || \ - ((x) == PIS_TIMER1_OUTPUT) || \ - ((x) == PIS_TIMER2_UPDATA) || \ - ((x) == PIS_TIMER2_TRIG) || \ - ((x) == PIS_TIMER2_INPUT) || \ - ((x) == PIS_TIMER2_OUTPUT) || \ - ((x) == PIS_TIMER3_UPDATA) || \ - ((x) == PIS_TIMER3_TRIG) || \ - ((x) == PIS_TIMER3_INPUT) || \ - ((x) == PIS_TIMER3_OUTPUT) || \ - ((x) == PIS_RTC_CLOCK) || \ - ((x) == PIS_RTC_ALARM) || \ - ((x) == PIS_LPTIM0_SYN_UPDATA) || \ - ((x) == PIS_LPTIM0_ASY_UPDATA) || \ - ((x) == PIS_LPUART0_ASY_RECV) || \ - ((x) == PIS_LPUART0_ASY_SEND) || \ - ((x) == PIS_LPUART0_SYN_RECV) || \ - ((x) == PIS_LPUART0_SYN_SEND) || \ - ((x) == PIS_DMA) || \ - ((x) == PIS_ADC1_INJECT) || \ - ((x) == PIS_ADC1_REGULAT) || \ - ((x) == PIS_ADC1_WINDOW)) -#define IS_PIS_TRIG(x) (((x) == PIS_CH0_TIMER0_BRKIN) || \ - ((x) == PIS_CH0_SPI1_CLK) || \ - ((x) == PIS_CH0_LPTIM0_EXT0) || \ - ((x) == PIS_CH0_ADC1_NORMAL) || \ - ((x) == PIS_CH1_TIMER0_CH1IN) || \ - ((x) == PIS_CH1_TIMER2_CH1IN) || \ - ((x) == PIS_CH1_TIMER3_CH1IN) || \ - ((x) == PIS_CH1_UART0_RX_IRDA) || \ - ((x) == PIS_CH1_LPTIM0_EXT1) || \ - ((x) == PIS_CH1_ADC1_INSERT) || \ - ((x) == PIS_CH2_TIMER0_CH2IN) || \ - ((x) == PIS_CH2_TIMER2_CH2IN) || \ - ((x) == PIS_CH2_TIMER3_CH2IN) || \ - ((x) == PIS_CH2_LPTIM0_EXT2) || \ - ((x) == PIS_CH2_UART1_RX_IRDA) || \ - ((x) == PIS_CH3_TIMER0_CH3IN) || \ - ((x) == PIS_CH3_LPTIM0_EXT3) || \ - ((x) == PIS_CH3_UART2_RX_IRDA) || \ - ((x) == PIS_CH4_TIMER0_CH4IN) || \ - ((x) == PIS_CH4_TIMER0_ITR0) || \ - ((x) == PIS_CH4_TIMER2_ITR0) || \ - ((x) == PIS_CH4_TIMER3_ITR0) || \ - ((x) == PIS_CH4_LPTIM0_EXT4) || \ - ((x) == PIS_CH4_UART3_RX_IRDA) || \ - ((x) == PIS_CH5_SPI0_RX) || \ - ((x) == PIS_CH5_LPTIM0_EXT5) || \ - ((x) == PIS_CH5_EUART0_RX) || \ - ((x) == PIS_CH5_TIMER0_ITR1) || \ - ((x) == PIS_CH5_TIMER2_ITR1) || \ - ((x) == PIS_CH5_TIMER3_ITR1) || \ - ((x) == PIS_CH6_SPI0_CLK) || \ - ((x) == PIS_CH6_ADC0_NORMAL) || \ - ((x) == PIS_CH6_LPTIM0_EXT6) || \ - ((x) == PIS_CH6_EUART1_RX) || \ - ((x) == PIS_CH6_TIMER0_ITR2) || \ - ((x) == PIS_CH6_TIMER2_ITR2) || \ - ((x) == PIS_CH6_TIMER3_ITR2) || \ - ((x) == PIS_CH6_DAC_CH1) || \ - ((x) == PIS_CH7_SPI1_RX) || \ - ((x) == PIS_CH7_ADC0_INSERT) || \ - ((x) == PIS_CH7_LPTIM0_EXT7) || \ - ((x) == PIS_CH7_DMA) || \ - ((x) == PIS_CH7_TIMER0_ITR3) || \ - ((x) == PIS_CH7_TIMER2_ITR3) || \ - ((x) == PIS_CH7_TIMER3_ITR3) || \ - ((x) == PIS_CH7_DAC_CH0) || \ - ((x) == PIS_CH7_LPUART_RX)) -#define IS_PIS_CLOCK(x) (((x) == PIS_CLK_PCLK1) || \ - ((x) == PIS_CLK_PCLK2) || \ - ((x) == PIS_CLK_SYS) || \ - ((x) == PIS_CLK_LP)) -#define IS_PIS_EDGE(x) (((x) == PIS_EDGE_NONE) || \ - ((x) == PIS_EDGE_UP) || \ - ((x) == PIS_EDGE_DOWN) || \ - ((x) == PIS_EDGE_UP_DOWN)) -#define IS_PIS_OUTPUT(x) (((x) == PIS_OUT_LEVEL) || \ - ((x) == PIS_OUT_PULSE)) -#define IS_PIS_OUPUT_CH(x) (((x) == PIS_OUT_CH_0) || \ - ((x) == PIS_OUT_CH_1) || \ - ((x) == PIS_OUT_CH_2) || \ - ((x) == PIS_OUT_CH_3)) -#define IS_PIS_MODU_TARGET(x) (((x) == PIS_UART0_TX) || \ - ((x) == PIS_UART1_TX) || \ - ((x) == PIS_UART2_TX) || \ - ((x) == PIS_UART3_TX) || \ - ((x) == PIS_LPUART0_TX)) -#define IS_PIS_MODU_LEVEL(x) (((x) == PIS_LOW_LEVEL) || \ - ((x) == PIS_HIGH_LEVEL)) -#define IS_PIS_MODU_SRC(x) (((x) == PIS_SRC_NONE) || \ - ((x) == PIS_SRC_TIMER0) || \ - ((x) == PIS_SRC_TIMER1) || \ - ((x) == PIS_SRC_TIMER2) || \ - ((x) == PIS_SRC_TIMER3) || \ - ((x) == PIS_SRC_TIMER6) || \ - ((x) == PIS_SRC_TIMER7) || \ - ((x) == PIS_SRC_LPTIM0) || \ - ((x) == PIS_SRC_BUZ)) -#define IS_PIS_MODU_CHANNEL(x) (((x) == PIS_TIMER_CH1) || \ - ((x) == PIS_TIMER_CH2) || \ - ((x) == PIS_TIMER_CH3) || \ - ((x) == PIS_TIMER_CH4)) -/** - * @} - */ - -/** @addtogroup PIS_Public_Functions - * @{ - */ - -/** @addtogroup PIS_Public_Functions_Group1 - * @{ - */ -ald_status_t ald_pis_create(pis_handle_t *hperh); -ald_status_t ald_pis_destroy(pis_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup PIS_Public_Functions_Group2 - * @{ - */ -ald_status_t ald_pis_output_start(pis_handle_t *hperh, pis_out_ch_t ch); -ald_status_t ald_pis_output_stop(pis_handle_t *hperh, pis_out_ch_t ch); -/** - * @} - */ - -/** @addtogroup PIS_Public_Functions_Group3 - * @{ - */ -pis_state_t ald_pis_get_state(pis_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup PIS_Public_Functions_Group4 - * @{ - */ -ald_status_t ald_pis_modu_config(pis_handle_t *hperh, pis_modulate_config_t *config); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_PIS_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_pmu.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_pmu.h deleted file mode 100644 index 13f5977459..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_pmu.h +++ /dev/null @@ -1,251 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_pmu.h - * @brief Header file of PMU module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_PMU_H__ -#define __ALD_PMU_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" -#include "ald_syscfg.h" -#include "ald_bkpc.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup PMU - * @{ - */ - -/** @defgroup PMU_Public_Macros PMU Public Macros - * @{ - */ -#define PMU_SRAM0_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(PMU->PWRCR, BIT(PMU_PWRCR_SRAM_POSS)); \ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_SRAM0_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(PMU->PWRCR, BIT(PMU_PWRCR_SRAM_POSS));\ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_SRAM1_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(PMU->PWRCR, BIT(PMU_PWRCR_SRAM_POSE)); \ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_SRAM1_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(PMU->PWRCR, BIT(PMU_PWRCR_SRAM_POSE));\ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_BXCAN_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(PMU->PWRCR, PMU_PWRCR_BXCAN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_BXCAN_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(PMU->PWRCR, PMU_PWRCR_BXCAN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) - -#define PMU_LPSTOP_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(PMU->CR, PMU_CR_LPSTOP_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_LPSTOP_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(PMU->CR, PMU_CR_LPSTOP_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_MTSTOP_ENABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(PMU->CR, PMU_CR_MTSTOP_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -#define PMU_MTSTOP_DISABLE() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(PMU->CR, PMU_CR_MTSTOP_MSK); \ - SYSCFG_LOCK(); \ -} while (0) - -#define PMU_GET_LVD_STATUS() (READ_BITS(PMU->LVDCR, PMU_LVDCR_LVDO_MSK, PMU_LVDCR_LVDO_POS)) -/** - * @} - */ - - -/** @defgroup PMU_Public_Types PMU Public Types - * @{ - */ -/** - * @brief Low power mode - */ -typedef enum { - PMU_LP_STOP1 = 0x0U, /**< Stop1 */ - PMU_LP_STOP2 = 0x1U, /**< Stop2 */ - PMU_LP_STANDBY = 0x2U, /**< Standby */ -} pmu_lp_mode_t; - -typedef enum { - PMU_SR_WUF = (1U << 0), - PMU_SR_STANDBY = (1U << 1), -} pmu_status_t; - -/** - * @brief LVD voltage select - */ -typedef enum { - PMU_LVD_VOL_SEL_2_0 = 0x0U, /**< 2.0V ~ 2.05V */ - PMU_LVD_VOL_SEL_2_1 = 0x1U, /**< 2.1V ~ 2.15V */ - PMU_LVD_VOL_SEL_2_2 = 0x2U, /**< 2.2V ~ 2.25V */ - PMU_LVD_VOL_SEL_2_4 = 0x3U, /**< 2.4V ~ 2.45V */ - PMU_LVD_VOL_SEL_2_6 = 0x4U, /**< 2.6V ~ 2.65V */ - PMU_LVD_VOL_SEL_2_8 = 0x5U, /**< 2.8V ~ 2.85V */ - PMU_LVD_VOL_SEL_3_0 = 0x6U, /**< 3.0V ~ 3.05V */ - PMU_LVD_VOL_SEL_3_6 = 0x7U, /**< 3.6V ~ 3.65V */ - PMU_LVD_VOL_SEL_4_0 = 0x8U, /**< 4.0V ~ 4.05V */ - PMU_LVD_VOL_SEL_4_6 = 0x9U, /**< 4.6V ~ 4.65V */ - PMU_LVD_VOL_SEL_2_3 = 0xAU, /**< 2.3V ~ 2.35V */ - PMU_LVD_VOL_SEL_EXT = 0xFU, /**< Select external input. It must be 1.2V */ -} pmu_lvd_voltage_sel_t; - -/** - * @brief LVD trigger mode - */ -typedef enum { - PMU_LVD_TRIGGER_RISING_EDGE = 0x0U, /**< Rising edge */ - PMU_LVD_TRIGGER_FALLING_EDGE = 0x1U, /**< Falling edge */ - PMU_LVD_TRIGGER_HIGH_LEVEL = 0x2U, /**< High level */ - PMU_LVD_TRIGGER_LOW_LEVEL = 0x3U, /**< Low level */ - PMU_LVD_TRIGGER_RISING_FALLING = 0x4U, /**< Rising and falling edge */ -} pmu_lvd_trigger_mode_t; - -/** - * @brief LDO output voltage selest in low power mode - */ -typedef enum { - PMU_LDO_LPMODE_OUTPUT_1_5 = 0x0U, /**< 1.5V */ - PMU_LDO_LPMODE_OUTPUT_1_4 = 0x1U, /**< 1.4V */ - PMU_LDO_LPMODE_OUTPUT_1_3 = 0x2U, /**< 1.3V */ - PMU_LDO_LPMODE_OUTPUT_1_2 = 0x4U, /**< 1.2V */ -} pmu_ldo_lpmode_output_t; -/** - * @} - */ - -/** - * @defgroup PMU_Private_Macros PMU Private Macros - * @{ - */ -#define IS_PMU_LP_MODE(x) (((x) == PMU_LP_STOP1) || \ - ((x) == PMU_LP_STOP2) || \ - ((x) == PMU_LP_STANDBY)) -#define IS_PMU_STATUS(x) (((x) == PMU_SR_WUF) || ((x) == PMU_SR_STANDBY)) -#define IS_PMU_LVD_VOL_SEL(x) (((x) == PMU_LVD_VOL_SEL_2_0) || \ - ((x) == PMU_LVD_VOL_SEL_2_1) || \ - ((x) == PMU_LVD_VOL_SEL_2_2) || \ - ((x) == PMU_LVD_VOL_SEL_2_4) || \ - ((x) == PMU_LVD_VOL_SEL_2_6) || \ - ((x) == PMU_LVD_VOL_SEL_2_8) || \ - ((x) == PMU_LVD_VOL_SEL_3_0) || \ - ((x) == PMU_LVD_VOL_SEL_3_6) || \ - ((x) == PMU_LVD_VOL_SEL_4_0) || \ - ((x) == PMU_LVD_VOL_SEL_4_6) || \ - ((x) == PMU_LVD_VOL_SEL_2_3) || \ - ((x) == PMU_LVD_VOL_SEL_EXT)) -#define IS_PMU_LVD_TRIGGER_MODE(x) (((x) == PMU_LVD_TRIGGER_RISING_EDGE) || \ - ((x) == PMU_LVD_TRIGGER_FALLING_EDGE) || \ - ((x) == PMU_LVD_TRIGGER_HIGH_LEVEL) || \ - ((x) == PMU_LVD_TRIGGER_LOW_LEVEL) || \ - ((x) == PMU_LVD_TRIGGER_RISING_FALLING)) -#define IS_PMU_LDO_LPMODE_OUTPUT(x) (((x) == PMU_LDO_LPMODE_OUTPUT_1_5) || \ - ((x) == PMU_LDO_LPMODE_OUTPUT_1_4) || \ - ((x) == PMU_LDO_LPMODE_OUTPUT_1_3) || \ - ((x) == PMU_LDO_LPMODE_OUTPUT_1_2)) -/** - * @} - */ - -/** @addtogroup PMU_Public_Functions - * @{ - */ -/** @addtogroup PMU_Public_Functions_Group1 - * @{ - */ -/* Low power mode select */ -__STATIC_INLINE__ void ald_pmu_sleep() -{ - __WFI(); -} - -__STATIC_INLINE__ void ald_pmu_sleep_deep() -{ - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - __WFI(); -} - -void ald_pmu_stop1_enter(void); -void ald_pmu_stop2_enter(void); -void ald_pmu_standby_enter(bkpc_wakeup_port_t port, bkpc_wakeup_level_t level); -void ald_pmu_lprun_config(pmu_ldo_lpmode_output_t vol, type_func_t state); -flag_status_t ald_pmu_get_status(pmu_status_t sr); -void ald_pmu_clear_status(pmu_status_t sr); -/** - * @} - */ -/** @addtogroup PMU_Public_Functions_Group2 - * @{ - */ -/* LVD configure */ -void ald_pmu_lvd_config(pmu_lvd_voltage_sel_t sel, pmu_lvd_trigger_mode_t mode, type_func_t state); -void ald_lvd_irq_handler(void); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_PMU_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_rmu.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_rmu.h deleted file mode 100644 index 164ebb5e3f..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_rmu.h +++ /dev/null @@ -1,288 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_rmu.h - * @brief Header file of RMU module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_RMU_H__ -#define __ALD_RMU_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup RMU - * @{ - */ - -/** @defgroup RMU_Public_Types RMU Public Types - * @{ - */ -/** - * @brief RMU BOR fliter - */ -typedef enum { - RMU_BORFLT_1 = 0x1U, /**< 1 cycle */ - RMU_BORFLT_2 = 0x2U, /**< 2 cycles */ - RMU_BORFLT_3 = 0x3U, /**< 3 cycles */ - RMU_BORFLT_4 = 0x4U, /**< 4 cycles */ - RMU_BORFLT_5 = 0x5U, /**< 5 cycles */ - RMU_BORFLT_6 = 0x6U, /**< 6 cycles */ - RMU_BORFLT_7 = 0x7U, /**< 7 cycles */ -} rmu_bor_filter_t; - -/** - * @brief RMU BOR voltage - */ -typedef enum { - RMU_VOL_1_8 = 0x0U, /**< 1.8V */ - RMU_VOL_2_0 = 0x1U, /**< 2.0V */ - RMU_VOL_2_2 = 0x2U, /**< 2.2V */ - RMU_VOL_2_4 = 0x3U, /**< 2.4V */ - RMU_VOL_2_6 = 0x4U, /**< 2.6V */ - RMU_VOL_2_8 = 0x5U, /**< 2.8V */ - RMU_VOL_3_0 = 0x6U, /**< 3.0V */ - RMU_VOL_3_2 = 0x7U, /**< 3.2V */ - RMU_VOL_3_4 = 0x8U, /**< 3.4V */ - RMU_VOL_3_6 = 0x9U, /**< 3.6V */ - RMU_VOL_3_8 = 0xAU, /**< 3.8V */ - RMU_VOL_4_0 = 0xBU, /**< 4.0V */ - RMU_VOL_4_2 = 0xCU, /**< 4.2V */ - RMU_VOL_4_4 = 0xDU, /**< 4.4V */ - RMU_VOL_4_6 = 0xEU, /**< 4.6V */ - RMU_VOL_4_8 = 0xFU, /**< 4.8V */ -} rmu_bor_vol_t; - -/** - * @brief RMU reset status - */ -typedef enum { - RMU_RST_POR = (1U << 0), /**< POR */ - RMU_RST_WAKEUP = (1U << 1), /**< WAKEUP */ - RMU_RST_BOR = (1U << 2), /**< BOR */ - RMU_RST_NMRST = (1U << 3), /**< NMRST */ - RMU_RST_IWDT = (1U << 4), /**< IWDT */ - RMU_RST_WWDT = (1U << 5), /**< WWDT */ - RMU_RST_LOCKUP = (1U << 6), /**< LOCKUP */ - RMU_RST_CHIP = (1U << 7), /**< CHIP */ - RMU_RST_MCU = (1U << 8), /**< MCU */ - RMU_RST_CPU = (1U << 9), /**< CPU */ - RMU_RST_CFG = (1U << 10), /**< CFG */ - RMU_RST_CFGERR = (1U << 16), /**< CFG Error */ - RMU_RST_ALL = (0xFFFFFU), /**< ALL */ -} rmu_state_t; - -/** - * @brief RMU periperal select bit - * @verbatim - In this module, for the convenience of code maintenance, - TIMERx is used to indicate the sequence of the timer peripheral. - Different product series TIMERx represent different meanings: - 1. For ES32F065x series: - TIMER0 ----> AD16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - TIMER4 ----> BS16T1 - TIMER5 ----> BS16T2 - TIMER6 ----> GP16C4T0 - TIMER7 ----> BS16T3 - - 2. For ES32F033x/ES32F093x series: - TIMER0 ----> GP16C4T0 - TIMER1 ----> BS16T0 - TIMER2 ----> GP16C2T0 - TIMER3 ----> GP16C2T1 - TIMER4 ----> BS16T1 - TIMER5 ----> BS16T2 - TIMER6 ----> GP16C4T1 - TIMER7 ----> BS16T3 - @endverbatim - */ -typedef enum { - RMU_PERH_GPIO = (1U << 0), /**< AHB1: GPIO */ - RMU_PERH_CRC = (1U << 1), /**< AHB1: CRC */ - RMU_PERH_CALC = (1U << 2), /**< AHB1: CALC */ - RMU_PERH_CRYPT = (1U << 3), /**< AHB1: CRYPT */ - RMU_PERH_TRNG = (1U << 4), /**< AHB1: TRNG */ - RMU_PERH_PIS = (1U << 5), /**< AHB1: PIS */ - RMU_PERH_CHIP = (1U << 0) | (1U << 27), /**< AHB2: CHIP */ - RMU_PERH_CPU = (1U << 1) | (1U << 27), /**< AHB2: CPU */ - RMU_PERH_TIMER0 = (1U << 0) | (1U << 28), /**< APB1: TIMER0 */ - RMU_PERH_TIMER1 = (1U << 1) | (1U << 28), /**< APB1: TIMER1 */ - RMU_PERH_TIMER2 = (1U << 2) | (1U << 28), /**< APB1: TIMER2 */ - RMU_PERH_TIMER3 = (1U << 3) | (1U << 28), /**< APB1: TIMER3 */ - RMU_PERH_TIMER4 = (1U << 4) | (1U << 28), /**< APB1: TIMER4 */ - RMU_PERH_TIMER5 = (1U << 5) | (1U << 28), /**< APB1: TIMER5 */ - RMU_PERH_TIMER6 = (1U << 6) | (1U << 28), /**< APB1: TIMER6 */ - RMU_PERH_TIMER7 = (1U << 7) | (1U << 28), /**< APB1: TIMER7 */ - RMU_PERH_UART0 = (1U << 8) | (1U << 28), /**< APB1: UART0 */ - RMU_PERH_UART1 = (1U << 9) | (1U << 28), /**< APB1: UART1 */ - RMU_PERH_UART2 = (1U << 10) | (1U << 28), /**< APB1: UART2 */ - RMU_PERH_UART3 = (1U << 11) | (1U << 28), /**< APB1: UART3 */ - RMU_PERH_USART0 = (1U << 12) | (1U << 28), /**< APB1: EUART0 */ - RMU_PERH_USART1 = (1U << 13) | (1U << 28), /**< APB1: EUART1 */ - RMU_PERH_SPI0 = (1U << 16) | (1U << 28), /**< APB1: SPI0 */ - RMU_PERH_SPI1 = (1U << 17) | (1U << 28), /**< APB1: SPI1 */ - RMU_PERH_SPI2 = (1U << 18) | (1U << 28), /**< APB1: SPI2 */ - RMU_PERH_I2C0 = (1U << 20) | (1U << 28), /**< APB1: I2C0 */ - RMU_PERH_I2C1 = (1U << 21) | (1U << 28), /**< APB1: I2C1 */ - RMU_PERH_CAN0 = (1U << 24) | (1U << 28), /**< APB1: CAN0 */ - RMU_PERH_LPTIM0 = (1U << 0) | (1U << 29), /**< APB2: LPTIM0 */ - RMU_PERH_LPUART0 = (1U << 2) | (1U << 29), /**< APB2: LPUART */ - RMU_PERH_ADC0 = (1U << 4) | (1U << 29), /**< APB2: ADC0 */ - RMU_PERH_ADC1 = (1U << 5) | (1U << 29), /**< APB2: ADC1 */ - RMU_PERH_ACMP0 = (1U << 6) | (1U << 29), /**< APB2: ACMP0 */ - RMU_PERH_ACMP1 = (1U << 7) | (1U << 29), /**< APB2: ACMP1 */ - RMU_PERH_OPAMP = (1U << 8) | (1U << 29), /**< APB2: OPAMP */ - RMU_PERH_DAC0 = (1U << 9) | (1U << 29), /**< APB2: DAC0 */ - RMU_PERH_WWDT = (1U << 12) | (1U << 29), /**< APB2: WWDT */ - RMU_PERH_LCD = (1U << 13) | (1U << 29), /**< APB2: LCD */ - RMU_PERH_IWDT = (1U << 14) | (1U << 29), /**< APB2: IWDT */ - RMU_PERH_RTC = (1U << 15) | (1U << 29), /**< APB2: RTC */ - RMU_PERH_TSENSE = (1U << 16) | (1U << 29), /**< APB2: TSENSE */ - RMU_PERH_BKPC = (1U << 17) | (1U << 29), /**< APB2: BKPC */ - RMU_PERH_BKPRAM = (1U << 18) | (1U << 29), /**< APB2: BKPRAM */ -} rmu_peripheral_t; -/** - * @} - */ - -/** - * @defgroup RMU_Private_Macros RMU Private Macros - * @{ - */ -#define IS_RMU_BORFLT(x) (((x) == RMU_BORFLT_1) || \ - ((x) == RMU_BORFLT_2) || \ - ((x) == RMU_BORFLT_3) || \ - ((x) == RMU_BORFLT_4) || \ - ((x) == RMU_BORFLT_5) || \ - ((x) == RMU_BORFLT_6) || \ - ((x) == RMU_BORFLT_7)) -#define IS_RMU_BORVOL(x) (((x) == RMU_VOL_1_8) || \ - ((x) == RMU_VOL_2_0) || \ - ((x) == RMU_VOL_2_2) || \ - ((x) == RMU_VOL_2_4) || \ - ((x) == RMU_VOL_2_6) || \ - ((x) == RMU_VOL_2_8) || \ - ((x) == RMU_VOL_3_0) || \ - ((x) == RMU_VOL_3_2) || \ - ((x) == RMU_VOL_3_4) || \ - ((x) == RMU_VOL_3_6) || \ - ((x) == RMU_VOL_3_8) || \ - ((x) == RMU_VOL_4_0) || \ - ((x) == RMU_VOL_4_2) || \ - ((x) == RMU_VOL_4_4) || \ - ((x) == RMU_VOL_4_6) || \ - ((x) == RMU_VOL_4_8)) -#define IS_RMU_STATE(x) (((x) == RMU_RST_POR) || \ - ((x) == RMU_RST_WAKEUP) || \ - ((x) == RMU_RST_BOR) || \ - ((x) == RMU_RST_NMRST) || \ - ((x) == RMU_RST_IWDT) || \ - ((x) == RMU_RST_WWDT) || \ - ((x) == RMU_RST_LOCKUP) || \ - ((x) == RMU_RST_CHIP) || \ - ((x) == RMU_RST_MCU) || \ - ((x) == RMU_RST_CPU) || \ - ((x) == RMU_RST_CFG) || \ - ((x) == RMU_RST_CFGERR) || \ - ((x) == RMU_RST_ALL)) -#define IS_RMU_STATE_CLEAR(x) (((x) == RMU_RST_POR) || \ - ((x) == RMU_RST_WAKEUP) || \ - ((x) == RMU_RST_BOR) || \ - ((x) == RMU_RST_NMRST) || \ - ((x) == RMU_RST_IWDT) || \ - ((x) == RMU_RST_WWDT) || \ - ((x) == RMU_RST_LOCKUP) || \ - ((x) == RMU_RST_CHIP) || \ - ((x) == RMU_RST_MCU) || \ - ((x) == RMU_RST_CPU) || \ - ((x) == RMU_RST_CFG) || \ - ((x) == RMU_RST_ALL)) -#define IS_RMU_PERH(x) (((x) == RMU_PERH_GPIO) || \ - ((x) == RMU_PERH_CRC) || \ - ((x) == RMU_PERH_CALC) || \ - ((x) == RMU_PERH_CRYPT) || \ - ((x) == RMU_PERH_TRNG) || \ - ((x) == RMU_PERH_PIS) || \ - ((x) == RMU_PERH_CHIP) || \ - ((x) == RMU_PERH_CPU) || \ - ((x) == RMU_PERH_TIMER0) || \ - ((x) == RMU_PERH_TIMER1) || \ - ((x) == RMU_PERH_TIMER2) || \ - ((x) == RMU_PERH_TIMER3) || \ - ((x) == RMU_PERH_TIMER4) || \ - ((x) == RMU_PERH_TIMER5) || \ - ((x) == RMU_PERH_TIMER6) || \ - ((x) == RMU_PERH_TIMER7) || \ - ((x) == RMU_PERH_UART0) || \ - ((x) == RMU_PERH_UART1) || \ - ((x) == RMU_PERH_UART2) || \ - ((x) == RMU_PERH_UART3) || \ - ((x) == RMU_PERH_USART0) || \ - ((x) == RMU_PERH_USART1) || \ - ((x) == RMU_PERH_SPI0) || \ - ((x) == RMU_PERH_SPI1) || \ - ((x) == RMU_PERH_SPI2) || \ - ((x) == RMU_PERH_I2C0) || \ - ((x) == RMU_PERH_I2C1) || \ - ((x) == RMU_PERH_CAN0) || \ - ((x) == RMU_PERH_LPTIM0) || \ - ((x) == RMU_PERH_LPUART0) || \ - ((x) == RMU_PERH_ADC0) || \ - ((x) == RMU_PERH_ADC1) || \ - ((x) == RMU_PERH_ACMP0) || \ - ((x) == RMU_PERH_ACMP1) || \ - ((x) == RMU_PERH_OPAMP) || \ - ((x) == RMU_PERH_DAC0) || \ - ((x) == RMU_PERH_WWDT) || \ - ((x) == RMU_PERH_LCD) || \ - ((x) == RMU_PERH_IWDT) || \ - ((x) == RMU_PERH_RTC) || \ - ((x) == RMU_PERH_TSENSE) || \ - ((x) == RMU_PERH_BKPC) || \ - ((x) == RMU_PERH_BKPRAM)) -/** - * @} - */ - -/** @addtogroup RMU_Public_Functions - * @{ - */ -void ald_rmu_bor_config(rmu_bor_filter_t flt, rmu_bor_vol_t vol, type_func_t state); -uint32_t ald_rmu_get_reset_status(rmu_state_t state); -void ald_rmu_clear_reset_status(rmu_state_t state); -void ald_rmu_reset_periperal(rmu_peripheral_t perh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_RMU_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_rtc.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_rtc.h deleted file mode 100644 index dd5d8ad7ee..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_rtc.h +++ /dev/null @@ -1,669 +0,0 @@ -/** - ****************************************************************************** - * @file ald_rtc.h - * @brief Header file of RTC Module driver. - * - * @version V1.0 - * @date 16 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************* - */ - -#ifndef __ALD_RTC_H__ -#define __ALD_RTC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup RTC - * @{ - */ - -/** @defgroup RTC_Public_Types RTC Public Types - * @{ - */ - -/** - * @brief Hours format - */ -typedef enum { - RTC_HOUR_FORMAT_24 = 0x0U, /**< 24-hours format */ - RTC_HOUR_FORMAT_12 = 0x1U, /**< 12-hours format */ -} rtc_hour_format_t; - -/** - * @brief Output mode - */ -typedef enum { - RTC_OUTPUT_DISABLE = 0x0U, /**< Disable output */ - RTC_OUTPUT_ALARM_A = 0x1U, /**< Output alarm_a signal */ - RTC_OUTPUT_ALARM_B = 0x2U, /**< Output alarm_b signal */ - RTC_OUTPUT_WAKEUP = 0x3U, /**< Output wakeup signal */ -} rtc_output_select_t; - -/** - * @brief Output polarity - */ -typedef enum { - RTC_OUTPUT_POLARITY_HIGH = 0x0U, /**< Polarity is high */ - RTC_OUTPUT_POLARITY_LOW = 0x1U, /**< Polarity is low */ -} rtc_output_polarity_t; - -/** - * @brief Initialization structure - */ -typedef struct { - rtc_hour_format_t hour_format; /**< Hours format */ - uint32_t asynch_pre_div; /**< Asynchronous predivider value */ - uint32_t synch_pre_div; /**< Synchronous predivider value */ - rtc_output_select_t output; /**< Output signal type */ - rtc_output_polarity_t output_polarity; /**< Output polarity */ -} rtc_init_t; - -/** - * @brief Source select - */ -typedef enum { - RTC_SOURCE_LOSC = 0x0U, /**< LOSC */ - RTC_SOURCE_LRC = 0x1U, /**< LRC */ - RTC_SOURCE_HRC_DIV_1M = 0x2U, /**< HRC divide to 1MHz */ - RTC_SOURCE_HOSC_DIV_1M = 0x3U, /**< HOSC divide to 1MHz */ -} rtc_source_sel_t; - -/** - * @brief Time structure - */ -typedef struct { - uint8_t hour; /**< Hours */ - uint8_t minute; /**< Minutes */ - uint8_t second; /**< Seconds */ - uint16_t sub_sec; /**< Sub-seconds */ -} rtc_time_t; - -/** - * @brief Date structure - */ -typedef struct { - uint8_t week; /**< Weeks */ - uint8_t day; /**< days */ - uint8_t month; /**< months */ - uint8_t year; /**< years */ -} rtc_date_t; - -/** - * @brief Data format - */ -typedef enum { - RTC_FORMAT_DEC = 0U, /**< DEC format */ - RTC_FORMAT_BCD = 1U, /**< BCD format */ -} rtc_format_t; - -/** - * @brief Index of alarm - */ -typedef enum { - RTC_ALARM_A = 0x0U, /**< Alarm-A */ - RTC_ALARM_B = 0x1U, /**< Alarm-B */ -} rtc_alarm_idx_t; - -/** - * @brief Alarm mask - */ -typedef enum { - RTC_ALARM_MASK_NONE = 0x0U, /**< Mask is disable */ - RTC_ALARM_MASK_WEEK_DAY = (1U << 30), /**< Mask week or day */ - RTC_ALARM_MASK_HOUR = (1U << 23), /**< Mask hour */ - RTC_ALARM_MASK_MINUTE = (1U << 15), /**< Mask minute */ - RTC_ALARM_MASK_SECOND = (1U << 7), /**< Mask second */ - RTC_ALARM_MASK_ALL = 0x40808080U, /**< Mask all */ -} rtc_alarm_mask_t; - -/** - * @brief Alarm sub-second mask - */ -typedef enum { - RTC_ALARM_SS_MASK_NONE = 0xFU, /**< Mask is disable */ - RTC_ALARM_SS_MASK_14_1 = 0x1U, /**< Mask bit(1-14) */ - RTC_ALARM_SS_MASK_14_2 = 0x2U, /**< Mask bit(2-14) */ - RTC_ALARM_SS_MASK_14_3 = 0x3U, /**< Mask bit(3-14) */ - RTC_ALARM_SS_MASK_14_4 = 0x4U, /**< Mask bit(4-14) */ - RTC_ALARM_SS_MASK_14_5 = 0x5U, /**< Mask bit(5-14) */ - RTC_ALARM_SS_MASK_14_6 = 0x6U, /**< Mask bit(6-14) */ - RTC_ALARM_SS_MASK_14_7 = 0x7U, /**< Mask bit(7-14) */ - RTC_ALARM_SS_MASK_14_8 = 0x8U, /**< Mask bit(8-14) */ - RTC_ALARM_SS_MASK_14_9 = 0x9U, /**< Mask bit(9-14) */ - RTC_ALARM_SS_MASK_14_10 = 0xAU, /**< Mask bit(10-14) */ - RTC_ALARM_SS_MASK_14_11 = 0xBU, /**< Mask bit(11-14) */ - RTC_ALARM_SS_MASK_14_12 = 0xCU, /**< Mask bit(12-14) */ - RTC_ALARM_SS_MASK_14_13 = 0xDU, /**< Mask bit(13-14) */ - RTC_ALARM_SS_MASK_14 = 0xEU, /**< Mask bit14 */ - RTC_ALARM_SS_MASK_ALL = 0x0U, /**< Mask bit(0-14) */ -} rtc_sub_second_mask_t; - -/** - * @brief Alarm select week or day */ -typedef enum { - RTC_SELECT_DAY = 0x0U, /**< Alarm select day */ - RTC_SELECT_WEEK = 0x1U, /**< Alarm select week */ -} rtc_week_day_sel_t; - -/** - * @brief Alarm structure - */ -typedef struct { - rtc_alarm_idx_t idx; /**< Index of alarm */ - rtc_time_t time; /**< Time structure */ - uint32_t mask; /**< Alarm mask */ - rtc_sub_second_mask_t ss_mask; /**< Alarm sub-second mask */ - rtc_week_day_sel_t sel; /**< Select week or day */ - - union { - uint8_t week; /**< Alarm select week */ - uint8_t day; /**< Alarm select day */ - }; -} rtc_alarm_t; - -/** - * @brief Time stamp signel select - */ -typedef enum { - RTC_TS_SIGNAL_SEL_TAMPER0 = 0U, /**< Select tamper0 */ - RTC_TS_SIGNAL_SEL_TAMPER1 = 1U, /**< Select tamper1 */ -} rtc_ts_signal_sel_t; - -/** - * @brief Time stamp trigger style - */ -typedef enum { - RTC_TS_RISING_EDGE = 0U, /**< Rising edge */ - RTC_TS_FALLING_EDGE = 1U, /**< Falling edge */ -} rtc_ts_trigger_style_t; - -/** - * @brief Index of tamper - */ -typedef enum { - RTC_TAMPER_0 = 0U, /**< Tamper0 */ - RTC_TAMPER_1 = 1U, /**< Tamper1 */ -} rtc_tamper_idx_t; - -/** - * @brief Tamper trigger type - */ -typedef enum { - RTC_TAMPER_TRIGGER_LOW = 0U, /**< High trigger */ - RTC_TAMPER_TRIGGER_HIGH = 1U, /**< Low trigger */ -} rtc_tamper_trigger_t; - -/** - * @brief Tamper sampling frequency - */ -typedef enum { - RTC_TAMPER_SAMPLING_FREQ_32768 = 0U, /**< RTCCLK / 32768 */ - RTC_TAMPER_SAMPLING_FREQ_16384 = 1U, /**< RTCCLK / 16384 */ - RTC_TAMPER_SAMPLING_FREQ_8192 = 2U, /**< RTCCLK / 8192 */ - RTC_TAMPER_SAMPLING_FREQ_4096 = 3U, /**< RTCCLK / 4096 */ - RTC_TAMPER_SAMPLING_FREQ_2048 = 4U, /**< RTCCLK / 2048 */ - RTC_TAMPER_SAMPLING_FREQ_1024 = 5U, /**< RTCCLK / 1024 */ - RTC_TAMPER_SAMPLING_FREQ_512 = 6U, /**< RTCCLK / 512 */ - RTC_TAMPER_SAMPLING_FREQ_256 = 7U, /**< RTCCLK / 256 */ -} rtc_tamper_sampling_freq_t; - -/** - * @brief Tamper filter time - */ -typedef enum { - RTC_TAMPER_DURATION_1 = 0U, /**< Duration 1 sampling */ - RTC_TAMPER_DURATION_2 = 1U, /**< Duration 2 sampling */ - RTC_TAMPER_DURATION_4 = 2U, /**< Duration 4 sampling */ - RTC_TAMPER_DURATION_8 = 3U, /**< Duration 8 sampling */ -} rtc_tamper_duration_t; - -/** - * @brief Tamper structure - */ -typedef struct { - rtc_tamper_idx_t idx; /**< Index of tamper */ - rtc_tamper_trigger_t trig; /**< Trigger type */ - rtc_tamper_sampling_freq_t freq; /**< Sampling frequency */ - rtc_tamper_duration_t dur; /**< Filter time */ - type_func_t ts; /**< Enable/Disable trigger time stamp event */ -} rtc_tamper_t; - -/** - * @brief Wake-up clock - */ -typedef enum { - RTC_WAKEUP_CLOCK_DIV_16 = 0U, /**< RTCCLK / 16 */ - RTC_WAKEUP_CLOCK_DIV_8 = 1U, /**< RTCCLK / 8 */ - RTC_WAKEUP_CLOCK_DIV_4 = 2U, /**< RTCCLK / 4 */ - RTC_WAKEUP_CLOCK_DIV_2 = 3U, /**< RTCCLK / 2 */ - RTC_WAKEUP_CLOCK_1HZ = 4U, /**< 1Hz */ - RTC_WAKEUP_CLOCK_1HZ_PULS = 6U, /**< 1Hz and WUT + 65536 */ -} rtc_wakeup_clock_t; - -/** - * @brief RTC clock output type - */ -typedef enum { - RTC_CLOCK_OUTPUT_32768 = 0U, /**< 32768Hz */ - RTC_CLOCK_OUTPUT_1024 = 1U, /**< 1024Hz */ - RTC_CLOCK_OUTPUT_32 = 2U, /**< 32Hz */ - RTC_CLOCK_OUTPUT_1 = 3U, /**< 1Hz */ - RTC_CLOCK_OUTPUT_CAL_1 = 4U, /**< 1Hz after calibration */ - RTC_CLOCK_OUTPUT_EXA_1 = 5U, /**< Exact 1Hz */ -} rtc_clock_output_t; - -/** - * @ Calibration frequency - */ -typedef enum { - RTC_CALI_FREQ_10_SEC = 0U, /**< Calibrate every 10 seconds */ - RTC_CALI_FREQ_20_SEC = 1U, /**< Calibrate every 20 seconds */ - RTC_CALI_FREQ_1_MIN = 2U, /**< Calibrate every 1 minute */ - RTC_CALI_FREQ_2_MIN = 3U, /**< Calibrate every 2 minutes */ - RTC_CALI_FREQ_5_MIN = 4U, /**< Calibrate every 5 minutes */ - RTC_CALI_FREQ_10_MIN = 5U, /**< Calibrate every 10 minutes */ - RTC_CALI_FREQ_20_MIN = 6U, /**< Calibrate every 20 minutes */ - RTC_CALI_FREQ_1_SEC = 7U, /**< Calibrate every 1 second */ -} rtc_cali_freq_t; - -/** - * @brief Temperature compensate type - */ -typedef enum { - RTC_CALI_TC_NONE = 0U, /**< Temperature compensate disable */ - RTC_CALI_TC_AUTO_BY_HW = 1U, /**< Temperature compensate by hardware */ - RTC_CALI_TC_AUTO_BY_SF = 2U, /**< Temperature compensate by software */ - RTC_CALI_TC_AUTO_BY_HW_SF = 3U, /**< Temperature compensate by hardware, trigger by software */ -} rtc_cali_tc_t; - -/** - * @ Calculate frequency - */ -typedef enum { - RTC_CALI_CALC_FREQ_10_SEC = 0U, /**< Calculate every 10 seconds */ - RTC_CALI_CALC_FREQ_20_SEC = 1U, /**< Calculate every 20 seconds */ - RTC_CALI_CALC_FREQ_1_MIN = 2U, /**< Calculate every 1 minute */ - RTC_CALI_CALC_FREQ_2_MIN = 3U, /**< Calculate every 2 minutes */ - RTC_CALI_CALC_FREQ_5_MIN = 4U, /**< Calculate every 5 minutes */ - RTC_CALI_CALC_FREQ_10_MIN = 5U, /**< Calculate every 10 minutes */ - RTC_CALI_CALC_FREQ_20_MIN = 6U, /**< Calculate every 20 minutes */ - RTC_CALI_CALC_FREQ_1_HOUR = 7U, /**< Calculate every 1 hour */ -} rtc_cali_calc_freq_t; - -/** - * @brief Calibration algorithm - */ -typedef enum { - RTC_CALI_CALC_4 = 0U, /**< 4-polynomial */ - RTC_CALI_CALC_2 = 1U, /**< 2-parabola */ -} rtc_cali_calc_t; - -/** - * @brief Calibration structure - */ -typedef struct { - rtc_cali_freq_t cali_freq; /**< calibrate frequency */ - rtc_cali_tc_t tc; /**< Temperature compensate type */ - rtc_cali_calc_freq_t calc_freq; /**< Calculate frequency */ - rtc_cali_calc_t calc; /**< algorithm */ - type_func_t acc; /**< Enable/Disable decimal accumulate */ -} rtc_cali_t; - -/** - * @brief Interrupt type - */ -typedef enum { - RTC_IT_SEC = (1U << 0), /**< Second */ - RTC_IT_MIN = (1U << 1), /**< Minute */ - RTC_IT_HR = (1U << 2), /**< Hour */ - RTC_IT_DAY = (1U << 3), /**< Day */ - RTC_IT_MON = (1U << 4), /**< Month */ - RTC_IT_YR = (1U << 5), /**< Year */ - RTC_IT_ALMA = (1U << 8), /**< Alarm-A */ - RTC_IT_ALMB = (1U << 9), /**< Alarm-B */ - RTC_IT_TS = (1U << 10), /**< Time stamp */ - RTC_IT_TSOV = (1U << 11), /**< Time stamp overflow */ - RTC_IT_TP0 = (1U << 12), /**< Tamper-0 */ - RTC_IT_TP1 = (1U << 13), /**< Tamper-1 */ - RTC_IT_RSC = (1U << 16), /**< Synchronous complete */ - RTC_IT_SFC = (1U << 17), /**< Shift complete */ - RTC_IT_WU = (1U << 18), /**< Wake-up */ - RTC_IT_TCC = (1U << 24), /**< Temperature compensate complete */ - RTC_IT_TCE = (1U << 25), /**< Temperature compensate error */ -} rtc_it_t; - -/** - * @brief Interrupt flag - */ -typedef enum { - RTC_IF_SEC = (1U << 0), /**< Second */ - RTC_IF_MIN = (1U << 1), /**< Minute */ - RTC_IF_HR = (1U << 2), /**< Hour */ - RTC_IF_DAY = (1U << 3), /**< Day */ - RTC_IF_MON = (1U << 4), /**< Month */ - RTC_IF_YR = (1U << 5), /**< Year */ - RTC_IF_ALMA = (1U << 8), /**< Alarm-A */ - RTC_IF_ALMB = (1U << 9), /**< Alarm-B */ - RTC_IF_TS = (1U << 10), /**< Time stamp */ - RTC_IF_TSOV = (1U << 11), /**< Time stamp overflow */ - RTC_IF_TP0 = (1U << 12), /**< Tamper-0 */ - RTC_IF_TP1 = (1U << 13), /**< Tamper-1 */ - RTC_IF_RSC = (1U << 16), /**< Synchronous complete */ - RTC_IF_SFC = (1U << 17), /**< Shift complete */ - RTC_IF_WU = (1U << 18), /**< Wake-up */ - RTC_IF_TCC = (1U << 24), /**< Temperature compensate complete */ - RTC_IF_TCE = (1U << 25), /**< Temperature compensate error */ -} rtc_flag_t; -/** - * @} - */ - -/** @defgroup RTC_Public_Macro RTC Public Macros - * @{ - */ -#define RTC_UNLOCK() (WRITE_REG(RTC->WPR, 0x55AAAA55U)) -#define RTC_LOCK() (WRITE_REG(RTC->WPR, 0x0U)) -#define RTC_BY_PASS_ENABLE() \ -do { \ - RTC_UNLOCK(); \ - SET_BIT(RTC->CON, RTC_CON_SHDBP_MSK); \ - RTC_LOCK(); \ -} while (0) -#define RTC_BY_PASS_DISABLE() \ -do { \ - RTC_UNLOCK(); \ - CLEAR_BIT(RTC->CON, RTC_CON_SHDBP_MSK); \ - RTC_LOCK(); \ -} while (0) -#define RTC_SUMMER_TIME_ENABLE() \ -do { \ - RTC_UNLOCK(); \ - SET_BIT(RTC->CON, RTC_CON_ADD1H_MSK); \ - RTC_LOCK(); \ -} while (0) -#define RTC_SUMMER_TIME_DISABLE() \ -do { \ - RTC_UNLOCK(); \ - CLEAR_BIT(RTC->CON, RTC_CON_ADD1H_MSK); \ - RTC_LOCK(); \ -} while (0) -#define RTC_WINTER_TIME_ENABLE() \ -do { \ - RTC_UNLOCK(); \ - SET_BIT(RTC->CON, RTC_CON_SUB1H_MSK); \ - RTC_LOCK(); \ -} while (0) -#define RTC_WINTER_TIME_DISABLE() \ -do { \ - RTC_UNLOCK(); \ - CLEAR_BIT(RTC->CON, RTC_CON_SUB1H_MSK); \ - RTC_LOCK(); \ -} while (0) -/** - * @} - */ - -/** @defgroup CAN_Private_Macros CAN Private Macros - * @{ - */ -#define RTC_CALI_UNLOCK() (WRITE_REG(RTC->CALWPR, 0x699655AAU)) -#define RTC_CALI_LOCK() (WRITE_REG(RTC->CALWPR, 0x0U)) -#define ALARM_MASK_ALL 0x40808080U -#define RTC_TIMEOUT_VALUE 100U - -#define IS_SHIFT_SUB_SS(x) ((x) < (1U << 15)) -#define IS_RTC_HOUR_FORMAT(x) (((x) == RTC_HOUR_FORMAT_24) || \ - ((x) == RTC_HOUR_FORMAT_12)) -#define IS_RTC_OUTPUT_SEL(x) (((x) == RTC_OUTPUT_DISABLE) || \ - ((x) == RTC_OUTPUT_ALARM_A) || \ - ((x) == RTC_OUTPUT_ALARM_B) || \ - ((x) == RTC_OUTPUT_WAKEUP)) -#define IS_RTC_OUTPUT_POLARITY(x) (((x) == RTC_OUTPUT_POLARITY_HIGH) || \ - ((x) == RTC_OUTPUT_POLARITY_LOW)) -#define IS_RTC_SOURCE_SEL(x) (((x) == RTC_SOURCE_LOSC) || \ - ((x) == RTC_SOURCE_LRC) || \ - ((x) == RTC_SOURCE_HRC_DIV_1M ) || \ - ((x) == RTC_SOURCE_HOSC_DIV_1M)) -#define IS_RTC_ALARM(x) (((x) == RTC_ALARM_A) || \ - ((x) == RTC_ALARM_B)) -#define IS_RTC_ALARM_SEL(x) (((x) == RTC_SELECT_DAY) || \ - ((x) == RTC_SELECT_WEEK)) -#define IS_RTC_ALARM_MASK(x) (((x) == RTC_ALARM_MASK_NONE) || \ - ((x) == RTC_ALARM_MASK_WEEK_DAY) || \ - ((x) == RTC_ALARM_MASK_HOUR) || \ - ((x) == RTC_ALARM_MASK_MINUTE) || \ - ((x) == RTC_ALARM_MASK_SECOND) || \ - ((x) == RTC_ALARM_MASK_ALL)) -#define IS_RTC_ALARM_SS_MASK(x) (((x) == RTC_ALARM_SS_MASK_NONE) || \ - ((x) == RTC_ALARM_SS_MASK_14_1) || \ - ((x) == RTC_ALARM_SS_MASK_14_2) || \ - ((x) == RTC_ALARM_SS_MASK_14_3) || \ - ((x) == RTC_ALARM_SS_MASK_14_4) || \ - ((x) == RTC_ALARM_SS_MASK_14_5) || \ - ((x) == RTC_ALARM_SS_MASK_14_6) || \ - ((x) == RTC_ALARM_SS_MASK_14_7) || \ - ((x) == RTC_ALARM_SS_MASK_14_8) || \ - ((x) == RTC_ALARM_SS_MASK_14_9) || \ - ((x) == RTC_ALARM_SS_MASK_14_10) || \ - ((x) == RTC_ALARM_SS_MASK_14_11) || \ - ((x) == RTC_ALARM_SS_MASK_14_12) || \ - ((x) == RTC_ALARM_SS_MASK_14_13) || \ - ((x) == RTC_ALARM_SS_MASK_14) || \ - ((x) == RTC_ALARM_SS_MASK_ALL)) -#define IS_RTC_TS_SIGNAL(x) (((x) == RTC_TS_SIGNAL_SEL_TAMPER0) || \ - ((x) == RTC_TS_SIGNAL_SEL_TAMPER1)) -#define IS_RTC_TS_STYLE(x) (((x) == RTC_TS_RISING_EDGE) || \ - ((x) == RTC_TS_FALLING_EDGE)) -#define IS_RTC_FORMAT(x) (((x) == RTC_FORMAT_DEC) || \ - ((x) == RTC_FORMAT_BCD)) -#define IS_RTC_TAMPER(x) (((x) == RTC_TAMPER_0) || \ - ((x) == RTC_TAMPER_1)) -#define IS_RTC_TAMPER_TRIGGER(x) (((x) == RTC_TAMPER_TRIGGER_LOW) || \ - ((x) == RTC_TAMPER_TRIGGER_HIGH)) -#define IS_RTC_TAMPER_SAMPLING_FREQ(x) (((x) == RTC_TAMPER_SAMPLING_FREQ_32768) || \ - ((x) == RTC_TAMPER_SAMPLING_FREQ_16384) || \ - ((x) == RTC_TAMPER_SAMPLING_FREQ_8192) || \ - ((x) == RTC_TAMPER_SAMPLING_FREQ_4096) || \ - ((x) == RTC_TAMPER_SAMPLING_FREQ_2048) || \ - ((x) == RTC_TAMPER_SAMPLING_FREQ_1024) || \ - ((x) == RTC_TAMPER_SAMPLING_FREQ_512) || \ - ((x) == RTC_TAMPER_SAMPLING_FREQ_256)) -#define IS_RTC_TAMPER_DURATION(x) (((x) == RTC_TAMPER_DURATION_1) || \ - ((x) == RTC_TAMPER_DURATION_2) || \ - ((x) == RTC_TAMPER_DURATION_4) || \ - ((x) == RTC_TAMPER_DURATION_8)) -#define IS_RTC_WAKEUP_CLOCK(x) (((x) == RTC_WAKEUP_CLOCK_DIV_16) || \ - ((x) == RTC_WAKEUP_CLOCK_DIV_8) || \ - ((x) == RTC_WAKEUP_CLOCK_DIV_4) || \ - ((x) == RTC_WAKEUP_CLOCK_DIV_2) || \ - ((x) == RTC_WAKEUP_CLOCK_1HZ) || \ - ((x) == RTC_WAKEUP_CLOCK_1HZ_PULS)) -#define IS_RTC_CLOCK_OUTPUT(x) (((x) == RTC_CLOCK_OUTPUT_32768) || \ - ((x) == RTC_CLOCK_OUTPUT_1024) || \ - ((x) == RTC_CLOCK_OUTPUT_32) || \ - ((x) == RTC_CLOCK_OUTPUT_1) || \ - ((x) == RTC_CLOCK_OUTPUT_CAL_1) || \ - ((x) == RTC_CLOCK_OUTPUT_EXA_1)) -#define IS_RTC_CALI_FREQ(x) (((x) == RTC_CALI_FREQ_10_SEC) || \ - ((x) == RTC_CALI_FREQ_20_SEC) || \ - ((x) == RTC_CALI_FREQ_1_MIN) || \ - ((x) == RTC_CALI_FREQ_2_MIN) || \ - ((x) == RTC_CALI_FREQ_5_MIN) || \ - ((x) == RTC_CALI_FREQ_10_MIN) || \ - ((x) == RTC_CALI_FREQ_20_MIN) || \ - ((x) == RTC_CALI_FREQ_1_SEC)) -#define IS_RTC_CALI_TC(x) (((x) == RTC_CALI_TC_NONE) || \ - ((x) == RTC_CALI_TC_AUTO_BY_HW) || \ - ((x) == RTC_CALI_TC_AUTO_BY_SF) || \ - ((x) == RTC_CALI_TC_AUTO_BY_HW_SF)) -#define IS_RTC_CALC_FREQ(x) (((x) == RTC_CALI_CALC_FREQ_10_SEC) || \ - ((x) == RTC_CALI_CALC_FREQ_20_SEC) || \ - ((x) == RTC_CALI_CALC_FREQ_1_MIN) || \ - ((x) == RTC_CALI_CALC_FREQ_2_MIN) || \ - ((x) == RTC_CALI_CALC_FREQ_5_MIN) || \ - ((x) == RTC_CALI_CALC_FREQ_10_MIN) || \ - ((x) == RTC_CALI_CALC_FREQ_20_MIN) || \ - ((x) == RTC_CALI_CALC_FREQ_1_HOUR)) -#define IS_RTC_CALI_CALC(x) (((x) == RTC_CALI_CALC_4) || \ - ((x) == RTC_CALI_CALC_2)) -#define IS_RTC_IT(x) (((x) == RTC_IT_SEC) || \ - ((x) == RTC_IT_MIN) || \ - ((x) == RTC_IT_HR) || \ - ((x) == RTC_IT_DAY) || \ - ((x) == RTC_IT_MON) || \ - ((x) == RTC_IT_YR) || \ - ((x) == RTC_IT_ALMA) || \ - ((x) == RTC_IT_ALMB) || \ - ((x) == RTC_IT_TS) || \ - ((x) == RTC_IT_TSOV) || \ - ((x) == RTC_IT_TP0) || \ - ((x) == RTC_IT_TP1) || \ - ((x) == RTC_IT_RSC) || \ - ((x) == RTC_IT_SFC) || \ - ((x) == RTC_IT_WU) || \ - ((x) == RTC_IT_TCC) || \ - ((x) == RTC_IT_TCE)) -#define IS_RTC_IF(x) (((x) == RTC_IF_SEC) || \ - ((x) == RTC_IF_MIN) || \ - ((x) == RTC_IF_HR) || \ - ((x) == RTC_IF_DAY) || \ - ((x) == RTC_IF_MON) || \ - ((x) == RTC_IF_YR) || \ - ((x) == RTC_IF_ALMA) || \ - ((x) == RTC_IF_ALMB) || \ - ((x) == RTC_IF_TS) || \ - ((x) == RTC_IF_TSOV) || \ - ((x) == RTC_IF_TP0) || \ - ((x) == RTC_IF_TP1) || \ - ((x) == RTC_IF_RSC) || \ - ((x) == RTC_IF_SFC) || \ - ((x) == RTC_IF_WU) || \ - ((x) == RTC_IF_TCC) || \ - ((x) == RTC_IF_TCE)) -#define IS_RTC_SECOND(x) ((x) < 60) -#define IS_RTC_MINUTE(x) ((x) < 60) -#define IS_RTC_HOUR(x) ((x) < 24) -#define IS_RTC_DAY(x) (((x) > 0) && ((x) < 32)) -#define IS_RTC_MONTH(x) (((x) > 0) && ((x) < 13)) -#define IS_RTC_YEAR(x) ((x) < 100) -/** - * @} - */ - -/** @addtogroup RTC_Public_Functions - * @{ - */ - -/** @addtogroup RTC_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -void ald_rtc_reset(void); -void ald_rtc_init(rtc_init_t *init); -void ald_rtc_source_select(rtc_source_sel_t sel); -/** - * @} - */ -/** @addtogroup RTC_Public_Functions_Group2 - * @{ - */ -/* Time and date operation functions */ -ald_status_t ald_rtc_set_time(rtc_time_t *time, rtc_format_t format); -ald_status_t ald_rtc_set_date(rtc_date_t *date, rtc_format_t format); -void ald_rtc_get_time(rtc_time_t *time, rtc_format_t format); -void ald_rtc_get_date(rtc_date_t *date, rtc_format_t format); -int32_t ald_rtc_get_date_time(rtc_date_t *date, rtc_time_t *time, rtc_format_t format); -/** - * @} - */ -/** @addtogroup RTC_Public_Functions_Group3 - * @{ - */ -/* Alarm functions */ -void ald_rtc_set_alarm(rtc_alarm_t *alarm, rtc_format_t format); -void ald_rtc_get_alarm(rtc_alarm_t *alarm, rtc_format_t format); -/** - * @} - */ -/** @addtogroup RTC_Public_Functions_Group4 - * @{ - */ -/* Time stamp functions */ -void ald_rtc_set_time_stamp(rtc_ts_signal_sel_t sel, rtc_ts_trigger_style_t style); -void ald_rtc_cancel_time_stamp(void); -void ald_rtc_get_time_stamp(rtc_time_t *ts_time, rtc_date_t *ts_date, rtc_format_t format); -/** - * @} - */ -/** @addtogroup RTC_Public_Functions_Group5 - * @{ - */ -/* Tamper functions */ -void ald_rtc_set_tamper(rtc_tamper_t *tamper); -void ald_rtc_cancel_tamper(rtc_tamper_idx_t idx); -/** - * @} - */ -/** @addtogroup RTC_Public_Functions_Group6 - * @{ - */ -/* Wakeup functions */ -void ald_rtc_set_wakeup(rtc_wakeup_clock_t clock, uint16_t value); -void ald_rtc_cancel_wakeup(void); -uint16_t ald_rtc_get_wakeup_timer_value(void); -/** - * @} - */ -/** @addtogroup RTC_Public_Functions_Group7 - * @{ - */ -/* Clock output functions */ -ald_status_t ald_rtc_set_clock_output(rtc_clock_output_t clock); -void ald_rtc_cancel_clock_output(void); -/** - * @} - */ -/** @addtogroup RTC_Public_Functions_Group8 - * @{ - */ -/* Control functions */ -void ald_rtc_interrupt_config(rtc_it_t it, type_func_t state); -void ald_rtc_alarm_cmd(rtc_alarm_idx_t idx, type_func_t state); -ald_status_t ald_rtc_set_shift(type_func_t add_1s, uint16_t sub_ss); -void ald_rtc_set_cali(rtc_cali_t *config); -void ald_rtc_cancel_cali(void); -ald_status_t ald_rtc_get_cali_status(void); -void ald_rtc_write_temp(uint16_t temp); -it_status_t ald_rtc_get_it_status(rtc_it_t it); -flag_status_t ald_rtc_get_flag_status(rtc_flag_t flag); -void ald_rtc_clear_flag_status(rtc_flag_t flag); -/** - * @} - */ -/** - * @} - */ -/** - * @} - */ -/** - * @} - */ -#ifdef __cplusplus -} -#endif -#endif diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_smartcard.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_smartcard.h deleted file mode 100644 index 74401fecc1..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_smartcard.h +++ /dev/null @@ -1,274 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_usart.h - * @brief Header file of SMARTCARD driver module. - * - * @version V1.0 - * @date 25 Apr 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_SMARTCARD_H__ -#define __ALD_SMARTCARD_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" -#include "ald_usart.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup SMARTCARD - * @{ - */ - -/** @defgroup SMARTCARD_Public_Constants SMARTCARD Public constants - * @{ - */ - -/** - * @brief SMARTCARD error codes - */ -typedef enum { - SMARTCARD_ERROR_NONE = ((uint32_t)0x00U), /**< No error */ - SMARTCARD_ERROR_PE = ((uint32_t)0x01U), /**< Parity error */ - SMARTCARD_ERROR_NE = ((uint32_t)0x02U), /**< Noise error */ - SMARTCARD_ERROR_FE = ((uint32_t)0x04U), /**< frame error */ - SMARTCARD_ERROR_ORE = ((uint32_t)0x08U), /**< Overrun error */ - SMARTCARD_ERROR_DMA = ((uint32_t)0x10U), /**< DMA transfer error */ -} smartcard_error_t; - -/** - * @brief SMARTCARD Prescaler - */ -typedef enum { - SMARTCARD_PRESCALER_SYSCLK_DIV2 = ((uint32_t)0x1U), /**< SYSCLK divided by 2 */ - SMARTCARD_PRESCALER_SYSCLK_DIV4 = ((uint32_t)0x2U), /**< SYSCLK divided by 4 */ - SMARTCARD_PRESCALER_SYSCLK_DIV6 = ((uint32_t)0x3U), /**< SYSCLK divided by 6 */ - SMARTCARD_PRESCALER_SYSCLK_DIV8 = ((uint32_t)0x4U), /**< SYSCLK divided by 8 */ - SMARTCARD_PRESCALER_SYSCLK_DIV10 = ((uint32_t)0x5U), /**< SYSCLK divided by 10 */ - SMARTCARD_PRESCALER_SYSCLK_DIV12 = ((uint32_t)0x6U), /**< SYSCLK divided by 12 */ - SMARTCARD_PRESCALER_SYSCLK_DIV14 = ((uint32_t)0x7U), /**< SYSCLK divided by 14 */ - SMARTCARD_PRESCALER_SYSCLK_DIV16 = ((uint32_t)0x8U), /**< SYSCLK divided by 16 */ - SMARTCARD_PRESCALER_SYSCLK_DIV18 = ((uint32_t)0x9U), /**< SYSCLK divided by 18 */ - SMARTCARD_PRESCALER_SYSCLK_DIV20 = ((uint32_t)0xAU), /**< SYSCLK divided by 20 */ - SMARTCARD_PRESCALER_SYSCLK_DIV22 = ((uint32_t)0xBU), /**< SYSCLK divided by 22 */ - SMARTCARD_PRESCALER_SYSCLK_DIV24 = ((uint32_t)0xCU), /**< SYSCLK divided by 24 */ - SMARTCARD_PRESCALER_SYSCLK_DIV26 = ((uint32_t)0xDU), /**< SYSCLK divided by 26 */ - SMARTCARD_PRESCALER_SYSCLK_DIV28 = ((uint32_t)0xEU), /**< SYSCLK divided by 28 */ - SMARTCARD_PRESCALER_SYSCLK_DIV30 = ((uint32_t)0xFU), /**< SYSCLK divided by 30 */ - SMARTCARD_PRESCALER_SYSCLK_DIV32 = ((uint32_t)0x10U), /**< SYSCLK divided by 32 */ - SMARTCARD_PRESCALER_SYSCLK_DIV34 = ((uint32_t)0x11U), /**< SYSCLK divided by 34 */ - SMARTCARD_PRESCALER_SYSCLK_DIV36 = ((uint32_t)0x12U), /**< SYSCLK divided by 36 */ - SMARTCARD_PRESCALER_SYSCLK_DIV38 = ((uint32_t)0x13U), /**< SYSCLK divided by 38 */ - SMARTCARD_PRESCALER_SYSCLK_DIV40 = ((uint32_t)0x14U), /**< SYSCLK divided by 40 */ - SMARTCARD_PRESCALER_SYSCLK_DIV42 = ((uint32_t)0x15U), /**< SYSCLK divided by 42 */ - SMARTCARD_PRESCALER_SYSCLK_DIV44 = ((uint32_t)0x16U), /**< SYSCLK divided by 44 */ - SMARTCARD_PRESCALER_SYSCLK_DIV46 = ((uint32_t)0x17U), /**< SYSCLK divided by 46 */ - SMARTCARD_PRESCALER_SYSCLK_DIV48 = ((uint32_t)0x18U), /**< SYSCLK divided by 48 */ - SMARTCARD_PRESCALER_SYSCLK_DIV50 = ((uint32_t)0x19U), /**< SYSCLK divided by 50 */ - SMARTCARD_PRESCALER_SYSCLK_DIV52 = ((uint32_t)0x1AU), /**< SYSCLK divided by 52 */ - SMARTCARD_PRESCALER_SYSCLK_DIV54 = ((uint32_t)0x1BU), /**< SYSCLK divided by 54 */ - SMARTCARD_PRESCALER_SYSCLK_DIV56 = ((uint32_t)0x1CU), /**< SYSCLK divided by 56 */ - SMARTCARD_PRESCALER_SYSCLK_DIV58 = ((uint32_t)0x1DU), /**< SYSCLK divided by 58 */ - SMARTCARD_PRESCALER_SYSCLK_DIV60 = ((uint32_t)0x1EU), /**< SYSCLK divided by 60 */ - SMARTCARD_PRESCALER_SYSCLK_DIV62 = ((uint32_t)0x1FU), /**< SYSCLK divided by 62 */ -} smartcard_prescaler_t; - -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Types SMARTCARD Public Types - * @{ - */ - -/** - * @brief SMARTCARD Init Structure definition - */ -typedef struct { - uint32_t baud; /**< This member configures the SmartCard communication baud rate. */ - usart_word_length_t word_length;/**< Specifies the number of data bits transmitted or received in a frame. */ - usart_stop_bits_t stop_bits; /**< Specifies the number of stop bits transmitted. */ - usart_parity_t parity; /**< Specifies the parity mode. - @note When parity is enabled, the computed parity is inserted - at the MSB position of the transmitted data (9th bit when - the word length is set to 9 data bits; 8th bit when the - word length is set to 8 data bits).*/ - usart_mode_t mode; /**< Specifies whether the Receive or Transmit mode is enabled or disabled. */ - usart_cpol_t polarity; /**< Specifies the steady state of the serial clock. */ - usart_cpha_t phase; /**< Specifies the clock transition on which the bit capture is made.*/ - usart_last_bit_t last_bit; /**< Specifies whether the clock pulse corresponding to the last transmitted - data bit (MSB) has to be output on the SCLK pin in synchronous mode. - This parameter can be a value of @ref usart_last_bit_t */ - smartcard_prescaler_t prescaler;/**< Specifies the SmartCard Prescaler value used for dividing the system clock - to provide the smartcard clock. The value given in the register (5 significant bits) - is multiplied by 2 to give the division factor of the source clock frequency. */ - uint32_t guard_time; /**< Specifies the SmartCard Guard Time value in terms of number of baud clocks */ - type_func_t nack; /**< Specifies the SmartCard NACK Transmission state. */ -} smartcard_init_t; - -/** - * @brief ALD state structures definition - */ -typedef enum { - SMARTCARD_STATE_RESET = 0x00U, /**< Peripheral is not yet Initialized */ - SMARTCARD_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - SMARTCARD_STATE_BUSY = 0x02U, /**< an internal process is ongoing */ - SMARTCARD_STATE_BUSY_TX = 0x11U, /**< Data Transmission process is ongoing */ - SMARTCARD_STATE_BUSY_RX = 0x21U, /**< Data Reception process is ongoing */ - SMARTCARD_STATE_BUSY_TX_RX = 0x31U, /**< Data Transmission and Reception process is ongoing */ - SMARTCARD_STATE_TIMEOUT = 0x03U, /**< Timeout state */ - SMARTCARD_STATE_ERROR = 0x04U, /**< Error */ -} smartcard_state_t; - - -/** - * @brief SMARTCARD handle structure definition - */ -typedef struct smartcard_handle_s { - USART_TypeDef *perh; /**< USART registers base address */ - smartcard_init_t init; /**< SmartCard communication parameters */ - uint8_t *tx_buf; /**< Pointer to SmartCard Tx transfer Buffer */ - uint16_t tx_size; /**< SmartCard Tx Transfer size */ - uint16_t tx_count; /**< SmartCard Tx Transfer Counter */ - uint8_t *rx_buf; /**< Pointer to SmartCard Rx transfer Buffer */ - uint16_t rx_size; /**< SmartCard Rx Transfer size */ - uint16_t rx_count; /**< SmartCard Rx Transfer Counter */ -#ifdef ALD_DMA - dma_handle_t hdmatx; /**< SmartCard Tx DMA Handle parameters */ - dma_handle_t hdmarx; /**< SmartCard Rx DMA Handle parameters */ -#endif - lock_state_t lock; /**< Locking object */ - smartcard_state_t state; /**< SmartCard communication state */ - uint32_t err_code; /**< SmartCard Error code */ - - void (*tx_cplt_cbk)(struct smartcard_handle_s *arg); /**< Tx completed callback */ - void (*rx_cplt_cbk)(struct smartcard_handle_s *arg); /**< Rx completed callback */ - void (*error_cbk)(struct smartcard_handle_s *arg); /**< error callback */ -} smartcard_handle_t; - -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Macros SMARTCARD Public Macros - * @{ - */ - -/** @defgroup SMARTCARD_Public_Macros_1 SMARTCARD handle reset - * @{ - */ -#define SMARTCARD_RESET_HANDLE_STATE(handle) ((handle)->state = SMARTCARD_STATE_RESET) -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Macros_2 SMARTCARD flush data - * @{ - */ -#define SMARTCARD_FLUSH_DRREGISTER(handle) ((handle)->perh->DATA) -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Macros_3 SMARTCARD enable - * @{ - */ -#define SMARTCARD_ENABLE(handle) (SET_BIT((handle)->perh->CON0, USART_CON0_EN_MSK)) -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Macros_4 SMARTCARD disable - * @{ - */ -#define SMARTCARD_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON0, USART_CON0_EN_MSK)) -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup SMARTCARD_Private_Macros SMARTCARD Private Macros - * @{ - */ - -#define IS_SMARTCARD_PRESCALER(x) (((x) >= SMARTCARD_PRESCALER_SYSCLK_DIV2) && \ - ((x) <= SMARTCARD_PRESCALER_SYSCLK_DIV62)) -/** - * @} - */ - -/** @addtogroup SMARTCARD_Public_Functions - * @{ - */ - -/** @addtogroup SMARTCARD_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -ald_status_t ald_smartcard_init(smartcard_handle_t *hperh); -ald_status_t ald_smartcard_reset(smartcard_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup SMARTCARD_Public_Functions_Group2 - * @{ - */ -/* IO operation functions */ -ald_status_t ald_smartcard_send(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_smartcard_recv(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_smartcard_send_by_it(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_smartcard_recv_by_it(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size); -#ifdef ALD_DMA -ald_status_t ald_smartcard_send_by_dma(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_smartcard_recv_by_dma(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -#endif -void ald_smartcard_irq_handler(smartcard_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup SMARTCARD_Public_Functions_Group3 - * @{ - */ -/* Peripheral State and Errors functions functions */ -smartcard_state_t ald_smartcard_get_state(smartcard_handle_t *hperh); -uint32_t ald_smartcard_get_error(smartcard_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_SMARTCARD_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_spi.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_spi.h deleted file mode 100644 index 1a7c7c7e5e..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_spi.h +++ /dev/null @@ -1,387 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_spi.c - * @brief Header file of SPI module driver. - * - * @version V1.0 - * @date 13 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_SPI_H__ -#define __ALD_SPI_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup SPI - * @{ - */ - -/** @defgroup SPI_Public_Types SPI Public Types - * @{ - */ - -/** - * @brief clock phase - */ -typedef enum { - SPI_CPHA_FIRST = 0U, /**< Transiting data in the first edge */ - SPI_CPHA_SECOND = 1U, /**< Transiting data in the seconde edge */ -} spi_cpha_t; - -/** - * @brief clock polarity - */ -typedef enum { - SPI_CPOL_LOW = 0U, /**< Polarity hold low when spi-bus is idle */ - SPI_CPOL_HIGH = 1U, /**< Polarity hold high when spi-bus is idle */ -} spi_cpol_t; - -/** - * @brief master selection - */ -typedef enum { - SPI_MODE_SLAVER = 0U, /**< Slave mode */ - SPI_MODE_MASTER = 1U, /**< Master mode */ -} spi_mode_t; - -/** - * @brief baud rate control - */ -typedef enum { - SPI_BAUD_2 = 0U, /**< fpclk/2 */ - SPI_BAUD_4 = 1U, /**< fpclk/4 */ - SPI_BAUD_8 = 2U, /**< fpclk/8 */ - SPI_BAUD_16 = 3U, /**< fpclk/16 */ - SPI_BAUD_32 = 4U, /**< fpclk/32 */ - SPI_BAUD_64 = 5U, /**< fpclk/64 */ - SPI_BAUD_128 = 6U, /**< fpclk/128 */ - SPI_BAUD_256 = 7U, /**< fpclk/256 */ -} spi_baud_t; - -/** - * @brief frame format - */ -typedef enum { - SPI_FIRSTBIT_MSB = 0U, /**< MSB transmitted first */ - SPI_FIRSTBIT_LSB = 1U, /**< LSB transmitted first */ -} spi_firstbit_t; - -/** - * @brief data frame format - */ -typedef enum { - SPI_DATA_SIZE_8 = 0U, /**< 8-bit data frame format is selected for transmission/reception */ - SPI_DATA_SIZE_16 = 1U, /**< 16-bit data frame format is selected for transmission/reception */ -} spi_datasize_t; - -/** - * @brief interrupt control - */ -typedef enum { - SPI_IT_ERR = (1U << 5), /**< error interrupt */ - SPI_IT_RXBNE = (1U << 6), /**< rx buffer not empty interrupt */ - SPI_IT_TXBE = (1U << 7), /**< tx buffer empty interrupt */ -} spi_it_t; - -/** - * @brief interrupt flag - */ -typedef enum { - SPI_IF_RXBNE = (1U << 0), /**< receive buffer not empty */ - SPI_IF_TXBE = (1U << 1), /**< transmit buffer empty */ - SPI_IF_CRCERR = (1U << 4), /**< crc error flag */ - SPI_IF_MODF = (1U << 5), /**< mode fault */ - SPI_IF_OVE = (1U << 6), /**< overrun flag */ - SPI_IF_BUSY = (1U << 7), /**< busy flag */ -} spi_flag_t; - -/** - * @brief SPI error status - */ -typedef enum { - SPI_ERROR_NONE = 0U, /**< none */ - SPI_ERROR_MODF = 1U, /**< mode fault */ - SPI_ERROR_CRC = 2U, /**< crc error */ - SPI_ERROR_OVE = 4U, /**< overrun error */ - SPI_ERROR_DMA = 8U, /**< dma error */ - SPI_ERROR_FLAG = 0x10U, /**< interrupt flag error */ -} spi_error_t; - - - -/** - * @brief SPI state structures definition - */ -typedef enum { - SPI_STATE_RESET = 0x00U, /**< Peripheral is not initialized */ - SPI_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - SPI_STATE_BUSY = 0x02U, /**< an internal process is ongoing */ - SPI_STATE_BUSY_TX = 0x11U, /**< transmit is ongoing */ - SPI_STATE_BUSY_RX = 0x21U, /**< receive is ongoing */ - SPI_STATE_BUSY_TX_RX = 0x31U, /**< transmit and receive are ongoing */ - SPI_STATE_TIMEOUT = 0x03U, /**< Timeout state */ - SPI_STATE_ERROR = 0x04U, /**< Error */ -} spi_state_t; - -/** - * @brief SPI status definition - */ -typedef enum { - SPI_STATUS_RXBNE = (1U << 0), /**< Receive not empty status */ - SPI_STATUS_TXBE = (1U << 1), /**< Transmit empty status */ - SPI_STATUS_CRCERR = (1U << 4), /**< CRC error status */ - SPI_STATUS_MODEERR = (1U << 5), /**< Mode error status */ - SPI_STATUS_OVERR = (1U << 6), /**< Overflow status */ - SPI_STATUS_BUSY = (1U << 7), /**< Busy status */ - -} spi_status_t; - -/** - * @brief SPI direction definition - */ -typedef enum { - SPI_DIRECTION_2LINES = 0U, /**< 2 lines */ - SPI_DIRECTION_2LINES_RXONLY = 1U, /**< 2 lines only rx */ - SPI_DIRECTION_1LINE = 2U, /**< 1 line */ - SPI_DIRECTION_1LINE_RX = 3U, /**< 1 line only rx */ -} spi_direction_t; - -/** - * @brief SPI dma request definition - */ -typedef enum { - SPI_DMA_REQ_TX = 0U, /**< TX dma request */ - SPI_DMA_REQ_RX = 1U, /**< RX dma request */ -} spi_dma_req_t; - -/** - * @brief SPI TXE/RXNE status definition - */ -typedef enum { - SPI_SR_TXBE = 0U, /**< SR.TXE set */ - SPI_SR_RXBNE = 1U, /**< SR.RXNE set */ - SPI_SR_TXBE_RXBNE = 2U, /**< SR.TXE and SR.RXNE set */ -} spi_sr_status_t; - -/** - * @brief SPI init structure definition - */ -typedef struct { - spi_mode_t mode; /**< SPI mode */ - spi_direction_t dir; /**< SPI direction */ - spi_datasize_t data_size; /**< SPI data size */ - spi_baud_t baud; /**< SPI baudrate prescaler */ - spi_cpha_t phase; /**< SPI clock phase */ - spi_cpol_t polarity; /**< SPI clock polarity */ - spi_firstbit_t first_bit; /**< SPI first bit */ - type_func_t ss_en; /**< SPI ssm enable or disable */ - type_func_t crc_calc; /**< SPI crc calculation */ - uint16_t crc_poly; /**< SPI crc polynomial */ -} spi_init_t; - -/** - * @brief SPI handle structure definition - */ -typedef struct spi_handle_s { - SPI_TypeDef *perh; /**< SPI registers base address */ - spi_init_t init; /**< SPI communication parameters */ - uint8_t *tx_buf; /**< Pointer to SPI Tx transfer buffer */ - uint16_t tx_size; /**< SPI Tx transfer size */ - uint16_t tx_count; /**< SPI Tx transfer counter */ - uint8_t *rx_buf; /**< Pointer to SPI Rx transfer buffer */ - uint16_t rx_size; /**< SPI Rx Transfer size */ - uint16_t rx_count; /**< SPI Rx Transfer Counter */ -#ifdef ALD_DMA - dma_handle_t hdmatx; /**< SPI Tx DMA handle parameters */ - dma_handle_t hdmarx; /**< SPI Rx DMA handle parameters */ -#endif - lock_state_t lock; /**< Locking object */ - spi_state_t state; /**< SPI communication state */ - uint32_t err_code; /**< SPI error code */ - - void (*tx_cplt_cbk)(struct spi_handle_s *arg); /**< Tx completed callback */ - void (*rx_cplt_cbk)(struct spi_handle_s *arg); /**< Rx completed callback */ - void (*tx_rx_cplt_cbk)(struct spi_handle_s *arg); /**< Tx & Rx completed callback */ - void (*err_cbk)(struct spi_handle_s *arg); /**< error callback */ -} spi_handle_t; -/** - * @} - */ - -/** @defgroup SPI_Public_Macros SPI Public Macros - * @{ - */ -#define SPI_RESET_HANDLE_STATE(x) ((x)->state = SPI_STATE_RESET) -#define SPI_ENABLE(x) ((x)->perh->CON1 |= (1 << SPI_CON1_SPIEN_POS)) -#define SPI_DISABLE(x) ((x)->perh->CON1 &= ~(1 << SPI_CON1_SPIEN_POS)) -#define SPI_CRC_RESET(x) \ -do { \ - CLEAR_BIT((x)->perh->CON1, SPI_CON1_CRCEN_MSK); \ - SET_BIT((x)->perh->CON1, SPI_CON1_CRCEN_MSK); \ -} while (0) -#define SPI_CRCNEXT_ENABLE(x) (SET_BIT((x)->perh->CON1, SPI_CON1_NXTCRC_MSK)) -#define SPI_CRCNEXT_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_NXTCRC_MSK)) -#define SPI_RXONLY_ENABLE(x) (SET_BIT((x)->perh->CON1, SPI_CON1_RXO_MSK)) -#define SPI_RXONLY_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_RXO_MSK)) -#define SPI_1LINE_TX(x) (SET_BIT((x)->perh->CON1, SPI_CON1_BIDOEN_MSK)) -#define SPI_1LINE_RX(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_BIDOEN_MSK)) -#define SPI_SSI_HIGH(x) (SET_BIT((x)->perh->CON1, SPI_CON1_SSOUT_MSK)) -#define SPI_SSI_LOW(x) (CLEAR_BIT((x)->perh->CON1, SPI_CON1_SSOUT_MSK)) -#define SPI_SSOE_ENABLE(x) (SET_BIT((x)->perh->CON2, SPI_CON2_NSSOE_MSK)) -#define SPI_SSOE_DISABLE(x) (CLEAR_BIT((x)->perh->CON2, SPI_CON2_NSSOE_MSK)) -/** - * @} - */ - -/** @defgroup SPI_Private_Macros SPI Private Macros - * @{ - */ -#if defined(ES32F065x) || defined(ES32F033x) -#define IS_SPI(x) (((x) == SPI0) || ((x) == SPI1)) -#endif -#if defined(ES32F093x) -#define IS_SPI(x) (((x) == SPI0) || ((x) == SPI1) || ((x) == SPI2)) -#endif -#define IS_SPI_CPHA(x) (((x) == SPI_CPHA_FIRST) || \ - ((x) == SPI_CPHA_SECOND)) -#define IS_SPI_CPOL(x) (((x) == SPI_CPOL_LOW) || \ - ((x) == SPI_CPOL_HIGH)) -#define IS_SPI_MODE(x) (((x) == SPI_MODE_SLAVER) || \ - ((x) == SPI_MODE_MASTER)) -#define IS_SPI_BAUD(x) (((x) == SPI_BAUD_2) || \ - ((x) == SPI_BAUD_4) || \ - ((x) == SPI_BAUD_8) || \ - ((x) == SPI_BAUD_16) || \ - ((x) == SPI_BAUD_32) || \ - ((x) == SPI_BAUD_64) || \ - ((x) == SPI_BAUD_128) || \ - ((x) == SPI_BAUD_256)) -#define IS_SPI_DATASIZE(x) (((x) == SPI_DATA_SIZE_8) || \ - ((x) == SPI_DATA_SIZE_16)) -#define IS_SPI_FIRSTBIT(x) (((x) == SPI_FIRSTBIT_MSB) || \ - ((x) == SPI_FIRSTBIT_LSB)) -#define IS_SPI_BIDOE(x) (((x) == SPI_BID_RX) || \ - ((x) == SPI_BID_TX)) -#define IS_SPI_BIDMODE(x) (((x) == SPI_BIDMODE_DUAL) || \ - ((x) == SPI_BIDMODE_SOLE)) -#define IS_SPI_DIRECTION(x) (((x) == SPI_DIRECTION_2LINES) || \ - ((x) == SPI_DIRECTION_2LINES_RXONLY) || \ - ((x) == SPI_DIRECTION_1LINE) || \ - ((x) == SPI_DIRECTION_1LINE_RX)) -#define IS_SPI_DMA_REQ(x) (((x) == SPI_DMA_REQ_TX) || \ - ((x) == SPI_DMA_REQ_RX)) -#define IS_SPI_SR_STATUS(x) (((x) == SPI_SR_TXBE) || \ - ((x) == SPI_SR_RXBNE) || \ - ((x) == SPI_SR_TXBE_RXBNE)) -#define IS_SPI_IT(x) (((x) == SPI_IT_ERR) || \ - ((x) == SPI_IT_RXBNE) || \ - ((x) == SPI_IT_TXBE)) -#define IS_SPI_IF(x) (((x) == SPI_IF_RXBNE) || \ - ((x) == SPI_IF_TXBE) || \ - ((x) == SPI_IF_CRCERR) || \ - ((x) == SPI_IF_MODF) || \ - ((x) == SPI_IF_OVE) || \ - ((x) == SPI_IF_BUSY)) -#define IS_SPI_STATUS(x) (((x) == SPI_STATUS_RXBNE) || \ - ((x) == SPI_STATUS_TXBE) || \ - ((x) == SPI_STATUS_CRCERR) || \ - ((x) == SPI_STATUS_MODEERR) || \ - ((x) == SPI_STATUS_OVERR) || \ - ((x) == SPI_STATUS_BUSY)) -/** - * @} - */ - -/** @addtogroup SPI_Public_Functions - * @{ - */ - -/** @addtogroup SPI_Public_Functions_Group1 - * @{ - */ - -ald_status_t ald_spi_init(spi_handle_t *hperh); -void ald_spi_reset(spi_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup SPI_Public_Functions_Group2 - * @{ - */ -int32_t ald_spi_send_byte_fast(spi_handle_t *hperh, uint8_t data); -int32_t ald_spi_send_byte_fast_1line(spi_handle_t *hperh, uint8_t data); -uint8_t ald_spi_recv_byte_fast(spi_handle_t *hperh); -ald_status_t ald_spi_send(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_spi_recv(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_spi_send_recv(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint32_t timeout); -ald_status_t ald_spi_send_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_spi_recv_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_spi_send_recv_by_it(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size); -#ifdef ALD_DMA -ald_status_t ald_spi_send_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_spi_recv_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_spi_send_recv_by_dma(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel); -ald_status_t ald_spi_dma_pause(spi_handle_t *hperh); -ald_status_t ald_spi_dma_resume(spi_handle_t *hperh); -ald_status_t ald_spi_dma_stop(spi_handle_t *hperh); -#endif -/** - * @} - */ - -/** @addtogroup SPI_Public_Functions_Group3 - * @{ - */ -void ald_spi_irq_handler(spi_handle_t *hperh); -void ald_spi_interrupt_config(spi_handle_t *hperh, spi_it_t it, type_func_t state); -void ald_spi_speed_config(spi_handle_t *hperh, spi_baud_t speed); -void ald_spi_dma_req_config(spi_handle_t *hperh, spi_dma_req_t req, type_func_t state); -it_status_t ald_spi_get_it_status(spi_handle_t *hperh, spi_it_t it); -flag_status_t spi_get_status(spi_handle_t *hperh, spi_status_t status); -flag_status_t ald_spi_get_flag_status(spi_handle_t *hperh, spi_flag_t flag); -void ald_spi_clear_flag_status(spi_handle_t *hperh, spi_flag_t flag); -/** - * @} - */ - -/** @addtogroup SPI_Public_Functions_Group4 - * @{ - */ -spi_state_t ald_spi_get_state(spi_handle_t *hperh); -uint32_t ald_spi_get_error(spi_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif -#endif diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_syscfg.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_syscfg.h deleted file mode 100644 index 35844c887e..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_syscfg.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_syscfg.h - * @brief SYSCFG module driver. - * - * @version V1.0 - * @date 04 Jun 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_SYSCFG_H__ -#define __ALD_SYSCFG_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup SYSCFG SYSCFG - * @brief SYSCFG module driver - * @{ - */ - -/** @defgroup SYSCFG_Public_Macros SYSCFG Public Macros - * @{ - */ -#define SYSCFG_LOCK() WRITE_REG(SYSCFG->PROT, 0x0U) -#define SYSCFG_UNLOCK() WRITE_REG(SYSCFG->PROT, 0x55AA6996U) -#define GET_SYSCFG_LOCK() READ_BIT(SYSCFG->PROT, SYSCFG_PROT_PROT_MSK) - -#define BOOT_FROM_BOOT_ROM() \ -do { \ - SYSCFG_UNLOCK(); \ - SET_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_BRRMPEN_MSK); \ - CLEAR_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_BFRMPEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) - -#define BOOT_FROM_BOOT_FLASH() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_BRRMPEN_MSK); \ - SET_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_BFRMPEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) - -#define BOOT_FROM_FLASH() \ -do { \ - SYSCFG_UNLOCK(); \ - CLEAR_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_BRRMPEN_MSK); \ - CLEAR_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_BFRMPEN_MSK); \ - SYSCFG_LOCK(); \ -} while (0) -/** - * @} - */ - - -/** @defgroup SYSCFG_Public_Functions SYSCFG Public Functions - * @{ - */ -__STATIC_INLINE__ void ald_vtor_config(uint32_t offset, type_func_t status) -{ - SYSCFG_UNLOCK(); - - if (status) { - MODIFY_REG(SYSCFG->VTOR, SYSCFG_VTOR_VTO_MSK, (offset & ~0x3FU)); - SET_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_VTOEN_MSK); - } - else { - CLEAR_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_VTOEN_MSK); - } - - SYSCFG_LOCK(); - return; -} -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_timer.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_timer.h deleted file mode 100644 index 538fc0ca0b..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_timer.h +++ /dev/null @@ -1,1154 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_timer.h - * @brief TIMER module driver. - * This is the common part of the TIMER initialization - * - * @version V1.0 - * @date 06 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_TIMER_H__ -#define __ALD_TIMER_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup TIMER - * @{ - */ - -/** @defgroup TIMER_Public_Types TIMER Public Types - * @{ - */ - -/** - * @brief TIMER counter mode - */ -typedef enum { - TIMER_CNT_MODE_UP = 0U, /**< Counter mode up */ - TIMER_CNT_MODE_DOWN = 1U, /**< Counter mode down */ - TIMER_CNT_MODE_CENTER1 = 2U, /**< Counter mode center1 */ - TIMER_CNT_MODE_CENTER2 = 3U, /**< Counter mode center2 */ - TIMER_CNT_MODE_CENTER3 = 4U, /**< Counter mode center3 */ -} timer_cnt_mode_t; - -/** - * @brief TIMER clock division - */ -typedef enum { - TIMER_CLOCK_DIV1 = 0U, /**< No prescaler is used */ - TIMER_CLOCK_DIV2 = 1U, /** Clock is divided by 2 */ - TIMER_CLOCK_DIV4 = 2U, /** Clock is divided by 4 */ -} timer_clock_division_t; - -/** - * @brief TIMER output compare and PWM modes - */ -typedef enum { - TIMER_OC_MODE_TIMERING = 0U, /**< Output compare mode is timering */ - TIMER_OC_MODE_ACTIVE = 1U, /**< Output compare mode is active */ - TIMER_OC_MODE_INACTIVE = 2U, /**< Output compare mode is inactive */ - TIMER_OC_MODE_TOGGLE = 3U, /**< Output compare mode is toggle */ - TIMER_OC_MODE_FORCE_INACTIVE = 4U, /**< Output compare mode is force inactive */ - TIMER_OC_MODE_FORCE_ACTIVE = 5U, /**< Output compare mode is force active */ - TIMER_OC_MODE_PWM1 = 6U, /**< Output compare mode is pwm1 */ - TIMER_OC_MODE_PWM2 = 7U, /**< Output compare mode is pwm2 */ -} timer_oc_mode_t; - -/** - * @brief TIMER output compare polarity - */ -typedef enum { - TIMER_OC_POLARITY_HIGH = 0U, /**< Output compare polarity is high */ - TIMER_OC_POLARITY_LOW = 1U, /**< Output compare polarity is low */ -} timer_oc_polarity_t; - -/** - * @brief TIMER complementary output compare polarity - */ -typedef enum { - TIMER_OCN_POLARITY_HIGH = 0U, /**< Complementary output compare polarity is high */ - TIMER_OCN_POLARITY_LOW = 1U, /**< Complementary output compare polarity is low */ -} timer_ocn_polarity_t; - -/** - * @brief TIMER output compare idle state - */ -typedef enum { - TIMER_OC_IDLE_RESET = 0U, /**< Output compare idle state is reset */ - TIMER_OC_IDLE_SET = 1U, /**< Output compare idle state is set */ -} timer_oc_idle_t; - -/** - * @brief TIMER complementary output compare idle state - */ -typedef enum { - TIMER_OCN_IDLE_RESET = 0U, /**< Complementary output compare idle state is reset */ - TIMER_OCN_IDLE_SET = 1U, /**< Complementary output compare idle state is set */ -} timer_ocn_idle_t; - -/** - * @brief TIMER channel - */ -typedef enum { - TIMER_CHANNEL_1 = 0U, /**< Channel 1 */ - TIMER_CHANNEL_2 = 1U, /**< Channel 2 */ - TIMER_CHANNEL_3 = 2U, /**< Channel 3 */ - TIMER_CHANNEL_4 = 4U, /**< Channel 4 */ - TIMER_CHANNEL_ALL = 0xFU, /**< All channel */ -} timer_channel_t; - -/** - * @brief TIMER one pulse mode - */ -typedef enum { - TIMER_OP_MODE_REPEAT = 0U, /**< Repetitive */ - TIMER_OP_MODE_SINGLE = 1U, /**< single */ -} timer_op_mode_t; - -/** - * @brief TIMER one pulse output channel - */ -typedef enum { - TIMER_OP_OUTPUT_CHANNEL_1 = 0U, /**< One pulse output channal 1 */ - TIMER_OP_OUTPUT_CHANNEL_2 = 1U, /**< One pulse output channal 2 */ -} timer_op_output_channel_t; - -/** - * @brief TIMER time base configuration structure definition - */ -typedef struct { - uint32_t prescaler; /**< Specifies the prescaler value used to divide the TIMER clock. */ - timer_cnt_mode_t mode; /**< Specifies the counter mode. */ - uint32_t period; /**< Specifies the period value to be loaded into ARR at the next update event. */ - timer_clock_division_t clk_div; /**< Specifies the clock division.*/ - uint32_t re_cnt; /**< Specifies the repetition counter value. */ -} timer_base_init_t; - -/** - * @brief TIMER output compare configuration structure definition - */ -typedef struct { - timer_oc_mode_t oc_mode; /**< Specifies the TIMER mode. */ - uint32_t pulse; /**< Specifies the pulse value to be loaded into the Capture Compare Register. */ - timer_oc_polarity_t oc_polarity; /**< Specifies the output polarity. */ - timer_ocn_polarity_t ocn_polarity; /**< Specifies the complementary output polarity. */ - type_func_t oc_fast_en; /**< Specifies the Fast mode state. */ - timer_oc_idle_t oc_idle; /**< Specifies the TIMER Output Compare pin state during Idle state. */ - timer_ocn_idle_t ocn_idle; /**< Specifies the TIMER Output Compare pin state during Idle state. */ -} timer_oc_init_t; - -/** - * @brief State structures definition - */ -typedef enum { - TIMER_STATE_RESET = 0x00U, /**< Peripheral not yet initialized or disabled */ - TIMER_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - TIMER_STATE_BUSY = 0x02U, /**< An internal process is ongoing */ - TIMER_STATE_TIMEREOUT = 0x03U, /**< Timeout state */ - TIMER_STATE_ERROR = 0x04U, /**< Reception process is ongoing */ -} timer_state_t; - -/** - * @brief Active channel structures definition - */ -typedef enum { - TIMER_ACTIVE_CHANNEL_1 = 0x01U, /**< The active channel is 1 */ - TIMER_ACTIVE_CHANNEL_2 = 0x02U, /**< The active channel is 2 */ - TIMER_ACTIVE_CHANNEL_3 = 0x04U, /**< The active channel is 3 */ - TIMER_ACTIVE_CHANNEL_4 = 0x08U, /**< The active channel is 4 */ - TIMER_ACTIVE_CHANNEL_CLEARED = 0x00U, /**< All active channels cleared */ -} timer_active_channel_t; - -/** - * @brief TIMER time base handle structure definition - */ -typedef struct timer_handle_s { - TIMER_TypeDef *perh; /**< Register base address */ - timer_base_init_t init; /**< TIMER Time Base required parameters */ - timer_active_channel_t ch; /**< Active channel */ - lock_state_t lock; /**< Locking object */ - timer_state_t state; /**< TIMER operation state */ - -#ifdef ALD_DMA - dma_handle_t hdma1; /**< Timer DMA handle parameters */ - dma_handle_t hdma2; -#endif - - void (*period_elapse_cbk)(struct timer_handle_s *arg); /**< Period elapse callback */ - void (*delay_elapse_cbk)(struct timer_handle_s *arg); /**< Delay_elapse callback */ - void (*capture_cbk)(struct timer_handle_s *arg); /**< Capture callback */ - void (*pwm_pulse_finish_cbk)(struct timer_handle_s *arg); /**< PWM_pulse_finish callback */ - void (*trigger_cbk)(struct timer_handle_s *arg); /**< Trigger callback */ - void (*break_cbk)(struct timer_handle_s *arg); /**< Break callback */ - void (*com_cbk)(struct timer_handle_s *arg); /**< commutation callback */ - void (*error_cbk)(struct timer_handle_s *arg); /**< Error callback */ -} timer_handle_t; - - -/** - * @brief TIMER encoder mode - */ -typedef enum { - TIMER_ENC_MODE_TI1 = 1U, /**< encoder mode 1 */ - TIMER_ENC_MODE_TI2 = 2U, /**< encoder mode 2 */ - TIMER_ENC_MODE_TI12 = 3U, /**< encoder mode 3 */ -} timer_encoder_mode_t; - -/** - * @brief TIMER input capture polarity - */ -typedef enum { - TIMER_IC_POLARITY_RISE = 0U, /**< Input capture polarity rising */ - TIMER_IC_POLARITY_FALL = 1U, /**< Input capture polarity falling */ -} timer_ic_polarity_t; - -/** - *@brief TIMER input capture selection - */ -typedef enum { - TIMER_IC_SEL_DIRECT = 1U, /**< IC1 -- TI1 */ - TIMER_IC_SEL_INDIRECT = 2U, /**< IC1 -- TI2 */ - TIMER_IC_SEL_TRC = 3U, /**< IC1 -- TRC */ -} timer_ic_select_t; - -/** - * @brief TIMER input capture prescaler - */ -typedef enum { - TIMER_IC_PSC_DIV1 = 0U, /**< Capture performed once every 1 events */ - TIMER_IC_PSC_DIV2 = 1U, /**< Capture performed once every 2 events */ - TIMER_IC_PSC_DIV4 = 2U, /**< Capture performed once every 4 events */ - TIMER_IC_PSC_DIV8 = 3U, /**< Capture performed once every 4 events */ -} timer_ic_prescaler_t; - -/** - * @brief TIMER encoder configuration structure definition - */ -typedef struct { - timer_encoder_mode_t mode; /**< Specifies the encoder mode */ - timer_ic_polarity_t ic1_polarity; /**< Specifies the active edge of the input signal */ - timer_ic_select_t ic1_sel; /**< Specifies the input */ - timer_ic_prescaler_t ic1_psc; /**< Specifies the Input Capture Prescaler */ - uint32_t ic1_filter; /**< Specifies the input capture filter */ - timer_ic_polarity_t ic2_polarity; /**< Specifies the active edge of the input signal */ - timer_ic_select_t ic2_sel; /**< Specifies the input */ - timer_ic_prescaler_t ic2_psc; /**< Specifies the Input Capture Prescaler */ - uint32_t ic2_filter; /**< Specifies the input capture filter */ -} timer_encoder_init_t; - -/** - * @brief TIMER input capture configuration structure definition - */ -typedef struct { - timer_ic_polarity_t polarity; /**< Specifies the active edge of the input signal */ - timer_ic_select_t sel; /**< Specifies the input */ - timer_ic_prescaler_t psc; /**< Specifies the Input Capture Prescaler */ - uint32_t filter; /**< Specifies the input capture filter */ -} timer_ic_init_t; - -/** - * @brief TIMER one pulse mode configuration structure definition - */ -typedef struct { - timer_oc_mode_t mode; /**< Specifies the TIMER mode */ - uint16_t pulse; /**< Specifies the pulse value */ - timer_oc_polarity_t oc_polarity; /**< Specifies the output polarity */ - timer_ocn_polarity_t ocn_polarity; /**< Specifies the complementary output polarity */ - timer_oc_idle_t oc_idle; /**< Specifies the TIMER Output Compare pin state during Idle state */ - timer_ocn_idle_t ocn_idle; /**< Specifies the TIMER Output Compare pin state during Idle state */ - timer_ic_polarity_t polarity; /**< Specifies the active edge of the input signal */ - timer_ic_select_t sel; /**< Specifies the input */ - uint32_t filter; /**< Specifies the input capture filter */ -} timer_one_pulse_init_t; - -/** @brief TIMER clear input source - */ -typedef enum { - TIMER_INPUT_NONE = 0U, /**< Clear input none */ - TIMER_INPUT_ETR = 1U, /**< Clear input etr */ -} timer_clear_input_source_t; - -/** @brief TIMER clear input polarity - */ -typedef enum { - TIMER_POLARITY_NO_INV = 0U, /**< Polarity for ETRx pin */ - TIMER_POLARITY_INV = 1U, /**< Polarity for ETRx pin */ -} timer_clear_input_polarity_t; - -/** @brief TIMER clear input polarity - */ -typedef enum { - TIMER_ETR_PSC_DIV1 = 0U, /**< No prescaler is used */ - TIMER_ETR_PSC_DIV2 = 1U, /**< ETR input source is divided by 2 */ - TIMER_ETR_PSC_DIV4 = 2U, /**< ETR input source is divided by 4 */ - TIMER_ETR_PSC_DIV8 = 3U, /**< ETR input source is divided by 8 */ -} timer_etr_psc_t; - -/** - * @brief TIMER clear input configuration handle structure definition - */ -typedef struct { - type_func_t state; /**< TIMER clear Input state */ - timer_clear_input_source_t source; /**< TIMER clear Input sources */ - timer_clear_input_polarity_t polarity; /**< TIMER Clear Input polarity */ - timer_etr_psc_t psc; /**< TIMER Clear Input prescaler */ - uint32_t filter; /**< TIMER Clear Input filter */ -} timer_clear_input_config_t; - -/** @brief TIMER clock source - */ -typedef enum { - TIMER_SRC_ETRMODE2 = 0U, /**< Clock source is etr mode2 */ - TIMER_SRC_INTER = 1U, /**< Clock source is etr internal */ - TIMER_SRC_ITR0 = 2U, /**< Clock source is etr itr0 */ - TIMER_SRC_ITR1 = 3U, /**< Clock source is etr itr1 */ - TIMER_SRC_ITR2 = 4U, /**< Clock source is etr itr2 */ - TIMER_SRC_ITR3 = 5U, /**< Clock source is etr itr3 */ - TIMER_SRC_TI1ED = 6U, /**< Clock source is etr ti1ed */ - TIMER_SRC_TI1 = 7U, /**< Clock source is etr ti1 */ - TIMER_SRC_TI2 = 8U, /**< Clock source is etr ti2 */ - TIMER_SRC_ETRMODE1 = 9U, /**< Clock source is etr mode1 */ -} timer_clock_source_t; - -/** @brief TIMER clock polarity - */ -typedef enum { - TIMER_CLK_POLARITY_INV = 1U, /**< Polarity for ETRx clock sources */ - TIMER_CLK_POLARITY_NO_INV = 0U, /**< Polarity for ETRx clock sources */ - TIMER_CLK_POLARITY_RISE = 0U, /**< Polarity for TIx clock sources */ - TIMER_CLK_POLARITY_FALL = 1U, /**< Polarity for TIx clock sources */ - TIMER_CLK_POLARITY_BOTH = 3U, /**< Polarity for TIx clock sources */ -} timer_clock_polarity_t; - -/** - * @brief TIMER clock config structure definition - */ -typedef struct { - timer_clock_source_t source; /**< TIMER clock sources */ - timer_clock_polarity_t polarity; /**< TIMER clock polarity */ - timer_etr_psc_t psc; /**< TIMER clock prescaler */ - uint32_t filter; /**< TIMER clock filter */ -} timer_clock_config_t; - -/** - * @brief TIMER slave mode - */ -typedef enum { - TIMER_MODE_DISABLE = 0U, /**< Slave mode is disable */ - TIMER_MODE_ENC1 = 1U, /**< Slave mode is encoder1 */ - TIMER_MODE_ENC2 = 2U, /**< Slave mode is encoder2 */ - TIMER_MODE_ENC3 = 3U, /**< Slave mode is encoder3 */ - TIMER_MODE_RESET = 4U, /**< Slave mode is reset */ - TIMER_MODE_GATED = 5U, /**< Slave mode is gated */ - TIMER_MODE_TRIG = 6U, /**< Slave mode is trigger */ - TIMER_MODE_EXTERNAL1 = 7U, /**< Slave mode is external1 */ -} timer_slave_mode_t; - -/** - * @brief TIMER ts definition - */ -typedef enum { - TIMER_TS_ITR0 = 0U, /**< ITR0 */ - TIMER_TS_ITR1 = 1U, /**< ITR1 */ - TIMER_TS_ITR2 = 2U, /**< ITR2 */ - TIMER_TS_ITR3 = 3U, /**< ITR3 */ - TIMER_TS_TI1F_ED = 4U, /**< TI1F_ED */ - TIMER_TS_TI1FP1 = 5U, /**< TI1FP1 */ - TIMER_TS_TI2FP2 = 6U, /**< TI2FP2 */ - TIMER_TS_ETRF = 7U, /**< ETRF */ -} timer_ts_t; - -/** - * @brief TIMER slave configuration structure definition - */ -typedef struct { - timer_slave_mode_t mode; /**< Slave mode selection */ - timer_ts_t input; /**< Input Trigger source */ - timer_clock_polarity_t polarity; /**< Input Trigger polarity */ - timer_etr_psc_t psc; /**< Input trigger prescaler */ - uint32_t filter; /**< Input trigger filter */ -} timer_slave_config_t; - -/** - * @brief TIMER hall sensor configuretion structure definition - */ -typedef struct { - timer_ic_polarity_t polarity; /**< Specifies the active edge of the input signal */ - timer_ic_prescaler_t psc; /**< Specifies the Input Capture Prescaler */ - uint32_t filter; /**< Specifies the input capture filter [0x0, 0xF] */ - uint32_t delay; /**< Specifies the pulse value to be loaded into the register [0x0, 0xFFFF] */ -} timer_hall_sensor_init_t; - -/** - * @brief TIMER lock level - */ -typedef enum { - TIMER_LOCK_LEVEL_OFF = 0U, /**< Lock off */ - TIMER_LOCK_LEVEL_1 = 1U, /**< Lock level 1 */ - TIMER_LOCK_LEVEL_2 = 2U, /**< Lock level 2 */ - TIMER_LOCK_LEVEL_3 = 3U, /**< Lock level 3 */ -} timer_lock_level_t; - -/** - * @brief TIMER break polarity - */ -typedef enum { - TIMER_BREAK_POLARITY_LOW = 0U, /**< LOW */ - TIMER_BREAK_POLARITY_HIGH = 1U, /**< HIGH */ -} timer_break_polarity_t; - -/** - * @brief TIMER break and dead time configuretion structure definition - */ -typedef struct { - type_func_t off_run; /**< Enalbe/Disable off state in run mode */ - type_func_t off_idle; /**< Enalbe/Disable off state in idle mode */ - timer_lock_level_t lock_level; /**< Lock level */ - uint32_t dead_time; /**< Dead time, [0x0, 0xFF] */ - type_func_t break_state; /**< Break state */ - timer_break_polarity_t polarity; /**< Break input polarity */ - type_func_t auto_out; /**< Enalbe/Disable automatic output */ -} timer_break_dead_time_t; - -/** - * @brief TIMER commutation event channel configuretion structure definition - */ -typedef struct { - type_func_t en; /**< Enalbe/Disable the channel */ - type_func_t n_en; /**< Enalbe/Disable the complementary channel */ - timer_oc_mode_t mode; /**< Mode of the channel */ -} timer_channel_config_t; - -/** - * @brief TIMER commutation event configuretion structure definition - */ -typedef struct { - timer_channel_config_t ch[3]; /**< Configure of channel */ -} timer_com_channel_config_t; - -/** - * @brief TIMER master mode selection - */ -typedef enum { - TIMER_TRGO_RESET = 0U, /**< RESET */ - TIMER_TRGO_ENABLE = 1U, /**< ENABLE */ - TIMER_TRGO_UPDATE = 2U, /**< UPDATE */ - TIMER_TRGO_OC1 = 3U, /**< OC1 */ - TIMER_TRGO_OC1REF = 4U, /**< OC1REF */ - TIMER_TRGO_OC2REF = 5U, /**< OC2REF */ - TIMER_TRGO_OC3REF = 6U, /**< OC3REF */ - TIMER_TRGO_OC4REF = 7U, /**< OC4REF */ -} timer_master_mode_sel_t; - -/** - * @brief TIMER master configuretion structure definition - */ -typedef struct { - timer_master_mode_sel_t sel; /**< Specifies the active edge of the input signal */ - type_func_t master_en; /**< Master/Slave mode selection */ -} timer_master_config_t; - -/** - * @brief Specifies the event source - */ -typedef enum { - TIMER_SRC_UPDATE = (1U << 0), /**< Event source is update */ - TIMER_SRC_CC1 = (1U << 1), /**< Event source is channel1 */ - TIMER_SRC_CC2 = (1U << 2), /**< Event source is channel2 */ - TIMER_SRC_CC3 = (1U << 3), /**< Event source is channel3 */ - TIMER_SRC_CC4 = (1U << 4), /**< Event source is channel4 */ - TIMER_SRC_COM = (1U << 5), /**< Event source is compare */ - TIMER_SRC_TRIG = (1U << 6), /**< Event source is trigger */ - TIMER_SRC_BREAK = (1U << 7), /**< Event source is break */ -} timer_event_source_t; - -/** - * @brief TIMER interrupt definition - */ -typedef enum { - TIMER_IT_UPDATE = (1U << 0), /**< Update interrupt bit */ - TIMER_IT_CC1 = (1U << 1), /**< Channel1 interrupt bit */ - TIMER_IT_CC2 = (1U << 2), /**< Channel2 interrupt bit */ - TIMER_IT_CC3 = (1U << 3), /**< Channel3 interrupt bit */ - TIMER_IT_CC4 = (1U << 4), /**< Channel4 interrupt bit */ - TIMER_IT_COM = (1U << 5), /**< compare interrupt bit */ - TIMER_IT_TRIGGER = (1U << 6), /**< Trigger interrupt bit */ - TIMER_IT_BREAK = (1U << 7), /**< Break interrupt bit */ -} timer_it_t; - -/** - * @brief TIMER DMA request - */ -typedef enum { - TIMER_DMA_UPDATE = (1U << 8), /**< DMA request from update */ - TIMER_DMA_CC1 = (1U << 9), /**< DMA request from channel1 */ - TIMER_DMA_CC2 = (1U << 10), /**< DMA request from channel2 */ - TIMER_DMA_CC3 = (1U << 11), /**< DMA request from channel3 */ - TIMER_DMA_CC4 = (1U << 12), /**< DMA request from channel4 */ - TIMER_DMA_COM = (1U << 13), /**< DMA request from compare */ - TIMER_DMA_TRIGGER = (1U << 14), /**< DMA request from trigger */ -} timer_dma_req_t; - -/** - * @brief TIMER flag definition - */ -typedef enum { - TIMER_FLAG_UPDATE = (1U << 0), /**< Update interrupt flag */ - TIMER_FLAG_CC1 = (1U << 1), /**< Channel1 interrupt flag */ - TIMER_FLAG_CC2 = (1U << 2), /**< Channel2 interrupt flag */ - TIMER_FLAG_CC3 = (1U << 3), /**< Channel3 interrupt flag */ - TIMER_FLAG_CC4 = (1U << 4), /**< Channel4 interrupt flag */ - TIMER_FLAG_COM = (1U << 5), /**< Compare interrupt flag */ - TIMER_FLAG_TRIGGER = (1U << 6), /**< Trigger interrupt flag */ - TIMER_FLAG_BREAK = (1U << 7), /**< Break interrupt flag */ - TIMER_FLAG_CC1OF = (1U << 9), /**< Channel1 override state flag */ - TIMER_FLAG_CC2OF = (1U << 10), /**< Channel2 override state flag */ - TIMER_FLAG_CC3OF = (1U << 11), /**< Channel3 override state flag */ - TIMER_FLAG_CC4OF = (1U << 12), /**< Channel4 override state flag */ -} timer_flag_t; -/** - * @} - */ - -/** @defgroup TIMER_Public_Macros TIMER Public Macros - * @{ - */ -#define CCER_CCxE_MASK ((1U << 0) | (1U << 4) | (1U << 8) | (1U << 12)) -#define CCER_CCxNE_MASK ((1U << 2) | (1U << 6) | (1U << 10)) - -/** - * @brief Reset TIMER handle state - */ -#define TIMER_RESET_HANDLE_STATE(hperh) ((hperh)->state = TIMER_STATE_RESET) - -/** - * @brief Enable the TIMER peripheral. - */ -#define TIMER_ENABLE(hperh) (SET_BIT((hperh)->perh->CON1, TIMER_CON1_CNTEN_MSK)) - -/** - * @brief Enable the TIMER main output. - */ -#define TIMER_MOE_ENABLE(hperh) (SET_BIT((hperh)->perh->BDCFG, TIMER_BDCFG_GOEN_MSK)) - -/** - * @brief Disable the TIMER peripheral. - */ -#define TIMER_DISABLE(hperh) \ -do { \ - if ((((hperh)->perh->CCEP & CCER_CCxE_MASK) == 0) \ - && (((hperh)->perh->CCEP & CCER_CCxNE_MASK) == 0)) \ - CLEAR_BIT((hperh)->perh->CON1, TIMER_CON1_CNTEN_MSK); \ -} while (0) - -/** - * @brief Disable the TIMER main output. - * @note The Main Output Enable of a timer instance is disabled only if - * all the CCx and CCxN channels have been disabled - */ -#define TIMER_MOE_DISABLE(hperh) \ -do { \ - if ((((hperh)->perh->CCEP & CCER_CCxE_MASK) == 0) \ - && (((hperh)->perh->CCEP & CCER_CCxNE_MASK) == 0)) \ - CLEAR_BIT((hperh)->perh->BDCFG, TIMER_BDCFG_GOEN_MSK); \ -} while (0) - -/** - * @brief Sets the TIMER autoreload register value on runtime without calling - * another time any Init function. - */ -#define TIMER_SET_AUTORELOAD(handle, AUTORELOAD) \ -do { \ - (handle)->perh->AR = (AUTORELOAD); \ - (handle)->init.period = (AUTORELOAD); \ -} while (0) - -/** - * @brief Gets the TIMER autoreload register value on runtime - */ -#define TIMER_GET_AUTORELOAD(handle) ((handle)->perh->AR) - -/** - * @brief Gets the TIMER count register value on runtime - */ -#define TIMER_GET_CNT(handle) ((handle)->perh->COUNT) - -/** - * @brief Gets the TIMER count direction value on runtime - */ -#define TIMER_GET_DIR(handle) (READ_BITS((handle)->perh->CON1, TIMER_CON1_DIRSEL_MSK, TIMER_CON1_DIRSEL_POS)) - -/** - * @brief CCx DMA request sent when CCx event occurs - */ -#define TIMER_CCx_DMA_REQ_CCx(handle) (CLEAR_BIT((handle)->perh->CON2, TIMER_CON2_CCDMASEL_MSK)) - -/** - * @brief CCx DMA request sent when update event occurs - */ -#define TIMER_CCx_DMA_REQ_UPDATE(handle) (SET_BIT((handle)->perh->CON2, TIMER_CON2_CCDMASEL_MSK)) - -/** - * @brief Enable channel - * @param handle: TIMER handle - * @param ch: Must be one of this: - * TIMER_CHANNEL_1 - * TIMER_CHANNEL_2 - * TIMER_CHANNEL_3 - * TIMER_CHANNEL_4 - */ -#define TIMER_CCx_ENABLE(handle, ch) (((ch) == TIMER_CHANNEL_4) ? \ -(SET_BIT((handle)->perh->CCEP, TIMER_CCEP_CC4POL_MSK)) : (WRITE_REG(((handle)->perh->CCEP), (((handle)->perh->CCEP) | (1 << ((ch) << 2)))))) - -/** - * @brief Disable channel - * @param handle: TIMER handle - * @param ch: Must be one of this: - * TIMER_CHANNEL_1 - * TIMER_CHANNEL_2 - * TIMER_CHANNEL_3 - * TIMER_CHANNEL_4 - */ -#define TIMER_CCx_DISABLE(handle, ch) (((ch) == TIMER_CHANNEL_4) ? \ -(CLEAR_BIT((handle)->perh->CCEP, TIMER_CCEP_CC4EN_MSK)) : ((handle)->perh->CCEP &= ~(1 << ((ch) << 2)))) - -/** - * @brief Enable complementary channel - * @param handle: TIMER handle - * @param ch: Must be one of this: - * TIMER_CHANNEL_1 - * TIMER_CHANNEL_2 - * TIMER_CHANNEL_3 - */ -#define TIMER_CCxN_ENABLE(handle, ch) ((handle)->perh->CCEP |= (1 << (((ch) << 2) + 2))) - -/** - * @brief Disable complementary channel - * @param handle: TIMER handle - * @param ch: Must be one of this: - * TIMER_CHANNEL_1 - * TIMER_CHANNEL_2 - * TIMER_CHANNEL_3 - */ -#define TIMER_CCxN_DISABLE(handle, ch) ((handle)->perh->CCEP &= ~(1 << (((ch) << 2) + 2))) -/** - * @} - */ - -/** @defgroup TIMER_Private_Macros TIMER Private Macros - * @{ - */ -#if defined (ES32F065x) -#define IS_TIMER_INSTANCE(x) (((x) == AD16C4T0) || \ - ((x) == GP16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1) || \ - ((x) == BS16T0) || \ - ((x) == BS16T1) || \ - ((x) == BS16T2) || \ - ((x) == BS16T3)) -#define IS_ADTIMER_INSTANCE(x) ((x) == AD16C4T0) -#define IS_TIMER_XOR_INSTANCE(x) (((x) == AD16C4T0) || ((x) == GP16C4T0)) -#define IS_TIMER_COM_EVENT_INSTANCE(x) (((x) == AD16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) -#define IS_TIMER_CC2_INSTANCE(x) (((x) == AD16C4T0) || \ - ((x) == GP16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) -#define IS_TIMER_CC4_INSTANCE(x) (((x) == AD16C4T0) || \ - ((x) == GP16C4T0)) -#define IS_TIMER_BREAK_INSTANCE(x) (((x) == AD16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) -#define IS_TIMER_PWM_INPUT_INSTANCE(x, y) ((((x) == AD16C4T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C2T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C2T1) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == AD16C4T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2)))) -#define IS_TIMER_CCX_INSTANCE(x, y) ((((x) == AD16C4T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2) || \ - ((y) == TIMER_CHANNEL_3) || \ - ((y) == TIMER_CHANNEL_4))) || \ - (((x) == GP16C2T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C2T1) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C4T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2) || \ - ((y) == TIMER_CHANNEL_3) || \ - ((y) == TIMER_CHANNEL_4)))) -#define IS_TIMER_CCXN_INSTANCE(x, y) ((((x) == AD16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2) || \ - ((y) == TIMER_CHANNEL_3) || \ - ((y) == TIMER_CHANNEL_4))) -#define IS_TIMER_REPETITION_COUNTER_INSTANCE(x) (((x) == AD16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) -#define IS_TIMER_CLOCK_DIVISION_INSTANCE(x) IS_TIMER_CC2_INSTANCE(x) - -#elif defined (ES32F033x) || defined (ES32F093x) - -#define IS_TIMER_INSTANCE(x) (((x) == GP16C4T0) || \ - ((x) == BS16T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1) || \ - ((x) == BS16T1) || \ - ((x) == BS16T2) || \ - ((x) == GP16C4T1) || \ - ((x) == BS16T3)) -#define IS_ADTIMER_INSTANCE(x) ((x) == AD16C4T0) -#define IS_TIMER_XOR_INSTANCE(x) (((x) == GP16C4T0) || ((x) == GP16C4T1)) -#define IS_TIMER_COM_EVENT_INSTANCE(x) (((x) == GP16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) -#define IS_TIMER_CC2_INSTANCE(x) (((x) == GP16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1) || \ - ((x) == GP16C4T1)) -#define IS_TIMER_CC4_INSTANCE(x) (((x) == GP16C4T0) || \ - ((x) == GP16C4T1)) -#define IS_TIMER_BREAK_INSTANCE(x) (((x) == GP16C4T0)) -#define IS_TIMER_PWM_INPUT_INSTANCE(x, y) ((((x) == GP16C4T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C2T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C2T1) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C4T1) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2)))) -#define IS_TIMER_CCX_INSTANCE(x, y) ((((x) == GP16C4T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2) || \ - ((y) == TIMER_CHANNEL_3) || \ - ((y) == TIMER_CHANNEL_4))) || \ - (((x) == GP16C2T0) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C2T1) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2))) || \ - (((x) == GP16C4T1) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2) || \ - ((y) == TIMER_CHANNEL_3) || \ - ((y) == TIMER_CHANNEL_4)))) -#define IS_TIMER_CCXN_INSTANCE(x, y) ((((x) == GP16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) && \ - (((y) == TIMER_CHANNEL_1) || \ - ((y) == TIMER_CHANNEL_2) || \ - ((y) == TIMER_CHANNEL_3) || \ - ((y) == TIMER_CHANNEL_4))) -#define IS_TIMER_REPETITION_COUNTER_INSTANCE(x) (((x) == GP16C4T0) || \ - ((x) == GP16C2T0) || \ - ((x) == GP16C2T1)) -#define IS_TIMER_CLOCK_DIVISION_INSTANCE(x) IS_TIMER_CC2_INSTANCE(x) -#endif - -#define IS_TIMER_COUNTER_MODE(x) (((x) == TIMER_CNT_MODE_UP) || \ - ((x) == TIMER_CNT_MODE_DOWN) || \ - ((x) == TIMER_CNT_MODE_CENTER1) || \ - ((x) == TIMER_CNT_MODE_CENTER2) || \ - ((x) == TIMER_CNT_MODE_CENTER3)) -#define IS_TIMER_CLOCK_DIVISION(x) (((x) == TIMER_CLOCK_DIV1) || \ - ((x) == TIMER_CLOCK_DIV2) || \ - ((x) == TIMER_CLOCK_DIV4)) -#define IS_TIMER_PWM_MODE(x) (((x) == TIMER_OC_MODE_PWM1) || \ - ((x) == TIMER_OC_MODE_PWM2)) -#define IS_TIMER_OC_MODE(x) (((x) == TIMER_OC_MODE_TIMERING) || \ - ((x) == TIMER_OC_MODE_ACTIVE) || \ - ((x) == TIMER_OC_MODE_INACTIVE) || \ - ((x) == TIMER_OC_MODE_TOGGLE) || \ - ((x) == TIMER_OC_MODE_FORCE_ACTIVE) || \ - ((x) == TIMER_OC_MODE_FORCE_INACTIVE) || \ - ((x) == TIMER_OC_MODE_PWM1) || \ - ((x) == TIMER_OC_MODE_PWM2)) -#define IS_TIMER_OC_POLARITY(x) (((x) == TIMER_OC_POLARITY_HIGH) || \ - ((x) == TIMER_OC_POLARITY_LOW)) -#define IS_TIMER_OCN_POLARITY(x) (((x) == TIMER_OCN_POLARITY_HIGH) || \ - ((x) == TIMER_OCN_POLARITY_LOW)) -#define IS_TIMER_OCIDLE_STATE(x) (((x) == TIMER_OC_IDLE_RESET) || \ - ((x) == TIMER_OC_IDLE_SET)) -#define IS_TIMER_OCNIDLE_STATE(x) (((x) == TIMER_OCN_IDLE_RESET) || \ - ((x) == TIMER_OCN_IDLE_SET)) -#define IS_TIMER_CHANNELS(x) (((x) == TIMER_CHANNEL_1) || \ - ((x) == TIMER_CHANNEL_2) || \ - ((x) == TIMER_CHANNEL_3) || \ - ((x) == TIMER_CHANNEL_4) || \ - ((x) == TIMER_CHANNEL_ALL)) -#define IS_TIMER_OP_MODE(x) (((x) == TIMER_OP_MODE_REPEAT) || \ - ((x) == TIMER_OP_MODE_SINGLE)) -#define IS_TIMER_OP_OUTPUT_CH(x) (((x) == TIMER_OP_OUTPUT_CHANNEL_1) || \ - ((x) == TIMER_OP_OUTPUT_CHANNEL_2)) -#define IS_TIMER_ENCODER_MODE(x) (((x) == TIMER_ENC_MODE_TI1) || \ - ((x) == TIMER_ENC_MODE_TI2) || \ - ((x) == TIMER_ENC_MODE_TI12)) -#define IS_TIMER_IC_POLARITY(x) (((x) == TIMER_IC_POLARITY_RISE) || \ - ((x) == TIMER_IC_POLARITY_FALL)) -#define IS_TIMER_IC_SELECT(x) (((x) == TIMER_IC_SEL_DIRECT) || \ - ((x) == TIMER_IC_SEL_INDIRECT) || \ - ((x) == TIMER_IC_SEL_TRC)) -#define IS_TIMER_IC_PSC(x) (((x) == TIMER_IC_PSC_DIV1) || \ - ((x) == TIMER_IC_PSC_DIV2) || \ - ((x) == TIMER_IC_PSC_DIV4) || \ - ((x) == TIMER_IC_PSC_DIV8)) -#define IS_TIMER_IC_FILTER(x) ((x) <= 0xF) -#define IS_TIMER_DEAD_TIMERE(x) ((x) <= 0xFF) -#define IS_TIMER_CLEAR_INPUT_SOURCE(x) (((x) == TIMER_INPUT_NONE) || \ - ((x) == TIMER_INPUT_ETR)) -#define IS_TIMER_CLEAR_INPUT_POLARITY(x) (((x) == TIMER_POLARITY_NO_INV) || \ - ((x) == TIMER_POLARITY_INV)) -#define IS_TIMER_ETR_PSC(x) (((x) == TIMER_ETR_PSC_DIV1) || \ - ((x) == TIMER_ETR_PSC_DIV2) || \ - ((x) == TIMER_ETR_PSC_DIV4) || \ - ((x) == TIMER_ETR_PSC_DIV8)) -#define IS_TIMER_CLOCK_SOURCE(x) (((x) == TIMER_SRC_ETRMODE2) || \ - ((x) == TIMER_SRC_INTER) || \ - ((x) == TIMER_SRC_ITR0) || \ - ((x) == TIMER_SRC_ITR1) || \ - ((x) == TIMER_SRC_ITR2) || \ - ((x) == TIMER_SRC_ITR3) || \ - ((x) == TIMER_SRC_TI1ED) || \ - ((x) == TIMER_SRC_TI1) || \ - ((x) == TIMER_SRC_TI2) || \ - ((x) == TIMER_SRC_ETRMODE1)) -#define IS_TIMER_CLOCK_POLARITY(x) (((x) == TIMER_CLK_POLARITY_INV) || \ - ((x) == TIMER_CLK_POLARITY_NO_INV) || \ - ((x) == TIMER_CLK_POLARITY_RISE) || \ - ((x) == TIMER_CLK_POLARITY_FALL) || \ - ((x) == TIMER_CLK_POLARITY_BOTH)) -#define IS_TIMER_SLAVE_MODE(x) (((x) == TIMER_MODE_DISABLE) || \ - ((x) == TIMER_MODE_ENC1) || \ - ((x) == TIMER_MODE_ENC2) || \ - ((x) == TIMER_MODE_ENC3) || \ - ((x) == TIMER_MODE_RESET) || \ - ((x) == TIMER_MODE_GATED) || \ - ((x) == TIMER_MODE_TRIG) || \ - ((x) == TIMER_MODE_EXTERNAL1)) -#define IS_TIMER_EVENT_SOURCE(x) (((x) == TIMER_SRC_UPDATE) || \ - ((x) == TIMER_SRC_CC1) || \ - ((x) == TIMER_SRC_CC2) || \ - ((x) == TIMER_SRC_CC3) || \ - ((x) == TIMER_SRC_CC4) || \ - ((x) == TIMER_SRC_COM) || \ - ((x) == TIMER_SRC_TRIG) || \ - ((x) == TIMER_SRC_BREAK)) -#define IS_TIMER_TS(x) (((x) == TIMER_TS_ITR0) || \ - ((x) == TIMER_TS_ITR1) || \ - ((x) == TIMER_TS_ITR2) || \ - ((x) == TIMER_TS_ITR3) || \ - ((x) == TIMER_TS_TI1F_ED) || \ - ((x) == TIMER_TS_TI1FP1) || \ - ((x) == TIMER_TS_TI2FP2) || \ - ((x) == TIMER_TS_ETRF)) -#define IS_TIMER_CLOCK_LEVEL(x) (((x) == TIMER_LOCK_LEVEL_OFF) || \ - ((x) == TIMER_LOCK_LEVEL_1) || \ - ((x) == TIMER_LOCK_LEVEL_2) || \ - ((x) == TIMER_LOCK_LEVEL_3)) -#define IS_TIMER_BREAK_POLARITY(x) (((x) == TIMER_BREAK_POLARITY_LOW) || \ - ((x) == TIMER_BREAK_POLARITY_HIGH)) -#define IS_TIMER_MASTER_MODE_SEL(x) (((x) == TIMER_TRGO_RESET) || \ - ((x) == TIMER_TRGO_ENABLE) || \ - ((x) == TIMER_TRGO_UPDATE) || \ - ((x) == TIMER_TRGO_OC1) || \ - ((x) == TIMER_TRGO_OC1REF) || \ - ((x) == TIMER_TRGO_OC2REF) || \ - ((x) == TIMER_TRGO_OC3REF) || \ - ((x) == TIMER_TRGO_OC4REF)) -#define IS_TIMER_IT(x) (((x) == TIMER_IT_UPDATE) || \ - ((x) == TIMER_IT_CC1) || \ - ((x) == TIMER_IT_CC2) || \ - ((x) == TIMER_IT_CC3) || \ - ((x) == TIMER_IT_CC4) || \ - ((x) == TIMER_IT_COM) || \ - ((x) == TIMER_IT_TRIGGER) || \ - ((x) == TIMER_IT_BREAK)) -#define IS_TIMER_DMA_REQ(x) (((x) == TIMER_DMA_UPDATE) || \ - ((x) == TIMER_DMA_CC1) || \ - ((x) == TIMER_DMA_CC2) || \ - ((x) == TIMER_DMA_CC3) || \ - ((x) == TIMER_DMA_CC4) || \ - ((x) == TIMER_DMA_COM) || \ - ((x) == TIMER_DMA_TRIGGER)) -#define IS_TIMER_FLAG(x) (((x) == TIMER_FLAG_UPDATE) || \ - ((x) == TIMER_FLAG_CC1) || \ - ((x) == TIMER_FLAG_CC2) || \ - ((x) == TIMER_FLAG_CC3) || \ - ((x) == TIMER_FLAG_CC4) || \ - ((x) == TIMER_FLAG_COM) || \ - ((x) == TIMER_FLAG_TRIGGER) || \ - ((x) == TIMER_FLAG_BREAK) || \ - ((x) == TIMER_FLAG_CC1OF) || \ - ((x) == TIMER_FLAG_CC2OF) || \ - ((x) == TIMER_FLAG_CC3OF) || \ - ((x) == TIMER_FLAG_CC4OF)) -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions - * @{ - */ -/** @addtogroup TIMER_Public_Functions_Group1 - * @{ - */ -/* Time Base functions */ -ald_status_t ald_timer_base_init(timer_handle_t *hperh); -void ald_timer_base_reset(timer_handle_t *hperh); -void ald_timer_base_start(timer_handle_t *hperh); -void ald_timer_base_stop(timer_handle_t *hperh); -void ald_timer_base_start_by_it(timer_handle_t *hperh); -void ald_timer_base_stop_by_it(timer_handle_t *hperh); -#ifdef ALD_DMA -ald_status_t ald_timer_base_start_by_dma(timer_handle_t *hperh, - uint16_t *buf, uint32_t len, uint8_t dma_ch); -void ald_timer_base_stop_by_dma(timer_handle_t *hperh); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group2 - * @{ - */ -/* Timer Output Compare functions */ -ald_status_t ald_timer_oc_init(timer_handle_t *hperh); -void ald_timer_oc_start(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_oc_stop(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_oc_start_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_oc_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -#ifdef ALD_DMA -ald_status_t ald_timer_oc_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf, uint32_t len, uint8_t dma_ch); -void ald_timer_oc_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group3 - * @{ - */ -/* Timer PWM functions */ -ald_status_t ald_timer_pwm_init(timer_handle_t *hperh); -void ald_timer_pwm_start(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwm_stop(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwm_start_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwm_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint16_t freq); -void ald_timer_pwm_set_duty(timer_handle_t *hperh, timer_channel_t ch, uint16_t duty); -void ald_timer_pwm_set_input(timer_handle_t *hperh, timer_channel_t ch); -#ifdef ALD_DMA -ald_status_t ald_timer_pwm_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf, uint32_t len, uint8_t dma_ch); -void ald_timer_pwm_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group4 - * @{ - */ -/* Timer Input Capture functions */ -ald_status_t ald_timer_ic_init(timer_handle_t *hperh); -void ald_timer_ic_start(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_ic_stop(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_ic_start_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_ic_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -#ifdef ALD_DMA -ald_status_t ald_timer_ic_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf, uint32_t len, uint8_t dma_ch); -void ald_timer_ic_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group5 - * @{ - */ -/* Timer One Pulse functions */ -ald_status_t ald_timer_one_pulse_init(timer_handle_t *hperh, timer_op_mode_t mode); -void ald_timer_one_pulse_start(timer_handle_t *hperh, timer_op_output_channel_t ch); -void ald_timer_one_pulse_stop(timer_handle_t *hperh, timer_op_output_channel_t ch); -void ald_timer_one_pulse_start_by_it(timer_handle_t *hperh, timer_op_output_channel_t ch); -void ald_timer_one_pulse_stop_by_it(timer_handle_t *hperh, timer_op_output_channel_t ch); -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group6 - * @{ - */ -/* Timer encoder functions */ -ald_status_t ald_timer_encoder_init(timer_handle_t *hperh, timer_encoder_init_t *config); -void ald_timer_encoder_start(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_encoder_stop(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_encoder_start_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_encoder_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -#ifdef ALD_DMA -ald_status_t ald_timer_encoder_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf1, uint16_t *buf2, uint32_t len, - uint8_t dma_ch1, uint8_t dma_ch2); -void ald_timer_encoder_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group7 - * @{ - */ -/* Timer hall sensor functions */ -ald_status_t ald_timer_hall_sensor_init(timer_handle_t *hperh, timer_hall_sensor_init_t *config); -void ald_timer_hall_sensor_start(timer_handle_t *hperh); -void ald_timer_hall_sensor_stop(timer_handle_t *hperh); -void ald_timer_hall_sensor_start_by_it(timer_handle_t *hperh); -void ald_timer_hall_sensor_stop_by_it(timer_handle_t *hperh); -#ifdef ALD_DMA -ald_status_t ald_timer_hall_sensor_start_by_dma(timer_handle_t *hperh, - uint16_t *buf, uint32_t len, uint8_t dma_ch); -void ald_timer_hall_sensor_stop_by_dma(timer_handle_t *hperh); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group8 - * @{ - */ -/* Timer complementary output compare functions */ -void ald_timer_ocn_start(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_ocn_stop(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_ocn_start_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_ocn_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -#ifdef ALD_DMA -ald_status_t ald_timer_ocn_start_by_dma(timer_handle_t *hperh, - timer_channel_t ch, uint16_t *buf, uint32_t len, uint8_t dma_ch); -void ald_timer_ocn_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group9 - * @{ - */ -/* Timer complementary PWM functions */ -void ald_timer_pwmn_start(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwmn_stop(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwmn_start_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwmn_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -#ifdef ALD_DMA -ald_status_t ald_timer_pwmn_start_by_dma(timer_handle_t *hperh, - timer_channel_t ch, uint16_t *buf, uint32_t len, uint8_t dma_ch); -void ald_timer_pwmn_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch); -#endif -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group10 - * @{ - */ -/* Timer complementary one pulse functions */ -void ald_timer_one_pulse_n_start(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_one_pulse_n_stop(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_one_pulse_n_start_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_one_pulse_n_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group11 - * @{ - */ -/* Control functions */ -ald_status_t ald_timer_oc_config_channel(timer_handle_t *hperh, timer_oc_init_t* config, timer_channel_t ch); -ald_status_t ald_timer_ic_config_channel(timer_handle_t *hperh, timer_ic_init_t* config, timer_channel_t ch); -ald_status_t ald_timer_one_pulse_config_channel(timer_handle_t *hperh, timer_one_pulse_init_t *config, - timer_channel_t ch_out, timer_channel_t ch_in); -ald_status_t ald_timer_config_oc_ref_clear(timer_handle_t *hperh, timer_clear_input_config_t *config, timer_channel_t ch); -ald_status_t ald_timer_config_clock_source(timer_handle_t *hperh, timer_clock_config_t *config); -ald_status_t ald_timer_config_ti1_input(timer_handle_t *hperh, uint32_t ti1_select); -ald_status_t ald_timer_slave_config_sync(timer_handle_t *hperh, timer_slave_config_t *config); -ald_status_t ald_timer_slave_config_sync_by_it(timer_handle_t *hperh, timer_slave_config_t *config); -ald_status_t ald_timer_generate_event(timer_handle_t *hperh, timer_event_source_t event); -uint32_t ald_timer_read_capture_value(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_set_output_mode(timer_handle_t *hperh, timer_oc_mode_t mode, timer_channel_t ch); -void ald_timer_com_change_config(timer_handle_t *hperh, timer_com_channel_config_t *config); -void ald_timer_com_event_config(timer_handle_t *hperh, timer_ts_t ts, type_func_t trgi); -void ald_timer_com_event_config_it(timer_handle_t *hperh, timer_ts_t ts, type_func_t trgi); -void ald_timer_break_dead_time_config(timer_handle_t *hperh, timer_break_dead_time_t *config); -void ald_timer_master_sync_config(timer_handle_t *hperh, timer_master_config_t *config); -void ald_timer_irq_handler(timer_handle_t *hperh); -void ald_timer_dma_req_config(timer_handle_t *hperh, timer_dma_req_t req, type_func_t state); -void ald_timer_interrupt_config(timer_handle_t *hperh, timer_it_t it, type_func_t state); -it_status_t ald_timer_get_it_status(timer_handle_t *hperh, timer_it_t it); -flag_status_t ald_timer_get_flag_status(timer_handle_t *hperh, timer_flag_t flag); -void ald_timer_clear_flag_status(timer_handle_t *hperh, timer_flag_t flag); -/** - * @} - */ - -/** @addtogroup TIMER_Public_Functions_Group12 - * @{ - */ -/* State functions */ -timer_state_t ald_timer_get_state(timer_handle_t *hperh); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_TIMER_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_trng.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_trng.h deleted file mode 100644 index 635cb1a90a..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_trng.h +++ /dev/null @@ -1,203 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_trng.h - * @brief Header file of TRNG module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_TRNG_H__ -#define __ALD_TRNG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup TRNG - * @{ - */ - -/** @defgroup TRNG_Public_Types TRNG Public Types - * @{ - */ -/** - * @brief Data width - */ -typedef enum { - TRNG_DSEL_1B = 0x0U, /**< 1-bit */ - TRNG_DSEL_8B = 0x1U, /**< 8-bit */ - TRNG_DSEL_16B = 0x2U, /**< 16-bit */ - TRNG_DSEL_32B = 0x3U, /**< 32-bit */ -} trng_data_width_t; - -/** - * @brief seed type - */ -typedef enum { - TRNG_SEED_TYPE_0 = 0x0U, /**< Using 0 as seed */ - TRNG_SEED_TYPE_1 = 0x1U, /**< Using 1 as seed */ - TRNG_SEED_TYPE_LAST = 0x2U, /**< Using last seed */ - TRNG_SEED_TYPE_SEED = 0x3U, /**< Using value of register */ -} trng_seed_type_t; - -/** - * @brief TRNG init structure definition - */ -typedef struct { - trng_data_width_t data_width; /**< The width of data */ - trng_seed_type_t seed_type; /**< The seed type */ - uint32_t seed; /**< The value of seed */ - uint16_t t_start; /**< T(start) = T(trng) * 2 ^ (t_start + 1), T(start) > 1ms */ - uint8_t adjc; /**< Adjust parameter */ - type_func_t posten; /**< Data back handle function */ -} trng_init_t; - -/** - * @brief TRNG state structures definition - */ -typedef enum { - TRNG_STATE_RESET = 0x0U, /**< Peripheral is not initialized */ - TRNG_STATE_READY = 0x1U, /**< Peripheral Initialized and ready for use */ - TRNG_STATE_BUSY = 0x2U, /**< An internal process is ongoing */ - TRNG_STATE_ERROR = 0x4U, /**< Error */ -} trng_state_t; - -/** - * @brief State type - */ -typedef enum { - TRNG_STATUS_START = (1U << 0), /**< Start state */ - TRNG_STATUS_DAVLD = (1U << 1), /**< Data valid state */ - TRNG_STATUS_SERR = (1U << 2), /**< Error state */ -} trng_status_t; - -/** - * @brief Interrupt type - */ -typedef enum { - TRNG_IT_START = (1U << 0), /**< Start */ - TRNG_IT_DAVLD = (1U << 1), /**< Data valid */ - TRNG_IT_SERR = (1U << 2), /**< Error */ -} trng_it_t; - -/** - * @brief Interrupt flag type - */ -typedef enum { - TRNG_IF_START = (1U << 0), /**< Start */ - TRNG_IF_DAVLD = (1U << 1), /**< Data valid */ - TRNG_IF_SERR = (1U << 2), /**< Error */ -} trng_flag_t; - -/** - * @brief TRNG Handle Structure definition - */ -typedef struct trng_handle_s { - TRNG_TypeDef *perh; /**< Register base address */ - trng_init_t init; /**< TRNG required parameters */ - uint32_t data; /**< result data */ - lock_state_t lock; /**< Locking object */ - trng_state_t state; /**< TRNG operation state */ - - void (*trng_cplt_cbk)(struct trng_handle_s *arg); /**< Trng completed callback */ - void (*err_cplt_cbk)(struct trng_handle_s *arg); /**< Trng error callback */ - void (*init_cplt_cbk)(struct trng_handle_s *arg); /**< Trng init completed callback */ -} trng_handle_t; -/** - * @} - */ - -/** @defgroup TRNG_Public_Macros TRNG Public Macros - * @{ - */ -#define TRNG_ENABLE() (SET_BIT(TRNG->CR, TRNG_CR_TRNGEN_MSK)) -#define TRNG_DISABLE() (CLEAR_BIT(TRNG->CR, TRNG_CR_TRNGEN_MSK)) -#define TRNG_ADJM_ENABLE() (SET_BIT(TRNG->CR, TRNG_CR_ADJM_MSK)) -#define TRNG_ADJM_DISABLE() (CLEAR_BIT(TRNG->CR, TRNG_CR_ADJM_MSK)) -/** - * @} - */ - -/** - * @defgroup TRNG_Private_Macros TRNG Private Macros - * @{ - */ -#define IS_TRNG_DATA_WIDTH(x) (((x) == TRNG_DSEL_1B) || \ - ((x) == TRNG_DSEL_8B) || \ - ((x) == TRNG_DSEL_16B) || \ - ((x) == TRNG_DSEL_32B)) -#define IS_TRNG_SEED_TYPE(x) (((x) == TRNG_SEED_TYPE_0) || \ - ((x) == TRNG_SEED_TYPE_1) || \ - ((x) == TRNG_SEED_TYPE_LAST) || \ - ((x) == TRNG_SEED_TYPE_SEED)) -#define IS_TRNG_STATUS(x) (((x) == TRNG_STATUS_START) || \ - ((x) == TRNG_STATUS_DAVLD) || \ - ((x) == TRNG_STATUS_SERR)) -#define IS_TRNG_IT(x) (((x) == TRNG_IT_START) || \ - ((x) == TRNG_IT_DAVLD) || \ - ((x) == TRNG_IT_SERR)) -#define IS_TRNG_FLAG(x) (((x) == TRNG_IF_START) || \ - ((x) == TRNG_IF_DAVLD) || \ - ((x) == TRNG_IF_SERR)) -#define IS_TRNG_ADJC(x) ((x) < 4) -#define IS_TRNG_T_START(x) ((x) < 8) -/** - * @} - */ - -/** @addtogroup TRNG_Public_Functions - * @{ - */ -/** @addtogroup TRNG_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -extern ald_status_t ald_trng_init(trng_handle_t *hperh); -/** - * @} - */ -/** @addtogroup TRNG_Public_Functions_Group2 - * @{ - */ -/* Control functions */ -extern uint32_t ald_trng_get_result(trng_handle_t *hperh); -extern void ald_trng_interrupt_config(trng_handle_t *hperh, trng_it_t it, type_func_t state); -extern flag_status_t ald_trng_get_status(trng_handle_t *hperh, trng_status_t status); -extern it_status_t ald_trng_get_it_status(trng_handle_t *hperh, trng_it_t it); -extern flag_status_t ald_trng_get_flag_status(trng_handle_t *hperh, trng_flag_t flag); -extern void ald_trng_clear_flag_status(trng_handle_t *hperh, trng_flag_t flag); -extern void ald_trng_irq_handler(trng_handle_t *hperh); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_TRNG_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_tsense.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_tsense.h deleted file mode 100644 index 410dcb7ff6..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_tsense.h +++ /dev/null @@ -1,199 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_tsense.h - * @brief Header file of TSENSE module driver. - * - * @version V1.0 - * @date 15 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_TSENSE_H__ -#define __ALD_TSENSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup TSENSE - * @{ - */ - -/** @defgroup TSENSE_Public_Macros TSENSE Public Macros - * @{ - */ -#define TSENSE_LOCK() (WRITE_REG(TSENSE->WPR, 0x0U)) -#define TSENSE_UNLOCK() (WRITE_REG(TSENSE->WPR, 0xA55A9669U)) -#define TSENSE_ENABLE() \ -do { \ - TSENSE_UNLOCK(); \ - SET_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_DISABLE() \ -do { \ - TSENSE_UNLOCK(); \ - CLEAR_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_REQ_ENABLE() \ -do { \ - TSENSE_UNLOCK(); \ - SET_BIT(TSENSE->CR, TSENSE_CR_REQEN_MSK); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_REQ_DISABLE() \ -do { \ - TSENSE_UNLOCK(); \ - CLEAR_BIT(TSENSE->CR, TSENSE_CR_REQEN_MSK); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_CTN_ENABLE() \ -do { \ - TSENSE_UNLOCK(); \ - SET_BIT(TSENSE->CR, TSENSE_CR_CTN_MSK); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_CTN_DISABLE() \ -do { \ - TSENSE_UNLOCK(); \ - CLEAR_BIT(TSENSE->CR, TSENSE_CR_CTN_MSK); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_RESET() \ -do { \ - TSENSE_UNLOCK(); \ - SET_BIT(TSENSE->CR, TSENSE_CR_RST_MSK); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_LTGR_WR(data) \ -do { \ - TSENSE_UNLOCK(); \ - WRITE_REG(TSENSE->LTGR, (data)); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_HTGR_WR(data) \ -do { \ - TSENSE_UNLOCK(); \ - WRITE_REG(TSENSE->HTGR, (data)); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_TBDR_WR(data) \ -do { \ - TSENSE_UNLOCK(); \ - WRITE_REG(TSENSE->TBDR, (data)); \ - TSENSE_LOCK(); \ -} while (0) -#define TSENSE_TCALBDR_WR(data) \ -do { \ - TSENSE_UNLOCK(); \ - WRITE_REG(TSENSE->TCALBDR, (data)); \ - TSENSE_LOCK(); \ -} while (0) -/** - * @} - */ - -/** @defgroup TSENSE_Public_Types TSENSE Public Types - * @{ - */ -/** - * @brief Temperature update time - */ -typedef enum { - TSENSE_UPDATE_CYCLE_3 = 0x3U, /**< 3 Cycles */ - TSENSE_UPDATE_CYCLE_4 = 0x4U, /**< 4 Cycles */ - TSENSE_UPDATE_CYCLE_5 = 0x5U, /**< 5 Cycles */ - TSENSE_UPDATE_CYCLE_6 = 0x6U, /**< 6 Cycles */ - TSENSE_UPDATE_CYCLE_7 = 0x7U, /**< 7 Cycles */ -} tsense_update_cycle_t; - -/** - * @brief Temperature output mode - */ -typedef enum { - TSENSE_OUTPUT_MODE_200 = 0x0U, /**< 200 cycles update one temperature */ - TSENSE_OUTPUT_MODE_400 = 0x1U, /**< 400 cycles update one temperature */ - TSENSE_OUTPUT_MODE_800 = 0x2U, /**< 800 cycles update one temperature */ - TSENSE_OUTPUT_MODE_1600 = 0x3U, /**< 1600 cycles update one temperature */ - TSENSE_OUTPUT_MODE_3200 = 0x4U, /**< 3200 cycles update one temperature */ -} tsense_output_mode_t; - -/** - * @brief Source select - */ -typedef enum { - TSENSE_SOURCE_LOSC = 0x0U, /**< LOSC */ - TSENSE_SOURCE_LRC = 0x1U, /**< LRC */ -} tsense_source_sel_t; - - -/** - * @brief Define callback function type - */ -typedef void (*tsense_cbk)(uint16_t value, ald_status_t status); -/** - * @} - */ - -/** - * @defgroup TSENSE_Private_Macros TSENSE Private Macros - * @{ - */ -#define IS_TSENSE_SOURCE_SEL(x) (((x) == TSENSE_SOURCE_LOSC) || \ - ((x) == TSENSE_SOURCE_LRC)) -/** - * @} - */ - -/** @addtogroup TSENSE_Public_Functions - * @{ - */ -/** @addtogroup TSENSE_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -extern void ald_tsense_init(void); -extern void ald_tsense_source_select(tsense_source_sel_t sel); -/** - * @} - */ -/** @addtogroup TSENSE_Public_Functions_Group2 - * @{ - */ -/* Control functions */ -extern ald_status_t ald_tsense_get_value(uint16_t *tsense); -extern void ald_tsense_get_value_by_it(tsense_cbk cbk); -extern void ald_tsense_irq_handler(void); -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_TSENSE_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_uart.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_uart.h deleted file mode 100644 index 10a351ca19..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_uart.h +++ /dev/null @@ -1,461 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_uart.h - * @brief Header file of UART module library. - * - * @version V1.0 - * @date 21 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_UART_H__ -#define __ALD_UART_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup UART - * @{ - */ - -/** - * @defgroup UART_Public_Macros UART Public Macros - * @{ - */ -#define UART_RX_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_RXEN_MSK)) -#define UART_RX_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_RXEN_MSK)) -#define UART_BRR_WRITE_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_BRWEN_MSK)) -#define UART_BRR_WRITE_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_BRWEN_MSK)) -#define UART_RX_TIMEOUT_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_RTOEN_MSK)) -#define UART_RX_TIMEOUT_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_RTOEN_MSK)) -#define UART_MSB_FIRST_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_MSBFIRST_MSK)) -#define UART_MSB_FIRST_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_MSBFIRST_MSK)) -#define UART_DATA_INV_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_DATAINV_MSK)) -#define UART_DATA_INV_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_DATAINV_MSK)) -#define UART_RX_INV_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_RXINV_MSK)) -#define UART_RX_INV_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_RXINV_MSK)) -#define UART_TX_INV_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_TXINV_MSK)) -#define UART_TX_INV_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_TXINV_MSK)) -#define UART_TX_RX_SWAP_ENABLE(hperh) (SET_BIT((hperh)->perh->LCR, UART_LCR_SWAP_MSK)) -#define UART_TX_RX_SWAP_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->LCR, UART_LCR_SWAP_MSK)) -#define UART_HDSEL_ENABLE(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_HDSEL_MSK)) -#define UART_HDSEL_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->MCR, UART_MCR_HDSEL_MSK)) -#define UART_FIFO_TX_RESET(hperh) (SET_BIT((hperh)->perh->FCR, UART_FCR_TFRST_MSK)) -#define UART_FIFO_RX_RESET(hperh) (SET_BIT((hperh)->perh->FCR, UART_FCR_RFRST_MSK)) -#define UART_LPBMOD_ENABLE(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_LBEN_MSK)) -#define UART_LPBMOD_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->MCR, UART_MCR_LBEN_MSK)) -#define UART_AUTOBR_ENABLE(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_ABREN_MSK)) -#define UART_AUTOBR_DISABLE(hperh) (CLEAR_BIT((hperh)->perh->MCR, UART_MCR_ABREN_MSK)) -#define UART_AUTOBR_RESTART(hperh) (SET_BIT((hperh)->perh->MCR, UART_MCR_ABRRS_MSK)) -#define UART_GET_BRR_VALUE(hperh) (READ_REG((hperh)->perh->BRR)) -#define UART_SET_TIMEOUT_VALUE(x, y) (MODIFY_REG((x)->perh->RTOR, UART_RTOR_RTO_MSK, (y) << UART_RTOR_RTO_POSS)) -/** - * @} - */ - -/** @defgroup UART_Public_Types UART Public Types - * @{ - */ -/** - * @brief UART word length - */ -typedef enum { - UART_WORD_LENGTH_5B = 0x0U, /**< 5-bits */ - UART_WORD_LENGTH_6B = 0x1U, /**< 6-bits */ - UART_WORD_LENGTH_7B = 0x2U, /**< 7-bits */ - UART_WORD_LENGTH_8B = 0x3U, /**< 8-bits */ -} uart_word_length_t; - -/** - * @brief UART stop bits - */ -typedef enum { - UART_STOP_BITS_1 = 0x0U, /**< 1-bits */ - UART_STOP_BITS_2 = 0x1U, /**< 2-bits */ - UART_STOP_BITS_0_5 = 0x0U, /**< 0.5-bits, using smartcard mode */ - UART_STOP_BITS_1_5 = 0x1U, /**< 1.5-bits, using smartcard mode */ -} uart_stop_bits_t; - -/** - * @brief UART parity - */ -typedef enum { - UART_PARITY_NONE = 0x0U, /**< Not parity */ - UART_PARITY_ODD = 0x1U, /**< Odd parity */ - UART_PARITY_EVEN = 0x3U, /**< Even parity */ -} uart_parity_t; - -/** - * @brief UART mode - */ -typedef enum { - UART_MODE_UART = 0x0U, /**< UART */ - UART_MODE_LIN = 0x1U, /**< LIN */ - UART_MODE_IrDA = 0x2U, /**< IrDA */ - UART_MODE_RS485 = 0x3U, /**< RS485 */ - UART_MODE_HDSEL = 0x4U, /**< Single-wire half-duplex */ -} uart_mode_t; - -/** - * @brief UART hardware flow control - */ -typedef enum { - UART_HW_FLOW_CTL_DISABLE = 0x0U, /**< Auto-flow-control disable */ - UART_HW_FLOW_CTL_ENABLE = 0x1U, /**< Auto-flow-control enable */ -} uart_hw_flow_ctl_t; - -/** - * @brief ALD UART state - */ -typedef enum { - UART_STATE_RESET = 0x00U, /**< Peripheral is not initialized */ - UART_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - UART_STATE_BUSY = 0x02U, /**< an internal process is ongoing */ - UART_STATE_BUSY_TX = 0x11U, /**< Data Transmission process is ongoing */ - UART_STATE_BUSY_RX = 0x21U, /**< Data Reception process is ongoing */ - UART_STATE_BUSY_TX_RX = 0x31U, /**< Data Transmission Reception process is ongoing */ - UART_STATE_TIMEOUT = 0x03U, /**< Timeout state */ - UART_STATE_ERROR = 0x04U, /**< Error */ -} uart_state_t; - -/** - * @brief UART error codes - */ -typedef enum { - UART_ERROR_NONE = ((uint32_t)0x00U), /**< No error */ - UART_ERROR_PE = ((uint32_t)0x01U), /**< Parity error */ - UART_ERROR_NE = ((uint32_t)0x02U), /**< Noise error */ - UART_ERROR_FE = ((uint32_t)0x04U), /**< frame error */ - UART_ERROR_ORE = ((uint32_t)0x08U), /**< Overrun error */ - UART_ERROR_DMA = ((uint32_t)0x10U), /**< DMA transfer error */ -} uart_error_t; - -/** - * @brief UART init structure definition - */ -typedef struct { - uint32_t baud; /**< Specifies the uart communication baud rate */ - uart_word_length_t word_length; /**< Specifies the number of data bits transmitted or received in a frame */ - uart_stop_bits_t stop_bits; /**< Specifies the number of stop bits transmitted */ - uart_parity_t parity; /**< Specifies the parity mode */ - uart_mode_t mode; /**< Specifies uart mode */ - uart_hw_flow_ctl_t fctl; /**< Specifies wether the hardware flow control mode is enabled or disabled */ -} uart_init_t; - -/** - * @brief UART handle structure definition - */ -typedef struct uart_handle_s { - UART_TypeDef *perh; /**< UART registers base address */ - uart_init_t init; /**< UART communication parameters */ - uint8_t *tx_buf; /**< Pointer to UART Tx transfer Buffer */ - uint16_t tx_size; /**< UART Tx Transfer size */ - uint16_t tx_count; /**< UART Tx Transfer Counter */ - uint8_t *rx_buf; /**< Pointer to UART Rx transfer Buffer */ - uint16_t rx_size; /**< UART Rx Transfer size */ - uint16_t rx_count; /**< UART Rx Transfer Counter */ -#ifdef ALD_DMA - dma_handle_t hdmatx; /**< UART Tx DMA Handle parameters */ - dma_handle_t hdmarx; /**< UART Rx DMA Handle parameters */ -#endif - lock_state_t lock; /**< Locking object */ - uart_state_t state; /**< UART communication state */ - uart_error_t err_code; /**< UART Error code */ - - void (*tx_cplt_cbk)(struct uart_handle_s *arg); /**< Tx completed callback */ - void (*rx_cplt_cbk)(struct uart_handle_s *arg); /**< Rx completed callback */ - void (*error_cbk)(struct uart_handle_s *arg); /**< error callback */ -} uart_handle_t; - -/** - * @brief UART RS485 configure structure definition - */ -typedef struct { - type_func_t normal; /**< Normal mode */ - type_func_t dir; /**< Auto-direction mode */ - type_func_t invert; /**< Address detection invert */ - uint8_t addr; /**< Address for compare */ -} uart_rs485_config_t; - -/** - * @brief LIN detection break length - */ -typedef enum { - LIN_BREAK_LEN_10B = 0x0U, /**< 10-bit break */ - LIN_BREAK_LEN_11B = 0x1U, /**< 11-bit break */ -} uart_lin_break_len_t; - -/** - * @brief UART TXFIFO size - */ -typedef enum { - UART_TXFIFO_EMPTY = 0x0U, /**< Empty */ - UART_TXFIFO_2BYTE = 0x1U, /**< 2-Bytes */ - UART_TXFIFO_4BYTE = 0x2U, /**< 4-Bytes */ - UART_TXFIFO_8BYTE = 0x3U, /**< 8-Bytes */ -} uart_txfifo_t; - -/** - * @brief UART RXFIFO size - */ -typedef enum { - UART_RXFIFO_1BYTE = 0x0U, /**< 1-Byte */ - UART_RXFIFO_4BYTE = 0x1U, /**< 4-Bytes */ - UART_RXFIFO_8BYTE = 0x2U, /**< 8-Bytes */ - UART_RXFIFO_14BYTE = 0x3U, /**< 14-Bytes */ -} uart_rxfifo_t; - -/** - * @brief UART auto-baud mode - */ -typedef enum { - UART_ABRMOD_1_TO_0 = 0x0U, /**< Detect bit0:1, bit1:0 */ - UART_ABRMOD_1 = 0x1U, /**< Detect bit0:1 */ - UART_ABRMOD_0_TO_1 = 0x2U, /**< Detect bit0:0, bit1:1 */ -} uart_auto_baud_mode_t; - -/** - * @brief UART status types - */ -typedef enum { - UART_STATUS_DR = (1U << 0), /**< Data ready */ - UART_STATUS_OE = (1U << 1), /**< Overrun error */ - UART_STATUS_PE = (1U << 2), /**< Parity error */ - UART_STATUS_FE = (1U << 3), /**< Framing error */ - UART_STATUS_BI = (1U << 4), /**< Break interrupt */ - UART_STATUS_TBEM = (1U << 5), /**< Transmit buffer empty */ - UART_STATUS_TEM = (1U << 6), /**< Transmitter empty */ - UART_STATUS_RFE = (1U << 7), /**< Reveiver FIFO data error */ - UART_STATUS_BUSY = (1U << 8), /**< UART busy */ - UART_STATUS_TFNF = (1U << 9), /**< Transmit FIFO not full */ - UART_STATUS_TFEM = (1U << 10), /**< Transmit FIFO not empty */ - UART_STATUS_RFNE = (1U << 11), /**< Receive FIFO not empty */ - UART_STATUS_RFF = (1U << 12), /**< Receive FIFO full */ - UART_STATUS_DCTS = (1U << 14), /**< Delta clear to send */ - UART_STATUS_CTS = (1U << 15), /**< Clear to send */ -} uart_status_t; - -/** - * @brief UART interrupt types - */ -typedef enum { - UART_IT_RXRD = (1U << 0), /**< Receive data available */ - UART_IT_TXS = (1U << 1), /**< Tx empty status */ - UART_IT_RXS = (1U << 2), /**< Rx line status */ - UART_IT_MDS = (1U << 3), /**< Modem status */ - UART_IT_RTO = (1U << 4), /**< Receiver timeout */ - UART_IT_BZ = (1U << 5), /**< Busy status */ - UART_IT_ABE = (1U << 6), /**< Auto-baud rate detection end */ - UART_IT_ABTO = (1U << 7), /**< Auto-baud rate detection timeout */ - UART_IT_LINBK = (1U << 8), /**< Lin break detection */ - UART_IT_TC = (1U << 9), /**< Transmission complete */ - UART_IT_EOB = (1U << 10), /**< End of block */ - UART_IT_CM = (1U << 11), /**< Character match */ -} uart_it_t; - -/** - * @brief UART flags types - */ -typedef enum { - UART_IF_RXRD = (1U << 0), /**< Receive data available */ - UART_IF_TXS = (1U << 1), /**< Tx empty status */ - UART_IF_RXS = (1U << 2), /**< Rx line status */ - UART_IF_MDS = (1U << 3), /**< Modem status */ - UART_IF_RTO = (1U << 4), /**< Receiver timeout */ - UART_IF_BZ = (1U << 5), /**< Busy status */ - UART_IF_ABE = (1U << 6), /**< Auto-baud rate detection end */ - UART_IF_ABTO = (1U << 7), /**< Auto-baud rate detection timeout */ - UART_IF_LINBK = (1U << 8), /**< Lin break detection */ - UART_IF_TC = (1U << 9), /**< Transmission complete */ - UART_IF_EOB = (1U << 10), /**< End of block */ - UART_IF_CM = (1U << 11), /**< Character match */ -} uart_flag_t; -/** - * @} - */ - -/** @defgroup UART_Private_Macros UART Private Macros - * @{ - */ -#define IS_UART_ALL(x) (((x) == UART0) || \ - ((x) == UART1) || \ - ((x) == UART2) || \ - ((x) == UART3)) -#define IS_UART_WORD_LENGTH(x) (((x) == UART_WORD_LENGTH_5B) || \ - ((x) == UART_WORD_LENGTH_6B) || \ - ((x) == UART_WORD_LENGTH_7B) || \ - ((x) == UART_WORD_LENGTH_8B)) -#define IS_UART_STOPBITS(x) (((x) == UART_STOP_BITS_1) || \ - ((x) == UART_STOP_BITS_2) || \ - ((x) == UART_STOP_BITS_0_5) || \ - ((x) == UART_STOP_BITS_1_5)) -#define IS_UART_PARITY(x) (((x) == UART_PARITY_NONE) || \ - ((x) == UART_PARITY_ODD) || \ - ((x) == UART_PARITY_EVEN)) -#define IS_UART_MODE(x) (((x) == UART_MODE_UART) || \ - ((x) == UART_MODE_LIN) || \ - ((x) == UART_MODE_IrDA) || \ - ((x) == UART_MODE_RS485) || \ - ((x) == UART_MODE_HDSEL)) -#define IS_UART_HARDWARE_FLOW_CONTROL(x) \ - (((x) == UART_HW_FLOW_CTL_DISABLE) || \ - ((x) == UART_HW_FLOW_CTL_ENABLE)) -#define IS_UART_LIN_BREAK_LEN(x) (((x) == LIN_BREAK_LEN_10B) || \ - ((x) == LIN_BREAK_LEN_11B)) -#define IS_UART_TXFIFO_TYPE(x) (((x) == UART_TXFIFO_EMPTY) || \ - ((x) == UART_TXFIFO_2BYTE) || \ - ((x) == UART_TXFIFO_4BYTE) || \ - ((x) == UART_TXFIFO_8BYTE)) -#define IS_UART_RXFIFO_TYPE(x) (((x) == UART_RXFIFO_1BYTE) || \ - ((x) == UART_RXFIFO_4BYTE) || \ - ((x) == UART_RXFIFO_8BYTE) || \ - ((x) == UART_RXFIFO_14BYTE)) -#define IS_UART_AUTO_BAUD_MODE(x) (((x) == UART_ABRMOD_1_TO_0) || \ - ((x) == UART_ABRMOD_1) || \ - ((x) == UART_ABRMOD_0_TO_1)) -#define IS_UART_STATUS(x) (((x) == UART_STATUS_DR) || \ - ((x) == UART_STATUS_OE) || \ - ((x) == UART_STATUS_PE) || \ - ((x) == UART_STATUS_FE) || \ - ((x) == UART_STATUS_BI) || \ - ((x) == UART_STATUS_TBEM) || \ - ((x) == UART_STATUS_TEM) || \ - ((x) == UART_STATUS_RFE) || \ - ((x) == UART_STATUS_BUSY) || \ - ((x) == UART_STATUS_TFNF) || \ - ((x) == UART_STATUS_TFEM) || \ - ((x) == UART_STATUS_RFNE) || \ - ((x) == UART_STATUS_RFF) || \ - ((x) == UART_STATUS_DCTS) || \ - ((x) == UART_STATUS_CTS)) -#define IS_UART_IT(x) (((x) == UART_IT_RXRD) || \ - ((x) == UART_IT_TXS) || \ - ((x) == UART_IT_RXS) || \ - ((x) == UART_IT_MDS) || \ - ((x) == UART_IT_RTO) || \ - ((x) == UART_IT_BZ) || \ - ((x) == UART_IT_ABE) || \ - ((x) == UART_IT_ABTO) || \ - ((x) == UART_IT_LINBK) || \ - ((x) == UART_IT_TC) || \ - ((x) == UART_IT_EOB) || \ - ((x) == UART_IT_CM)) -#define IS_UART_IF(x) (((x) == UART_IF_RXRD) || \ - ((x) == UART_IF_TXS) || \ - ((x) == UART_IF_RXS) || \ - ((x) == UART_IF_MDS) || \ - ((x) == UART_IF_RTO) || \ - ((x) == UART_IF_BZ) || \ - ((x) == UART_IF_ABE) || \ - ((x) == UART_IF_ABTO) || \ - ((x) == UART_IF_LINBK) || \ - ((x) == UART_IF_TC) || \ - ((x) == UART_IF_EOB) || \ - ((x) == UART_IF_CM)) -#define IS_UART_BAUDRATE(x) (((x) > 0) && ((x) < 0x44AA21)) -#define IS_UART_DATA(x) ((x) <= 0x1FF) - -#define UART_STATE_TX_MASK (1U << 4) -#define UART_STATE_RX_MASK (1U << 5) -/** - * @} - */ - -/** @addtogroup UART_Public_Functions - * @{ - */ - -/** @addtogroup UART_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -void ald_uart_init(uart_handle_t *hperh); -void ald_uart_reset(uart_handle_t *hperh); -void ald_uart_rs485_config(uart_handle_t *hperh, uart_rs485_config_t *config); -/** - * @} - */ - -/** @addtogroup UART_Public_Functions_Group2 - * @{ - */ -/* IO operation functions */ -ald_status_t ald_uart_send(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_uart_recv(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_uart_send_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_uart_recv_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size); -#ifdef ALD_DMA -ald_status_t ald_uart_send_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_uart_recv_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_uart_dma_pause(uart_handle_t *hperh); -ald_status_t ald_uart_dma_resume(uart_handle_t *hperh); -ald_status_t ald_uart_dma_stop(uart_handle_t *hperh); -#endif -void ald_uart_irq_handler(uart_handle_t *hperh); -/** - * @} - */ - -/** @addtogroup UART_Public_Functions_Group3 - * @{ - */ -/* Peripheral Control functions */ -void ald_uart_interrupt_config(uart_handle_t *hperh, uart_it_t it, type_func_t state); -void ald_uart_dma_req_config(uart_handle_t *hperh, type_func_t state); -void ald_uart_tx_fifo_config(uart_handle_t *hperh, uart_txfifo_t config); -void ald_uart_rx_fifo_config(uart_handle_t *hperh, uart_rxfifo_t config); -void ald_uart_lin_send_break(uart_handle_t *hperh); -void ald_uart_lin_detect_break_len_config(uart_handle_t *hperh, uart_lin_break_len_t len); -void ald_uart_auto_baud_config(uart_handle_t *hperh, uart_auto_baud_mode_t mode); -ald_status_t ald_uart_rs485_send_addr(uart_handle_t *hperh, uint16_t addr, uint32_t timeout); -it_status_t ald_uart_get_it_status(uart_handle_t *hperh, uart_it_t it); -flag_status_t ald_uart_get_status(uart_handle_t *hperh, uart_status_t status); -flag_status_t ald_uart_get_flag_status(uart_handle_t *hperh, uart_flag_t flag); -flag_status_t ald_uart_get_mask_flag_status(uart_handle_t *hperh, uart_flag_t flag); -void ald_uart_clear_flag_status(uart_handle_t *hperh, uart_flag_t flag); -/** - * @} - */ - -/** @addtogroup UART_Public_Functions_Group4 - * @{ - */ -/* Peripheral State and Errors functions */ -uart_state_t ald_uart_get_state(uart_handle_t *hperh); -uint32_t ald_uart_get_error(uart_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_UART_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_usart.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_usart.h deleted file mode 100644 index 4f30e2c2a4..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_usart.h +++ /dev/null @@ -1,560 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_usart.h - * @brief Header file of USART module library. - * - * @version V1.0 - * @date 16 Apr 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __ALD_USART_H__ -#define __ALD_USART_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include "utils.h" -#include "ald_dma.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup USART - * @{ - */ - -/** @defgroup USART_Public_Types USART Public Types - * @{ - */ - -/** - * @brief usart_word_length - */ -typedef enum { - USART_WORD_LENGTH_8B = 0x0U, /**< Word length is 8-bits */ - USART_WORD_LENGTH_9B = 0x1U, /**< Word length is 9-bits */ -} usart_word_length_t; - -/** - * @brief usart_stop_bits - */ -typedef enum { - USART_STOP_BITS_1 = 0x0U, /**< Stop bits is 1-bits */ - USART_STOP_BITS_0_5 = 0x1U, /**< Stop bits is 0.5-bits */ - USART_STOP_BITS_2 = 0x2U, /**< Stop bits is 2-bits */ - USART_STOP_BITS_1_5 = 0x3U, /**< Stop bits is 1.5-bits */ -} usart_stop_bits_t; - -/** - * @brief usart_parity - */ -typedef enum { - USART_PARITY_NONE = 0x0U, /**< Not parity */ - USART_PARITY_EVEN = 0x2U, /**< Even parity */ - USART_PARITY_ODD = 0x3U, /**< Odd parity */ -} usart_parity_t; - -/** - * @brief usart_mode - */ -typedef enum { - USART_MODE_RX = 0x1U, /**< TX mode */ - USART_MODE_TX = 0x2U, /**< RX mode */ - USART_MODE_TX_RX = 0x3U, /**< TX & RX mode */ -} usart_mode_t; - -/** - * @brief usart_hardware_flow_control - */ -typedef enum { - USART_HW_FLOW_CTL_NONE = 0x0U, /**< Not flow control */ - USART_HW_FLOW_CTL_RTS = 0x1U, /**< RTS flow control */ - USART_HW_FLOW_CTL_CTS = 0x2U, /**< CTS flow control */ - USART_HW_FLOW_CTL_RTS_CTS = 0x3U, /**< RTS & CTS flow control */ -} usart_hw_flow_ctl_t; - -/** - * @brief usart_clock - */ -typedef enum { - USART_CLOCK_DISABLE = 0x0U, /**< Disable clock output */ - USART_CLOCK_ENABLE = 0x1U, /**< Enable clock output */ -} usart_clock_t; - -/** - * @brief usart_clock_polarity - */ -typedef enum { - USART_CPOL_LOW = 0x0U, /**< Clock polarity low */ - USART_CPOL_HIGH = 0x1U, /**< Clock polarity high */ -} usart_cpol_t; - -/** - * @brief usart_clock_phase - */ -typedef enum { - USART_CPHA_1EDGE = 0x0U, /**< Clock phase first edge */ - USART_CPHA_2EDGE = 0x1U, /**< Clock phase second edge */ -} usart_cpha_t; - -/** - * @brief usart_last_bit - */ -typedef enum { - USART_LAST_BIT_DISABLE = 0x0U, /**< Disable last bit clock output */ - USART_LAST_BIT_ENABLE = 0x1U, /**< Enable last bit clock output */ -} usart_last_bit_t; - -/** - * @brief usart state structures definition - */ -typedef enum { - USART_STATE_RESET = 0x00U, /**< Peripheral is not initialized */ - USART_STATE_READY = 0x01U, /**< Peripheral Initialized and ready for use */ - USART_STATE_BUSY = 0x02U, /**< an internal process is ongoing */ - USART_STATE_BUSY_TX = 0x11U, /**< Data Transmission process is ongoing */ - USART_STATE_BUSY_RX = 0x21U, /**< Data Reception process is ongoing */ - USART_STATE_BUSY_TX_RX = 0x31U, /**< Data Transmission Reception process is ongoing */ - USART_STATE_TIMEOUT = 0x03U, /**< Timeout state */ - USART_STATE_ERROR = 0x04U, /**< Error */ -} usart_state_t; - -/** - * @brief usart error codes - */ -typedef enum { - USART_ERROR_NONE = ((uint32_t)0x00U), /**< No error */ - USART_ERROR_PE = ((uint32_t)0x01U), /**< Parity error */ - USART_ERROR_NE = ((uint32_t)0x02U), /**< Noise error */ - USART_ERROR_FE = ((uint32_t)0x04U), /**< frame error */ - USART_ERROR_ORE = ((uint32_t)0x08U), /**< Overrun error */ - USART_ERROR_DMA = ((uint32_t)0x10U), /**< DMA transfer error */ -} usart_error_t; - - -/** - * @brief usart init structure definition - */ -typedef struct { - uint32_t baud; /**< This member configures the Usart communication baud rate. */ - usart_word_length_t word_length;/**< Specifies the number of data bits transmitted or received in a frame. */ - usart_stop_bits_t stop_bits; /**< Specifies the number of stop bits transmitted. */ - usart_parity_t parity; /**< Specifies the parity mode. - @note When parity is enabled, the computed parity is inserted - at the MSB position of the transmitted data (9th bit when - the word length is set to 9 data bits; 8th bit when the - word length is set to 8 data bits). */ - usart_mode_t mode; /**< Specifies wether the Receive or Transmit mode is enabled or disabled. */ - usart_hw_flow_ctl_t fctl; /**< Specifies wether the hardware flow control mode is enabled or disabled. */ -} usart_init_t; - -/** - * @brief USART handle structure definition - */ -typedef struct usart_handle_s { - USART_TypeDef *perh; /**< USART registers base address */ - usart_init_t init; /**< USART communication parameters */ - uint8_t *tx_buf; /**< Pointer to USART Tx transfer buffer */ - uint16_t tx_size; /**< USART Tx transfer size */ - uint16_t tx_count; /**< USART Tx transfer counter */ - uint8_t *rx_buf; /**< Pointer to USART Rx transfer buffer */ - uint16_t rx_size; /**< USART Rx Transfer size */ - uint16_t rx_count; /**< USART Rx Transfer Counter */ -#ifdef ALD_DMA - dma_handle_t hdmatx; /**< USART Tx DMA handle parameters */ - dma_handle_t hdmarx; /**< USART Rx DMA handle parameters */ -#endif - lock_state_t lock; /**< Locking object */ - usart_state_t state; /**< USART communication state */ - uint32_t err_code; /**< USART error code */ - - void (*tx_cplt_cbk)(struct usart_handle_s *arg); /**< Tx completed callback */ - void (*rx_cplt_cbk)(struct usart_handle_s *arg); /**< Rx completed callback */ - void (*tx_rx_cplt_cbk)(struct usart_handle_s *arg); /**< Tx & Rx completed callback */ - void (*error_cbk)(struct usart_handle_s *arg); /**< error callback */ -} usart_handle_t; - - -/** - * @brief USART clock init structure definition - */ -typedef struct { - usart_clock_t clk; /**< Pecifies whether the USART clock is enable or disable. */ - usart_cpol_t polarity; /**< Specifies the steady state of the serial clock. */ - usart_cpha_t phase; /**< Specifies the clock transition on which the bit capture is made. */ - usart_last_bit_t last_bit; /**< Specifies whether the clock pulse corresponding to the last transmitted - data bit (MSB) has to be output on the SCLK pin in synchronous mode. */ -} usart_clock_init_t; - - -/** - * @brief usart_dma_request - */ -typedef enum { - USART_DMA_REQ_TX = (1U << 7), /**< TX dma bit */ - USART_DMA_REQ_RX = (1U << 6), /**< RX dma bit */ -} usart_dma_req_t; - -/** - * @brief usart_wakeup_methods - */ -typedef enum { - USART_WAKEUP_IDLE = 0x0U, /**< Wake up the machine when bus-line is idle */ - USART_WAKEUP_ADDR = 0x1U, /**< Wake up the machine when match the address */ -} usart_wakeup_t; - -/** - * @brief usart_IrDA_low_power - */ -typedef enum { - USART_IrDA_MODE_NORMAL = 0x0U, /**< Normal IrDA mode */ - USART_IrDA_MODE_LOW_POWER = 0x1U, /**< Low-power IrDA mode */ -} usart_IrDA_mode_t; - -/** - * @brief USART interrupts definition - */ -typedef enum { - USART_IT_PE = ((1U << 8) | (1U << 16)), /**< Parity error */ - USART_IT_TXE = ((1U << 7) | (1U << 16)), /**< Tx empty */ - USART_IT_TC = ((1U << 6) | (1U << 16)), /**< Tx complete */ - USART_IT_RXNE = ((1U << 5) | (1U << 16)), /**< Rx not empty */ - USART_IT_IDLE = ((1U << 4) | (1U << 16)), /**< Idle */ - USART_IT_CTS = ((1U << 10)| (1U << 18)), /**< CTS */ - USART_IT_ERR = ((1U << 0) | (1U << 18)), /**< Error */ - USART_IT_ORE = (1U << 3), /**< Overrun error */ - USART_IT_NE = (1U << 2), /**< Noise error */ - USART_IT_FE = (1U << 0), /**< Frame error */ -} usart_it_t; - -/** - * @brief USART flags - */ -typedef enum { - USART_FLAG_CTS = (1U << 9), /**< CTS */ - USART_FLAG_TXE = (1U << 7), /**< Tx empty */ - USART_FLAG_TC = (1U << 6), /**< Tx complete */ - USART_FLAG_RXNE = (1U << 5), /**< Rx not empty */ - USART_FLAG_IDLE = (1U << 4), /**< Idle */ - USART_FLAG_ORE = (1U << 3), /**< Overrun error */ - USART_FLAG_NE = (1U << 2), /**< Noise error */ - USART_FLAG_FE = (1U << 1), /**< Frame error */ - USART_FLAG_PE = (1U << 0), /**< Parity error */ -} usart_flag_t; - -/** - * @} - */ - - -/** @defgroup USART_Public_Macros USART Public Macros - * @{ - */ - -/** @defgroup USART_Public_Macros_1 USART handle reset - * @{ - */ -#define USART_RESET_HANDLE_STATE(handle) ((handle)->state = USART_STATE_RESET) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_2 USART clear PE flag - * @{ - */ -#define USART_CLEAR_PEFLAG(handle) \ -do { \ - __IO uint32_t tmpreg; \ - tmpreg = (handle)->perh->STAT; \ - tmpreg = (handle)->perh->DATA; \ - UNUSED(tmpreg); \ -} while (0) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_3 USART clear FE flag - * @{ - */ -#define USART_CLEAR_FEFLAG(handle) USART_CLEAR_PEFLAG(handle) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_4 USART clear NE flag - * @{ - */ -#define USART_CLEAR_NEFLAG(handle) USART_CLEAR_PEFLAG(handle) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_5 USART clear ORE flag - * @{ - */ -#define USART_CLEAR_OREFLAG(handle) USART_CLEAR_PEFLAG(handle) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_6 USART clear IDLE flag - * @{ - */ -#define USART_CLEAR_IDLEFLAG(handle) USART_CLEAR_PEFLAG(handle) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_7 USART enable CTS flow control - * @{ - */ -#define USART_HWCONTROL_CTS_ENABLE(handle) \ - (SET_BIT((handle)->perh->CON2, USART_CON2_CTSEN_MSK)) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_8 USART disable CTS flow control - * @{ - */ -#define USART_HWCONTROL_CTS_DISABLE(handle) \ - (CLEAR_BIT((handle)->perh->CON2, USART_CON2_CTSEN_MSK)) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_9 USART enable RTS flow control - * @{ - */ -#define USART_HWCONTROL_RTS_ENABLE(handle) \ - (SET_BIT((handle)->perh->CON2, USART_CON2_RTSEN_MSK)) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_10 USART disable RTS flow control - * @{ - */ -#define USART_HWCONTROL_RTS_DISABLE(handle) \ - (CLEAR_BIT((handle)->perh->CON2, USART_CON2_RTSEN_MSK)) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_11 USART enable - * @{ - */ -#define USART_ENABLE(handle) (SET_BIT((handle)->perh->CON0, USART_CON0_EN_MSK)) -/** - * @} - */ - -/** @defgroup USART_Public_Macros_12 USART disable - * @{ - */ -#define USART_DISABLE(handle) (CLEAR_BIT((handle)->perh->CON0, USART_CON0_EN_MSK)) - /** - * @} - */ - -/** - * @} - */ - -/** @defgroup USART_Private_Macros USART Private Macros - * @{ - */ - -#define IS_USART(x) (((x) == USART0) || ((x) == USART1)) -#define IS_USART_WORD_LENGTH(x) (((x) == USART_WORD_LENGTH_8B) || \ - ((x) == USART_WORD_LENGTH_9B)) -#define IS_USART_STOPBITS(x) (((x) == USART_STOP_BITS_1) || \ - ((x) == USART_STOP_BITS_0_5) || \ - ((x) == USART_STOP_BITS_2) || \ - ((x) == USART_STOP_BITS_1_5)) -#define IS_USART_PARITY(x) (((x) == USART_PARITY_NONE) || \ - ((x) == USART_PARITY_EVEN) || \ - ((x) == USART_PARITY_ODD)) -#define IS_USART_MODE(x) (((x) == USART_MODE_RX) || \ - ((x) == USART_MODE_TX) || \ - ((x) == USART_MODE_TX_RX)) -#define IS_USART_HARDWARE_FLOW_CONTROL(x)\ - (((x) == USART_HW_FLOW_CTL_NONE) || \ - ((x) == USART_HW_FLOW_CTL_RTS) || \ - ((x) == USART_HW_FLOW_CTL_CTS) || \ - ((x) == USART_HW_FLOW_CTL_RTS_CTS)) -#define IS_USART_CLOCK(x) (((x) == USART_CLOCK_DISABLE) || \ - ((x) == USART_CLOCK_ENABLE)) -#define IS_USART_CPOL(x) (((x) == USART_CPOL_LOW) || ((x) == USART_CPOL_HIGH)) -#define IS_USART_CPHA(x) (((x) == USART_CPHA_1EDGE) || ((x) == USART_CPHA_2EDGE)) -#define IS_USART_LASTBIT(x) (((x) == USART_LAST_BIT_DISABLE) || \ - ((x) == USART_LAST_BIT_ENABLE)) -#define IS_USART_DMAREQ(x) (((x) == USART_DMA_REQ_TX) || \ - ((x) == USART_DMA_REQ_RX)) -#define IS_USART_WAKEUP(x) (((x) == USART_WAKEUP_IDLE) || \ - ((x) == USART_WAKEUP_ADDR)) -#define IS_USART_IRDA_MODE(x) (((x) == USART_IrDA_MODE_NORMAL) || \ - ((x) == USART_IrDA_MODE_LOW_POWER)) -#define IS_USART_CONFIG_IT(x) (((x) == USART_IT_PE) || ((x) == USART_IT_TXE) || \ - ((x) == USART_IT_TC) || ((x) == USART_IT_RXNE) || \ - ((x) == USART_IT_IDLE) || \ - ((x) == USART_IT_CTS) || ((x) == USART_IT_ERR)) -#define IS_USART_GET_IT(x) (((x) == USART_IT_PE) || ((x) == USART_IT_TXE) || \ - ((x) == USART_IT_TC) || ((x) == USART_IT_RXNE) || \ - ((x) == USART_IT_IDLE) || \ - ((x) == USART_IT_CTS) || ((x) == USART_IT_ORE) || \ - ((x) == USART_IT_NE) || ((x) == USART_IT_FE) || \ - ((x) == USART_IT_ERR)) -#define IS_USART_CLEAR_IT(x) (((x) == USART_IT_TC) || ((x) == USART_IT_RXNE) || \ - ((x) == USART_IT_CTS)) - -#define IS_USART_FLAG(x) (((x) == USART_FLAG_PE) || ((x) == USART_FLAG_TXE) || \ - ((x) == USART_FLAG_TC) || ((x) == USART_FLAG_RXNE) || \ - ((x) == USART_FLAG_IDLE) || \ - ((x) == USART_FLAG_CTS) || ((x) == USART_FLAG_ORE) || \ - ((x) == USART_FLAG_NE) || ((x) == USART_FLAG_FE)) -#define IS_USART_CLEAR_FLAG(x) (((x) == USART_FLAG_CTS) || \ - ((x) == USART_FLAG_TC) || \ - ((x) == USART_FLAG_RXNE)) -#define IS_USART_BAUDRATE(x) (((x) > 0) && ((x) < 0x0044AA21)) -#define IS_USART_ADDRESS(x) ((x) <= 0xF) -#define IS_USART_DATA(x) ((x) <= 0x1FF) -#define DUMMY_DATA 0xFFFF -#define USART_STATE_TX_MASK (1U << 4) -#define USART_STATE_RX_MASK (1U << 5) - -/** - * @} - */ - -/** @addtogroup USART_Public_Functions - * @{ - */ - -/** @addtogroup USART_Public_Functions_Group1 - * @{ - */ -/* Initialization functions */ -void ald_usart_reset(usart_handle_t *hperh); -ald_status_t ald_usart_init(usart_handle_t *hperh); -ald_status_t ald_usart_half_duplex_init(usart_handle_t *hperh); -ald_status_t ald_usart_multi_processor_init(usart_handle_t *hperh, uint8_t addr, usart_wakeup_t wakeup); -ald_status_t ald_usart_clock_init(usart_handle_t *hperh, usart_clock_init_t *init); -/** - * @} - */ - -/** @addtogroup USART_Public_Functions_Group2 - * @{ - */ - -/** @addtogroup USART_Public_Functions_Group2_1 - * @{ - */ -/* Asynchronization IO operation functions */ -ald_status_t ald_usart_send(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_usart_recv(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_usart_send_by_it(usart_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_usart_recv_by_it(usart_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_usart_recv_frame_by_it(usart_handle_t *hperh, uint8_t *buf, uint16_t size); -#ifdef ALD_DMA -ald_status_t ald_usart_send_by_dma(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_usart_recv_by_dma(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -#endif -/** - * @} - */ - -/** @addtogroup USART_Public_Functions_Group2_2 - * @{ - */ -/* Synchronization IO operation functions */ -ald_status_t ald_usart_send_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_usart_recv_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout); -ald_status_t ald_usart_send_recv_sync(usart_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint32_t timeout); -ald_status_t ald_usart_send_by_it_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_usart_recv_by_it_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size); -ald_status_t ald_usart_send_recv_by_it_sync(usart_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size); -#ifdef ALD_DMA -ald_status_t ald_usart_send_by_dma_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel); -ald_status_t ald_usart_recv_by_dma_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel); -ald_status_t ald_usart_send_recv_by_dma_sync(usart_handle_t *hperh, uint8_t *tx_buf, - uint8_t *rx_buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel); -#endif -/** - * @} - */ - -/** @addtogroup USART_Public_Functions_Group2_3 - * @{ - */ -/* Utilities functions */ -#ifdef ALD_DMA -ald_status_t ald_usart_dma_pause(usart_handle_t *hperh); -ald_status_t ald_usart_dma_resume(usart_handle_t *hperh); -ald_status_t ald_usart_dma_stop(usart_handle_t *hperh); -#endif -void ald_usart_irq_handler(usart_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** @addtogroup USART_Public_Functions_Group3 - * @{ - */ -/* Peripheral control functions */ -ald_status_t ald_usart_multi_processor_enter_mute_mode(usart_handle_t *hperh); -ald_status_t ald_usart_multi_processor_exit_mute_mode(usart_handle_t *hperh); -ald_status_t ald_usart_half_duplex_enable_send(usart_handle_t *hperh); -ald_status_t ald_usart_half_duplex_enable_recv(usart_handle_t *hperh); -void ald_usart_dma_req_config(usart_handle_t *hperh, usart_dma_req_t req, type_func_t state); -void ald_usart_interrupt_config(usart_handle_t *hperh, usart_it_t it, type_func_t state); -flag_status_t ald_usart_get_flag_status(usart_handle_t *hperh, usart_flag_t flag); -void ald_usart_clear_flag_status(usart_handle_t *hperh, usart_flag_t flag); -it_status_t ald_usart_get_it_status(usart_handle_t *hperh, usart_it_t it); -/** - * @} - */ - -/** @addtogroup USART_Public_Functions_Group4 - * @{ - */ - -/* Peripheral state and error functions */ -usart_state_t ald_usart_get_state(usart_handle_t *hperh); -uint32_t ald_usart_get_error(usart_handle_t *hperh); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_USART_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_wdt.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_wdt.h deleted file mode 100644 index 619f777324..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/ald_wdt.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_wdt.h - * @brief Header file of WDT module driver. - * - * @version V1.0 - * @date 18 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - */ - -#ifndef __ALD_WDT_H__ -#define __ALD_WDT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "utils.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup WDT - * @{ - */ - -/** @defgroup WDT_Public_Types WDT Public Types - * @{ - */ - -/** - * @brief Wwdt no dog window - */ -typedef enum { - WWDT_WIN_25 = 0x0U, /**< No dog window size: 25% */ - WWDT_WIN_50 = 0x1U, /**< No dog window size: 50% */ - WWDT_WIN_75 = 0x2U, /**< No dog window size: 75% */ - WWDT_WIN_00 = 0x3U, /**< No dog window size: 0% */ -} wwdt_win_t; - -/** - * @} - */ - -/** - * @defgroup WDT_Private_Macros WDT Private Macros - * @{ - */ -#define WWDT_UNLOCK() {WRITE_REG(WWDT->LOCK, 0x1ACCE551U);} -#define WWDT_LOCK() {WRITE_REG(WWDT->LOCK, 0xFFFFFFFFU);} -#define IWDT_UNLOCK() {WRITE_REG(IWDT->LOCK, 0x1ACCE551U);} -#define IWDT_LOCK() {WRITE_REG(IWDT->LOCK, 0xFFFFFFFFU);} - -/** - * @} - */ - -/** - * @addtogroup WDT_Private_Macros WDT Private Macros - * @{ - */ -#define IS_WWDT_WIN_TYPE(x) ((x == WWDT_WIN_25) || \ - (x == WWDT_WIN_50) || \ - (x == WWDT_WIN_75) || \ - (x == WWDT_WIN_00)) -#define IS_FUNC_STATE(x) (((x) == DISABLE) || \ - ((x) == ENABLE)) -/** - * @} - */ - -/** @addtogroup WWDT_Public_Functions - * @{ - */ -void ald_wwdt_init(uint32_t load, wwdt_win_t win, type_func_t interrupt); -void ald_wwdt_start(void); -uint32_t ald_wwdt_get_value(void); -it_status_t ald_wwdt_get_flag_status(void); -void ald_wwdt_clear_flag_status(void); -void ald_wwdt_feed_dog(void); -/** - * @} - */ - -/** @addtogroup IWDT_Public_Functions - * @{ - */ -void ald_iwdt_init(uint32_t load, type_func_t interrupt); -void ald_iwdt_start(void); -uint32_t ald_iwdt_get_value(void); -it_status_t ald_iwdt_get_flag_status(void); -void ald_iwdt_clear_flag_status(void); -void ald_iwdt_feed_dog(void); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ -#ifdef __cplusplus -} -#endif - -#endif /* __ALD_WDT_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/type.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/type.h deleted file mode 100644 index 54082f3f21..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/type.h +++ /dev/null @@ -1,122 +0,0 @@ -/** - ********************************************************************************* - * - * @file type.h - * @brief define type - * - * @version V1.0 - * @date 17 Apr 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __TYPE_H__ -#define __TYPE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -#if defined (__CC_ARM) -#define __INLINE__ __inline -#define __STATIC_INLINE__ static __inline -#else -#define __INLINE__ inline -#define __STATIC_INLINE__ static inline -#endif - -#define __isr__ - -typedef enum { - RESET = 0x0U, - SET = 0x1U, -} flag_status_t, it_status_t; - -typedef enum { - BIT_RESET = 0x0U, - BIT_SET = 0x1U, -} bit_status_t; - -typedef enum { - DISABLE = 0x0U, - ENABLE = 0x1U, -} type_func_t; -#define IS_FUNC_STATE(x) (((x) == DISABLE) || ((x) == ENABLE)) - -typedef enum { - FALSE = 0x0U, - TRUE = 0x1U, -} type_bool_t; - -typedef enum { - UNLOCK = 0x0U, - LOCK = 0x1U, -} lock_state_t; -#define IS_LOCK_STATE(x) (((x) == UNLOCK) || ((x) == LOCK)) - - -#define BIT(x) ((1U << (x))) -#define BITS(s, e) ((0xffffffffU << (s)) & (0xffffffffU >> (31 - (e)))) -#define SET_BIT(reg, bit) ((reg) |= (bit)) -#define CLEAR_BIT(reg, bit) ((reg) &= ~(bit)) -#define READ_BIT(reg, bit) ((reg) & (bit)) -#define READ_BITS(reg, msk, s) (((reg) & (msk)) >> (s)) -#define CLEAR_REG(reg) ((reg) = (0x0)) -#define WRITE_REG(reg, val) ((reg) = (val)) -#define READ_REG(reg) ((reg)) -#define MODIFY_REG(reg, clearmask, setmask) \ - WRITE_REG((reg), (((READ_REG(reg)) & (~(clearmask))) | (setmask))) -#define UNUSED(x) ((void)(x)) - -#ifdef USE_ASSERT -#define assert_param(x) \ -do { \ - if (!(x)) { \ - __disable_irq(); \ - while (1) \ - ; \ - } \ -} while (0) -#else -#define assert_param(x) -#endif - - -#define PER_MEM_BASE ((uint32_t) 0x40000000UL) /* PER base address */ -#define RAM_MEM_BASE ((uint32_t) 0x20000000UL) /* RAM base address */ -#define BITBAND_PER_BASE ((uint32_t) 0x42000000UL) /* Peripheral Address Space bit-band area */ -#define BITBAND_RAM_BASE ((uint32_t) 0x22000000UL) /* SRAM Address Space bit-band area */ - -__STATIC_INLINE__ void BITBAND_PER(volatile uint32_t *addr, uint32_t bit, uint32_t val) -{ - uint32_t tmp = BITBAND_PER_BASE + (((uint32_t)addr - PER_MEM_BASE) << 5) + (bit << 2); - *((volatile uint32_t *)tmp) = (uint32_t)val; -} - -__STATIC_INLINE__ void BITBAND_SRAM(uint32_t *addr, uint32_t bit, uint32_t val) -{ - uint32_t tmp = BITBAND_RAM_BASE + (((uint32_t)addr - RAM_MEM_BASE) << 5) + (bit << 2); - *((volatile uint32_t *)tmp) = (uint32_t)val; -} - -#if defined ( __GNUC__ ) - #ifndef __weak - #define __weak __attribute__((weak)) - #endif /* __weak */ - #ifndef __packed - #define __packed __attribute__((__packed__)) - #endif /* __packed */ -#endif /* __GNUC__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __TYPE_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/utils.h b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/utils.h deleted file mode 100644 index 619914c23a..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Include/utils.h +++ /dev/null @@ -1,166 +0,0 @@ -/** - ********************************************************************************* - * - * @file utils.h - * @brief This file contains the Utilities functions/types for the driver. - * - * @version V1.0 - * @date 07 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#ifndef __UTILS_H__ -#define __UTILS_H__ - -#ifdef __cplusplus - extern "C" { -#endif - -#include -#include "ald_conf.h" -#include "type.h" -#include "es32f033x.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup UTILS - * @{ - */ - -/** @defgroup ALD_Public_Types Public Types - * @{ - */ -/** - * @brief SysTick interval - */ -extern uint32_t __systick_interval; - -/** - * @brief ALD Status structures definition - */ -typedef enum { - OK = 0x0U, /**< Status: OK */ - ERROR = 0x1U, /**< Status: ERROR */ - BUSY = 0x2U, /**< Status: BUSY */ - TIMEOUT = 0x3U, /**< Status: TIMEOUT */ -} ald_status_t; - -/** - * @brief SysTick interval definition - */ -typedef enum { - SYSTICK_INTERVAL_1MS = 1000U, /**< Interval is 1ms */ - SYSTICK_INTERVAL_10MS = 100U, /**< Interval is 10ms */ - SYSTICK_INTERVAL_100MS = 10U, /**< Interval is 100ms */ - SYSTICK_INTERVAL_1000MS = 1U, /**< Interval is 1s */ -} systick_interval_t; -/** - * @} - */ - -/** @defgroup ALD_Public_Macros Public Macros - * @{ - */ -#define ALD_MAX_DELAY 0xFFFFFFFFU -#define IS_BIT_SET(reg, bit) (((reg) & (bit)) != RESET) -#define IS_BIT_CLR(reg, bit) (((reg) & (bit)) == RESET) -#define RESET_HANDLE_STATE(x) ((x)->state = 0) -#define __LOCK(x) \ - do { \ - if ((x)->lock == LOCK) { \ - return BUSY; \ - } \ - else { \ - (x)->lock = LOCK; \ - } \ - } while (0) - -#define __UNLOCK(x) \ - do { \ - (x)->lock = UNLOCK; \ - } while (0) - -/** - * @} - */ - -/** @defgroup ALD_Private_Macros Private Macros - * @{ - */ -#define MCU_UID0_ADDR 0x000403E0U -#define MCU_UID1_ADDR 0x000403E8U -#define MCU_UID2_ADDR 0x000403F0U -#define MCU_CHIPID_ADDR 0x000403F8U -#define IS_PRIO(x) ((x) < 4) -#define IS_SYSTICK_INTERVAL(x) (((x) == SYSTICK_INTERVAL_1MS) || \ - ((x) == SYSTICK_INTERVAL_10MS) || \ - ((x) == SYSTICK_INTERVAL_100MS) || \ - ((x) == SYSTICK_INTERVAL_1000MS)) -/** - * @} - */ - -/** @addtogroup ALD_Public_Functions - * @{ - */ - -/** @addtogroup ALD_Public_Functions_Group1 - * @{ - */ - -/* Initialization functions */ -void ald_cmu_init(void); -void ald_tick_init(uint32_t prio); -void ald_systick_interval_select(systick_interval_t value); - -/** - * @} - */ - -/** @addtogroup ALD_Public_Functions_Group2 - * @{ - */ -/* Peripheral Control functions */ -void ald_inc_tick_weak(void); -void ald_delay_ms(__IO uint32_t delay); -uint32_t ald_get_tick(void); -void ald_suspend_tick(void); -void ald_resume_tick(void); -void ald_systick_irq_cbk(void); -void ald_inc_tick(void); -uint32_t ald_get_ald_version(void); -ald_status_t ald_wait_flag(uint32_t *reg, uint32_t bit, flag_status_t status, uint32_t timeout); -void ald_mcu_irq_config(IRQn_Type irq, uint8_t prio, type_func_t status); -uint32_t ald_mcu_get_tick(void); -uint32_t ald_mcu_get_cpu_id(void); -void ald_mcu_get_uid(uint8_t *buf); -uint32_t ald_mcu_get_chipid(void); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __UTILS_H__ */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_acmp.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_acmp.c deleted file mode 100644 index e480de1697..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_acmp.c +++ /dev/null @@ -1,351 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_acmp.c - * @brief ACMP module driver. - * - * @version V1.0 - * @date 13 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_acmp.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup ACMP ACMP - * @brief ACMP module driver - * @{ - */ -#ifdef ALD_ACMP - -/** @defgroup ACMP_Public_Functions ACMP Public Functions - * @{ - */ - -/** @defgroup ACMP_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * @{ - */ - -/** - * @brief Initializes the ACMP mode according to the specified parameters in - * the acmp_init_t and create the associated handle. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_acmp_init(acmp_handle_t *hperh) -{ - uint32_t tmp = 0; - - if (hperh == NULL) - return ERROR; - - if (hperh->init.vdd_level > 63) - return ERROR; - - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_MODE_TYPE(hperh->init.mode)); - assert_param(IS_ACMP_WARM_UP_TIME_TYPE(hperh->init.warm_time)); - assert_param(IS_ACMP_HYSTSEL_TYPE(hperh->init.hystsel)); - assert_param(IS_ACMP_WARM_FUNC_TYPE(hperh->init.warm_func)); - assert_param(IS_ACMP_POS_INPUT_TYPE(hperh->init.pos_port)); - assert_param(IS_ACMP_NEG_INPUT_TYPE(hperh->init.neg_port)); - assert_param(IS_ACMP_INACTVAL_TYPE(hperh->init.inactval)); - assert_param(IS_ACMP_EDGE_TYPE(hperh->init.edge)); - - __LOCK(hperh); - - tmp = hperh->perh->CON; - - tmp |= ((hperh->init.mode << ACMP_CON_MODSEL_POSS) | (hperh->init.warm_time << ACMP_CON_WARMUPT_POSS) | - (hperh->init.inactval << ACMP_CON_INACTV_POS) | (hperh->init.hystsel << ACMP_CON_HYSTSEL_POSS)); - - hperh->perh->CON = tmp; - - tmp = hperh->perh->INPUTSEL; - - tmp |= ((hperh->init.pos_port << ACMP_INPUTSEL_PSEL_POSS) | (hperh->init.neg_port << ACMP_INPUTSEL_NSEL_POSS) | - (hperh->init.vdd_level << ACMP_INPUTSEL_VDDLVL_POSS)); - - hperh->perh->INPUTSEL = tmp; - - if (hperh->init.warm_func == ACMP_WARM_DISABLE) - CLEAR_BIT(hperh->perh->IES, ACMP_IES_WARMUP_MSK); - else - SET_BIT(hperh->perh->IES, ACMP_IES_WARMUP_MSK); - - switch (hperh->init.edge) { - case ACMP_EDGE_NONE: - CLEAR_BIT(hperh->perh->CON, ACMP_CON_FALLEN_MSK); - CLEAR_BIT(hperh->perh->CON, ACMP_CON_RISEEN_MSK); - break; - - case ACMP_EDGE_FALL: - SET_BIT(hperh->perh->CON, ACMP_CON_FALLEN_MSK); - CLEAR_BIT(hperh->perh->CON, ACMP_CON_RISEEN_MSK); - break; - - case ACMP_EDGE_RISE: - CLEAR_BIT(hperh->perh->CON, ACMP_CON_FALLEN_MSK); - SET_BIT(hperh->perh->CON, ACMP_CON_RISEEN_MSK); - break; - - case ACMP_EDGE_ALL: - SET_BIT(hperh->perh->CON, ACMP_CON_FALLEN_MSK); - SET_BIT(hperh->perh->CON, ACMP_CON_RISEEN_MSK); - break; - - default: - break; - } - - SET_BIT(hperh->perh->CON, ACMP_CON_EN_MSK); - - tmp = 0; - while (READ_BIT(hperh->perh->STAT, ACMP_STAT_ACT_MSK) == 0) { - if (tmp++ >= 600000) { - __UNLOCK(hperh); - return ERROR; - } - } - - __UNLOCK(hperh); - return OK; -} -/** - * @} - */ - -/** @defgroup ACMP_Public_Functions_Group2 Interrupt operation functions - * @brief ACMP Interrupt operation functions - * @{ - */ - -/** - * @brief Enables or disables the specified ACMP interrupts. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @param it: Specifies the ACMP interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref acmp_it_t. - * @param state: New status - * - ENABLE - * - DISABLE - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_acmp_interrupt_config(acmp_handle_t *hperh, acmp_it_t it, type_func_t state) -{ - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_IT_TYPE(it)); - assert_param(IS_FUNC_STATE(state)); - - __LOCK(hperh); - - if (state) - hperh->perh->IES |= it; - else - hperh->perh->IEC |= it; - - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Checks whether the specified ACMP interrupt has set or not. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @param it: Specifies the ACMP interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref acmp_it_t. - * @retval it_status_t - * - SET - * - RESET - */ -it_status_t ald_acmp_get_it_status(acmp_handle_t *hperh, acmp_it_t it) -{ - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_IT_TYPE(it)); - - if (hperh->perh->IEV & it) - return SET; - else - return RESET; -} - -/** - * @brief Checks whether the specified ACMP interrupt has occurred or not. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @param flag: Specifies the ACMP interrupt source to check. - * This parameter can be one of the @ref acmp_it_t. - * @retval it_status_t - * - SET - * - RESET - */ -it_status_t ald_acmp_get_flag_status(acmp_handle_t *hperh, acmp_flag_t flag) -{ - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_FLAG_TYPE(flag)); - - if (hperh->perh->RIF & flag) { - __UNLOCK(hperh); - return SET; - } - - return RESET; -} - -/** @brief Clear the specified ACMP it flags. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @param flag: specifies the it flag. - * This parameter can be one of the @ref acmp_it_t. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_acmp_clear_flag_status(acmp_handle_t *hperh, acmp_flag_t flag) -{ - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_FLAG_TYPE(flag)); - - __LOCK(hperh); - hperh->perh->IFC |= flag; - __UNLOCK(hperh); - - return OK; -} - -/** @brief Set the specified acmp it flags. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified acmp module. - * @param it: specifies the it flag. - * This parameter can be one of the @ref acmp_it_t. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t acmp_set_it_mask(acmp_handle_t *hperh, acmp_it_t it) -{ - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_IT_TYPE(it)); - - __LOCK(hperh); - hperh->perh->IFM |= it; - __UNLOCK(hperh); - - return OK; -} - -/** @brief Check whether the specified ACMP flag is set or not. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @param status: specifies the status to check. - * This parameter can be one of the @ref acmp_status_t. - * @retval flag_status_t - * - SET - * - RESET - */ -flag_status_t ald_acmp_get_status(acmp_handle_t *hperh, acmp_status_t status) -{ - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_STATUS_TYPE(status)); - - if (hperh->perh->STAT & status) { - __UNLOCK(hperh); - return SET; - } - - return RESET; -} -/** - * @} - */ - -/** @defgroup ACMP_Public_Functions_Group3 Output value functions - * @brief ACMP Output value functions - * @{ - */ - -/** - * @brief This function handles ACMP interrupt request. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @retval None - */ -void ald_acmp_irq_handler(acmp_handle_t *hperh) -{ - if ((ald_acmp_get_flag_status(hperh, ACMP_FLAG_WARMUP) == SET) && (ald_acmp_get_it_status(hperh, ACMP_IT_WARMUP) == SET)) { - if (hperh->acmp_warmup_cplt_cbk) - hperh->acmp_warmup_cplt_cbk(hperh); - ald_acmp_clear_flag_status(hperh, ACMP_FLAG_WARMUP); - } - - if ((ald_acmp_get_flag_status(hperh, ACMP_FLAG_EDGE) == SET) && (ald_acmp_get_it_status(hperh, ACMP_IT_EDGE) == SET)) { - if (hperh->acmp_edge_cplt_cbk) - hperh->acmp_edge_cplt_cbk(hperh); - ald_acmp_clear_flag_status(hperh, ACMP_FLAG_EDGE); - } - - return; -} - -/** - * @brief This function config acmp output. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @param config: Pointer to a acmp_output_config_t structure that contains - * the configutation information for acmp output. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_acmp_out_config(acmp_handle_t *hperh, acmp_output_config_t *config) -{ - if (hperh == NULL) - return ERROR; - - if (config == NULL) - return ERROR; - - assert_param(IS_ACMP_TYPE(hperh->perh)); - assert_param(IS_ACMP_INVERT_TYPE(config->gpio_inv)); - assert_param(IS_ACMP_OUT_FUNC_TYPE(config->out_func)); - - __LOCK(hperh); - hperh->perh->CON |= (config->gpio_inv << ACMP_CON_OUTINV_POS); - hperh->perh->PORT = config->out_func; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief This function output acmp result. - * @param hperh: Pointer to a acmp_handle_t structure that contains - * the configuration information for the specified ACMP module. - * @retval output value. - */ -uint8_t ald_acmp_out_result(acmp_handle_t *hperh) -{ - assert_param(IS_ACMP_TYPE(hperh->perh)); - - return (READ_BIT(hperh->perh->STAT, ACMP_STAT_OUT_MSK) >> ACMP_STAT_OUT_POS); -} -/** - * @} - */ - -/** - * @} - */ -#endif /* ALD_ACMP */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_adc.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_adc.c deleted file mode 100644 index 7f1f522c7a..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_adc.c +++ /dev/null @@ -1,1083 +0,0 @@ -/** - ****************************************************************************** - * @file ald_adc.c - * @brief This file provides firmware functions to manage the following - * functionalities of the Analog to Digital Convertor (ADC) - * peripheral: - * + Initialization functions - * ++ Initialization and Configuration of ADC - * + Operation functions - * ++ Start, stop, get result of conversions of normal - * group, using 3 possible modes: polling, interruption or DMA. - * + Control functions - * ++ Channels configuration on normal group - * ++ Channels configuration on insert group - * ++ Analog Watchdog configuration - * + State functions - * ++ ADC state machine management - * ++ Interrupts and flags management - * - * @version V1.0 - * @date 15 Dec 2017 - * @author AE Team. - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - - -#include "ald_cmu.h" -#include "ald_adc.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup ADC ADC - * @brief ADC module driver - * @{ - */ - -#ifdef ALD_ADC - -/** @addtogroup ADC_Private_Functions - * @{ - */ -#ifdef ALD_DMA -static void adc_dma_normal_conv_cplt(void *arg); -static void adc_dma_error(void *arg); -#endif -/** - * @} - */ - - -/** @defgroup ADC_Public_Functions ADC Public Functions - * @{ - */ - -/** @defgroup ADC_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * @{ - */ - -/** - * @brief Initializes the ADC peripheral and normal group according to - * parameters specified in structure "adc_handle_t". - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_init(adc_handle_t *hperh) -{ - if (hperh == NULL) - return ERROR; - - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_DATA_ALIGN_TYPE(hperh->init.align)); - assert_param(IS_FUNC_STATE(hperh->init.scan)); - assert_param(IS_ADC_NCH_NR_TYPE(hperh->init.nch_nr)); - assert_param(IS_ADC_DISC_MODE_TYPE(hperh->init.disc)); - assert_param(IS_ADC_DISC_NR_TYPE(hperh->init.disc_nr)); - assert_param(IS_ADC_CONV_BIT_TYPE(hperh->init.data_bit)); - assert_param(IS_ADC_CLK_DIV_TYPE(hperh->init.div)); - assert_param(IS_ADC_NCHESEL_MODE_TYPE(hperh->init.nche_sel)); - assert_param(IS_ADC_NEG_REF_VOLTAGE_TYPE(hperh->init.n_ref)); - assert_param(IS_POS_REF_VOLTAGE_TYPE(hperh->init.p_ref)); - - if (hperh->state == ADC_STATE_RESET ) { - hperh->error_code = ADC_ERROR_NONE; - hperh->lock = UNLOCK; - } - - if ((hperh->init.p_ref == ADC_POS_REF_VDD) && (hperh->init.n_ref == ADC_NEG_REF_VSS)) { - ADC_ENABLE(hperh); - - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRNSEL_MSK, hperh->init.n_ref << ADC_CCR_VRNSEL_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRPSEL_MSK, hperh->init.p_ref << ADC_CCR_VRPSEL_POSS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VCMBUFEN_MSK, 1 << ADC_CCR_VCMBUFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_IREFEN_MSK, 1 << ADC_CCR_IREFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VREFEN_MSK, 1 << ADC_CCR_VREFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_CKDIV_MSK, 6 << ADC_CCR_CKDIV_POSS); - MODIFY_REG(hperh->perh->CON1, ADC_CON1_ALIGN_MSK, ADC_DATAALIGN_RIGHT << ADC_CON1_ALIGN_POS); - MODIFY_REG(hperh->perh->CON0, ADC_CON0_RSEL_MSK, ADC_CONV_BIT_12 << ADC_CON0_RSEL_POSS); - MODIFY_REG(hperh->perh->CON1, ADC_CON1_CM_MSK, DISABLE << ADC_CON1_CM_POS); - MODIFY_REG(hperh->perh->NCHS1, ADC_NCHS1_NS1_MSK, ADC_CHANNEL_18 << ADC_NCHS1_NS1_POSS); - hperh->perh->SMPT2 = 0x30; - - /* Start adc normal convert */ - SET_BIT(hperh->perh->CON1, ADC_CON1_NCHTRG_MSK); - /* Wait convert finish */ - while (!READ_BIT(hperh->perh->STAT, ADC_STAT_NCHE_MSK)); - hperh->vdd_value = (hperh->perh->NCHDR & 0xfff); - /* Get calibration VDD value */ - hperh->vdd_value = 2000 * 4096 / hperh->vdd_value; - } - - ADC_DISABLE(hperh); - ald_adc_reset(hperh); - hperh->state = ADC_STATE_BUSY; - MODIFY_REG(hperh->perh->CON1, ADC_CON1_ALIGN_MSK, hperh->init.align << ADC_CON1_ALIGN_POS); - MODIFY_REG(hperh->perh->CON0, ADC_CON0_RSEL_MSK, hperh->init.data_bit << ADC_CON0_RSEL_POSS); - - /* Enable discontinuous mode only if continuous mode is disable */ - if (hperh->init.disc == ADC_NCH_DISC_EN) { - hperh->init.scan = ENABLE; - SET_BIT(hperh->perh->CON0, ADC_CON0_NCHDCEN_MSK); - MODIFY_REG(hperh->perh->CON0, ADC_CON0_ETRGN_MSK, hperh->init.disc_nr << ADC_CON0_ETRGN_POSS); - } - else if (hperh->init.disc == ADC_ICH_DISC_EN) { - hperh->init.scan = ENABLE; - SET_BIT(hperh->perh->CON0, ADC_CON0_ICHDCEN_MSK); - MODIFY_REG(hperh->perh->CON0, ADC_CON0_ETRGN_MSK, hperh->init.disc_nr << ADC_CON0_ETRGN_POSS); - } - else { - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_NCHDCEN_MSK); - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_ICHDCEN_MSK); - } - - if ((hperh->init.scan == ENABLE) || (hperh->init.disc == ADC_NCH_DISC_EN)) - MODIFY_REG(hperh->perh->CHSL, ADC_CHSL_NSL_MSK, hperh->init.nch_nr << ADC_CHSL_NSL_POSS); - - MODIFY_REG(hperh->perh->CON1, ADC_CON1_CM_MSK, hperh->init.scan << ADC_CON1_CM_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_GAINCALEN_MSK, DISABLE << ADC_CCR_GAINCALEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_OFFCALEN_MSK, DISABLE << ADC_CCR_OFFCALEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_DIFFEN_MSK, DISABLE << ADC_CCR_DIFFEN_POS); - /* if the ADC clock less than 1MHz,PWRMOD should be disable*/ - MODIFY_REG(hperh->perh->CCR, ADC_CCR_PWRMODSEL_MSK, DISABLE << ADC_CCR_PWRMODSEL_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRBUFEN_MSK, ENABLE << ADC_CCR_VRBUFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VCMBUFEN_MSK, ENABLE << ADC_CCR_VCMBUFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VREFEN_MSK, ENABLE << ADC_CCR_VREFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_IREFEN_MSK, ENABLE << ADC_CCR_IREFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_CKDIV_MSK, hperh->init.div << ADC_CCR_CKDIV_POSS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRNSEL_MSK, hperh->init.n_ref << ADC_CCR_VRNSEL_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRPSEL_MSK, hperh->init.p_ref << ADC_CCR_VRPSEL_POSS); - MODIFY_REG(hperh->perh->CON1, ADC_CON1_NCHESEL_MSK, hperh->init.nche_sel << ADC_CON1_NCHESEL_POS); - ald_adc_interrupt_config(hperh, ADC_IT_OVR, ENABLE); - ADC_ENABLE(hperh); - - hperh->init.cont = DISABLE; - hperh->error_code = ADC_ERROR_NONE; - hperh->state = ADC_STATE_READY; - return OK; -} - -/** - * @brief Deinitialize the ADC peripheral registers to their default reset - * values. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_reset(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - ADC_DISABLE(hperh); - WRITE_REG(hperh->perh->CLR, 0x30F); - WRITE_REG(hperh->perh->CON0, 0x0); - WRITE_REG(hperh->perh->CON1, 0x0); - WRITE_REG(hperh->perh->CCR, 0x0); - WRITE_REG(hperh->perh->WDTH, 0xFFF); - WRITE_REG(hperh->perh->WDTL, 0x0); - WRITE_REG(hperh->perh->ICHOFF[0], 0x0); - WRITE_REG(hperh->perh->ICHOFF[1], 0x0); - WRITE_REG(hperh->perh->ICHOFF[2], 0x0); - WRITE_REG(hperh->perh->ICHOFF[3], 0x0); - WRITE_REG(hperh->perh->ICHS, 0x0); - WRITE_REG(hperh->perh->NCHS1, 0x0); - WRITE_REG(hperh->perh->NCHS2, 0x0); - WRITE_REG(hperh->perh->NCHS3, 0x0); - WRITE_REG(hperh->perh->NCHS4, 0x0); - WRITE_REG(hperh->perh->SMPT1, 0x0); - WRITE_REG(hperh->perh->SMPT2, 0x0); - WRITE_REG(hperh->perh->CHSL, 0x0); - - hperh->state = ADC_STATE_RESET; - hperh->error_code = ADC_ERROR_NONE; - return OK; -} -/** - * @} - */ - -/** @defgroup ADC_Public_Functions_Group2 IO operation functions - * @brief Input and Output operation functions - * @{ - */ - -/** - * @brief Enables ADC, starts conversion of normal group. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_normal_start(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - ADC_ENABLE(hperh); - WRITE_REG(hperh->perh->CLR, ADC_FLAG_NCH | ADC_FLAG_NCHS); - SET_BIT(hperh->perh->CON1, ADC_CON1_NCHTRG_MSK); - - return OK; -} - -/** - * @brief Stop ADC conversion of normal group (and insert channels in - * case of auto_injection mode), disable ADC peripheral. - * @note: ADC peripheral disable is forcing stop of potential - * conversion on insert group. If insert group is under use, it - * should be preliminarily stopped using ald_adc_insert_stop function. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_normal_stop(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - ADC_DISABLE(hperh); - hperh->state = ADC_STATE_READY; - return OK; -} - -/** - * @brief Wait for normal group conversion to be completed. - * @note This function cannot be used in a particular setup: ADC configured in DMA mode. - * In this case, DMA resets the flag EOC and polling cannot be performed on each conversion. - * @note When use this function,you should be pay attention to the hperh->init.reocs_mode, - * if it is ADC_REOCS_MODE_ALL, it means the function will wait all normal rank conversion finished. - * if it is ADC_REOCS_MODE_ONE, it means the funcion will wait every normal rank conversion finished. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param timeout: Timeout value in millisecond. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_normal_poll_for_conversion(adc_handle_t *hperh, uint32_t timeout) -{ - uint32_t _tick; - - assert_param(IS_ADC_TYPE(hperh->perh)); - - _tick = ald_get_tick(); - while (!(READ_BIT(hperh->perh->STAT, ADC_STAT_NCHE_MSK))) { - if (timeout != ALD_MAX_DELAY ) { - if ((timeout == 0) || ((ald_get_tick() - _tick) > timeout)) { - hperh->state = ADC_STATE_TIMEOUT; - return TIMEOUT; - } - } - } - - WRITE_REG(hperh->perh->CLR, ADC_FLAG_NCHS | ADC_FLAG_NCH); - return OK; -} - -/** - * @brief Poll for conversion event. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param event_type: the ADC event type. - * This parameter can be one of the following values: - * ADC_awd_event: ADC Analog watchdog event. - * @param timeout: Timeout value in millisecond. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_poll_for_event(adc_handle_t *hperh, adc_event_type_t event_type, uint32_t timeout) -{ - uint32_t _tick; - - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_EVENT_TYPE(event_type)); - - _tick = ald_get_tick(); - while (ald_adc_get_flag_status(hperh, (adc_flag_t)event_type) == RESET) { - if (timeout != ALD_MAX_DELAY ) { - if ((timeout == 0) || ((ald_get_tick() - _tick) > timeout)) { - hperh->state = ADC_STATE_TIMEOUT; - return TIMEOUT; - } - } - } - - - CLEAR_BIT(hperh->state, ADC_STATE_BUSY_WDG); - return OK; -} - -/** - * @brief Enables ADC, starts conversion of normal group with interruption. - * Interruptions enabled in this function: - * - REOC (end of conversion of normal group) - * Each of these interruptions has its dedicated callback function. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_normal_start_by_it(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - SET_BIT(hperh->state, ADC_STATE_BUSY_N); - ADC_ENABLE(hperh); - WRITE_REG(hperh->perh->CLR, ADC_FLAG_NCH); - ald_adc_interrupt_config(hperh, ADC_IT_NCH, ENABLE); - SET_BIT(hperh->perh->CON1, ADC_CON1_NCHTRG_MSK); - - return OK; -} - -/** - * @brief Stop ADC conversion of normal group (and insert group in - * case of auto_injection mode), disable interrution of - * end-of-conversion, disable ADC peripheral. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_normal_stop_by_it(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - ADC_DISABLE(hperh); - ald_adc_interrupt_config(hperh, ADC_IT_NCH, DISABLE); - CLEAR_BIT(hperh->state, ADC_STATE_BUSY_N); - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Enables ADC, starts conversion of normal group and transfers result - * through DMA. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param buf: The destination Buffer address. - * @param size: The length of data to be transferred from ADC peripheral to memory. - * @param channel: The DMA channel - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_start_by_dma(adc_handle_t *hperh, uint16_t *buf, uint16_t size, uint8_t channel) -{ - if ((buf == NULL) || (size == 0)) - return ERROR; - - assert_param(IS_ADC_TYPE(hperh->perh)); - - SET_BIT(hperh->state, ADC_STATE_BUSY_N); - - if (hperh->hdma.perh == NULL) - hperh->hdma.perh = DMA0; - - hperh->hdma.cplt_cbk = adc_dma_normal_conv_cplt; - hperh->hdma.cplt_arg = hperh; - hperh->hdma.err_cbk = adc_dma_error; - hperh->hdma.err_arg = hperh; - - ald_dma_config_struct(&hperh->hdma.config); - hperh->hdma.config.src = (void *)&hperh->perh->NCHDR; - hperh->hdma.config.dst = (void *)buf; - hperh->hdma.config.size = size; - hperh->hdma.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdma.config.dst_inc = DMA_DATA_INC_HALFWORD; - hperh->hdma.config.msel = DMA_MSEL_ADC0; - hperh->hdma.config.msigsel = DMA_MSIGSEL_ADC; - hperh->hdma.config.channel = channel; - ald_dma_config_basic(&hperh->hdma); - - ADC_ENABLE(hperh); - SET_BIT(hperh->perh->CON1, ADC_CON1_NCHTRG_MSK); - return OK; -} - -/** - * @brief Stop ADC conversion of normal group (and insert group in - * case of auto_insert mode), disable ADC DMA transfer, disable - * ADC peripheral. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param channel: The DMA channel. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_stop_by_dma(adc_handle_t *hperh, uint8_t channel) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - ADC_DISABLE(hperh); - ald_dma_channel_config(hperh->hdma.perh, channel, DISABLE); - CLEAR_BIT(hperh->state, ADC_STATE_BUSY_N); - return OK; -} - -/** - * @brief DMA transfer complete callback. - * @param arg: argument of the call back. - * @retval None - */ -static void adc_dma_timer_trigger_cplt(void *arg) -{ - adc_timer_config_t *hperh = (adc_timer_config_t *)arg; - - ald_timer_base_stop(&hperh->h_timer); - ADC_DISABLE(&hperh->h_adc); - ald_dma_channel_config(hperh->h_dma.perh, hperh->dma_ch, DISABLE); - CLEAR_BIT(hperh->h_adc.state, ADC_STATE_BUSY_N); - - if (hperh->h_adc.normal_cplt_cbk) - hperh->h_adc.normal_cplt_cbk(&hperh->h_adc); - - return; -} - -/** - * @brief Config Timer trigger adc function - * @param config: Pointer to a adc_timer_config_t structure that - * contains the configuration information for the specified function. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_timer_trigger_adc_by_dma(adc_timer_config_t *config) -{ - SET_BIT(config->h_adc.state, ADC_STATE_BUSY_N); - - config->h_pis.perh = PIS; - config->h_pis.init.producer_clk = PIS_CLK_PCLK1; - config->h_pis.init.producer_edge = PIS_EDGE_NONE; - config->h_pis.init.consumer_clk = PIS_CLK_PCLK2; - - #if defined (ES32F065x) - if (config->p_timer == AD16C4T0) - config->h_pis.init.producer_src = PIS_TIMER0_UPDATA; - #elif defined(ES32F033x) || defined (ES32F093x) - if (config->p_timer == GP16C4T0) - config->h_pis.init.producer_src = PIS_TIMER0_UPDATA; - #endif - else if (config->p_timer == BS16T0) - config->h_pis.init.producer_src = PIS_TIMER1_UPDATA; - else if (config->p_timer == GP16C2T0) - config->h_pis.init.producer_src = PIS_TIMER2_UPDATA; - else if (config->p_timer == GP16C2T1) - config->h_pis.init.producer_src = PIS_TIMER3_UPDATA; - else - return ERROR; - - if (config->p_adc == ADC0) - config->h_pis.init.consumer_trig = PIS_CH6_ADC0_NORMAL; - else - return ERROR; - - ald_pis_create(&config->h_pis); - - /* Initialize TIMER0 */ - config->h_timer.perh = config->p_timer; - config->h_timer.init.prescaler = 0; - config->h_timer.init.mode = TIMER_CNT_MODE_UP; - config->h_timer.init.period = ((ald_cmu_get_pclk1_clock() / 1000000) * config->time); - config->h_timer.init.clk_div = TIMER_CLOCK_DIV1; - config->h_timer.init.re_cnt = 0; - ald_timer_base_init(&config->h_timer); - - config->h_adc.perh = config->p_adc; - config->h_adc.init.align = ADC_DATAALIGN_RIGHT; - config->h_adc.init.scan = DISABLE; - config->h_adc.init.cont = DISABLE; - config->h_adc.init.nch_nr = ADC_NCH_NR_1; - config->h_adc.init.disc = ADC_ALL_DISABLE; - config->h_adc.init.disc_nr = ADC_DISC_NR_1; - config->h_adc.init.data_bit = ADC_CONV_BIT_12; - config->h_adc.init.div = ADC_CKDIV_128; - config->h_adc.init.nche_sel = ADC_NCHESEL_MODE_ONE; - config->h_adc.init.n_ref = config->n_ref; - config->h_adc.init.p_ref = config->p_ref; - config->h_adc.normal_cplt_cbk = config->cplt_cbk; - config->h_adc.insert_cplt_cbk = NULL; - config->h_adc.wdg_cbk = NULL; - config->h_adc.error_cbk = NULL; - config->h_adc.ovr_cbk = NULL; - ald_adc_init(&config->h_adc); - ADC_ENABLE(&config->h_adc); - - config->config.ch = config->adc_ch; - config->config.idx = ADC_NCH_IDX_1; - config->config.samp = ADC_SAMPLETIME_4; - ald_adc_normal_channel_config(&config->h_adc, &config->config); - - config->h_dma.cplt_cbk = adc_dma_timer_trigger_cplt; - config->h_dma.cplt_arg = config; - config->h_dma.err_cbk = adc_dma_error; - config->h_dma.err_arg = &config->h_adc; - - ald_dma_config_struct(&config->h_dma.config); - config->h_dma.perh = DMA0; - config->h_dma.config.src = (void *)&config->h_adc.perh->NCHDR; - config->h_dma.config.dst = (void *)config->buf; - config->h_dma.config.size = config->size; - config->h_dma.config.data_width = DMA_DATA_SIZE_HALFWORD; - config->h_dma.config.src_inc = DMA_DATA_INC_NONE; - config->h_dma.config.dst_inc = DMA_DATA_INC_HALFWORD; - config->h_dma.config.msel = DMA_MSEL_ADC0; - config->h_dma.config.msigsel = DMA_MSIGSEL_ADC; - config->h_dma.config.channel = config->dma_ch; - ald_dma_config_basic(&config->h_dma); - ald_timer_base_start(&config->h_timer); - - return OK; -} -#endif - -/** - * @brief Get ADC normal group conversion result. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval ADC group normal conversion data - */ -uint32_t ald_adc_normal_get_value(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - return hperh->perh->NCHDR; -} - -/** - * @brief The pos reference is VDD and neg reference is VSS, - * get adc normal group result and convert voltage value. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval ADC group normal voltage value,the unit is mV. - */ -uint32_t ald_adc_get_vdd_value(adc_handle_t *hperh) -{ - uint32_t value, _tmp[5]; - - if ((hperh->init.p_ref != ADC_POS_REF_VDD) || (hperh->init.n_ref != ADC_NEG_REF_VSS)) - return 0; - - _tmp[0] = hperh->perh->CCR; - _tmp[1] = hperh->perh->CON0; - _tmp[2] = hperh->perh->CON1; - _tmp[3] = hperh->perh->NCHS1; - _tmp[4] = hperh->perh->SMPT2; - - hperh->perh->CON0 = 0x0; - hperh->perh->CON1 = 0x0; - hperh->perh->NCHS1 = 0x0; - - ADC_ENABLE(hperh); - hperh->perh->CCR = 0x8B06; - MODIFY_REG(hperh->perh->CON0, ADC_CON1_ALIGN_MSK, ADC_DATAALIGN_RIGHT << ADC_CON1_ALIGN_POS); - MODIFY_REG(hperh->perh->CON0, ADC_CON0_RSEL_MSK, ADC_CONV_BIT_12 << ADC_CON0_RSEL_POSS); - MODIFY_REG(hperh->perh->CON1, ADC_CON1_CM_MSK, DISABLE << ADC_CON1_CM_POS); - MODIFY_REG(hperh->perh->NCHS1, ADC_NCHS1_NS1_MSK, ADC_CHANNEL_18 << ADC_NCHS1_NS1_POSS); - hperh->perh->SMPT2 = 0x30; - SET_BIT(hperh->perh->CON1, ADC_CON1_NCHTRG_MSK); - - while (!READ_BIT(hperh->perh->STAT, ADC_STAT_NCHE_MSK)); - WRITE_REG(hperh->perh->CLR, ADC_FLAG_NCH | ADC_FLAG_NCHS); - value = (hperh->perh->NCHDR & 0xfff); - value = value == 0 ? 1 : value; - value = (2000 << 12) / value; - hperh->vdd_value = value; - - hperh->perh->CCR = _tmp[0]; - hperh->perh->CON0 = _tmp[1]; - hperh->perh->CON1 = _tmp[2]; - hperh->perh->NCHS1 = _tmp[3]; - hperh->perh->SMPT2 = _tmp[4]; - ADC_DISABLE(hperh); - - return value; -} - -/** - * @brief Enables ADC, starts conversion of insert group. - * Interruptions enabled in this function: None. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_insert_start(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - ADC_ENABLE(hperh); - WRITE_REG(hperh->perh->CLR, ADC_FLAG_ICH); - - if (!(READ_BIT(hperh->perh->CON0, ADC_CON0_IAUTO_MSK))) - SET_BIT(hperh->perh->CON1, ADC_CON1_ICHTRG_MSK); - - return OK; -} - -/** - * @brief Stop conversion of insert channels. Disable ADC peripheral if - * no normal conversion is on going. - * @note If ADC must be disabled and if conversion is on going on - * normal group, function ald_adc_normal_stop must be used to stop both - * insert and normal groups, and disable the ADC. - * @note If insert group mode auto-injection is enabled, - * function ald_adc_normal_stop must be used. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_insert_stop(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - ADC_DISABLE(hperh); - hperh->state = ADC_STATE_READY; - return OK; -} - -/** - * @brief Wait for insert group conversion to be completed. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param timeout: Timeout value in millisecond. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_insert_poll_for_conversion(adc_handle_t *hperh, uint32_t timeout) -{ - uint32_t _tick; - - assert_param(IS_ADC_TYPE(hperh->perh)); - - _tick = ald_get_tick(); - - while (!(READ_BIT(hperh->perh->STAT, ADC_STAT_ICHE_MSK))) { - if (timeout != ALD_MAX_DELAY) { - if ((timeout == 0) || ((ald_get_tick() - _tick) > timeout)) { - hperh->state = ADC_STATE_TIMEOUT; - return TIMEOUT; - } - } - } - - WRITE_REG(hperh->perh->CLR, ADC_FLAG_ICHS | ADC_FLAG_ICH); - return OK; -} - -/** - * @brief Enables ADC, starts conversion of insert group with interruption. - * - JEOC (end of conversion of insert group) - * Each of these interruptions has its dedicated callback function. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval Status, see @ref ald_status_t.. - */ -ald_status_t ald_adc_insert_start_by_it(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - SET_BIT(hperh->state, ADC_STATE_BUSY_I); - ADC_ENABLE(hperh); - WRITE_REG(hperh->perh->CLR, ADC_FLAG_ICHS | ADC_FLAG_ICH); - ald_adc_interrupt_config(hperh, ADC_IT_ICH, ENABLE); - - if (!(READ_BIT(hperh->perh->CON0, ADC_CON0_IAUTO_MSK))) - SET_BIT(hperh->perh->CON1, ADC_CON1_ICHTRG_MSK); - - return OK; -} - -/** - * @brief Stop conversion of insert channels, disable interruption of - * end-of-conversion. Disable ADC peripheral if no normal conversion - * is on going. - * @note If ADC must be disabled and if conversion is on going on - * normal group, function ald_adc_normal_stop must be used to stop both - * insert and normal groups, and disable the ADC. - * @note If insert group mode auto-injection is enabled, - * function ald_adc_normal_stop must be used. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval None - */ -ald_status_t ald_adc_insert_stop_by_it(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - CLEAR_BIT(hperh->state, ADC_STATE_BUSY_I); - ADC_DISABLE(hperh); - ald_adc_interrupt_config(hperh, ADC_IT_ICH, DISABLE); - return OK; -} - -/** - * @brief Get ADC insert group conversion result. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param idx: Index of the insert channel. - * @retval ADC group insert conversion data - */ -uint32_t ald_adc_insert_get_value(adc_handle_t *hperh, adc_ich_idx_t idx) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_ICH_IDX_TYPE(idx)); - - return hperh->perh->ICHDR[idx - 1]; -} - -/** - * @brief Handles ADC interrupt request - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval None - */ -void ald_adc_irq_handler(adc_handle_t *hperh) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - - if (ald_adc_get_it_status(hperh, ADC_IT_NCH) && ald_adc_get_flag_status(hperh, ADC_FLAG_NCH)) { - WRITE_REG(hperh->perh->CLR, ADC_FLAG_NCH | ADC_FLAG_NCHS); - CLEAR_BIT(hperh->state, ADC_STATE_BUSY_N); - - if (hperh->normal_cplt_cbk) - hperh->normal_cplt_cbk(hperh); - } - - if (ald_adc_get_it_status(hperh, ADC_IT_ICH) && ald_adc_get_flag_status(hperh, ADC_FLAG_ICH)) { - WRITE_REG(hperh->perh->CLR, ADC_FLAG_ICH | ADC_FLAG_ICHS); - CLEAR_BIT(hperh->state, ADC_STATE_BUSY_I); - - if (hperh->insert_cplt_cbk) - hperh->insert_cplt_cbk(hperh); - } - - if (ald_adc_get_it_status(hperh, ADC_IT_AWD) && ald_adc_get_flag_status(hperh, ADC_FLAG_AWD)) { - CLEAR_BIT(hperh->state, ADC_STATE_BUSY_WDG); - WRITE_REG(hperh->perh->CLR, ADC_FLAG_AWD); - - if (hperh->wdg_cbk) - hperh->wdg_cbk(hperh); - } - - if (ald_adc_get_it_status(hperh, ADC_IT_OVR) && ald_adc_get_flag_status(hperh, ADC_FLAG_OVR)) { - WRITE_REG(hperh->perh->CLR, ADC_FLAG_OVR); - hperh->error_code |= ADC_ERROR_OVR; - hperh->state |= ADC_STATE_ERROR; - - if (hperh->ovr_cbk) - hperh->ovr_cbk(hperh); - } -} - -/** - * @} - */ - -/** @defgroup ADC_Public_Functions_Group3 Peripheral Control functions - * @brief Peripheral Control functions - * @{ - */ - -/** - * @brief Configures the the selected channel to be linked to the normal - * group. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param config: Structure of ADC channel for normal group. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_normal_channel_config(adc_handle_t *hperh, adc_nch_conf_t *config) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_CHANNELS_TYPE(config->ch)); - assert_param(IS_ADC_NCH_IDX_TYPE(config->idx)); - assert_param(IS_ADC_SAMPLING_TIMES_TYPE(config->samp)); - - if (config->idx <= ADC_NCH_IDX_4 ) { - hperh->perh->NCHS1 &= ~(0x1f << (uint32_t)((config->idx - 1) << 3)); - hperh->perh->NCHS1 |= (config->ch << (uint32_t)((config->idx - 1) << 3)); - } - else if (config->idx <= ADC_NCH_IDX_8) { - hperh->perh->NCHS2 &= ~(0x1f << (uint32_t)((config->idx - 5) << 3)); - hperh->perh->NCHS2 |= (config->ch << (uint32_t)((config->idx - 5) << 3)); - } - else if (config->idx <= ADC_NCH_IDX_12) { - hperh->perh->NCHS3 &= ~(0x1f << (uint32_t)((config->idx - 9) << 3)); - hperh->perh->NCHS3 |= (config->ch << (uint32_t)((config->idx - 9) << 3)); - } - else { - hperh->perh->NCHS4 &= ~(0x1f << (uint32_t)((config->idx - 13) << 3)); - hperh->perh->NCHS4 |= (config->ch << (uint32_t)((config->idx - 13) << 3)); - } - - if (config->ch <= 15) { - hperh->perh->SMPT1 &= ~(0x03 << (uint32_t)(config->ch << 1)); - hperh->perh->SMPT1 |= config->samp << (uint32_t)(config->ch << 1); - } - else { - hperh->perh->SMPT2 &= ~(0x03 << (uint32_t)((config->ch - 16) << 1)); - hperh->perh->SMPT2 |= config->samp << (uint32_t)((config->ch - 16) << 1); - } - - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_SCANEN_MSK); - return OK; -} - -/** - * @brief Configures the the selected channel to be linked to the insert - * group. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param config: Structure of ADC channel for insert group. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_insert_channel_config(adc_handle_t *hperh, adc_ich_conf_t *config) -{ - ald_status_t status = OK; - - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_CHANNELS_TYPE(config->ch)); - assert_param(IS_ADC_ICH_IDX_TYPE(config->idx)); - assert_param(IS_ADC_SAMPLING_TIMES_TYPE(config->samp)); - assert_param(IS_ADC_IST_OFFSET_TYPE(config->offset)); - assert_param(IS_ADC_ICH_NR_TYPE(config->nr)); - assert_param(IS_FUNC_STATE(config->auto_m)); - - MODIFY_REG(hperh->perh->CHSL, ADC_CHSL_ISL_MSK, config->nr << ADC_CHSL_ISL_POSS); - hperh->perh->ICHS &= ~(0x1f << (uint32_t)((config->idx - 1) << 3)); - hperh->perh->ICHS |= config->ch << (uint32_t)((config->idx - 1) << 3); - - if (config->nr > 0) - SET_BIT(hperh->perh->CON0, ADC_CON0_SCANEN_MSK); - else - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_SCANEN_MSK); - - if (config->auto_m == ENABLE) - SET_BIT(hperh->perh->CON0, ADC_CON0_IAUTO_MSK); - else - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_IAUTO_MSK); - - if (hperh->init.disc == ADC_ICH_DISC_EN) { - if (config->auto_m == DISABLE) { - SET_BIT(hperh->perh->CON0, ADC_CON0_ICHDCEN_MSK); - } - else { - hperh->state |= ADC_STATE_ERROR; - hperh->error_code |= ADC_ERROR_INTERNAL; - status = ERROR; - } - } - - if (config->ch <= 15) { - hperh->perh->SMPT1 &= ~(0x03U << ((uint32_t)config->ch << 1)); - hperh->perh->SMPT1 |= config->samp << ((uint32_t)config->ch << 1); - } - else { - hperh->perh->SMPT2 &= ~(0x03U << (((uint32_t)config->ch - 16) << 1)); - hperh->perh->SMPT2 |= config->samp << (((uint32_t)config->ch - 16) << 1); - } - - hperh->perh->ICHOFF[config->idx] = config->offset; - return status; -} - -/** - * @brief Configures the analog watchdog. - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @param config: Structure of ADC analog watchdog configuration - * @retval ALD status - */ -ald_status_t ald_adc_analog_wdg_config(adc_handle_t *hperh, adc_analog_wdg_conf_t *config) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_ANALOG_WTD_MODE_TYPE(config->mode)); - assert_param(IS_FUNC_STATE(config->interrupt)); - assert_param(IS_HTR_TYPE(config->high_thrd)); - assert_param(IS_LTR_TYPE(config->low_thrd)); - - if ((config->mode == ADC_ANAWTD_SING_NM) - || (config->mode == ADC_ANAWTD_SING_IST) - || (config->mode == ADC_ANAWTD_SING_NMIST)) - assert_param(IS_ADC_CHANNELS_TYPE(config->ch)); - - if (config->interrupt == DISABLE) - ald_adc_interrupt_config(hperh, ADC_IT_AWD, DISABLE); - else - ald_adc_interrupt_config(hperh, ADC_IT_AWD, ENABLE); - - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_ICHWDTEN_MSK); - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_NCHWDEN_MSK); - CLEAR_BIT(hperh->perh->CON0, ADC_CON0_AWDSGL_MSK); - hperh->perh->CON0 |= config->mode; - - if (READ_BIT(hperh->perh->CON0, ADC_CON0_AWDSGL_MSK)) - MODIFY_REG(hperh->perh->CON0, ADC_CON0_AWDCH_MSK, config->ch << ADC_CON0_AWDCH_POSS); - - WRITE_REG(hperh->perh->WDTL, config->low_thrd); - WRITE_REG(hperh->perh->WDTH, config->high_thrd); - SET_BIT(hperh->state, ADC_STATE_BUSY_WDG); - - return OK; -} - -/** - * @brief Enables or disables the specified ADC interrupts. - * @param hperh: Pointer to a adc_handle_t structure. - * @param it: Specifies the ADC interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref adc_it_t. - * @param state: New status - * - ENABLE - * - DISABLE - * @retval None - */ -void ald_adc_interrupt_config(adc_handle_t *hperh, adc_it_t it, type_func_t state) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_IT_TYPE(it)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - SET_BIT(hperh->perh->CON0, it); - else - CLEAR_BIT(hperh->perh->CON0, it); - - return; -} - -/** - * @brief Checks whether the specified ADC interrupt has occurred or not. - * @param hperh: Pointer to a adc_handle_t structure. - * @param it: Specifies the ADC interrupt source to check. - * This parameter can be one of the @ref adc_it_t. - * @retval Status - * - SET - * - RESET - */ -it_status_t ald_adc_get_it_status(adc_handle_t *hperh, adc_it_t it) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_IT_TYPE(it)); - - if (READ_BIT(hperh->perh->CON0, it)) - return SET; - - return RESET; -} - -/** @brief Check whether the specified ADC flag is set or not. - * @param hperh: Pointer to a adc_handle_t structure. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref adc_flag_t. - * @retval Status - * - SET - * - RESET - */ -flag_status_t ald_adc_get_flag_status(adc_handle_t *hperh, adc_flag_t flag) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_FLAGS_TYPE(flag)); - - if (READ_BIT(hperh->perh->STAT, flag)) - return SET; - - return RESET; -} - -/** @brief Clear the specified ADC pending flags. - * @param hperh: Pointer to a adc_handle_t structure. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref adc_flag_t. - * @retval None - */ -void ald_adc_clear_flag_status(adc_handle_t *hperh, adc_flag_t flag) -{ - assert_param(IS_ADC_TYPE(hperh->perh)); - assert_param(IS_ADC_FLAGS_TYPE(flag)); - - WRITE_REG(hperh->perh->CLR, flag); - return; -} -/** - * @} - */ - -/** @defgroup ADC_Public_Functions_Group4 Peripheral State functions - * @brief Peripheral State functions - * @{ - */ - -/** - * @brief return the ADC state - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval state - */ -uint32_t ald_adc_get_state(adc_handle_t *hperh) -{ - return hperh->state; -} - -/** - * @brief Return the ADC error code - * @param hperh: Pointer to a adc_handle_t structure that contains - * the configuration information for the specified ADC module. - * @retval ADC Error Code - */ -uint32_t ald_adc_get_error(adc_handle_t *hperh) -{ - return hperh->error_code; -} - -/** - *@} - */ - -/** - *@} - */ - -/** @defgroup ADC_Private_Functions ADC Private Functions - * @{ - */ - -#ifdef ALD_DMA -/** - * @brief DMA transfer complete callback. - * @param arg: argument of the call back. - * @retval None - */ -static void adc_dma_normal_conv_cplt(void *arg) -{ - adc_handle_t *hperh = (adc_handle_t *)arg; - - if (hperh->normal_cplt_cbk) - hperh->normal_cplt_cbk(hperh); - -} - -/** - * @brief DMA error callback - * @param arg: argument of the call back. - * @retval None - */ -static void adc_dma_error(void *arg) -{ - adc_handle_t *hperh = (adc_handle_t *)arg; - hperh->state |= ADC_STATE_ERROR; - hperh->error_code |= ADC_ERROR_DMA; - - if (hperh->error_cbk) - hperh->error_cbk(hperh); -} -#endif -/** - *@} - */ - -#endif /* ALD_ADC */ - -/** - *@} - */ - -/** - *@} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_bkpc.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_bkpc.c deleted file mode 100644 index a3852bdb22..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_bkpc.c +++ /dev/null @@ -1,158 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_bkpc.c - * @brief BKPC module driver. - * - * @version V1.0 - * @date 15 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_bkpc.h" -#include "ald_rtc.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup BKPC BKPC - * @brief BKPC module driver - * @{ - */ -#ifdef ALD_BKPC - -/** @defgroup BKPC_Public_Functions BKPC Public Functions - * @{ - */ - -/** @addtogroup BKPC_Public_Functions_Group1 Peripheral Control functions - * @brief Peripheral Control functions - * - * @verbatim - ============================================================================== - ##### Peripheral Control functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) ald_bkpc_ldo_config() API can configure LDO in backup field. - (+) ald_bkpc_standby_wakeup_config() API can configure STANDBY wakeup. - - @endverbatim - * @{ - */ - -/** - * @brief Configure ldo in backup field - * @param output: Output voltage select. - * @param state: DISABLE/ENABLE. - * @retval None - */ -void ald_bkpc_ldo_config(bkpc_ldo_output_t output, type_func_t state) -{ - assert_param(IS_BKPC_LDO_OUTPUT(output)); - assert_param(IS_FUNC_STATE(state)); - - BKPC_UNLOCK(); - MODIFY_REG(BKPC->CR, BKPC_CR_MT_STDB_MSK, state << BKPC_CR_MT_STDB_POS); - - if (state) - MODIFY_REG(BKPC->CR, BKPC_CR_LDO_VSEL_MSK, output << BKPC_CR_LDO_VSEL_POSS); - - BKPC_LOCK(); - return; -} - -/** - * @brief Configure standby wakeup in backup field - * @param port: Wakeup port - * @param level: HIGH/LOW. - * @retval None - */ -void ald_bkpc_standby_wakeup_config(bkpc_wakeup_port_t port, bkpc_wakeup_level_t level) -{ - assert_param(IS_BKPC_WAKEUP_PORT(port)); - assert_param(IS_BKPC_WAKEUP_LEVEL(level)); - - if (port == PMU_STANDBY_PORT_SEL_NONE) { - BKPC_UNLOCK(); - CLEAR_BIT(BKPC->CR, BKPC_CR_WKPEN_MSK); - BKPC_LOCK(); - return; - } - - BKPC_UNLOCK(); - SET_BIT(BKPC->CR, BKPC_CR_WKPEN_MSK); - MODIFY_REG(BKPC->CR, BKPC_CR_WKPS_MSK, port << BKPC_CR_WKPS_POSS); - MODIFY_REG(BKPC->CR, BKPC_CR_WKPOL_MSK, level << BKPC_CR_WKPOL_POS); - BKPC_LOCK(); - - return; -} -/** - * @} - */ - -/** @addtogroup BKPC_Public_Functions_Group2 IO operation functions - * @brief IO operation functions - * - * @verbatim - ============================================================================== - ##### IO operation functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) ald_bkpc_write_ram() API can write data in backup ram. - (+) ald_bkpc_read_ram() API can read data from backup ram. - - @endverbatim - * @{ - */ - -/** - * @brief Write data into backup ram. - * @param idx: Index of backup word. - * @param value: Value which will be written to backup ram. - * @retval None - */ -void ald_bkpc_write_ram(uint8_t idx, uint32_t value) -{ - assert_param(IS_BKPC_RAM_IDX(idx)); - - RTC_UNLOCK(); - WRITE_REG(RTC->BKPR[idx], value); - RTC_LOCK(); - - return; -} - -/** - * @brief Read data from backup ram. - * @param idx: Index of backup word. - * @retval The data. - */ -uint32_t ald_bkpc_read_ram(uint8_t idx) -{ - assert_param(IS_BKPC_RAM_IDX(idx)); - - return READ_REG(RTC->BKPR[idx]); -} -/** - * @} - */ - -/** - * @} - */ -#endif /* ALD_BKPC */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_calc.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_calc.c deleted file mode 100644 index ec2400453d..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_calc.c +++ /dev/null @@ -1,121 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_calc.c - * @brief CALC module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_calc.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup CALC CALC - * @brief CALC module driver - * @{ - */ -#ifdef ALD_CALC - -/** @defgroup CALC_Public_Functions CALC Public Functions - * @brief Accelerating calculate functions - * - * @verbatim - ============================================================================== - ##### Accelerating calculate functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Square root operation. - (+) Division. - (+) Get DZ flag. - - @endverbatim - * @{ - */ - -/** - * @brief Square root operation. - * @param data: The radicand - * @retval The value of square root. - */ -uint32_t ald_calc_sqrt(uint32_t data) -{ - WRITE_REG(CALC->RDCND, data); - while (READ_BIT(CALC->SQRTSR, CALC_SQRTSR_BUSY_MSK)); - - return READ_REG(CALC->SQRTRES); -} - -/** - * @brief Calculating division. - * @param dividend: The value of the dividend. - * @param divisor: The value of the divisor. - * @param remainder: The value of the remainder. - * @retval The result of division. - */ -uint32_t ald_calc_div(uint32_t dividend, uint32_t divisor, uint32_t *remainder) -{ - CLEAR_BIT(CALC->DIVCSR, CALC_DIVCSR_SIGN_MSK); - SET_BIT(CALC->DIVCSR, CALC_DIVCSR_TRM_MSK); - WRITE_REG(CALC->DIVDR, dividend); - WRITE_REG(CALC->DIVSR, divisor); - - while (READ_BIT(CALC->DIVCSR, CALC_DIVCSR_BUSY_MSK)); - - *remainder = READ_REG(CALC->DIVRR); - return READ_REG(CALC->DIVQR); -} - -/** - * @brief Calculating division. - * @param dividend: The value of the dividend. - * @param divisor: The value of the divisor. - * @param remainder: The value of the remainder. - * @retval The result of division. - */ -int32_t ald_calc_div_sign(int32_t dividend, int32_t divisor, int32_t *remainder) -{ - SET_BIT(CALC->DIVCSR, CALC_DIVCSR_SIGN_MSK); - SET_BIT(CALC->DIVCSR, CALC_DIVCSR_TRM_MSK); - WRITE_REG(CALC->DIVDR, dividend); - WRITE_REG(CALC->DIVSR, divisor); - - while (READ_BIT(CALC->DIVCSR, CALC_DIVCSR_BUSY_MSK)); - - *remainder = READ_REG(CALC->DIVRR); - return READ_REG(CALC->DIVQR); -} - -/** - * @brief Get the flag of divisor is zero. - * @retval The status, SET/RESET. - */ -flag_status_t ald_calc_get_dz_status(void) -{ - if (READ_BIT(CALC->DIVCSR, CALC_DIVCSR_DZ_MSK)) - return SET; - - return RESET; -} - -/** - * @} - */ -#endif /* ALD_CALC */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_cmu.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_cmu.c deleted file mode 100644 index e43b12c7d1..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_cmu.c +++ /dev/null @@ -1,1093 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_cmu.c - * @brief CMU module driver. - * - * @version V1.0 - * @date 22 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - *** System clock configure *** - ================================= - [..] - (+) If you don't change system clock, you can using ald_cmu_clock_config_default() API. - It will select HRC as system clock. The system clock is 24MHz. - (+) If you want to change system clock, you can using ald_cmu_clock_config() API. - You can select one of the following as system clock: - @ref CMU_CLOCK_HRC 2MHz or 24MHz - @ref CMU_CLOCK_LRC 32768Hz - @ref CMU_CLOCK_LOSC 32768Hz - @ref CMU_CLOCK_PLL1 32MHz, 48MHz or (32768*1024)Hz - @ref CMU_CLOCK_HOSC 1MHz -- 24MHz - (+) If you select CMU_CLOCK_PLL1 as system clock, it must config the PLL1 - using ald_cmu_pll1_config() API. The input of clock must be 4MHz or PLL2. - (+) If you get system clock, you can using ald_cmu_get_sys_clock() API. - - *** BUS division control *** - =================================== - - MCLK sys_clk hclk1 - -------DIV_SYS-----------+------DIV_AHB1------------Peripheral(GPIO, CRC, ... etc.) - | - | pclk1 - +------DIV_APB1------------Peripheral(TIM, UART, ... etc.) - | - | pclk2 - +------DIV_APB2------------Peripheral(ADC, WWDT, ... etc.) - - [..] - (+) Configure the division using ald_cmu_div_config() API. - (+) Get sys_clk using ald_cmu_get_sys_clock() API. - (+) Get hclk1 using ald_cmu_get_hclk1_clock() API. - (+) Get pclk1 using ald_cmu_get_pclk1_clock() API. - (+) Get pclk2 using ald_cmu_get_pclk2_clock() API. - - *** Clock safe configure *** - =================================== - [..] - (+) If you select CMU_CLOCK_HOSC as system clock, you need enable - clock safe using ald_cmu_hosc_safe_config() API. It will change - CMU_CLOCK_HRC as system clock, when the outer crystal stoped. - (+) If you select CMU_CLOCK_LOSC as system clock, you need enable - clock safe using ald_cmu_losc_safe_config() API. It will change - CMU_CLOCK_LRC as system clock, when the outer crystal stoped. - (+) If you select CMU_CLOCK_PLL1 as system clock, you need enable - clock safe using ald_cmu_pll_safe_config() API. It will change - CMU_CLOCK_HRC as system clock, when the pll1 is lose. - (+) The ald_cmu_irq_cbk() will be invoked, when CMU interrupt has - been occurred. You can overwrite this function in application. - - *** Clock output configure *** - =================================== - [..] - (+) Output high-speed clock using ald_cmu_output_high_clock_config() API. - (+) Output low-speed clock using ald_cmu_output_low_clock_config() API. - - *** Peripheral clock configure *** - =================================== - [..] - (+) Configure buzz clock using ald_cmu_buzz_config() API. - (+) Selected lptim0 clock using ald_cmu_lptim0_clock_select() API. - (+) Selected lpuart clock using ald_cmu_lpuart0_clock_select() API. - (+) Selected lcd clock using ald_cmu_lcd_clock_select() API. - (+) Enable/Disable peripheral clock using ald_cmu_perh_clock_config() API. - - *** CMU ALD driver macros list *** - ============================================= - [..] - Below the list of most used macros in CMU driver. - - (+) CMU_LOSC_ENABLE(): Enable outer low crystal(32768Hz). - (+) CMU_LOSC_DISABLE(): Disable outer low crystal(32768Hz). - (+) CMU_LRC_ENABLE(): Enable LRC(32768Hz). - (+) CMU_LRC_DISABLE(): Disable LRC(32768Hz). - (+) CMU_ULRC_ENABLE(): Enable ULRC(10KHz). - (+) CMU_ULRC_DISABLE(): Disable ULRC(10KHz). - (+) CMU_LP_LRC_ENABLE(): Enable low power LRC(32768Hz). - (+) CMU_LP_LRC_DISABLE(): Disable low power LRC(32768Hz). - (+) CMU_LP_LOSC_ENABLE(): Enable low power LOSC(32768Hz). - (+) CMU_LP_LOSC_DISABLE(): Disable low power LOSC(32768Hz). - (+) CMU_LP_HRC_ENABLE(): Enable low power HRC(2MHz or 24MHz). - (+) CMU_LP_HRC_DISABLE(): Disable low power HRC(2MHz OR 24MHz). - (+) CMU_LP_HOSC_ENABLE(): Enable low power HOSC(1MHz -- 24MHz). - (+) CMU_LP_HOSC_DISABLE(): Disable low power HOSC(1MHz -- 24MHz). - - [..] - (@) You can refer to the CMU driver header file for used the macros - - @endverbatim - ****************************************************************************** - */ - -#include "ald_cmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup CMU CMU - * @brief CMU module driver - * @{ - */ - -/** - * @defgroup CMU_Private_Variables CMU Private Variables - * @{ - */ -uint32_t __system_clock = 24000000U; -/** - * @} - */ - -/** @defgroup CMU_Private_Functions CMU Private Functions - * @{ - */ - -/** - * @brief Update the current system clock. This function - * will be invoked, when system clock has changed. - * @param clock: The new clock. - * @retval None - */ - -static void cmu_clock_update(uint32_t clock) -{ - __system_clock = clock; - - if (clock > 1000000) - ald_tick_init(TICK_INT_PRIORITY); - - return; -} - -/** - * @brief CMU module interrupt handler - * @retval None - */ -void ald_cmu_irq_handler(void) -{ - /* HOSC stop */ - if (READ_BIT(CMU->HOSMCR, CMU_HOSMCR_STPIF_MSK) && READ_BIT(CMU->HOSMCR, CMU_HOSMCR_STPIE_MSK)) { - SYSCFG_UNLOCK(); - SET_BIT(CMU->HOSMCR, CMU_HOSMCR_STPIF_MSK); - SYSCFG_LOCK(); - - if ((READ_BIT(CMU->HOSMCR, CMU_HOSMCR_CLKS_MSK)) - && ((READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) == 1) - || ((READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) == 5)))) - cmu_clock_update(READ_BIT(CMU->CFGR, CMU_CFGR_HRCFST_MSK) ? 2000000 : 24000000); - ald_cmu_irq_cbk(CMU_HOSC_STOP); - } - - /* HOSC start */ - if (READ_BIT(CMU->HOSMCR, CMU_HOSMCR_STRIF_MSK) && READ_BIT(CMU->HOSMCR, CMU_HOSMCR_STRIE_MSK)) { - SYSCFG_UNLOCK(); - SET_BIT(CMU->HOSMCR, CMU_HOSMCR_STRIF_MSK); - SYSCFG_LOCK(); - - if (!(READ_BIT(CMU->HOSMCR, CMU_HOSMCR_CLKS_MSK)) - && ((READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) == 5))) - cmu_clock_update((READ_BITS(CMU->HOSCCFG, CMU_HOSCCFG_FREQ_MSK, CMU_HOSCCFG_FREQ_POSS) + 1) * 1000000); - ald_cmu_irq_cbk(CMU_HOSC_START); - } - - /* LOSC stop */ - if (READ_BIT(CMU->LOSMCR, CMU_LOSMCR_STPIF_MSK) && READ_BIT(CMU->LOSMCR, CMU_LOSMCR_STPIE_MSK)) { - SYSCFG_UNLOCK(); - SET_BIT(CMU->LOSMCR, CMU_LOSMCR_STPIF_MSK); - SYSCFG_LOCK(); - ald_cmu_irq_cbk(CMU_LOSC_STOP); - } - - /* LOSC start */ - if (READ_BIT(CMU->LOSMCR, CMU_LOSMCR_STRIF_MSK) && READ_BIT(CMU->LOSMCR, CMU_LOSMCR_STRIE_MSK)) { - SYSCFG_UNLOCK(); - SET_BIT(CMU->LOSMCR, CMU_LOSMCR_STRIF_MSK); - SYSCFG_LOCK(); - ald_cmu_irq_cbk(CMU_LOSC_START); - } - - /* PLL1 lose */ - if (READ_BIT(CMU->PULMCR, CMU_PULMCR_ULKIF_MSK) && READ_BIT(CMU->PULMCR, CMU_PULMCR_ULKIE_MSK)) { - SYSCFG_UNLOCK(); - SET_BIT(CMU->PULMCR, CMU_PULMCR_ULKIF_MSK); - SYSCFG_LOCK(); - - if (READ_BIT(CMU->PULMCR, CMU_PULMCR_CLKS_MSK) - && ((READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) == 1) - || ((READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) == 5)))) - cmu_clock_update(READ_BIT(CMU->CFGR, CMU_CFGR_HRCFST_MSK) ? 2000000 : 24000000); - ald_cmu_irq_cbk(CMU_PLL1_UNLOCK); - } - - return; -} -/** - * @} - */ - -/** @defgroup CMU_Public_Functions CMU Public Functions - * @{ - */ - -/** @defgroup CMU_Public_Functions_Group1 System clock configuration - * @brief System clock configuration functions - * - * @verbatim - ============================================================================== - ##### System clock Configuration functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Configure system clock using default parameters. - (+) Configure system clock using specified parameters. - (+) Configure PLL1 using specified parameters. - (+) Get system clock. - - @endverbatim - * @{ - */ - -/** - * @brief Configure system clock using default. - * Select CMU_CLOCK_HRC(24MHz) as system clock and - * enable CMU_CLOCK_LRC(32768Hz). - * @retval The status of ALD. - */ -ald_status_t ald_cmu_clock_config_default(void) -{ - uint32_t cnt = 4000, tmp; - - SYSCFG_UNLOCK(); - - /* Select HRC */ - MODIFY_REG(CMU->CSR, CMU_CSR_SYS_CMD_MSK, CMU_CLOCK_HRC << CMU_CSR_SYS_CMD_POSS); - while (READ_BIT(CMU->CSR, CMU_CSR_SYS_RDYN_MSK) && (--cnt)); - - if (READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) != CMU_CLOCK_HRC) { - SYSCFG_LOCK(); - return ERROR; - } - - CLEAR_BIT(CMU->CFGR, CMU_CFGR_HRCFSW_MSK); /* Select 24Mhz */ - - tmp = READ_REG(CMU->CLKENR); - /* Enable HRC/LRC/LOSC */ - SET_BIT(tmp, CMU_CLKENR_HRCEN_MSK | CMU_CLKENR_LRCEN_MSK | CMU_CLKENR_LOSCEN_MSK); - WRITE_REG(CMU->CLKENR, tmp); - - SYSCFG_LOCK(); - return OK; -} - -/** - * @brief Configure system clock using specified parameters - * @param clk: The parameter can be one of the following: - * @arg @ref CMU_CLOCK_HRC 2MHz or 24MHz - * @arg @ref CMU_CLOCK_LRC 32768Hz - * @arg @ref CMU_CLOCK_LOSC 32768Hz - * @arg @ref CMU_CLOCK_PLL1 32MHz, 48MHz or (32768*1024)Hz - * @arg @ref CMU_CLOCK_HOSC 1MHz -- 24MHz - * @param clock: The clock which will be set. the value depends - * on the parameter of clk. - * @retval The status of ALD. - */ -ald_status_t ald_cmu_clock_config(cmu_clock_t clk, uint32_t clock) -{ - uint32_t cnt = 4000; - - assert_param(IS_CMU_CLOCK(clk)); - SYSCFG_UNLOCK(); - - switch (clk) { - case CMU_CLOCK_HRC: - assert_param(clock == 24000000 || clock == 2000000); - - MODIFY_REG(CMU->CSR, CMU_CSR_SYS_CMD_MSK, CMU_CLOCK_HRC << CMU_CSR_SYS_CMD_POSS); - while (READ_BIT(CMU->CSR, CMU_CSR_SYS_RDYN_MSK) && (--cnt)); - - if (READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) != CMU_CLOCK_HRC) { - SYSCFG_LOCK(); - return ERROR; - } - - if (clock == 24000000) - CLEAR_BIT(CMU->CFGR, CMU_CFGR_HRCFSW_MSK); - else - SET_BIT(CMU->CFGR, CMU_CFGR_HRCFSW_MSK); - - SET_BIT(CMU->CLKENR, CMU_CLKENR_HRCEN_MSK); - - for (cnt = 4000; cnt; --cnt); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_HRCACT_MSK))) && (--cnt)); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_HRCRDY_MSK))) && (--cnt)); - - cmu_clock_update(clock); - break; - - case CMU_CLOCK_LRC: - /* Close SysTick interrupt in lower clock */ - SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - - MODIFY_REG(CMU->CSR, CMU_CSR_SYS_CMD_MSK, CMU_CLOCK_LRC << CMU_CSR_SYS_CMD_POSS); - while (READ_BIT(CMU->CSR, CMU_CSR_SYS_RDYN_MSK) && (--cnt)); - - if (READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) != CMU_CLOCK_LRC) { - SYSCFG_LOCK(); - return ERROR; - } - - SET_BIT(CMU->CLKENR, CMU_CLKENR_LRCEN_MSK); - - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_LRCACT_MSK))) && (--cnt)); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_LRCRDY_MSK))) && (--cnt)); - - cmu_clock_update(32768); - break; - - case CMU_CLOCK_LOSC: - /* Close SysTick interrupt in lower clock */ - SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - - MODIFY_REG(CMU->CSR, CMU_CSR_SYS_CMD_MSK, CMU_CLOCK_LOSC << CMU_CSR_SYS_CMD_POSS); - while (READ_BIT(CMU->CSR, CMU_CSR_SYS_RDYN_MSK) && (--cnt)); - - if (READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) != CMU_CLOCK_LOSC) { - SYSCFG_LOCK(); - return ERROR; - } - - SET_BIT(CMU->CLKENR, CMU_CLKENR_LOSCEN_MSK); - - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_LOSCACT_MSK))) && (--cnt)); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_LOSCRDY_MSK))) && (--cnt)); - - cmu_clock_update(32768); - break; - - case CMU_CLOCK_PLL1: - MODIFY_REG(CMU->CSR, CMU_CSR_SYS_CMD_MSK, CMU_CLOCK_PLL1 << CMU_CSR_SYS_CMD_POSS); - while (READ_BIT(CMU->CSR, CMU_CSR_SYS_RDYN_MSK) && (--cnt)); - - if (READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) != CMU_CLOCK_PLL1) { - SYSCFG_LOCK(); - return ERROR; - } - - SET_BIT(CMU->CLKENR, CMU_CLKENR_PLL1EN_MSK); - - for (cnt = 4000; cnt; --cnt); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_PLL1ACT_MSK))) && (--cnt)); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_PLL1RDY_MSK))) && (--cnt)); - - cmu_clock_update(clock); - break; - - case CMU_CLOCK_HOSC: - assert_param(clock <= 24000000); - - MODIFY_REG(CMU->CSR, CMU_CSR_SYS_CMD_MSK, CMU_CLOCK_HOSC << CMU_CSR_SYS_CMD_POSS); - while (READ_BIT(CMU->CSR, CMU_CSR_SYS_RDYN_MSK) && (--cnt)); - - if (READ_BITS(CMU->CSR, CMU_CSR_SYS_STU_MSK, CMU_CSR_SYS_STU_POSS) != CMU_CLOCK_HOSC) { - SYSCFG_LOCK(); - return ERROR; - } - - SET_BIT(CMU->CLKENR, CMU_CLKENR_HOSCEN_MSK); - MODIFY_REG(CMU->HOSCCFG, CMU_HOSCCFG_FREQ_MSK, clock / 1000000 - 1); - - for (cnt = 4000; cnt; --cnt); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_HOSCACT_MSK))) && (--cnt)); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_HOSCRDY_MSK))) && (--cnt)); - - cmu_clock_update(clock); - break; - - default: - break; - } - - SYSCFG_LOCK(); - return OK; -} - - - -/** - * @brief Configure PLL1 using specified parameters. - * @param input: The input clock type. - * @param output: The output clock which can be 32MHz or 48MHz. - * When input = CMU_PLL1_INPUT_PLL2; then output must be - * CMU_PLL1_OUTPUT_32M, and then the real clock is (32768x1024)Hz. - * @retval None - */ -void ald_cmu_pll1_config(cmu_pll1_input_t input, cmu_pll1_output_t output) -{ - uint32_t cnt = 4000; - - assert_param(IS_CMU_PLL1_INPUT(input)); - assert_param(IS_CMU_PLL1_OUTPUT(output)); - - SYSCFG_UNLOCK(); - - if (input == CMU_PLL1_INPUT_HRC_6) { - SET_BIT(CMU->CLKENR, CMU_CLKENR_HRCEN_MSK); - } - else if (input == CMU_PLL1_INPUT_PLL2) { - SET_BIT(CMU->CLKENR, CMU_CLKENR_LOSCEN_MSK); - CLEAR_BIT(CMU->PLLCFG, CMU_PLLCFG_PLL2RFS_MSK); - SET_BIT(CMU->CLKENR, CMU_CLKENR_PLL2EN_MSK); - } - else { - SET_BIT(CMU->CLKENR, CMU_CLKENR_HOSCEN_MSK); - } - - MODIFY_REG(CMU->PLLCFG, CMU_PLLCFG_PLL1RFS_MSK, input << CMU_PLLCFG_PLL1RFS_POSS); - MODIFY_REG(CMU->PLLCFG, CMU_PLLCFG_PLL1OS_MSK, output << CMU_PLLCFG_PLL1OS_POS); - SET_BIT(CMU->CLKENR, CMU_CLKENR_PLL1EN_MSK); - - while ((READ_BIT(CMU->PLLCFG, CMU_PLLCFG_PLL1LCKN_MSK)) && (--cnt)); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_PLL1RDY_MSK))) && (--cnt)); - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Gets MCLK clock. - * @retval The value of MCLK clock. - */ -uint32_t ald_cmu_get_clock(void) -{ - return __system_clock; -} - -/** - * @brief Automatic-calibrate internal clock. - * @param input: input type: HOSC or LOSC. - * @param freq: output frequency: 24MHz or 2MHz. - * @retval The result: - * - 0 Success - * - -1 Failed - */ -int32_t ald_cmu_auto_calib_clock(cmu_auto_calib_input_t input, cmu_auto_calib_output_t freq) -{ - uint32_t cnt = 5000, tmp; - - assert_param(IS_CMU_AUTO_CALIB_INPUT(input)); - assert_param(IS_CMU_AUTO_CALIB_OUTPUT(freq)); - - SYSCFG_UNLOCK(); - - tmp = READ_REG(CMU->HRCACR); - - MODIFY_REG(tmp, CMU_HRCACR_AC_MSK, 1 << CMU_HRCACR_AC_POSS); - MODIFY_REG(tmp, CMU_HRCACR_RFSEL_MSK, input << CMU_HRCACR_RFSEL_POS); - MODIFY_REG(tmp, CMU_HRCACR_FREQ_MSK, freq << CMU_HRCACR_FREQ_POS); - SET_BIT(tmp, CMU_HRCACR_EN_MSK); - WRITE_REG(CMU->HRCACR, tmp); - - while (cnt--); - cnt = 30000; - while ((READ_BIT(CMU->HRCACR, CMU_HRCACR_BUSY_MSK)) && (--cnt)); - - if (READ_BITS(CMU->HRCACR, CMU_HRCACR_STA_MSK, CMU_HRCACR_STA_POSS) != 1) { - CLEAR_BIT(CMU->HRCACR, CMU_HRCACR_EN_MSK); - SYSCFG_LOCK(); - return -1; - } - - SET_BIT(CMU->HRCACR, CMU_HRCACR_WRTRG_MSK); - CLEAR_BIT(CMU->HRCACR, CMU_HRCACR_EN_MSK); - SYSCFG_LOCK(); - - return 0; -} -/** - * @} - */ - -/** @defgroup CMU_Public_Functions_Group2 BUS division control - * @brief BUS division control functions - * - * @verbatim - ============================================================================== - ##### BUS division control functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Configure the bus division. - (+) Get AHB1 clock. - (+) Get system clock. - (+) Get APB1 clock. - (+) Get APB2 clock. - - @endverbatim - * @{ - */ - -/** - * @brief Configure the bus division. - * @param bus: The type of bus: - * @arg CMU_HCLK_1 - * @arg CMU_SYS - * @arg CMU_PCLK_1 - * @arg CMU_PCLK_2 - * @param div: The value of divider. - * @retval None - */ -void ald_cmu_div_config(cmu_bus_t bus, cmu_div_t div) -{ - assert_param(IS_CMU_BUS(bus)); - assert_param(IS_CMU_DIV(div)); - - SYSCFG_UNLOCK(); - - switch (bus) { - case CMU_HCLK_1: - MODIFY_REG(CMU->CFGR, CMU_CFGR_HCLK1DIV_MSK, div << CMU_CFGR_HCLK1DIV_POSS); - break; - - case CMU_SYS: - MODIFY_REG(CMU->CFGR, CMU_CFGR_SYSDIV_MSK, div << CMU_CFGR_SYSDIV_POSS); - - if ((__system_clock >> div) <= 1000000) { - /* Close SysTick interrupt in lower clock */ - SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - } - else { - ald_tick_init(TICK_INT_PRIORITY); - } - - break; - - case CMU_PCLK_1: - MODIFY_REG(CMU->CFGR, CMU_CFGR_PCLK1DIV_MSK, div << CMU_CFGR_PCLK1DIV_POSS); - break; - - case CMU_PCLK_2: - MODIFY_REG(CMU->CFGR, CMU_CFGR_PCLK2DIV_MSK, div << CMU_CFGR_PCLK2DIV_POSS); - break; - - default: - break; - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Get AHB1 clock. - * @retval The value of AHB1 clock. - */ -uint32_t ald_cmu_get_hclk1_clock(void) -{ - uint32_t sys_div = READ_BITS(CMU->CFGR, CMU_CFGR_SYSDIV_MSK, CMU_CFGR_SYSDIV_POSS); - uint32_t ahb_div = READ_BITS(CMU->CFGR, CMU_CFGR_HCLK1DIV_MSK, CMU_CFGR_HCLK1DIV_POSS); - - return (__system_clock >> sys_div) >> ahb_div; -} - -/** - * @brief Get system clock - * @retval The value of system clock - */ -uint32_t ald_cmu_get_sys_clock(void) -{ - uint32_t sys_div = READ_BITS(CMU->CFGR, CMU_CFGR_SYSDIV_MSK, CMU_CFGR_SYSDIV_POSS); - - return __system_clock >> sys_div; -} - -/** - * @brief Get APB1 clock. - * @retval The value of APB1 clock. - */ -uint32_t ald_cmu_get_pclk1_clock(void) -{ - uint32_t sys_div = READ_BITS(CMU->CFGR, CMU_CFGR_SYSDIV_MSK, CMU_CFGR_SYSDIV_POSS); - uint32_t apb1_div = READ_BITS(CMU->CFGR, CMU_CFGR_PCLK1DIV_MSK, CMU_CFGR_PCLK1DIV_POSS); - - return (__system_clock >> sys_div) >> apb1_div; -} - -/** - * @brief Get APB2 clock. - * @retval The value of APB2 clock. - */ -uint32_t ald_cmu_get_pclk2_clock(void) -{ - uint32_t sys_div = READ_BITS(CMU->CFGR, CMU_CFGR_SYSDIV_MSK, CMU_CFGR_SYSDIV_POSS); - uint32_t apb2_div = READ_BITS(CMU->CFGR, CMU_CFGR_PCLK2DIV_MSK, CMU_CFGR_PCLK2DIV_POSS); - - return (__system_clock >> sys_div) >> apb2_div; -} -/** - * @} - */ - -/** @defgroup CMU_Public_Functions_Group3 Clock safe configure - * @brief Clock safe configure functions - * - * @verbatim - ============================================================================== - ##### Clock safe configure functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Enable/Disable outer high crystal safe mode. - (+) Enable/Disable outer low crystal safe mode. - (+) Enable/Disable PLL1 safe mode. - (+) Interrupt callback function. - - @endverbatim - * @{ - */ - -/** - * @brief Enable/Disable outer high crystal safe mode. - * @param clock: the value of outer crystal frequency. - * @param status: The new status. - * @retval None - */ -void ald_cmu_hosc_safe_config(cmu_hosc_range_t clock, type_func_t status) -{ - assert_param(IS_CMU_HOSC_RANGE(clock)); - assert_param(IS_FUNC_STATE(status)); - - SYSCFG_UNLOCK(); - - if (status) { - SET_BIT(CMU->HOSMCR, CMU_HOSMCR_STPIF_MSK); - MODIFY_REG(CMU->HOSMCR, CMU_HOSMCR_FRQS_MSK, clock << CMU_HOSMCR_FRQS_POSS); - SET_BIT(CMU->HOSMCR, CMU_HOSMCR_EN_MSK); - SET_BIT(CMU->HOSMCR, CMU_HOSMCR_STPIE_MSK); - - ald_mcu_irq_config(CMU_IRQn, 3, ENABLE); - } - else { - CLEAR_BIT(CMU->HOSMCR, CMU_HOSMCR_EN_MSK); - CLEAR_BIT(CMU->HOSMCR, CMU_HOSMCR_STPIE_MSK); - - if (READ_BIT(CMU->LOSMCR, CMU_LOSMCR_EN_MSK) == 0 && READ_BIT(CMU->PULMCR, CMU_PULMCR_EN_MSK) == 0) - ald_mcu_irq_config(CMU_IRQn, 3, DISABLE); - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Enable/Disable outer low crystal safe mode. - * @param status: The new status. - * @retval None - */ -void ald_cmu_losc_safe_config(type_func_t status) -{ - assert_param(IS_FUNC_STATE(status)); - SYSCFG_UNLOCK(); - - if (status) { - SET_BIT(CMU->LOSMCR, CMU_LOSMCR_STPIF_MSK); - SET_BIT(CMU->LOSMCR, CMU_LOSMCR_EN_MSK); - SET_BIT(CMU->LOSMCR, CMU_LOSMCR_STPIE_MSK); - - ald_mcu_irq_config(CMU_IRQn, 3, ENABLE); - } - else { - CLEAR_BIT(CMU->LOSMCR, CMU_LOSMCR_EN_MSK); - CLEAR_BIT(CMU->LOSMCR, CMU_LOSMCR_STPIE_MSK); - - if (READ_BIT(CMU->HOSMCR, CMU_HOSMCR_EN_MSK) == 0 && READ_BIT(CMU->PULMCR, CMU_PULMCR_EN_MSK) == 0) - ald_mcu_irq_config(CMU_IRQn, 3, DISABLE); - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Enable/Disable PLL1 safe mode. - * @param status: The new status. - * @retval None - */ -void ald_cmu_pll_safe_config(type_func_t status) -{ - assert_param(IS_FUNC_STATE(status)); - SYSCFG_UNLOCK(); - - if (status) { - SET_BIT(CMU->PULMCR, CMU_PULMCR_ULKIF_MSK); - MODIFY_REG(CMU->PULMCR, CMU_PULMCR_MODE_MSK, 2 << CMU_PULMCR_MODE_POSS); - SET_BIT(CMU->PULMCR, CMU_PULMCR_EN_MSK); - SET_BIT(CMU->PULMCR, CMU_PULMCR_ULKIE_MSK); - - ald_mcu_irq_config(CMU_IRQn, 3, ENABLE); - } - else { - CLEAR_BIT(CMU->PULMCR, CMU_PULMCR_EN_MSK); - CLEAR_BIT(CMU->PULMCR, CMU_PULMCR_ULKIE_MSK); - - if (READ_BIT(CMU->HOSMCR, CMU_HOSMCR_EN_MSK) == 0 && READ_BIT(CMU->LOSMCR, CMU_LOSMCR_EN_MSK) == 0) - ald_mcu_irq_config(CMU_IRQn, 3, DISABLE); - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Get current clock source. - * @param type: Type of source: HOSC/LOSC/PLL. - * @retval Status: - * - 0: Current clock is HOSC, LOSC or PLL - * - 1: Current clock is HRC, LRC or HRC - */ -uint32_t ald_cmu_current_clock_source_get(cmu_clock_safe_type_t type) -{ - assert_param(IS_CMU_SAFE_CLOCK_TYPE(type)); - - if (type == CMU_SAFE_CLK_HOSC) - return READ_BITS(CMU->HOSMCR, CMU_HOSMCR_CLKS_MSK, CMU_HOSMCR_CLKS_POS); - else if (type == CMU_SAFE_CLK_LOSC) - return READ_BITS(CMU->LOSMCR, CMU_LOSMCR_CLKS_MSK, CMU_LOSMCR_CLKS_POS); - else - return READ_BITS(CMU->PULMCR, CMU_PULMCR_CLKS_MSK, CMU_PULMCR_CLKS_POS); -} - -/** - * @brief Get clock state. - * @param sr: The state type, see @ref cmu_clock_state_t. - * @retval SET/RESET - */ -flag_status_t ald_cmu_get_clock_state(cmu_clock_state_t sr) -{ - assert_param(IS_CMU_CLOCK_STATE(sr)); - - if (READ_BIT(CMU->CLKSR, sr)) - return SET; - - return RESET; -} - -/** - * @brief Interrupt callback function. - * @note This function is declared as __weak to be overwritten in case of other - * implementations in user file. - * @retval None - */ -__weak void ald_cmu_irq_cbk(cmu_security_t se) -{ - return; -} -/** - * @} - */ - -/** @defgroup CMU_Public_Functions_Group4 Clock output configure - * @brief Clock output configure functions - * - * @verbatim - ============================================================================== - ##### Clock output configure functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Configure the high-speed clock output. - (+) Configure the low-speed clock output. - - @endverbatim - * @{ - */ - -/** - * @brief Configure the high-speed clock output. - * @param sel: Select the source: - * @arg CMU_OUTPUT_HIGH_SEL_HOSC - * @arg CMU_OUTPUT_HIGH_SEL_LOSC - * @arg CMU_OUTPUT_HIGH_SEL_HRC - * @arg CMU_OUTPUT_HIGH_SEL_LRC - * @arg CMU_OUTPUT_HIGH_SEL_HOSM - * @arg CMU_OUTPUT_HIGH_SEL_PLL1 - * @arg CMU_OUTPUT_HIGH_SEL_PLL2 - * @arg CMU_OUTPUT_HIGH_SEL_SYSCLK - * @param div: The value of divider: - * @arg CMU_OUTPUT_DIV_1 - * @arg CMU_OUTPUT_DIV_2 - * @arg CMU_OUTPUT_DIV_4 - * @arg CMU_OUTPUT_DIV_8 - * @arg CMU_OUTPUT_DIV_16 - * @arg CMU_OUTPUT_DIV_32 - * @arg CMU_OUTPUT_DIV_64 - * @arg CMU_OUTPUT_DIV_128 - * @param status: The new status. - * @retval None - */ -void ald_cmu_output_high_clock_config(cmu_output_high_sel_t sel, - cmu_output_high_div_t div, type_func_t status) -{ - assert_param(IS_CMU_OUTPUT_HIGH_SEL(sel)); - assert_param(IS_CMU_OUTPUT_HIGH_DIV(div)); - assert_param(IS_FUNC_STATE(status)); - - SYSCFG_UNLOCK(); - - if (status) { - MODIFY_REG(CMU->CLKOCR, CMU_CLKOCR_HSCOS_MSK, sel << CMU_CLKOCR_HSCOS_POSS); - MODIFY_REG(CMU->CLKOCR, CMU_CLKOCR_HSCODIV_MSK, div << CMU_CLKOCR_HSCODIV_POSS); - SET_BIT(CMU->CLKOCR, CMU_CLKOCR_HSCOEN_MSK); - } - else { - CLEAR_BIT(CMU->CLKOCR, CMU_CLKOCR_HSCOEN_MSK); - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Configure the low-speed clock output. - * @param sel: Select the source: - * @arg CMU_OUTPUT_LOW_SEL_LOSC - * @arg CMU_OUTPUT_LOW_SEL_LRC - * @arg CMU_OUTPUT_LOW_SEL_LOSM - * @arg CMU_OUTPUT_LOW_SEL_BUZZ - * @arg CMU_OUTPUT_LOW_SEL_ULRC - * @param status: The new status. - * @retval None - */ -void ald_cmu_output_low_clock_config(cmu_output_low_sel_t sel, type_func_t status) -{ - assert_param(IS_CMU_OUTPUT_LOW_SEL(sel)); - assert_param(IS_FUNC_STATE(status)); - - SYSCFG_UNLOCK(); - - if (status) { - MODIFY_REG(CMU->CLKOCR, CMU_CLKOCR_LSCOS_MSK, sel << CMU_CLKOCR_LSCOS_POSS); - SET_BIT(CMU->CLKOCR, CMU_CLKOCR_LSCOEN_MSK); - } - else { - CLEAR_BIT(CMU->CLKOCR, CMU_CLKOCR_LSCOEN_MSK); - } - - SYSCFG_LOCK(); - return; -} -/** - * @} - */ - -/** @defgroup CMU_Public_Functions_Group5 Peripheral Clock configure - * @brief Peripheral clock configure functions - * - * @verbatim - ============================================================================== - ##### Peripheral clock configure functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Configure buzz clock. - (+) Select lptim0 clock source. - (+) Select lpuart0 clock source. - (+) Select lcd clock source. - (+) Enable/Disable peripheral clock. - - @endverbatim - * @{ - */ - -/** - * @brief Configure buzz clock. - * freq = sysclk / (2^(div + 1) * (dat + 1)) - * @param div: The value of divider. - * @param dat: The value of coefficient. - * @param status: The new status. - * @retval None - */ -void ald_cmu_buzz_config(cmu_buzz_div_t div, uint16_t dat, type_func_t status) -{ - assert_param(IS_CMU_BUZZ_DIV(div)); - assert_param(IS_FUNC_STATE(status)); - - SYSCFG_UNLOCK(); - - if (status) { - MODIFY_REG(CMU->BUZZCR, CMU_BUZZCR_DIV_MSK, div << CMU_BUZZCR_DIV_POSS); - MODIFY_REG(CMU->BUZZCR, CMU_BUZZCR_DAT_MSK, dat << CMU_BUZZCR_DAT_POSS); - SET_BIT(CMU->BUZZCR, CMU_BUZZCR_EN_MSK); - } - else { - CLEAR_BIT(CMU->BUZZCR, CMU_BUZZCR_EN_MSK); - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Select lptim0 clock source. - * @param clock: The clock source: - * @arg CMU_LP_PERH_CLOCK_SEL_PCLK2 - * @arg CMU_LP_PERH_CLOCK_SEL_PLL1 - * @arg CMU_LP_PERH_CLOCK_SEL_PLL2 - * @arg CMU_LP_PERH_CLOCK_SEL_HRC - * @arg CMU_LP_PERH_CLOCK_SEL_HOSC - * @arg CMU_LP_PERH_CLOCK_SEL_LRC - * @arg CMU_LP_PERH_CLOCK_SEL_LOSC - * @arg CMU_LP_PERH_CLOCK_SEL_ULRC - * @arg CMU_LP_PERH_CLOCK_SEL_HRC_1M - * @arg CMU_LP_PERH_CLOCK_SEL_HOSC_1M - * @arg CMU_LP_PERH_CLOCK_SEL_LOSM - * @arg CMU_LP_PERH_CLOCK_SEL_HOSM - * @retval None - */ -void ald_cmu_lptim0_clock_select(cmu_lp_perh_clock_sel_t clock) -{ - assert_param(IS_CMU_LP_PERH_CLOCK_SEL(clock)); - - SYSCFG_UNLOCK(); - MODIFY_REG(CMU->PERICR, CMU_PERICR_LPTIM0_MSK, clock << CMU_PERICR_LPTIM0_POSS); - SYSCFG_LOCK(); - - return; -} - -/** - * @brief Select lpuart0 clock source. - * @param clock: The clock source: - * @arg CMU_LP_PERH_CLOCK_SEL_PCLK2 - * @arg CMU_LP_PERH_CLOCK_SEL_PLL1 - * @arg CMU_LP_PERH_CLOCK_SEL_PLL2 - * @arg CMU_LP_PERH_CLOCK_SEL_HRC - * @arg CMU_LP_PERH_CLOCK_SEL_HOSC - * @arg CMU_LP_PERH_CLOCK_SEL_LRC - * @arg CMU_LP_PERH_CLOCK_SEL_LOSC - * @arg CMU_LP_PERH_CLOCK_SEL_ULRC - * @arg CMU_LP_PERH_CLOCK_SEL_HRC_1M - * @arg CMU_LP_PERH_CLOCK_SEL_HOSC_1M - * @arg CMU_LP_PERH_CLOCK_SEL_LOSM - * @arg CMU_LP_PERH_CLOCK_SEL_HOSM - * @retval None - */ -void ald_cmu_lpuart0_clock_select(cmu_lp_perh_clock_sel_t clock) -{ - assert_param(IS_CMU_LP_PERH_CLOCK_SEL(clock)); - - SYSCFG_UNLOCK(); - MODIFY_REG(CMU->PERICR, CMU_PERICR_LPUART0_MSK, clock << CMU_PERICR_LPUART0_POSS); - SYSCFG_LOCK(); - - return; -} - -/** - * @brief Select lcd clock source. - * @param clock: The clock source: - * @arg CMU_LCD_SEL_LOSM - * @arg CMU_LCD_SEL_LOSC - * @arg CMU_LCD_SEL_LRC - * @arg CMU_LCD_SEL_ULRC - * @arg CMU_LCD_SEL_HRC_1M - * @arg CMU_LCD_SEL_HOSC_1M - * @retval None - */ -void ald_cmu_lcd_clock_select(cmu_lcd_clock_sel_t clock) -{ - assert_param(IS_CMU_LCD_CLOCK_SEL(clock)); - - SYSCFG_UNLOCK(); - MODIFY_REG(CMU->PERICR, CMU_PERICR_LCD_MSK, clock << CMU_PERICR_LCD_POSS); - SYSCFG_LOCK(); - - return; -} - -/** - * @brief Enable/Disable peripheral clock. - * @param perh: The type of peripheral, you can see @ref cmu_perh_t - * @param status: The new status. - * @retval None - */ -void ald_cmu_perh_clock_config(cmu_perh_t perh, type_func_t status) -{ - uint32_t idx, pos; - - assert_param(IS_CMU_PERH(perh)); - assert_param(IS_FUNC_STATE(status)); - - SYSCFG_UNLOCK(); - - if (perh == CMU_PERH_ALL) { - if (status) { - WRITE_REG(CMU->AHB1ENR, ~0); - WRITE_REG(CMU->APB1ENR, ~0); - WRITE_REG(CMU->APB2ENR, ~0); - } - else { - WRITE_REG(CMU->AHB1ENR, 0); - WRITE_REG(CMU->APB1ENR, 0); - WRITE_REG(CMU->APB2ENR, 0); - } - - SYSCFG_LOCK(); - return; - } - - idx = (perh >> 27) & 0x3; - pos = perh & ~(0x3 << 27); - - if (status) { - switch (idx) { - case 0: - SET_BIT(CMU->AHB1ENR, pos); - break; - - case 1: - SET_BIT(CMU->APB1ENR, pos); - break; - - case 2: - SET_BIT(CMU->APB2ENR, pos); - break; - - default: - break; - } - } - else { - switch (idx) { - case 0: - CLEAR_BIT(CMU->AHB1ENR, pos); - break; - - case 1: - CLEAR_BIT(CMU->APB1ENR, pos); - break; - - case 2: - CLEAR_BIT(CMU->APB2ENR, pos); - break; - - default: - break; - } - } - - SYSCFG_LOCK(); - return; -} - -/** - * @} - */ -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_crc.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_crc.c deleted file mode 100644 index bf6fde037c..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_crc.c +++ /dev/null @@ -1,514 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_crc.c - * @brief CRC module driver. - * - * @version V1.0 - * @date 6 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_crc.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup CRC CRC - * @brief CRC module driver - * @{ - */ -#ifdef ALD_CRC - -/** @addtogroup CRC_Private_Functions CRC Private Functions - * @{ - */ -void ald_crc_reset(crc_handle_t *hperh); -#ifdef ALD_DMA -static void crc_dma_calculate_cplt(void *arg); -static void crc_dma_error(void *arg); -#endif -/** - * @} - */ - - -/** @defgroup CRC_Public_Functions CRC Public Functions - * @{ - */ - -/** @defgroup CRC_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * @{ - */ - -/** - * @brief Initializes the CRC mode according to the specified parameters in - * the crc_handle_t and create the associated handle. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crc_init(crc_handle_t *hperh) -{ - uint32_t tmp = 0; - - if (hperh == NULL) - return ERROR; - - assert_param(IS_CRC(hperh->perh)); - assert_param(IS_CRC_MODE(hperh->init.mode)); - assert_param(IS_FUNC_STATE(hperh->init.chs_rev)); - assert_param(IS_FUNC_STATE(hperh->init.data_inv)); - assert_param(IS_FUNC_STATE(hperh->init.data_rev)); - assert_param(IS_FUNC_STATE(hperh->init.chs_inv)); - - ald_crc_reset(hperh); - __LOCK(hperh); - - CRC_ENABLE(hperh); - - tmp = hperh->perh->CR; - - tmp |= ((hperh->init.chs_rev << CRC_CR_CHSREV_POS) | (hperh->init.data_inv << CRC_CR_DATREV_POS) | - (hperh->init.chs_inv << CRC_CR_CHSINV_POS) | (hperh->init.mode << CRC_CR_MODE_POSS) | - (CRC_DATASIZE_8 << CRC_CR_DATLEN_POSS) | (hperh->init.data_rev << CRC_CR_DATREV_POS) | - (0 << CRC_CR_BYTORD_POS)); - - hperh->perh->CR = tmp; - hperh->perh->SEED = hperh->init.seed; - CRC_RESET(hperh); - - hperh->state = CRC_STATE_READY; - - __UNLOCK(hperh); - return OK; -} - -/** - * @} - */ - -/** @defgroup CRC_Public_Functions_Group2 Calculate functions - * @brief Calculate functions - * @{ - */ - -/** - * @brief Calculate the crc value of data by byte. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @param buf: Pointer to data buffer - * @param size: The size of data to be calculate - * @retval result, the result of a amount data - */ -uint32_t ald_crc_calculate(crc_handle_t *hperh, uint8_t *buf, uint32_t size) -{ - uint32_t i; - uint32_t ret; - - assert_param(IS_CRC(hperh->perh)); - - if (buf == NULL || size == 0) - return 0; - - __LOCK(hperh); - MODIFY_REG(hperh->perh->CR, CRC_CR_DATLEN_MSK, CRC_DATASIZE_8 << CRC_CR_DATLEN_POSS); - hperh->state = CRC_STATE_BUSY; - - for (i = 0; i < size; i++) - *((volatile uint8_t *)&(hperh->perh->DATA)) = buf[i]; - - ret = CRC->CHECKSUM; - hperh->state = CRC_STATE_READY; - __UNLOCK(hperh); - - return ret; -} - -/** - * @brief Calculate the crc value of data by halfword. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @param buf: Pointer to data buffer - * @param size: The size of data to be calculate,width is 2 bytes. - * @retval result, the result of a amount data - */ -uint32_t ald_crc_calculate_halfword(crc_handle_t *hperh, uint16_t *buf, uint32_t size) -{ - uint32_t i; - uint32_t ret; - - assert_param(IS_CRC(hperh->perh)); - - if (buf == NULL || size == 0) - return 0; - - __LOCK(hperh); - MODIFY_REG(hperh->perh->CR, CRC_CR_DATLEN_MSK, CRC_DATASIZE_16 << CRC_CR_DATLEN_POSS); - hperh->state = CRC_STATE_BUSY; - - for (i = 0; i < size; i++) - *((volatile uint16_t *)&(hperh->perh->DATA)) = buf[i]; - - ret = CRC->CHECKSUM; - hperh->state = CRC_STATE_READY; - __UNLOCK(hperh); - - return ret; -} - -/** - * @brief Calculate the crc value of data by word. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @param buf: Pointer to data buffer - * @param size: The size of data to be calculate,width is 4 bytes - * @retval result, the result of a amount data - */ -uint32_t ald_crc_calculate_word(crc_handle_t *hperh, uint32_t *buf, uint32_t size) -{ - uint32_t i; - uint32_t ret; - - assert_param(IS_CRC(hperh->perh)); - - if (buf == NULL || size == 0) - return 0; - - __LOCK(hperh); - MODIFY_REG(hperh->perh->CR, CRC_CR_DATLEN_MSK, CRC_DATASIZE_32 << CRC_CR_DATLEN_POSS); - hperh->state = CRC_STATE_BUSY; - - for (i = 0; i < size; i++) - CRC->DATA = buf[i]; - - ret = CRC->CHECKSUM; - hperh->state = CRC_STATE_READY; - __UNLOCK(hperh); - - return ret; -} - -/** - * @} - */ - -#ifdef ALD_DMA -/** @defgroup CRC_Public_Functions_Group3 DMA operation functions - * @brief DMA operation functions - * @{ - */ - -/** - * @brief Calculate an amount of data used dma channel - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @param buf: Pointer to data buffer - * @param res: Pointer to result - * @param size: Amount of data to be Calculate - * @param channel: DMA channel as CRC transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crc_calculate_by_dma(crc_handle_t *hperh, uint8_t *buf, uint32_t *res, uint16_t size, uint8_t channel) -{ - if (hperh->state != CRC_STATE_READY) - return BUSY; - - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - MODIFY_REG(hperh->perh->CR, CRC_CR_DATLEN_MSK, CRC_DATASIZE_8 << CRC_CR_DATLEN_POSS); - - hperh->state = CRC_STATE_BUSY; - - hperh->cal_buf = buf; - hperh->cal_res = res; - - if (hperh->hdma.perh == NULL) - hperh->hdma.perh = DMA0; - - hperh->hdma.cplt_arg = (void *)hperh; - hperh->hdma.cplt_cbk = &crc_dma_calculate_cplt; - hperh->hdma.err_arg = (void *)hperh; - hperh->hdma.err_cbk = &crc_dma_error; - - ald_dma_config_struct(&(hperh->hdma.config)); - hperh->hdma.config.data_width = DMA_DATA_SIZE_BYTE; - hperh->hdma.config.src = (void *)buf; - hperh->hdma.config.dst = (void *)&hperh->perh->DATA; - hperh->hdma.config.size = size; - hperh->hdma.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdma.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma.config.msel = DMA_MSEL_CRC; - hperh->hdma.config.msigsel = DMA_MSIGSEL_NONE; - hperh->hdma.config.channel = channel; - ald_dma_config_basic(&(hperh->hdma)); - - __UNLOCK(hperh); - CRC_DMA_ENABLE(hperh); - - return OK; -} - -/** - * @brief Calculate an amount of data used dma channel,data width is half-word. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @param buf: Pointer to half_word data buffer - * @param res: Pointer to result - * @param size: Amount of half_word data to be Calculate - * @param channel: DMA channel as CRC transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crc_calculate_halfword_by_dma(crc_handle_t *hperh, uint16_t *buf, uint32_t *res, uint16_t size, uint8_t channel) -{ - if (hperh->state != CRC_STATE_READY) - return BUSY; - - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - MODIFY_REG(hperh->perh->CR, CRC_CR_DATLEN_MSK, CRC_DATASIZE_16 << CRC_CR_DATLEN_POSS); - - hperh->state = CRC_STATE_BUSY; - - hperh->cal_buf = (uint8_t *)buf; - hperh->cal_res = res; - - if (hperh->hdma.perh == NULL) - hperh->hdma.perh = DMA0; - - hperh->hdma.cplt_arg = (void *)hperh; - hperh->hdma.cplt_cbk = &crc_dma_calculate_cplt; - hperh->hdma.err_arg = (void *)hperh; - hperh->hdma.err_cbk = &crc_dma_error; - - ald_dma_config_struct(&(hperh->hdma.config)); - hperh->hdma.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma.config.src = (void *)buf; - hperh->hdma.config.dst = (void *)&hperh->perh->DATA; - hperh->hdma.config.size = size; - hperh->hdma.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdma.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma.config.msel = DMA_MSEL_CRC; - hperh->hdma.config.msigsel = DMA_MSIGSEL_NONE; - hperh->hdma.config.channel = channel; - ald_dma_config_basic(&(hperh->hdma)); - - __UNLOCK(hperh); - CRC_DMA_ENABLE(hperh); - - return OK; -} - -/** - * @brief Calculate an amount of data used dma channel,data width is word. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @param buf: Pointer to word data buffer - * @param res: Pointer to result - * @param size: Amount of word data to be Calculate - * @param channel: DMA channel as CRC transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crc_calculate_word_by_dma(crc_handle_t *hperh, uint32_t *buf, uint32_t *res, uint16_t size, uint8_t channel) -{ - if (hperh->state != CRC_STATE_READY) - return BUSY; - - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - MODIFY_REG(hperh->perh->CR, CRC_CR_DATLEN_MSK, CRC_DATASIZE_32 << CRC_CR_DATLEN_POSS); - - hperh->state = CRC_STATE_BUSY; - - hperh->cal_buf = (uint8_t *)buf; - hperh->cal_res = res; - - if (hperh->hdma.perh == NULL) - hperh->hdma.perh = DMA0; - - hperh->hdma.cplt_arg = (void *)hperh; - hperh->hdma.cplt_cbk = &crc_dma_calculate_cplt; - hperh->hdma.err_arg = (void *)hperh; - hperh->hdma.err_cbk = &crc_dma_error; - - ald_dma_config_struct(&(hperh->hdma.config)); - hperh->hdma.config.data_width = DMA_DATA_SIZE_WORD; - hperh->hdma.config.src = (void *)buf; - hperh->hdma.config.dst = (void *)&hperh->perh->DATA; - hperh->hdma.config.size = size; - hperh->hdma.config.src_inc = DMA_DATA_INC_WORD; - hperh->hdma.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma.config.msel = DMA_MSEL_CRC; - hperh->hdma.config.msigsel = DMA_MSIGSEL_NONE; - hperh->hdma.config.channel = channel; - ald_dma_config_basic(&(hperh->hdma)); - - __UNLOCK(hperh); - CRC_DMA_ENABLE(hperh); - - return OK; -} - - -/** - * @brief Pauses the DMA Transfer. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crc_dma_pause(crc_handle_t *hperh) -{ - __LOCK(hperh); - CRC_DMA_DISABLE(hperh); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Resumes the DMA Transfer. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crc_dma_resume(crc_handle_t *hperh) -{ - __LOCK(hperh); - CRC_DMA_ENABLE(hperh); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Stops the DMA Transfer. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crc_dma_stop(crc_handle_t *hperh) -{ - __LOCK(hperh); - CRC_DMA_DISABLE(hperh); - __UNLOCK(hperh); - - hperh->state = CRC_STATE_READY; - return OK; -} - -/** - * @} - */ -#endif - -/** @defgroup CRC_Public_Functions_Group4 Peripheral State and Errors functions - * @brief CRC State and Errors functions - * @{ - */ - -/** - * @brief Returns the CRC state. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval CRC state - */ -crc_state_t ald_crc_get_state(crc_handle_t *hperh) -{ - assert_param(IS_CRC(hperh->perh)); - - return hperh->state; -} -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup CRC_Private_Functions CRC Private Functions - * @brief CRC Private functions - * @{ - */ - -/** - * @brief Reset the CRC peripheral. - * @param hperh: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval None - */ -void ald_crc_reset(crc_handle_t *hperh) -{ - hperh->perh->DATA = 0x0; - hperh->perh->CR = 0x2; - hperh->perh->SEED = 0xFFFFFFFF; - - hperh->state = CRC_STATE_READY; - __UNLOCK(hperh); - return; -} - -#ifdef ALD_DMA -/** - * @brief DMA CRC calculate process complete callback. - * @param arg: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval None - */ -static void crc_dma_calculate_cplt(void *arg) -{ - crc_handle_t *hperh = (crc_handle_t *)arg; - - *(hperh->cal_res) = CRC->CHECKSUM; - CRC_DMA_DISABLE(hperh); - - hperh->state = CRC_STATE_READY; - - if (hperh->cal_cplt_cbk) - hperh->cal_cplt_cbk(hperh); -} - -/** - * @brief DMA CRC communication error callback. - * @param arg: Pointer to a crc_handle_t structure that contains - * the configuration information for the specified CRC module. - * @retval None - */ -static void crc_dma_error(void *arg) -{ - crc_handle_t *hperh = (crc_handle_t *)arg; - - CRC_CLEAR_ERROR_FLAG(hperh); - CRC_DMA_DISABLE(hperh); - - hperh->state = CRC_STATE_READY; - - if (hperh->err_cplt_cbk) - hperh->err_cplt_cbk(hperh); -} -#endif -/** - * @} - */ -#endif /* ALD_CRC */ - -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_crypt.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_crypt.c deleted file mode 100644 index ff8f92d9d5..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_crypt.c +++ /dev/null @@ -1,996 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_crypt.c - * @brief CRYPT module driver. - * This is the common part of the CRYPT initialization - * - * @version V1.0 - * @date 7 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - - -#include "ald_crypt.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup CRYPT CRYPT - * @brief CRYPT module driver - * @{ - */ -#ifdef ALD_CRYPT - -/** @addtogroup CRYPT_Private_Functions CRYPT Private Functions - * @{ - */ -void crypt_reset(crypt_handle_t *hperh); -#ifdef ALD_DMA -static void crypt_dma_crypt_cplt(void *arg); -static void crypt_dma_error(void *arg); -#endif -/** - * @} - */ - - -/** @defgroup CRYPT_Public_Functions CRYPT Public Functions - * @{ - */ - -/** @defgroup CRYPT_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * @{ - */ - -/** - * @brief Initializes the CRYPT mode according to the specified parameters in - * the crypt_init_t and create the associated handle. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_init(crypt_handle_t *hperh) -{ - uint32_t tmp = 0; - - if (hperh == NULL) - return ERROR; - - assert_param(IS_CRYPT(hperh->perh)); - assert_param(IS_CRYPT_MODE(hperh->init.mode)); - - __LOCK(hperh); - crypt_reset(hperh); - - if (hperh->state == CRYPT_STATE_RESET) - __UNLOCK(hperh); - - tmp = hperh->perh->CON; - hperh->step = 4; - tmp |= ((1 << CRYPT_CON_FIFOODR_POS) | (hperh->init.mode << CRYPT_CON_MODE_POSS) | \ - (hperh->init.type << CRYPT_CON_TYPE_POSS) | (1 << CRYPT_CON_FIFOEN_POS)); - WRITE_REG(hperh->perh->CON, tmp); - hperh->state = CRYPT_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Write the Content of KEY. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param key: Pointer to key data buffer - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_write_key(crypt_handle_t *hperh, uint32_t *key) -{ - uint32_t *temp = key; - uint32_t i; - - if ((hperh == NULL) || (key == NULL)) - return ERROR; - if (hperh->state == CRYPT_STATE_BUSY) - return BUSY; - - assert_param(IS_CRYPT(hperh->perh)); - - hperh->perh->KEY[3] = *temp++; - hperh->perh->KEY[2] = *temp++; - hperh->perh->KEY[1] = *temp++; - hperh->perh->KEY[0] = *temp; - - for (i = 0; i < 4; i++) - hperh->key[i] = *key++; - - return OK; -} - -/** - * @brief Read the Content of KEY. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param key: The pointer to the key - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_read_key(crypt_handle_t *hperh, uint32_t *key) -{ - uint32_t *temp = key; - - if ((hperh == NULL) || (key == NULL)) - return ERROR; - if (hperh->state == CRYPT_STATE_BUSY) - return BUSY; - - assert_param(IS_CRYPT(hperh->perh)); - - *temp++ = hperh->perh->KEY[3]; - *temp++ = hperh->perh->KEY[2]; - *temp++ = hperh->perh->KEY[1]; - *temp = hperh->perh->KEY[0]; - - return OK; -} - -/** - * @brief Write the Content of IV if you use CBC mode - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param iv: Pointer to iv data buffer - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_write_ivr(crypt_handle_t *hperh, uint32_t *iv) -{ - uint32_t *temp = iv; - uint32_t i; - - if ((hperh == NULL) || (iv == NULL)) - return ERROR; - if (hperh->state == CRYPT_STATE_BUSY) - return BUSY; - - assert_param(IS_CRYPT(hperh->perh)); - - hperh->perh->IV[3] = *temp++; - hperh->perh->IV[2] = *temp++; - hperh->perh->IV[1] = *temp++; - hperh->perh->IV[0] = *temp; - - for (i = 0; i < 4; i++) - hperh->iv[i] = *iv++; - - CRYPT_IVEN_ENABLE(hperh); - return OK; -} - -/** - * @brief Read the Content of IV. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param iv: Pointer to iv data buffer - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_read_ivr(crypt_handle_t *hperh, uint32_t *iv) -{ - uint32_t *temp = iv; - - if ((hperh == NULL) || (iv == NULL)) - return ERROR; - if (hperh->state == CRYPT_STATE_BUSY) - return BUSY; - - assert_param(IS_CRYPT(hperh->perh)); - - *temp++ = hperh->perh->IV[3]; - *temp++ = hperh->perh->IV[2]; - *temp++ = hperh->perh->IV[1]; - *temp = hperh->perh->IV[0]; - - return OK; -} - -/** - * @} - */ - -/** @defgroup CRYPT_Public_Functions_Group2 Encrypt or Decrypt functions - * @brief Encrypt or Decrypt functions - * @{ - */ - -/** - * @brief Encrypt an amount of data in blocking mode. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param plain_text: Pointer to plain data buffer - * @param cipher_text: Pointer to cipher data buffer - * @param size: Amount of plain data - * @retval Status, see @ref ald_status_t. - * @note the size is multiple of 16(ase) - */ -ald_status_t ald_crypt_encrypt(crypt_handle_t *hperh, uint8_t *plain_text, uint8_t *cipher_text, uint32_t size) -{ - uint32_t count = 0; - uint32_t i; - uint32_t *plain_buf = (uint32_t *)plain_text; - uint32_t *cipher_buf = (uint32_t *)cipher_text; - - if (hperh->state != CRYPT_STATE_READY) - return ERROR; - - if ((plain_buf == NULL) || (cipher_buf == NULL) || (size == 0)) - return ERROR; - - assert_param(IS_CRYPT(hperh->perh)); - - __LOCK(hperh); - hperh->state = CRYPT_STATE_BUSY; - CRYPT_SETDIR(hperh, CRYPT_ENCRYPT); - count = size / (4 * hperh->step); - - while (count--) { - for (i = 0; i < hperh->step; i++) { - CRYPT_WRITE_FIFO(hperh, *plain_buf); - plain_buf++; - } - - while (ald_crypt_get_flag_status(hperh, CRYPT_FLAG_DONE) == SET); - - for (i = 0; i < hperh->step; i++) { - *cipher_buf = CRYPT_READ_FIFO(hperh); - cipher_buf++; - } - } - - hperh->state = CRYPT_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Decrypt an amount of data in blocking mode. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param cipher_text: Pointer to cipher data buffer - * @param plain_text: Pointer to plain data buffer - * @param size: Amount of cipher data - * @retval Status, see @ref ald_status_t. - * @note the size is multiple of 16(ase) - */ -ald_status_t ald_crypt_decrypt(crypt_handle_t *hperh, uint8_t *cipher_text, uint8_t *plain_text, uint32_t size) -{ - uint32_t count = 0; - uint32_t i; - uint32_t *plain_buf = (uint32_t*)plain_text; - uint32_t *cipher_buf = (uint32_t*)cipher_text; - - if (hperh->init.mode == CRYPT_MODE_CTR) { - return ald_crypt_encrypt(hperh, cipher_text, plain_text, size); - } - - if (hperh->state != CRYPT_STATE_READY) - return ERROR; - - if ((plain_buf == NULL) || (cipher_buf == NULL) || (size == 0)) - return ERROR; - - assert_param(IS_CRYPT(hperh->perh)); - - __LOCK(hperh); - hperh->state = CRYPT_STATE_BUSY; - CRYPT_SETDIR(hperh, CRYPT_DECRYPT); - count = size / (4 * hperh->step); - - while (count--) { - for (i = 0; i < hperh->step; i++) { - CRYPT_WRITE_FIFO(hperh, *cipher_buf); - cipher_buf++; - } - - while (ald_crypt_get_flag_status(hperh, CRYPT_FLAG_DONE) == SET); - - for (i = 0; i < hperh->step; i++) { - *plain_buf = CRYPT_READ_FIFO(hperh); - plain_buf++; - } - } - - hperh->state = CRYPT_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -void gcm_mul(uint32_t *res, uint32_t *data, uint32_t *iv) -{ - CRYPT->CON = 0; - CRYPT->DATA[0] = data[3]; - CRYPT->DATA[1] = data[2]; - CRYPT->DATA[2] = data[1]; - CRYPT->DATA[3] = data[0]; - CRYPT->IV[0] = iv[3]; - CRYPT->IV[1] = iv[2]; - CRYPT->IV[2] = iv[1]; - CRYPT->IV[3] = iv[0]; - CRYPT->CON |= ((1 << CRYPT_CON_RESCLR_POS) | (3 << CRYPT_CON_MODE_POSS) | \ - (1 << CRYPT_CON_GO_POS)); - - while (READ_BIT(CRYPT->IF, CRYPT_IF_MULTHIF_MSK) == 0); - - res[3] = CRYPT->RES[0]; - res[2] = CRYPT->RES[1]; - res[1] = CRYPT->RES[2]; - res[0] = CRYPT->RES[3]; - - WRITE_REG(CRYPT->IFC, CRYPT_IFC_MULTHIFC_MSK); - return; -} - -/** - * @brief verify an amount of data in gcm mode. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param cipher_text: Pointer to cipher data buffer - * @param size: Amount of cipher data - * @param aadata: Pointer to additional authenticated data buffer - * @param alen: Amount of additional authenticated data - * @param tag: Pointer to authentication tag buffer - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_gcm_verify(crypt_handle_t *hperh, uint8_t *cipher_text, uint32_t size, uint8_t *aadata, uint32_t alen, uint8_t *tag) -{ - uint8_t GCM_HASH_in[0x60] = {0}; - uint8_t ecb[16] = {0}; - uint32_t x_temp[4]; - uint64_t u, v; - uint32_t len = 0; - uint32_t j, i, k; - uint32_t *tag_temp, *cipher_text_temp; - - /* calculate u and v */ - u = 128 * ((size % 16) ? (size / 16 + 1) : size / 16) - size * 8; - v = 128 * ((alen % 16) ? (alen / 16 + 1): alen / 16) - alen * 8; - - /* get the input of GHASH algorithm,the input:A||0^v||C||0^u||[len(A)]_64||[len(C)]_64 */ - for (i = 0; i < alen; i++) { - GCM_HASH_in [i] = * (aadata + i); - } - len += alen; - for (i = 0; i < v / 8; i++) { - GCM_HASH_in[i + len] = 0; - } - len += v / 8; - for (i = 0; i < size; i++) { - GCM_HASH_in[i + len] = * (cipher_text + i); - } - len += size; - for (i = 0; i < u / 8; i++) { - GCM_HASH_in[i + len] = 0; - } - len += u / 8; - - for (i = 0; i < 4; i++) { - GCM_HASH_in[i + len] = 0; - } - len += 4; - - for (i = 0; i < 4; i++) { - GCM_HASH_in[i + len] = ((alen * 8) >> (8 * i)) & 0xFF; - } - len += 4; - - for (i = 0; i < 4; i++) { - GCM_HASH_in[i + len] = 0; - } - len += 4; - - for (i = 0; i < 4; i++) { - GCM_HASH_in[i + len] = ((size * 8) >> (8 * i)) & 0xFF; - } - len += 4; - - CRYPT->CON &= ~(3U << CRYPT_CON_MODE_POSS); - CRYPT->CON |= (CRYPT_MODE_ECB << CRYPT_CON_MODE_POSS); - - ald_crypt_encrypt(hperh, ecb, ecb, 16); - - k = len / 16; - for (i = 0; i < 16; i++) { - tag[i] = 0; - } - - cipher_text_temp = (uint32_t *)GCM_HASH_in; - tag_temp = (uint32_t *)tag; - for (i = 0; i < k; i++) { - for (j = 0; j < 4; j++) { - x_temp[j] = (*cipher_text_temp) ^ tag_temp[j]; - ++cipher_text_temp; - } - - gcm_mul((uint32_t *)tag_temp, x_temp, (uint32_t *)ecb); - } - - /* calculate the authentication tag T, - * T = CIPH_K(J0)^S,J0=IV||0^31||1,CIPH_K is the algorithm of AES in ECB mode - */ - tag_temp = (uint32_t *)tag; - ald_crypt_init(hperh); - CRYPT->CON &= ~(3U << CRYPT_CON_MODE_POSS); - CRYPT->CON |= (CRYPT_MODE_CTR << CRYPT_CON_MODE_POSS); - ald_crypt_write_key(hperh, hperh->key); - hperh->iv[3] = 1; - ald_crypt_write_ivr(hperh, hperh->iv); - ald_crypt_encrypt(hperh, tag, tag, 16); - - return OK; -} - -/** - * @brief Encrypt an amount of data in non-blocking mode. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param plain_text: Pointer to plain data buffer - * @param cipher_text: Pointer to cipher data buffer - * @param size: Amount of plain data - * @retval Status, see @ref ald_status_t. - * @note the size is multiple of 16(ase) - */ -ald_status_t ald_crypt_encrypt_by_it(crypt_handle_t *hperh, uint8_t * plain_text, uint8_t *cipher_text, uint32_t size) -{ - uint32_t i; - uint32_t *plain_buf = (uint32_t *)plain_text; - - if (hperh->state != CRYPT_STATE_READY) - return ERROR; - - if ((plain_text == NULL) || (cipher_text == NULL) || (size == 0)) - return ERROR; - - assert_param(IS_CRYPT(hperh->perh)); - - __LOCK(hperh); - hperh->state = CRYPT_STATE_BUSY; - CRYPT_SETDIR(hperh, CRYPT_ENCRYPT); - hperh->count = hperh->step; - hperh->plain_text = plain_text; - hperh->cipher_text = cipher_text; - hperh->size = size; - ald_crypt_interrupt_config(hperh, CRYPT_IT_IT, ENABLE); - - for (i = 0; i < hperh->step; i++) { - CRYPT_WRITE_FIFO(hperh, *plain_buf); - ++plain_buf; - } - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Decrypt an amount of data in non-blocking mode. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param plain_text: Pointer to plain data buffer - * @param cipher_text: Pointer to cipher data buffer - * @param size: Amount of cipher data - * @retval Status, see @ref ald_status_t. - * @note the size is multiple of 16(ase) - */ -ald_status_t ald_crypt_decrypt_by_it(crypt_handle_t *hperh, uint8_t *cipher_text, uint8_t *plain_text, uint32_t size) -{ - uint32_t i; - uint32_t *cipher_buf = (uint32_t*)cipher_text; - - if (hperh->init.mode == CRYPT_MODE_CTR) { - return ald_crypt_decrypt_by_it(hperh, cipher_text, plain_text, size); - } - - if (hperh->state != CRYPT_STATE_READY) - return ERROR; - - if ((plain_text == NULL) || (cipher_text == NULL) || (size == 0)) - return ERROR; - - assert_param(IS_CRYPT(hperh->perh)); - - __LOCK(hperh); - hperh->state = CRYPT_STATE_BUSY; - CRYPT_SETDIR(hperh, CRYPT_DECRYPT); - hperh->count = hperh->step; - hperh->plain_text = plain_text; - hperh->cipher_text = cipher_text; - hperh->size = size; - ald_crypt_interrupt_config(hperh, CRYPT_IT_IT, ENABLE); - - for (i = 0; i < hperh->step; i++) { - CRYPT_WRITE_FIFO(hperh, *cipher_buf); - cipher_buf++; - } - - __UNLOCK(hperh); - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Encrypt an amount of data in non-blocking mode. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param plain_text: Pointer to plain data buffer - * @param cipher_text: Pointer to cipher data buffer - * @param size: Amount of plain data - * @param channel_m2p: Memory to Crypt module DMA channel - * @param channel_p2m: Crypt module to Memory DMA channel - * @retval Status, see @ref ald_status_t. - * @note the size is multiple of 16(ase) - */ -ald_status_t ald_crypt_encrypt_by_dma(crypt_handle_t *hperh, uint8_t * plain_text, - uint8_t *cipher_text, uint32_t size, uint8_t channel_m2p, uint8_t channel_p2m) -{ - if (hperh->state != CRYPT_STATE_READY) - return ERROR; - - if (plain_text == NULL || cipher_text == NULL || size == 0) - return ERROR; - - assert_param(IS_CRYPT(hperh->perh)); - - __LOCK(hperh); - hperh->state = CRYPT_STATE_BUSY; - - hperh->plain_text = plain_text; - hperh->cipher_text = cipher_text; - hperh->size = size; - hperh->count = size; - - if (hperh->hdma_m2p.perh == NULL) - hperh->hdma_m2p.perh = DMA0; - if (hperh->hdma_p2m.perh == NULL) - hperh->hdma_p2m.perh = DMA0; - - hperh->hdma_m2p.cplt_arg = NULL; - hperh->hdma_m2p.cplt_cbk = NULL; - hperh->hdma_m2p.err_arg = NULL; - hperh->hdma_m2p.err_cbk = NULL; - - hperh->hdma_p2m.cplt_arg = (void *)hperh; - hperh->hdma_p2m.cplt_cbk = &crypt_dma_crypt_cplt; - hperh->hdma_p2m.err_arg = (void *)hperh; - hperh->hdma_p2m.err_cbk = &crypt_dma_error; - - CRYPT_SETDIR(hperh, CRYPT_ENCRYPT); - - ald_dma_config_struct(&hperh->hdma_m2p.config); - hperh->hdma_m2p.config.data_width = DMA_DATA_SIZE_WORD; - hperh->hdma_m2p.config.src = (void *)hperh->plain_text; - hperh->hdma_m2p.config.dst = (void *)&hperh->perh->FIFO; - hperh->hdma_m2p.config.size = size / 4; - hperh->hdma_m2p.config.src_inc = DMA_DATA_INC_WORD; - hperh->hdma_m2p.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma_m2p.config.msel = DMA_MSEL_CRYPT; - hperh->hdma_m2p.config.msigsel = DMA_MSIGSEL_CRYPT_WRITE; - hperh->hdma_m2p.config.channel = channel_m2p; - ald_dma_config_basic(&(hperh->hdma_m2p)); - - ald_dma_config_struct(&hperh->hdma_p2m.config); - hperh->hdma_p2m.config.data_width = DMA_DATA_SIZE_WORD; - hperh->hdma_p2m.config.src = (void *)&hperh->perh->FIFO; - hperh->hdma_p2m.config.dst = (void *)hperh->cipher_text; - hperh->hdma_p2m.config.size = size / 4; - hperh->hdma_p2m.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdma_p2m.config.dst_inc = DMA_DATA_INC_WORD; - hperh->hdma_p2m.config.msel = DMA_MSEL_CRYPT; - hperh->hdma_p2m.config.msigsel = DMA_MSIGSEL_CRYPT_READ; - hperh->hdma_p2m.config.channel = channel_p2m; - ald_dma_config_basic(&(hperh->hdma_p2m)); - - CRYPT_DMA_ENABLE(hperh); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Decrypt an amount of data in non-blocking mode. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param plain_text: Pointer to plain data buffer - * @param cipher_text: Pointer to cipher data buffer - * @param size: Amount of cipher data - * @param channel_m2p: Memory to Crypt module DMA channel - * @param channel_p2m: Crypt module to Memory DMA channel - * @retval Status, see @ref ald_status_t. - * @note the size is multiple of 16(ase) - */ -ald_status_t ald_crypt_decrypt_by_dma(crypt_handle_t *hperh, uint8_t * cipher_text, - uint8_t *plain_text, uint32_t size, uint8_t channel_m2p, uint8_t channel_p2m) -{ - if (hperh->init.mode == CRYPT_MODE_CTR) - return ald_crypt_decrypt_by_dma(hperh, cipher_text, plain_text, size, channel_m2p, channel_p2m); - - if (hperh->state != CRYPT_STATE_READY) - return ERROR; - if (plain_text == NULL || cipher_text == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = CRYPT_STATE_BUSY; - - hperh->plain_text = plain_text; - hperh->cipher_text = cipher_text; - hperh->size = size; - hperh->count = size; - - if (hperh->hdma_m2p.perh == NULL) - hperh->hdma_m2p.perh = DMA0; - if (hperh->hdma_p2m.perh == NULL) - hperh->hdma_p2m.perh = DMA0; - - - hperh->hdma_m2p.cplt_arg = NULL; - hperh->hdma_m2p.cplt_cbk = NULL; - hperh->hdma_m2p.err_arg = NULL; - hperh->hdma_m2p.err_cbk = NULL; - - hperh->hdma_p2m.cplt_arg = (void *)hperh; - hperh->hdma_p2m.cplt_cbk = &crypt_dma_crypt_cplt; - hperh->hdma_p2m.err_arg = (void *)hperh; - hperh->hdma_p2m.err_cbk = &crypt_dma_error; - - CRYPT_SETDIR(hperh, CRYPT_DECRYPT); - - ald_dma_config_struct(&hperh->hdma_m2p.config); - hperh->hdma_m2p.config.data_width = DMA_DATA_SIZE_WORD; - hperh->hdma_m2p.config.src = (void *)hperh->cipher_text; - hperh->hdma_m2p.config.dst = (void *)&hperh->perh->FIFO; - hperh->hdma_m2p.config.size = size / 4; - hperh->hdma_m2p.config.src_inc = DMA_DATA_INC_WORD; - hperh->hdma_m2p.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma_m2p.config.msel = DMA_MSEL_CRYPT; - hperh->hdma_m2p.config.msigsel = DMA_MSIGSEL_CRYPT_WRITE; - hperh->hdma_m2p.config.channel = channel_m2p; - ald_dma_config_basic(&(hperh->hdma_m2p)); - - ald_dma_config_struct(&hperh->hdma_p2m.config); - hperh->hdma_p2m.config.data_width = DMA_DATA_SIZE_WORD; - hperh->hdma_p2m.config.src = (void *)&hperh->perh->FIFO; - hperh->hdma_p2m.config.dst = (void *)hperh->plain_text; - hperh->hdma_p2m.config.size = size / 4; - hperh->hdma_p2m.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdma_p2m.config.dst_inc = DMA_DATA_INC_WORD; - hperh->hdma_p2m.config.msel = DMA_MSEL_CRYPT; - hperh->hdma_p2m.config.msigsel = DMA_MSIGSEL_CRYPT_READ; - hperh->hdma_p2m.config.channel = channel_p2m; - ald_dma_config_basic(&(hperh->hdma_p2m)); - - CRYPT_DMA_ENABLE(hperh); - __UNLOCK(hperh); - - return OK; -} - -/** - * @} - */ - -/** @defgroup CRYPT_Public_Functions_Group3 DMA operation functions - * @brief DMA operation functions - * @{ - */ - -/** - * @brief Pauses the DMA Transfer. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_dma_pause(crypt_handle_t *hperh) -{ - __LOCK(hperh); - CRYPT_DMA_DISABLE(hperh); - __UNLOCK(hperh); - - return OK; - -} - -/** - * @brief Resumes the DMA Transfer. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_dma_resume(crypt_handle_t *hperh) -{ - __LOCK(hperh); - CRYPT_DMA_ENABLE(hperh); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Stops the DMA Transfer. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_crypt_dma_stop(crypt_handle_t *hperh) -{ - __LOCK(hperh); - CRYPT_DMA_DISABLE(hperh); - __UNLOCK(hperh); - - hperh->state = CRYPT_STATE_READY; - return OK; -} -#endif - -/** - * @brief This function handles CRYPT interrupt request. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval None - */ -void ald_crypt_irq_handler(crypt_handle_t *hperh) -{ - uint32_t i; - uint32_t *in_buf; - uint32_t *out_buf; - - if (READ_BIT(hperh->perh->CON, CRYPT_CON_ENCS_MSK)) { - in_buf = (uint32_t *)hperh->plain_text + hperh->count; - out_buf = (uint32_t *)hperh->cipher_text + hperh->count - hperh->step; - } - else { - in_buf = (uint32_t *)hperh->cipher_text + hperh->count; - out_buf = (uint32_t *)hperh->plain_text + hperh->count - hperh->step; - } - - if (ald_crypt_get_flag_status(hperh, CRYPT_FLAG_AESIF) == SET) { - ald_crypt_clear_flag_status(hperh, CRYPT_FLAG_AESIF); - } - - for (i = 0; i < hperh->step; i++) - *out_buf++ = CRYPT_READ_FIFO(hperh); - - hperh->count += hperh->step; - if (hperh->count > (hperh->size / 4)) { - hperh->count = 0; - hperh->state = CRYPT_STATE_READY; - - if (hperh->crypt_cplt_cbk) - hperh->crypt_cplt_cbk(hperh); - } - else { - for (i = 0; i < hperh->step; i++) { - CRYPT_WRITE_FIFO(hperh, *in_buf++); - } - } -} -/** - * @} - */ - -/** @defgroup CRYPT_Public_Functions_Group4 Peripheral Control functions - * @brief CRYPT control functions - * @{ - */ - -/** - * @brief Enables or disables the specified CRYPT interrupts. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param it: Specifies the CRYPT interrupt sources to be enabled or disabled. - * This parameter can be one of the following values: - * @arg crypt_it_t: CRYPT interrupt - * @param state: New status - * - ENABLE - * - DISABLE - * @retval None - */ -void ald_crypt_interrupt_config(crypt_handle_t *hperh, crypt_it_t it, type_func_t state) -{ - assert_param(IS_CRYPT(hperh->perh)); - - if (it == CRYPT_IT_IT) { - CLEAR_BIT(CRYPT->CON, CRYPT_CON_IE_MSK); - CRYPT->CON |= (state << CRYPT_CON_IE_POS); - } - - return; -} - -/** @brief Check whether the specified CRYPT flag is set or not. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref crypt_flag_t. - * @retval Status - * - SET - * - RESET - */ -flag_status_t ald_crypt_get_flag_status(crypt_handle_t *hperh, crypt_flag_t flag) -{ - assert_param(IS_CRYPT(hperh->perh)); - assert_param(IS_CRYPT_FLAG(flag)); - - if (CRYPT->IF & flag) - return SET; - - return RESET; -} - -/** @brief Clear the specified CRYPT pending flags. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param flag: specifies the flag to check. - * This parameter can be any combination of the following values: - * @arg CRYPT_FLAG_AESIF: AES encrypt or decrypt Complete flag. - * @arg CRYPT_FLAG_DONE: encrypt or decrypt Complete flag. - * @retval None - */ -void ald_crypt_clear_flag_status(crypt_handle_t *hperh, crypt_flag_t flag) -{ - assert_param(IS_CRYPT(hperh->perh)); - assert_param(IS_CRYPT_FLAG(flag)); - - WRITE_REG(CRYPT->IFC, flag); - return; -} - -/** - * @brief Checks whether the specified CRYPT interrupt has occurred or not. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @param it: Specifies the CRYPT interrupt source to check. - * This parameter can be one of the following values: - * @arg crypt_it_t: CRYPT interrupt - * @retval Status - * - SET - * - RESET - */ -it_status_t ald_crypt_get_it_status(crypt_handle_t *hperh, crypt_it_t it) -{ - assert_param(IS_CRYPT_IT(it)); - - if (READ_BIT(CRYPT->CON, CRYPT_CON_IE_MSK)) - return SET; - - return RESET; -} - - -/** - * @} - */ - -/** @defgroup CRYPT_Public_Functions_Group5 Peripheral State and Errors functions - * @brief State and Errors functions - * @{ - */ - -/** - * @brief Returns the CRYPT state. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval CRYPT state - */ -crypt_state_t ald_crypt_get_state(crypt_handle_t *hperh) -{ - assert_param(IS_CRYPT(hperh->perh)); - - - return hperh->state; -} - -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup CRYPT_Private_Functions CRYPT Private Functions - * @brief CRYPT Private functions - * @{ - */ - -/** - * @brief Reset the CRYPT peripheral. - * @param hperh: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval None - */ -void crypt_reset(crypt_handle_t *hperh) -{ - hperh->perh->DATA[0] = 0x0; - hperh->perh->DATA[1] = 0x0; - hperh->perh->DATA[2] = 0x0; - hperh->perh->DATA[3] = 0x0; - hperh->perh->KEY[0] = 0x0; - hperh->perh->KEY[1] = 0x0; - hperh->perh->KEY[2] = 0x0; - hperh->perh->KEY[3] = 0x0; - hperh->perh->KEY[4] = 0x0; - hperh->perh->KEY[5] = 0x0; - hperh->perh->KEY[6] = 0x0; - hperh->perh->KEY[7] = 0x0; - hperh->perh->IV[0] = 0x0; - hperh->perh->IV[1] = 0x0; - hperh->perh->IV[2] = 0x0; - hperh->perh->IV[3] = 0x0; - hperh->perh->CON = 0x0; - - hperh->state = CRYPT_STATE_READY; - __UNLOCK(hperh); -} - -#ifdef ALD_DMA -/** - * @brief DMA CRYPT encrypt or decrypt process complete callback. - * @param arg: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval None - */ -static void crypt_dma_crypt_cplt(void *arg) -{ - crypt_handle_t *hperh = (crypt_handle_t *)arg; - - CRYPT_DMA_DISABLE(hperh); - hperh->count = 0; - hperh->plain_text = NULL; - hperh->cipher_text = NULL; - hperh->size = 0; - - hperh->state = CRYPT_STATE_READY; - - if (hperh->crypt_cplt_cbk) - hperh->crypt_cplt_cbk(hperh); -} - -/** - * @brief DMA CRYPT communication error callback. - * @param arg: Pointer to a crypt_handle_t structure that contains - * the configuration information for the specified CRYPT module. - * @retval None - */ -static void crypt_dma_error(void *arg) -{ - crypt_handle_t *hperh = (crypt_handle_t *)arg; - CRYPT_DMA_DISABLE(hperh); - - hperh->count = 0; - hperh->plain_text = NULL; - hperh->cipher_text = NULL; - hperh->size = 0; - - hperh->state = CRYPT_STATE_READY; - - if (hperh->err_cplt_cbk) - hperh->err_cplt_cbk(hperh); -} -#endif -/** - * @} - */ - -/** - * @} - */ -#endif /* ALD_CRYPT */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_dma.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_dma.c deleted file mode 100644 index f3c125578d..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_dma.c +++ /dev/null @@ -1,999 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_dma.c - * @brief DMA module driver. - * - * @version V1.0 - * @date 09 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - The DMA driver can be used as follows: - - (#) System initialization invokes ald_dma_init(), ald_cmu_init() --> ald_dma_init(). - - (#) Declare a dma_handle_t handle structure. - - (#) Configure the dma_handle_t structure, you can configure the - dma_config_t structure with the help of ald_dma_config_struct(). - - (#) Enable the DMA Configure: - (##) Memory -- memory: call ald_dma_config_auto(). - (##) Peripheral -- memory: call ald_dma_config_basic(). - (##) If you want use the dma easily, you can do this: - (+++) Memory -- memory: call ald_dma_config_auto_easy(). - (+++) Peripheral -- memory: call ald_dma_config_basic_easy(). - - (#) Enable the DMA request signal: - (##) Memory -- memory: the DMA request signal is request automatic. - (##) Peripheral -- memory: you need enable peripheral request signal. - - (#) If you enable DMA interrupt, the callback will be invoked: - (##) When DMA transfer is completed, the cplt_cbk() will be invoked. - (##) When DMA bus occurs error, the err_cbk() will be invoked. - - (#) If you don't enable the DMA interrupt, you need do this: - (##) Polling the ald_dma_get_flag_status(), this function's parameter is channel - or DMA_ERR. - (+++) When the function's Parameter is channel, if retval is SET, it means - the DMA transfer is completed. at this moment, you can do something, - and then, you need invoke ald_dma_clear_flag_status() to clear flag. - - (+++) When the function's Parameter is DMA_ERR, if retval is SET, it means - the DMA bus occurs error. at this moment, you can do something, - and then, you need invoke ald_dma_clear_flag_status() to clear flag. - - @endverbatim - */ - -#include -#include "ald_conf.h" -#include "ald_dma.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup DMA DMA - * @brief DMA module driver - * @{ - */ - -#ifdef ALD_DMA -/** @defgroup DMA_Private_Variables DMA Private Variables - * @{ - */ -dma_descriptor_t dma0_ctrl_base[28] __attribute__ ((aligned(512))); -dma_call_back_t dma0_cbk[6]; -/** - * @} - */ - -/** @defgroup DMA_Private_Functions DMA Private Functions - * @{ - */ - -/** - * @brief Configure DMA channel using dma_config_t structure - * @param DMAx: Pointer to DMA peripheral - * @param mode: DMA transfer mode. see @ref dma_cycle_ctrl_t - * @param p: Pointer to dma_cycle_ctrl_t which contains - * DMA channel parameter. see @ref dma_config_t - * @retval None - */ -static void dma_config_base(DMA_TypeDef *DMAx, dma_cycle_ctrl_t mode, dma_config_t *p) -{ - dma_descriptor_t *descr; - - assert_param(IS_DMA(DMAx)); - assert_param(IS_CYCLECTRL_TYPE(mode)); - assert_param(p->src != NULL); - assert_param(p->dst != NULL); - assert_param(IS_DMA_DATA_SIZE(p->size)); - assert_param(IS_DMA_DATASIZE_TYPE(p->data_width)); - assert_param(IS_DMA_DATAINC_TYPE(p->src_inc)); - assert_param(IS_DMA_DATAINC_TYPE(p->dst_inc)); - assert_param(IS_DMA_ARBITERCONFIG_TYPE(p->R_power)); - assert_param(IS_FUNC_STATE(p->primary)); - assert_param(IS_FUNC_STATE(p->burst)); - assert_param(IS_FUNC_STATE(p->high_prio)); - assert_param(IS_FUNC_STATE(p->interrupt)); - assert_param(IS_DMA_MSEL_TYPE(p->msel)); - assert_param(IS_DMA_MSIGSEL_TYPE(p->msigsel)); - assert_param(IS_DMA_CHANNEL(p->channel)); - - if (p->primary) - descr = (dma_descriptor_t *)(DMAx->CTRLBASE) + p->channel; - else - descr = (dma_descriptor_t *)(DMAx->ALTCTRLBASE) + p->channel; - - if (p->src_inc == DMA_DATA_INC_NONE) - descr->src = p->src; - else - descr->src = (void *)((uint32_t)p->src + ((p->size - 1) << (uint32_t)p->src_inc)); - - if (p->dst_inc == DMA_DATA_INC_NONE) - descr->dst = p->dst; - else - descr->dst = (void *)((uint32_t)p->dst + ((p->size - 1) << (uint32_t)p->dst_inc)); - - descr->ctrl.cycle_ctrl = mode; - descr->ctrl.next_useburst = 0; - descr->ctrl.n_minus_1 = p->size - 1; - descr->ctrl.R_power = p->R_power; - descr->ctrl.src_prot_ctrl = 0, - descr->ctrl.dst_prot_ctrl = 0, - descr->ctrl.src_size = p->data_width; - descr->ctrl.src_inc = p->src_inc; - descr->ctrl.dst_size = p->data_width; - descr->ctrl.dst_inc = p->dst_inc; - - if (p->primary) - WRITE_REG(DMAx->CHPRIALTCLR, (1 << p->channel)); - else - WRITE_REG(DMAx->CHPRIALTSET, (1 << p->channel)); - - if (p->burst) - WRITE_REG(DMAx->CHUSEBURSTSET, (1 << p->channel)); - else - WRITE_REG(DMAx->CHUSEBURSTCLR, (1 << p->channel)); - - if (p->high_prio) - WRITE_REG(DMAx->CHPRSET, (1 << p->channel)); - else - WRITE_REG(DMAx->CHPRCLR, (1 << p->channel)); - - if (p->interrupt) - SET_BIT(DMAx->IER, (1 << p->channel)); - else - CLEAR_BIT(DMAx->IER, (1 << p->channel)); - - MODIFY_REG(DMAx->CH_SELCON[p->channel], DMA_CH0_SELCON_MSEL_MSK, p->msel << DMA_CH0_SELCON_MSEL_POSS); - MODIFY_REG(DMAx->CH_SELCON[p->channel], DMA_CH0_SELCON_MSIGSEL_MSK, p->msigsel << DMA_CH0_SELCON_MSIGSEL_POSS); - return; -} - -/** - * @brief Handle DMA interrupt - * @retval None - */ -void ald_dma_irq_handler(void) -{ - uint32_t i, reg = DMA0->IFLAG; - - for (i = 0; i < DMA_CH_COUNT; ++i) { - if (READ_BIT(reg, (1 << i))) { - if (dma0_cbk[i].cplt_cbk != NULL) - dma0_cbk[i].cplt_cbk(dma0_cbk[i].cplt_arg); - - ald_dma_clear_flag_status(DMA0, i); - } - } - - if (READ_BIT(reg, (1U << DMA_ERR))) { - ald_dma_clear_flag_status(DMA0, DMA_ERR); - - for (i = 0; i < DMA_CH_COUNT; ++i) { - if (((DMA0->CHENSET >> i) & 0x1) && (dma0_cbk[i].err_cbk != NULL)) - dma0_cbk[i].err_cbk(dma0_cbk[i].err_arg); - } - } - - return; -} -/** - * @} - */ - -/** @defgroup DMA_Public_Functions DMA Public Functions - * @{ - */ - -/** @defgroup DMA_Public_Functions_Group1 Initialization functions - * @brief Initialization functions - * - * @verbatim - =================================================================== - - #### Initialization functions #### - - =================================================================== - [..] - This subsection provides two functions to Initilizate DMA: - (+) ald_dma_reset(): Reset the DMA register. - - (+) ald_dma_init(): Initializate the DMA module. this function is - invoked by ald_cmu_init(). - this function do this: - (++) Initializte private variable dma_ctrl_base and dma_cbk. - (++) Reset DMA register. - (++) Set DMA interrupt priority: preempt_prio=1, sub_priority=1 - (++) Enable DMA interrupt. - (++) Enable DMA bus error interrupt. - (++) Configure CTRLBASE resigter. - (++) Enable DMA module. - - (+) ald_dma_config_struct(): Configure dma_config_t - structure using default parameter. - - (+) ald_dma_config_sg_alt_desc(): Configure dma_descriptor_t - structure using specified parameter. This function used - in scatter-gather mode(memory or peripheral). - @endverbatim - * @{ - */ - -/** - * @brief Reset the DMA register - * @param DMAx: Pointer to DMA peripheral - * @retval None - */ -void ald_dma_reset(DMA_TypeDef *DMAx) -{ - uint32_t i; - - assert_param(IS_DMA(DMAx)); - - WRITE_REG(DMAx->CFG, 0x0); - WRITE_REG(DMAx->CHUSEBURSTCLR, 0xFFF); - WRITE_REG(DMAx->CHREQMASKCLR, 0xFFF); - WRITE_REG(DMAx->CHENCLR, 0xFFF); - WRITE_REG(DMAx->CHPRIALTCLR, 0xFFF); - WRITE_REG(DMAx->CHPRCLR, 0xFFF); - WRITE_REG(DMAx->ERRCLR, 0x1); - WRITE_REG(DMAx->IER, 0x0); - WRITE_REG(DMAx->ICFR, 0x80000FFF); - - for (i = 0; i < DMA_CH_COUNT; ++i) - WRITE_REG(DMAx->CH_SELCON[i], 0x0); - - return; -} - -/** - * @brief DMA module initialization, this function - * is invoked by ald_cmu_init(). - * @param DMAx: Pointer to DMA peripheral - * @retval None - */ -void ald_dma_init(DMA_TypeDef *DMAx) -{ - assert_param(IS_DMA(DMAx)); - - memset(dma0_ctrl_base, 0x0, sizeof(dma0_ctrl_base)); - memset(dma0_cbk, 0x0, sizeof(dma0_cbk)); - - ald_dma_reset(DMAx); - NVIC_SetPriority(DMA_IRQn, 2); - NVIC_EnableIRQ(DMA_IRQn); - SET_BIT(DMAx->IER, DMA_IER_DMAERRIE_MSK); - - WRITE_REG(DMAx->CTRLBASE, (uint32_t)&dma0_ctrl_base); - SET_BIT(DMAx->CFG, DMA_CFG_MASTER_ENABLE_MSK); - - return; -} - -/** - * @brief Configure dma_config_t structure using default parameter. - * User can invoked this function, before configure dma_config_t - * @param p: Pointer to dma_config_t structure, see @ref dma_config_t - * @retval None - */ -void ald_dma_config_struct(dma_config_t *p) -{ - p->data_width = DMA_DATA_SIZE_BYTE; - p->src_inc = DMA_DATA_INC_BYTE; - p->dst_inc = DMA_DATA_INC_BYTE; - p->R_power = DMA_R_POWER_1; - p->primary = ENABLE; - p->burst = DISABLE; - p->high_prio = DISABLE; - p->interrupt = ENABLE; - - return; -} - -/** - * @brief Configure dma_descriptor_t structure using specified parameter. - * @note This function used in scatter-gather mode(memory or peripheral). - * @param desc: Address of the alternate descriptor. - * @param config: Pointer to the dma_config_t structure. - * @param memory: Memory or peripheral scatter-gather. - * @retval None - */ -void ald_dma_config_sg_alt_desc(dma_descriptor_t *desc, dma_config_t *config, uint8_t memory) -{ - if ((desc == NULL) || (config == NULL)) - return; - - if (config->src_inc == DMA_DATA_INC_NONE) - desc->src = config->src; - else - desc->src = (void *)((uint32_t)config->src + ((config->size - 1) << (uint32_t)config->data_width)); - - if (config->dst_inc == DMA_DATA_INC_NONE) - desc->dst = config->dst; - else - desc->dst = (void *)((uint32_t)config->dst + ((config->size - 1) << (uint32_t)config->data_width)); - - desc->ctrl.cycle_ctrl = memory ? DMA_CYCLE_CTRL_MEM_SG_ALTERNATE : DMA_CYCLE_CTRL_PER_SG_ALTERNATE; - desc->ctrl.next_useburst = memory ? 0 : 1; - desc->ctrl.n_minus_1 = config->size - 1; - desc->ctrl.R_power = config->R_power; - desc->ctrl.src_prot_ctrl = 0; - desc->ctrl.dst_prot_ctrl = 0; - desc->ctrl.src_size = config->data_width; - desc->ctrl.src_inc = config->src_inc; - desc->ctrl.dst_size = config->data_width; - desc->ctrl.dst_inc = config->dst_inc; - - return; -} - -/** - * @} - */ - -/** @defgroup DMA_Public_Functions_Group2 Configure DMA channel functions - * @brief Configure DMA channel functions - * - * @verbatim - =================================================================== - - #### Configure DMA channel functions #### - - =================================================================== - [..] - This subsection provides some functions allowing to configure - DMA channel. Include two type DMA transfer: - (+) Carry data from memory to memory, this mode APIs are: - (++) ald_dma_config_auto(): Configure DMA channel according to - the specified parameter in the dma_handle_t structure. - (++) ald_dma_restart_auto(): Restart DMA transmitted. - (++) ald_dma_config_auto_easy(): Configure DMA channel according - to the specified parameter. If you want use the dma easily, - you can invoke this function. - (++) ald_dma_config_sg_mem(): Carry data used scatter-gather mode. - (+) Carry data from peripheral to memory or from memory to peripheral, - this mode APIs are: - (++) ald_dma_config_basic(): Configure DMA channel according to - the specified parameter in the dma_handle_t structure. - (++) ald_dma_restart_basic(): Restart DMA transmitted. - (++) ald_dma_config_basic_easy(): Configure DMA channel according - to the specified parameter. If you want use the dma easily, - you can invoke this function. - (++) ald_dma_ping_pong(): Carry data used ping-pong mode. - (++) ald_dma_config_sg_per(): Carry data used scatter-gather mode. - - @endverbatim - * @{ - */ - -/** - * @brief Configure DMA channel according to the specified parameter - * in the dma_handle_t structure. The DMA mode is automatic. - * This mode is used to carry data from memory to memory. - * @param hperh: Pointer to DMA_handle_t structure that contains - * configuration information for specified DMA channel. - * @retval None - */ -void ald_dma_config_auto(dma_handle_t *hperh) -{ - dma0_cbk[hperh->config.channel].cplt_cbk = hperh->cplt_cbk; - dma0_cbk[hperh->config.channel].err_cbk = hperh->err_cbk; - dma0_cbk[hperh->config.channel].cplt_arg = hperh->cplt_arg; - dma0_cbk[hperh->config.channel].err_arg = hperh->err_arg; - dma_config_base(hperh->perh, DMA_CYCLE_CTRL_AUTO, &hperh->config); - - ald_dma_clear_flag_status(hperh->perh, hperh->config.channel); - WRITE_REG(hperh->perh->CHENSET, (1 << hperh->config.channel)); - SET_BIT(hperh->perh->CHSWREQ, (1 << hperh->config.channel)); - - return; -} - -/** - * @brief Restart DMA transmitted. The DMA mode is automatic. - * The other parameters have not changed except 'size' and 'addr'. - * @param hperh: Pointer to DMA_handle_t structure that contains - * configuration information for specified DMA channel. - * @param src: Source data begin pointer - * @param dst: Destination data begin pointer - * @param size: Size. - * @retval None - */ -void ald_dma_restart_auto(dma_handle_t *hperh, void *src, void *dst, uint16_t size) -{ - dma_descriptor_t *descr; - - if (hperh->config.primary) - descr = (dma_descriptor_t *)(hperh->perh->CTRLBASE) + hperh->config.channel; - else - descr = (dma_descriptor_t *)(hperh->perh->ALTCTRLBASE) + hperh->config.channel; - - if (src) { - if (hperh->config.src_inc == DMA_DATA_INC_NONE) - descr->src = src; - else - descr->src = (void *)((uint32_t)src + ((size - 1) << (uint32_t)hperh->config.data_width)); - } - - if (dst) { - if (hperh->config.dst_inc == DMA_DATA_INC_NONE) - descr->dst = dst; - else - descr->dst = (void *)((uint32_t)dst + ((size - 1) << (uint32_t)hperh->config.data_width)); - } - - ald_dma_clear_flag_status(hperh->perh, hperh->config.channel); - descr->ctrl.cycle_ctrl = DMA_CYCLE_CTRL_AUTO; - descr->ctrl.n_minus_1 = size - 1; - WRITE_REG(hperh->perh->CHENSET, (1 << hperh->config.channel)); - SET_BIT(hperh->perh->CHSWREQ, (1 << hperh->config.channel)); - return; -} - -/** - * @brief Configure DMA channel according to the specified parameter. - * The DMA mode is automatic. This mode is used to carry data - * from memory to memory. If User want use the dma easily, - * they can invoke this function. - * @param DMAx: Pointer to DMA peripheral - * @param src: Source data begin pointer - * @param dst: Destination data begin pointer - * @param size: The total number of DMA transfers that DMA cycle contains - * @param channel: Channel index which will be used. - * @param cbk: DMA complete callback function - * @retval None - */ -void ald_dma_config_auto_easy(DMA_TypeDef *DMAx, void *src, void *dst, - uint16_t size, uint8_t channel, void (*cbk)(void *arg)) -{ - dma_handle_t hperh; - - assert_param(IS_DMA(DMAx)); - - ald_dma_config_struct(&hperh.config); - hperh.config.src = src; - hperh.config.dst = dst; - hperh.config.size = size; - hperh.config.msel = DMA_MSEL_NONE; - hperh.config.msigsel = DMA_MSIGSEL_NONE; - hperh.config.channel = channel; - - hperh.perh = DMAx; - hperh.cplt_cbk = cbk; - hperh.cplt_arg = NULL; - hperh.err_cbk = NULL; - - ald_dma_clear_flag_status(DMAx, channel); - ald_dma_config_auto(&hperh); - - return; -} - -/** - * @brief Configure DMA channel according to the specified parameter - * in the dma_handle_t structure. The DMA mode is basic. - * This mode is used to carry data from peripheral to memory - * or from memory to peripheral. - * @param hperh: Pointer to dma_handle_t structure that contains - * configuration information for specified DMA channel. - * @retval None - */ -void ald_dma_config_basic(dma_handle_t *hperh) -{ - dma0_cbk[hperh->config.channel].cplt_cbk = hperh->cplt_cbk; - dma0_cbk[hperh->config.channel].err_cbk = hperh->err_cbk; - dma0_cbk[hperh->config.channel].cplt_arg = hperh->cplt_arg; - dma0_cbk[hperh->config.channel].err_arg = hperh->err_arg; - - ald_dma_clear_flag_status(hperh->perh, hperh->config.channel); - dma_config_base(hperh->perh, DMA_CYCLE_CTRL_BASIC, &hperh->config); - WRITE_REG(hperh->perh->CHENSET, (1 << hperh->config.channel)); - - return; -} - -/** - * @brief Restart DMA transmitted. The DMA mode is basic. - * The other parameters have not changed except 'size' and 'addr'. - * @param hperh: Pointer to DMA_handle_t structure that contains - * configuration information for specified DMA channel. - * @param src: Source data begin pointer - * @param dst: Destination data begin pointer - * @param size: Size. - * @retval None - */ -void ald_dma_restart_basic(dma_handle_t *hperh, void *src, void *dst, uint16_t size) -{ - dma_descriptor_t *descr; - - if (hperh->config.primary) - descr = (dma_descriptor_t *)(hperh->perh->CTRLBASE) + hperh->config.channel; - else - descr = (dma_descriptor_t *)(hperh->perh->ALTCTRLBASE) + hperh->config.channel; - - if (src) { - if (hperh->config.src_inc == DMA_DATA_INC_NONE) - descr->src = src; - else - descr->src = (void *)((uint32_t)src + ((size - 1) << (uint32_t)hperh->config.data_width)); - } - - if (dst) { - if (hperh->config.dst_inc == DMA_DATA_INC_NONE) - descr->dst = dst; - else - descr->dst = (void *)((uint32_t)dst + ((size - 1) << (uint32_t)hperh->config.data_width)); - } - - ald_dma_clear_flag_status(hperh->perh, hperh->config.channel); - descr->ctrl.cycle_ctrl = DMA_CYCLE_CTRL_BASIC; - descr->ctrl.n_minus_1 = size - 1; - WRITE_REG(hperh->perh->CHENSET, (1 << hperh->config.channel)); - - return; -} - -/** - * @brief Configure DMA channel according to the specified parameter. - * The DMA mode is basic. This mode is used to carry data - * from peripheral to memory or negative direction. If user want - * use the dma easily, they can invoke this function. - * @param DMAx: Pointer to DMA peripheral - * @param src: Source data begin pointer - * @param dst: Destination data begin pointer - * @param size: The total number of DMA transfers that DMA cycle contains - * @param msel: Input source to DMA channel @ref dma_msel_t - * @param msigsel: Input signal to DMA channel @ref dma_msigsel_t - * @param channel: Channel index which will be used - * @param cbk: DMA complete callback function - * @retval None - */ -void ald_dma_config_basic_easy(DMA_TypeDef *DMAx, void *src, void *dst, uint16_t size, dma_msel_t msel, - dma_msigsel_t msigsel, uint8_t channel, void (*cbk)(void *arg)) -{ - dma_handle_t hperh; - - assert_param(IS_DMA(DMAx)); - ald_dma_config_struct(&hperh.config); - - if (((uint32_t)src) >= 0x40000000) - hperh.config.src_inc = DMA_DATA_INC_NONE; - - if (((uint32_t)dst) >= 0x40000000) - hperh.config.dst_inc = DMA_DATA_INC_NONE; - - hperh.config.src = src; - hperh.config.dst = dst; - hperh.config.size = size; - hperh.config.msel = msel; - hperh.config.msigsel = msigsel; - hperh.config.channel = channel; - - hperh.perh = DMAx; - hperh.cplt_cbk = cbk; - hperh.cplt_arg = NULL; - hperh.err_cbk = NULL; - - ald_dma_clear_flag_status(DMAx, channel); - ald_dma_config_basic(&hperh); - - return; -} - -/** - * @brief Configure DMA channel according to the specified parameter. - * The DMA mode is ping-pong. - * @note The ping-pong mode does not support memory to memory. - * @param DMAx: Pointer to DMA peripheral. - * @param config: Pointer to the dma_config_t structure which contains - * the specified parameters. - * @param first: Whether it is the first transmission. 1-first, 0-not first. - * @param cbk: DMA complete callback function. - * @retval None - */ -void ald_dma_config_ping_pong(DMA_TypeDef *DMAx, dma_config_t *config, - uint8_t first, void (*cbk)(void *arg)) -{ - dma_descriptor_t *desc; - - assert_param(IS_DMA(DMAx)); - assert_param(config->src != NULL); - assert_param(config->dst != NULL); - assert_param(IS_DMA_DATA_SIZE(config->size)); - assert_param(IS_DMA_DATASIZE_TYPE(config->data_width)); - assert_param(IS_DMA_DATAINC_TYPE(config->src_inc)); - assert_param(IS_DMA_DATAINC_TYPE(config->dst_inc)); - assert_param(IS_DMA_ARBITERCONFIG_TYPE(config->R_power)); - assert_param(IS_FUNC_STATE(config->primary)); - assert_param(IS_FUNC_STATE(config->burst)); - assert_param(IS_FUNC_STATE(config->high_prio)); - assert_param(IS_FUNC_STATE(config->interrupt)); - assert_param(IS_DMA_MSEL_TYPE(config->msel)); - assert_param(IS_DMA_MSIGSEL_TYPE(config->msigsel)); - assert_param(IS_DMA_CHANNEL(config->channel)); - - dma0_cbk[config->channel].cplt_cbk = cbk; - dma0_cbk[config->channel].err_cbk = NULL; - dma0_cbk[config->channel].cplt_arg = NULL; - dma0_cbk[config->channel].err_arg = NULL; - - if (config->primary) - desc = (dma_descriptor_t *)(DMAx->CTRLBASE) + config->channel; - else - desc = (dma_descriptor_t *)(DMAx->ALTCTRLBASE) + config->channel; - - if (config->src_inc == DMA_DATA_INC_NONE) - desc->src = config->src; - else - desc->src = (void *)((uint32_t)config->src + ((config->size - 1) << (uint32_t)config->data_width)); - - if (config->dst_inc == DMA_DATA_INC_NONE) - desc->dst = config->dst; - else - desc->dst = (void *)((uint32_t)config->dst + ((config->size - 1) << (uint32_t)config->data_width)); - - desc->ctrl.cycle_ctrl = DMA_CYCLE_CTRL_PINGPONG; - desc->ctrl.next_useburst = 0; - desc->ctrl.n_minus_1 = config->size - 1; - desc->ctrl.R_power = config->R_power; - desc->ctrl.src_prot_ctrl = 0, - desc->ctrl.dst_prot_ctrl = 0, - desc->ctrl.src_size = config->data_width; - desc->ctrl.src_inc = config->src_inc; - desc->ctrl.dst_size = config->data_width; - desc->ctrl.dst_inc = config->dst_inc; - - if (!first) - return; - - if (config->primary) - WRITE_REG(DMAx->CHPRIALTCLR, (1 << config->channel)); - else - WRITE_REG(DMAx->CHPRIALTSET, (1 << config->channel)); - - if (config->burst) - WRITE_REG(DMAx->CHUSEBURSTSET, (1 << config->channel)); - else - WRITE_REG(DMAx->CHUSEBURSTCLR, (1 << config->channel)); - - if (config->high_prio) - WRITE_REG(DMAx->CHPRSET, (1 << config->channel)); - else - WRITE_REG(DMAx->CHPRCLR, (1 << config->channel)); - - if (config->interrupt) - SET_BIT(DMAx->IER, (1 << config->channel)); - else - CLEAR_BIT(DMAx->IER, (1 << config->channel)); - - MODIFY_REG(DMAx->CH_SELCON[config->channel], DMA_CH0_SELCON_MSEL_MSK, config->msel << DMA_CH0_SELCON_MSEL_POSS); - MODIFY_REG(DMAx->CH_SELCON[config->channel], DMA_CH0_SELCON_MSIGSEL_MSK, config->msigsel << DMA_CH0_SELCON_MSIGSEL_POSS); - - WRITE_REG(DMAx->ICFR, (1 << config->channel)); - WRITE_REG(DMAx->CHENSET, (1 << config->channel)); - - return; -} - -/** - * @brief Configure DMA channel according to the specified parameter. - * The DMA mode is memory scatter-gather. - * @param DMAx: Pointer to DMA peripheral. - * @param desc: Pointer to first alternate descriptor. - * @param nr: Number of the alternate descriptor. - * @param channel: Channel index which will be used. - * @param cbk: DMA complete callback function. - * @retval None - */ -void ald_dma_config_sg_mem(DMA_TypeDef *DMAx, dma_descriptor_t *desc, uint32_t nr, - uint8_t channel, void (*cbk)(void *arg)) -{ - dma_descriptor_t *tmp = (dma_descriptor_t *)(DMAx->CTRLBASE) + channel; - dma_descriptor_t *_tmp = (dma_descriptor_t *)(DMAx->ALTCTRLBASE) + channel; - - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_CHANNEL(channel)); - - if ((desc == NULL) || (nr == 0)) - return; - - dma0_cbk[channel].cplt_cbk = cbk; - dma0_cbk[channel].err_cbk = NULL; - dma0_cbk[channel].cplt_arg = NULL; - dma0_cbk[channel].err_arg = NULL; - - tmp->src = (void *)((uint32_t)desc + (((nr << 2) - 1) << DMA_DATA_INC_WORD)); - tmp->dst = (void *)((uint32_t)_tmp + ((4 - 1) << DMA_DATA_INC_WORD)); - tmp->ctrl.cycle_ctrl = DMA_CYCLE_CTRL_MEM_SG_PRIMARY; - tmp->ctrl.next_useburst = 0; - tmp->ctrl.n_minus_1 = (nr << 2) - 1; - tmp->ctrl.R_power = DMA_R_POWER_4; - tmp->ctrl.src_prot_ctrl = 0, - tmp->ctrl.dst_prot_ctrl = 0, - tmp->ctrl.src_size = DMA_DATA_SIZE_WORD; - tmp->ctrl.src_inc = DMA_DATA_INC_WORD; - tmp->ctrl.dst_size = DMA_DATA_SIZE_WORD; - tmp->ctrl.dst_inc = DMA_DATA_INC_WORD; - - desc[nr - 1].ctrl.cycle_ctrl = DMA_CYCLE_CTRL_AUTO; - WRITE_REG(DMAx->CHPRIALTCLR, (1 << channel)); - WRITE_REG(DMAx->CHUSEBURSTCLR, (1 << channel)); - WRITE_REG(DMAx->CHPRCLR, (1 << channel)); - - WRITE_REG(DMAx->ICFR, (1 << channel)); - SET_BIT(DMAx->IER, (1 << channel)); - WRITE_REG(DMAx->CHENSET, (1 << channel)); - SET_BIT(DMAx->CHSWREQ, (1 << channel)); - - return; -} - -/** - * @brief Configure DMA channel according to the specified parameter. - * The DMA mode is peripheral scatter-gather. - * @note The size of the first transmission must be 5. - * @param DMAx: Pointer to DMA peripheral. - * @param desc: Pointer to first alternate descriptor. - * @param nr: Number of the alternate descriptor. - * @param burst: 1-Enable burst, 0-Disable burst. - * @param msel: Input source to DMA channel @ref dma_msel_t - * @param msigsel: Input signal to DMA channel @ref dma_msigsel_t - * @param channel: Channel index which will be used. - * @param cbk: DMA complete callback function. - * @retval None - */ -void ald_dma_config_sg_per(DMA_TypeDef *DMAx, dma_descriptor_t *desc, uint32_t nr, uint8_t burst, - dma_msel_t msel, dma_msigsel_t msigsel, uint8_t channel, void (*cbk)(void *arg)) -{ - dma_descriptor_t *tmp = (dma_descriptor_t *)(DMAx->CTRLBASE) + channel; - dma_descriptor_t *_tmp = (dma_descriptor_t *)(DMAx->ALTCTRLBASE) + channel; - - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_MSEL_TYPE(msel)); - assert_param(IS_DMA_MSIGSEL_TYPE(msigsel)); - assert_param(IS_DMA_CHANNEL(channel)); - - if ((desc == NULL) || (nr == 0)) - return; - - dma0_cbk[channel].cplt_cbk = cbk; - dma0_cbk[channel].err_cbk = NULL; - dma0_cbk[channel].cplt_arg = NULL; - dma0_cbk[channel].err_arg = NULL; - - tmp->src = (void *)((uint32_t)desc + (((nr << 2) - 1) << DMA_DATA_INC_WORD)); - tmp->dst = (void *)((uint32_t)_tmp + ((4 - 1) << DMA_DATA_INC_WORD)); - tmp->ctrl.cycle_ctrl = DMA_CYCLE_CTRL_PER_SG_PRIMARY; - tmp->ctrl.next_useburst = 0; - tmp->ctrl.n_minus_1 = (nr << 2) - 1; - tmp->ctrl.R_power = DMA_R_POWER_4; - tmp->ctrl.src_prot_ctrl = 0, - tmp->ctrl.dst_prot_ctrl = 0, - tmp->ctrl.src_size = DMA_DATA_SIZE_WORD; - tmp->ctrl.src_inc = DMA_DATA_INC_WORD; - tmp->ctrl.dst_size = DMA_DATA_SIZE_WORD; - tmp->ctrl.dst_inc = DMA_DATA_INC_WORD; - - desc[nr - 1].ctrl.cycle_ctrl = DMA_CYCLE_CTRL_BASIC; - WRITE_REG(DMAx->CHPRIALTCLR, (1 << channel)); - burst ? (DMAx->CHUSEBURSTSET = (1 << channel)) : (DMAx->CHUSEBURSTCLR, (1 << channel)); - WRITE_REG(DMAx->CHPRCLR, (1 << channel)); - - MODIFY_REG(DMAx->CH_SELCON[channel], DMA_CH0_SELCON_MSEL_MSK, msel << DMA_CH0_SELCON_MSEL_POSS); - MODIFY_REG(DMAx->CH_SELCON[channel], DMA_CH0_SELCON_MSIGSEL_MSK, msigsel << DMA_CH0_SELCON_MSIGSEL_POSS); - - WRITE_REG(DMAx->ICFR, (1 << channel)); - SET_BIT(DMAx->IER, (1 << channel)); - WRITE_REG(DMAx->CHENSET, (1 << channel)); - - return; -} -/** - * @} - */ - -/** @defgroup DMA_Public_Functions_Group3 DMA Control functions - * @brief DMA control functions - * - * @verbatim - =================================================================== - - #### DMA control functions #### - - =================================================================== - [..] - This subsection provides some functions allowing to control DMA: - (+) ald_dma_channel_config(): Control DMA channel ENABLE/DISABLE. - (+) ald_dma_interrupt_config(): Control DMA channel interrupt ENABLE or - DISABLE. - (+) ald_dma_get_it_status(): Check whether the specified channel - interrupt is SET or RESET. - (+) ald_dma_get_flag_status(): Check whether the specified channel - flag is SET or RESET. - (+) ald_dma_clear_flag_status(): Clear the specified channel - pending flag - - @endverbatim - * @{ - */ - -/** - * @brief Configure channel enable or disable. It will unbind descriptor with - * channel, when channel has been disable. - * @param DMAx: Pointer to DMA peripheral - * @param channel: channel index - * @param state: status of channel: - * @arg ENABLE: Enable the channel - * @arg DISABLE: Disable the channel - * @retval None - */ -void ald_dma_channel_config(DMA_TypeDef *DMAx, uint8_t channel, type_func_t state) -{ - dma_descriptor_t *descr, *alt_descr; - - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_CHANNEL(channel)); - assert_param(IS_FUNC_STATE(state)); - - descr = (dma_descriptor_t *)(DMAx->CTRLBASE) + channel; - alt_descr = (dma_descriptor_t *)(DMAx->ALTCTRLBASE) + channel; - - if (state) { - WRITE_REG(DMAx->CHENSET, (1 << channel)); - } - else { - memset(descr, 0x00, sizeof(dma_descriptor_t)); - memset(alt_descr, 0x00, sizeof(dma_descriptor_t)); - WRITE_REG(DMAx->CH_SELCON[channel], 0x0); - WRITE_REG(DMAx->CHENCLR, (1 << channel)); - } - - return; -} - -/** - * @brief Configure the interrupt enable or disable - * @param DMAx: Pointer to DMA peripheral - * @param channel: Channel index or DMA_ERR. - * @arg 0~5: Channel index - * @arg DMA_ERR: DMA bus error - * @param state: status of channel: - * @arg ENABLE: Enable the channel - * @arg DISABLE: Disable the channel - * - * @retval None - */ -void ald_dma_interrupt_config(DMA_TypeDef *DMAx, uint8_t channel, type_func_t state) -{ - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_IT_TYPE(channel)); - assert_param(IS_FUNC_STATE(state)); - - if (state) - SET_BIT(DMAx->IER, (1 << channel)); - else - CLEAR_BIT(DMAx->IER, (1 << channel)); - - return; -} - -/** - * @brief Check whether the specified channel interrupt - * is set or reset - * @param DMAx: Pointer to DMA peripheral - * @param channel: Channel index or DMA_ERR - * @arg 0~5: Channel index - * @arg DMA_ERR: DMA bus error - * @retval Status: - * - SET: Channel interrupt is set - * - RESET: Channel interrupt is reset - */ -it_status_t ald_dma_get_it_status(DMA_TypeDef *DMAx, uint8_t channel) -{ - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_IT_TYPE(channel)); - - if (READ_BIT(DMAx->IER, (1 << channel))) - return SET; - - return RESET; -} - -/** - * @brief Check whether the specified channel flag - * is set or reset - * @param DMAx: Pointer to DMA peripheral - * @param channel: Channel index or DMA_ERR - * @arg 0~5: Channel index - * @arg DMA_ERR: DMA bus error - * @retval Status: - * - SET: Channel flag is set - * - RESET: Channel flag is reset - */ -flag_status_t ald_dma_get_flag_status(DMA_TypeDef *DMAx, uint8_t channel) -{ - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_IT_TYPE(channel)); - - if (READ_BIT(DMAx->IFLAG, (1 << channel))) - return SET; - - return RESET; -} - -/** - * @brief Clear the specified channel pending flag - * @param DMAx: Pointer to DMA peripheral - * @param channel: Channel index or DMA_ERR - * @arg 0~5: Channel index - * @arg DMA_ERR: DMA bus error - * @retval None - */ -void ald_dma_clear_flag_status(DMA_TypeDef *DMAx, uint8_t channel) -{ - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_IT_TYPE(channel)); - - WRITE_REG(DMAx->ICFR, (1 << channel)); - return; -} - -/** - * @brief Get the completion status of the descriptor - * @param DMAx: Pointer to DMA peripheral - * @param channel: Channel index - * @retval Completion status: - * - DMA_DESCP_CPLT_PRI: Primary descriptor has been completed - * - DMA_DESCP_CPLT_ALT: Alternate descriptor has been completed - * - DMA_DESCP_CPLT_ALL: Both primary and alternate descriptors have been completed - */ -dma_descrp_cplt_t ald_dma_descriptor_cplt_get(DMA_TypeDef *DMAx, uint8_t channel) -{ - uint8_t pri, alt; - dma_descriptor_t *desc; - - assert_param(IS_DMA(DMAx)); - assert_param(IS_DMA_IT_TYPE(channel)); - - desc = (dma_descriptor_t *)(DMAx->CTRLBASE) + channel; - pri = desc->ctrl.cycle_ctrl; - desc = (dma_descriptor_t *)(DMAx->ALTCTRLBASE) + channel; - alt = desc->ctrl.cycle_ctrl; - - if ((pri == 0) && (alt == 0)) - return DMA_DESCP_CPLT_ALL; - - if (pri == 0) - return DMA_DESCP_CPLT_PRI; - else - return DMA_DESCP_CPLT_ALT; -} -/** - * @} - */ - -/** - * @} - */ -#endif /* ALD_DMA */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_flash.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_flash.c deleted file mode 100644 index 44d25a7f76..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_flash.c +++ /dev/null @@ -1,208 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_flash.c - * @brief FLASH module driver. - * - * @version V1.0 - * @date 20 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - */ - -#include "ald_flash.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup FLASH FLASH - * @brief FLASH module driver - * @{ - */ - -#ifdef ALD_FLASH - -#if defined ( __ICCARM__ ) -#define __RAMFUNC __ramfunc -#else -#define __RAMFUNC -#endif - -/** @defgroup Flash_Private_Variables Flash Private Variables - * @{ - */ -/* global variable*/ -static op_cmd_type OP_CMD = OP_FLASH; -/** - * @} - */ - -/** @defgroup Flash_Private_Functions Flash Private Functions - * @brief Flash Private functions - * @{ - */ -/** - * @brief Unlock the flash. - * @retval Status, see @ref ald_status_t. - */ -__RAMFUNC static ald_status_t flash_unlock(void) -{ - uint16_t i; - uint16_t op_cmd = OP_CMD; - - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_BUSY_MSK)) - return ERROR; - - FLASH_REG_UNLOCK(); - FLASH_IAP_ENABLE(); - FLASH_REQ(); - - for (i = 0; i < 0xFFFF; i++) { - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_FLASHACK_MSK)) - break; - } - - return i == 0xFFFF ? ERROR : OK; -} - -/** - * @brief Lock the flash. - * @retval Status, see @ref ald_status_t. - */ -__RAMFUNC static ald_status_t flash_lock(void) -{ - uint16_t i; - uint16_t op_cmd = OP_CMD; - - FLASH_REG_UNLOCK(); - WRITE_REG(MSC->FLASHCR, 0x0); - - for (i = 0; i < 0xFFFF; i++) { - if (!(READ_BIT(MSC->FLASHSR, MSC_FLASHSR_FLASHACK_MSK))) - break; - } - - return i == 0xFFFF ? ERROR : OK; -} - -/** - * @brief Erase one page. - * @param addr: The erased page's address - * @retval Status, see @ref ald_status_t. - */ -__RAMFUNC ald_status_t flash_page_erase(uint32_t addr) -{ - uint32_t i; - uint16_t op_cmd = OP_CMD; - - if (flash_unlock() != OK) - goto end; - - if (op_cmd == OP_FLASH) { - CLEAR_BIT(MSC->FLASHADDR, MSC_FLASHADDR_IFREN_MSK); - MODIFY_REG(MSC->FLASHADDR, MSC_FLASHADDR_ADDR_MSK, FLASH_PAGE_ADDR(addr) << MSC_FLASHADDR_ADDR_POSS); - } - else { - SET_BIT(MSC->FLASHADDR, MSC_FLASHADDR_IFREN_MSK); - MODIFY_REG(MSC->FLASHADDR, MSC_FLASHADDR_ADDR_MSK, INFO_PAGE_ADDR(addr) << MSC_FLASHADDR_ADDR_POSS); - } - - WRITE_REG(MSC->FLASHCMD, FLASH_CMD_PE); - - for (i = 0; i < 0xFFFF; i++) { - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_BUSY_MSK)) - continue; - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_ADDR_OV_MSK)) - goto end; - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_WRP_FLAG_MSK)) - goto end; - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_SERA_MSK)) - break; - } - - if (i == 0xFFFF) - goto end; - - if (flash_lock() == ERROR) - goto end; - - return OK; -end: - flash_lock(); - return ERROR; -} - -/** - * @brief Programme a word. - * @param addr: The word's address, it is must word align. - * @param data: The 8 bytes data be write. - * @param len: The number of data be write. - * @param fifo: Choose if use fifo. - * @retval Status, see @ref ald_status_t. - */ -__RAMFUNC ald_status_t flash_word_program(uint32_t addr, uint32_t *data, uint32_t len, uint32_t fifo) -{ - uint16_t i = 0; - uint16_t prog_len; - uint32_t *p_data = data; - uint16_t op_cmd = OP_CMD; - - if (flash_unlock() != OK) - goto end; - - if (op_cmd == OP_FLASH) - CLEAR_BIT(MSC->FLASHADDR, MSC_FLASHADDR_IFREN_MSK); - else - SET_BIT(MSC->FLASHADDR, MSC_FLASHADDR_IFREN_MSK); - - MODIFY_REG(MSC->FLASHADDR, MSC_FLASHADDR_ADDR_MSK, addr << MSC_FLASHADDR_ADDR_POSS); - MODIFY_REG(MSC->FLASHCR, MSC_FLASHCR_FIFOEN_MSK, fifo << MSC_FLASHCR_FIFOEN_POS); - - for (prog_len = 0; prog_len < len; prog_len++) { - if (fifo) { - WRITE_REG(MSC->FLASHFIFO, p_data[0]); - WRITE_REG(MSC->FLASHFIFO, p_data[1]); - } - else { - WRITE_REG(MSC->FLASHDL, p_data[0]); - WRITE_REG(MSC->FLASHDH, p_data[1]); - WRITE_REG(MSC->FLASHCMD, FLASH_CMD_WP); - } - - p_data += 2; - - for (i = 0; i < 0xFFFF; i++) { - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_BUSY_MSK)) - continue; - if (READ_BIT(MSC->FLASHSR, MSC_FLASHSR_PROG_MSK)) - break; - } - } - if (i == 0xFFFF) - goto end; - - if (flash_lock() == ERROR) - goto end; - - return OK; -end: - flash_lock(); - return ERROR; -} -/** - * @} - */ - -#endif - -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_flash_ext.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_flash_ext.c deleted file mode 100644 index 44e8fe7d9c..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_flash_ext.c +++ /dev/null @@ -1,330 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_flash_ext.c - * @brief FLASH module driver. - * - * @version V1.0 - * @date 15 May 2019 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### FLASH Peripheral features ##### - ============================================================================== - [..] - Base address is 0x00000000 - - [..] - FLASH have just one programme mode , word programme. - word programme can programme 8 bytes once ; - - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - (#) programme flash using ald_flash_write(uint32_t addr, uint8_t *buf, uint16_t len) - (++) call the function and supply all the three paraments is needs, addr means - the first address to write in this operation, buf is a pointer to the data which - need writing to flash. - - (#) erase flash using ald_flash_erase(uint32_t addr, uint16_t len) - (++) call the function and supply two paraments, addr is the first address to erase, - len is the length to erase - - (#) read flash using ald_flash_read(uint32_t *ram_addr, uint32_t addr, uint16_t len) - (++) read the flash and save to a buffer, ram_addr is the buffer's first address, - addr is the start reading address in flash, len is the length need read - - @endverbatim - */ - - -#include "ald_flash.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @addtogroup FLASH - * @{ - */ - -#ifdef ALD_FLASH - -/** @addtogroup Flash_Private_Variables - * @{ - */ -/* opration buffer*/ -static uint8_t write_buf[FLASH_PAGE_SIZE]; -/** - * @} - */ - -/** @addtogroup Flash_Private_Functions - * @{ - */ - -/** - * @brief Check whether the flash between the given address section - * have been writen, if it have been writen, return TRUE, else - * return FALSE. - * @param begin_addr: The begin address. - * @param end_addr: The end address. - * @retval The check result - * - TRUE - * - FALSE - */ -static type_bool_t page_have_writen(uint32_t begin_addr, uint32_t end_addr) -{ - uint8_t* addr_to_read; - uint8_t value; - uint32_t index; - - /* Check the parameters */ - assert_param(IS_FLASH_ADDRESS(begin_addr)); - assert_param(IS_FLASH_ADDRESS(end_addr)); - - addr_to_read = (uint8_t *)begin_addr; - index = begin_addr; - value = 0xFF; - - if (begin_addr > end_addr) - return FALSE; - - while (index++ <= end_addr) { - value = *addr_to_read++; - - if (value != 0xFF) - break; - } - - return value == 0xFF ? FALSE : TRUE; -} -/** - * @} - */ - -/** @defgroup Flash_Public_Functions Flash Public Functions - * @verbatim - =============================================================================== - ##### Flash operation functions ##### - =============================================================================== - [..] - This section provides functions allowing to operate flash, such as read and write. - - @endverbatim - * @{ - */ - -/** - * @brief read the specified length bytes from flash, and store to the specified area. - * @param ram_addr: the specified area to store the reading bytes. - * @param addr: the start address. - * @param len: the length to read. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_flash_read(uint32_t *ram_addr, uint32_t addr, uint16_t len) -{ - uint32_t i; - uint32_t temp; - - assert_param(IS_4BYTES_ALIGN(ram_addr)); - assert_param(IS_FLASH_ADDRESS(addr)); - assert_param(IS_FLASH_ADDRESS(addr + len - 1)); - - temp = (uint32_t)ram_addr; - - if (((temp & 0x3) != 0) || (((addr) & 0x3) != 0)) - return ERROR; - - for (i = 0; i < len; i++) { - ram_addr[i] = ((uint32_t *)addr)[i]; - } - - return OK; -} - -/** - * @brief Write the give bytes to the given address section. - * @param addr: The start address to write. - * @param buf: The bytes' address. - * @param len: The length to write,and multiple of 2. - * @retval Status, see @ref ald_status_t. - */ - -ald_status_t ald_flash_write(uint32_t addr, uint8_t *buf, uint16_t len) -{ - uint32_t index = 0; - uint32_t para = 0; - uint32_t index2 = 0; - uint32_t start_write_addr; - uint32_t end_write_addr; - uint32_t start_word_addr; - uint32_t end_word_addr; - uint16_t len_to_write; - uint32_t len_index; - type_bool_t need_erase_page; - - assert_param(IS_FLASH_ADDRESS(addr)); - assert_param(IS_FLASH_ADDRESS(addr + len - 1)); - - len_to_write = len; - - __disable_irq(); - while (len_to_write > 0) { - need_erase_page = FALSE; - - for (index = 0; index < FLASH_PAGE_SIZE; index++) - write_buf[index] = 0xFF; - - start_write_addr = addr + (len - len_to_write); - end_write_addr = addr + len - 1; - end_write_addr = FLASH_PAGE_ADDR(start_write_addr) == FLASH_PAGE_ADDR(end_write_addr) - ? end_write_addr : FLASH_PAGEEND_ADDR(start_write_addr); - need_erase_page = page_have_writen(FLASH_WORD_ADDR(start_write_addr), - FLASH_WORDEND_ADDR(end_write_addr)); - - if (need_erase_page) { - if (ERROR == ald_flash_read((uint32_t *)write_buf, FLASH_PAGE_ADDR(start_write_addr), - FLASH_PAGE_SIZE >> 2)) { - __enable_irq(); - return ERROR; - } - - if (ERROR == flash_page_erase(FLASH_PAGE_ADDR(start_write_addr))) { - __enable_irq(); - return ERROR; - } - - para = end_write_addr & (FLASH_PAGE_SIZE - 1); - index = start_write_addr & (FLASH_PAGE_SIZE - 1); - index2 = len - len_to_write; - - while (index <= para) - write_buf[index++] = buf[index2++]; - - index2 = 0; - index = FLASH_PAGE_ADDR(start_write_addr); - len_index = FLASH_PAGE_SIZE; - } - else { - para = end_write_addr & (FLASH_PAGE_SIZE - 1); - index = start_write_addr & (FLASH_PAGE_SIZE - 1); - index2 = len - len_to_write; - - while (index <= para) - write_buf[index++] = buf[index2++]; - - start_word_addr = FLASH_WORD_ADDR(start_write_addr); - end_word_addr = FLASH_WORDEND_ADDR(end_write_addr); - index2 = (FLASH_WORD_ADDR(start_word_addr) - FLASH_PAGE_ADDR(start_word_addr)); - index = start_word_addr; - len_index = end_word_addr - start_word_addr + 1; - } - - if (ERROR == flash_word_program(index, (uint32_t *)(write_buf + index2), (len_index >> 3), FLASH_FIFO)) { - __enable_irq(); - return ERROR; - } - - len_to_write = len_to_write - (end_write_addr - start_write_addr + 1); - } - - __enable_irq(); - return OK; -} - -/** - * @brief erase The flash between the given address section. - * @param addr: The start address to erase. - * @param len: The length to erase. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_flash_erase(uint32_t addr, uint16_t len) -{ - uint32_t index; - int32_t para; - int32_t start_erase_addr; - int32_t end_erase_addr; - uint16_t len_not_erase; - uint32_t len_index; - type_bool_t page_need_save; - - assert_param(IS_FLASH_ADDRESS(addr)); - assert_param(IS_FLASH_ADDRESS(addr + len - 1)); - - len_not_erase = len; - - __disable_irq(); - while (len_not_erase > 0) { - page_need_save = FALSE; - - start_erase_addr = addr + len - len_not_erase; - end_erase_addr = addr + len - 1; - end_erase_addr = (FLASH_PAGE_ADDR(start_erase_addr) == FLASH_PAGE_ADDR(end_erase_addr)) - ? end_erase_addr : FLASH_PAGEEND_ADDR(start_erase_addr); - - if (start_erase_addr != FLASH_PAGE_ADDR(start_erase_addr)) { - if (page_have_writen(FLASH_PAGE_ADDR(start_erase_addr), (start_erase_addr - 1))) - page_need_save = TRUE; - } - if (end_erase_addr != FLASH_PAGEEND_ADDR(end_erase_addr)) { - if (page_have_writen((end_erase_addr + 1), FLASH_PAGEEND_ADDR(end_erase_addr))) - page_need_save = TRUE; - } - - if (page_need_save) { - if (ERROR == ald_flash_read((uint32_t *)write_buf, FLASH_PAGE_ADDR(start_erase_addr), - FLASH_PAGE_SIZE >> 2)) { - __enable_irq(); - return ERROR; - } - } - - if (ERROR == flash_page_erase(FLASH_PAGE_ADDR(start_erase_addr))) { - __enable_irq(); - return ERROR; - } - - if (page_need_save) { - para = end_erase_addr & (FLASH_PAGE_SIZE - 1); - index = start_erase_addr & (FLASH_PAGE_SIZE - 1); - - while (index <= para) - write_buf[index++] = 0xFF; - - index = FLASH_PAGE_ADDR(start_erase_addr); - len_index = FLASH_PAGE_SIZE; - if (ERROR == flash_word_program(index, (uint32_t *)write_buf, (len_index >> 3), FLASH_FIFO)) { - __enable_irq(); - return ERROR; - } - } - len_not_erase = len_not_erase - (end_erase_addr - start_erase_addr + 1); - } - - __enable_irq(); - return OK; -} -/** - * @} - */ - - -#endif - -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_gpio.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_gpio.c deleted file mode 100644 index 08366e9350..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_gpio.c +++ /dev/null @@ -1,623 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_gpio.c - * @brief GPIO module driver. - * This file provides firmware functions to manage the following - * functionalities of the General Purpose Input/Output (GPIO) peripheral: - * + Initialization functions - * + IO operation functions - * + Control functions - * - * @version V1.0 - * @date 07 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### GPIO Peripheral features ##### - ============================================================================== - [..] - Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each - port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software - in several modes: - (+) Input mode - (+) Analog mode - (+) Output mode - (+) External interrupt/event lines - - [..] - During and just after reset, the external interrupt lines are not active and - the I/O ports are configured Analog mode. - - [..] - All GPIO pins have weak internal pull-up and pull-down resistors, which can be - activated or not. - - [..] - In Output mode, each IO can be configured on open-drain or push-pull - type and the Output driver can be selected depending on ODRV register. - - [..] - In Input mode, each IO can select filter function. - - [..] - Each IO can select TTL or SMIT type. - - [..] - Each IO have up to eight functions, user can configure the functions depend - on the user's environment. - - [..] - Each IO can be locked. Once locked, uesr can only change the output data. - Only when the CPU reset to unlock the GPIO port. - - [..] - All ports have external interrupt/event capability. To use external interrupt - lines, the port must be configured in input mode. All available GPIO pins are - connected to the 16 external interrupt/event lines from EXTI0 to EXTI15. - - [..] - Each input line can be independently configured to select the type (event or interrupt) and - the corresponding trigger event (rising or falling). Each line can also masked - independently. A pending register maintains the status line of the interrupt requests. - - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - (#) Enable the GPIO clock. - - (#) Configure the GPIO pin(s) using ald_gpio_init(). - (++) Configure the IO mode using "mode" member from gpio_init_t structure - (++) Activate Pull-up, Pull-down resistor using "pupd" member from gpio_init_t - structure. - (++) In Output mode, configured on open-drain or push-pull using "odos" - member from gpio_init_t structure. - (++) In Output mode, configured output driver using "odrv" member - from gpio_init_t structure. - (++) In Input mode, configured filter function using "flt" member - from gpio_init_t structure. - (++) Configured type using "type" member from gpio_init_t structure. - (++) Configured functions using "func" member from gpio_init_t structure. - (++) Analog mode is required when a pin is to be used as ADC channel - or DAC output. - - (#) Configure the GPIO pin(s) using ald_gpio_init_default(). - (++) Configure GPIO pin using default param: - init.mode = GPIO_MODE_OUTPUT; - init.odos = GPIO_PUSH_PULL; - init.pupd = GPIO_PUSH_UP; - init.odrv = GPIO_OUT_DRIVE_NORMAL; - init.flt = GPIO_FILTER_DISABLE; - init.type = GPIO_TYPE_TTL; - init.func = GPIO_FUNC_1; - - (#) In case of external interrupt/event mode selection, user need invoke - ald_gpio_exti_init() to configure some param. And then invoke - ald_gpio_exti_interrupt_config() to enable/disable external interrupt/event. - - (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority - mapped to the EXTI line using NVIC_SetPriority() and enable it using - NVIC_EnableIRQ(). - - (#) To get the level of a pin configured in input mode use GPIO_read_pin(). - - (#) To set/reset the level of a pin configured in output mode use - ald_gpio_write_pin()/ald_gpio_toggle_pin(). - - (#) To lock pin configuration until next reset use ald_gpio_lock_pin(). - - (#) Configure external interrupt mode and enable/disable using - ald_gpio_exti_interrupt_config(). - - (#) Get external interrupt flag status using ald_gpio_exti_get_flag_status(). - - (#) Clear pending external interrupt flag status using - ald_gpio_exti_clear_flag_status(). - - @endverbatim - */ - -#include "ald_conf.h" -#include "ald_gpio.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup GPIO GPIO - * @brief GPIO module driver - * @{ - */ - -#ifdef ALD_GPIO - -/** @defgroup GPIO_Public_Functions GPIO Public Functions - * @{ - */ - -/** @defgroup GPIO_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * - @verbatim - =============================================================================== - ##### Initialization functions ##### - =============================================================================== - [..] - This section provides functions allowing to initialize the GPIOs or external - interrupt to be ready for use. - - @endverbatim - * @{ - */ - -/** - * @brief Initialize the GPIOx peripheral according to the specified - * parameters in the gpio_init_t. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: The pin which need to initialize. - * @param init: Pointer to a gpio_init_t structure that can contains - * the configuration information for the specified parameters. - * @retval None - */ -void ald_gpio_init(GPIO_TypeDef *GPIOx, uint16_t pin, gpio_init_t *init) -{ - uint32_t i, pos, mask, tmp; - - assert_param(IS_GPIO_PORT(GPIOx)); - assert_param(IS_GPIO_PIN(pin)); - assert_param(IS_GPIO_MODE(init->mode)); - assert_param(IS_GPIO_ODOS(init->odos)); - assert_param(IS_GPIO_PUPD(init->pupd)); - assert_param(IS_GPIO_ODRV(init->odrv)); - assert_param(IS_GPIO_FLT(init->flt)); - assert_param(IS_GPIO_TYPE(init->type)); - assert_param(IS_GPIO_FUNC(init->func)); - - for (i = 0; i < 16; ++i) { - if (((pin >> i) & 0x1) == 0) - continue; - - /* Get position and 2-bits mask */ - pos = i << 1; - mask = 0x3 << pos; - - /* Set PIN mode */ - tmp = READ_REG(GPIOx->MODE); - tmp &= ~mask; - tmp |= (init->mode << pos); - WRITE_REG(GPIOx->MODE, tmp); - - /* Set PIN open-drain or push-pull */ - tmp = READ_REG(GPIOx->ODOS); - tmp &= ~mask; - tmp |= (init->odos << pos); - WRITE_REG(GPIOx->ODOS, tmp); - - /* Set PIN push-up or/and push-down */ - tmp = READ_REG(GPIOx->PUPD); - tmp &= ~mask; - tmp |= (init->pupd << pos); - WRITE_REG(GPIOx->PUPD, tmp); - - /* Set PIN output driver */ - tmp = READ_REG(GPIOx->ODRV); - tmp &= ~mask; - tmp |= (init->odrv << pos); - WRITE_REG(GPIOx->ODRV, tmp); - - /* Get position and 1-bit mask */ - pos = i; - mask = 0x1 << pos; - - /* Set PIN filter enable or disable */ - tmp = READ_REG(GPIOx->FLT); - tmp &= ~mask; - tmp |= (init->flt << pos); - WRITE_REG(GPIOx->FLT, tmp); - - /* Set PIN type ttl or smit */ - tmp = READ_REG(GPIOx->TYPE); - tmp &= ~mask; - tmp |= (init->type << pos); - WRITE_REG(GPIOx->TYPE, tmp); - - /* Configure PIN function */ - pos = i < 8 ? (i << 2) : ((i - 8) << 2); - mask = 0xF << pos; - tmp = i < 8 ? READ_REG(GPIOx->FUNC0) : READ_REG(GPIOx->FUNC1); - tmp &= ~mask; - tmp |= (init->func << pos); - i < 8 ? WRITE_REG(GPIOx->FUNC0, tmp) : WRITE_REG(GPIOx->FUNC1, tmp); - } - - return; -} - -/** - * @brief Initialize the GPIOx peripheral using the default parameters. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: The pin which need to initialize. - * @retval None - */ -void ald_gpio_init_default(GPIO_TypeDef *GPIOx, uint16_t pin) -{ - gpio_init_t init; - - /* Fill GPIO_init_t structure with default parameter */ - init.mode = GPIO_MODE_OUTPUT; - init.odos = GPIO_PUSH_PULL; - init.pupd = GPIO_PUSH_UP; - init.odrv = GPIO_OUT_DRIVE_NORMAL; - init.flt = GPIO_FILTER_DISABLE; - init.type = GPIO_TYPE_CMOS; - init.func = GPIO_FUNC_1; - - ald_gpio_init(GPIOx, pin, &init); - return; -} - -/** - * @brief Sets GPIO function to default(func0). - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @retval None - */ -void ald_gpio_func_default(GPIO_TypeDef *GPIOx) -{ - WRITE_REG(GPIOx->FUNC0, 0x00); - WRITE_REG(GPIOx->FUNC1, 0x00); - - return; -} - -/** - * @brief Initialize the external interrupt according to the specified - * parameters in the exti_init_t. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: The pin which need to initialize. - * @param init: Pointer to a exti_init_t structure that can contains - * the configuration information for the specified parameters. - * @retval None - */ -void ald_gpio_exti_init(GPIO_TypeDef *GPIOx, uint16_t pin, exti_init_t *init) -{ - uint8_t i; - uint8_t port; - - assert_param(IS_GPIO_PORT(GPIOx)); - assert_param(IS_GPIO_PIN(pin)); - assert_param(IS_FUNC_STATE(init->filter)); - assert_param(IS_EXTI_FLTCKS_TYPE(init->cks)); - - /* Get GPIO port */ - if (GPIOx == GPIOA) - port = 0x0; - else if (GPIOx == GPIOB) - port = 0x1; - else if (GPIOx == GPIOC) - port = 2; - else if (GPIOx == GPIOD) - port = 3; - else if (GPIOx == GPIOE) - port = 4; - else if (GPIOx == GPIOF) - port = 5; - else if (GPIOx == GPIOG) - port = 6; - else if (GPIOx == GPIOH) - port = 7; - else - port = 0; - - /* Get Pin index */ - for (i = 0; i < 16; ++i) { - if (((pin >> i) & 0x1) == 0x1) - break; - } - - /* Select external interrupt line */ - if (i <= 7) { - EXTI->EXTIPSR0 &= ~(0x7U << (i * 4)); - EXTI->EXTIPSR0 |= (port << (i * 4)); - } - else { - i -= 8; - EXTI->EXTIPSR1 &= ~(0x7U << (i * 4)); - EXTI->EXTIPSR1 |= (port << (i * 4)); - } - - /* Configure filter parameter */ - if (init->filter == ENABLE) { - SET_BIT(EXTI->EXTIFLTCR, pin); - MODIFY_REG(EXTI->EXTIFLTCR, GPIO_EXTIFLTCR_FLTCKS_MSK, init->cks << GPIO_EXTIFLTCR_FLTCKS_POSS); - MODIFY_REG(EXTI->EXTIFLTCR, GPIO_EXTIFLTCR_FLTSEL_MSK, init->filter_time << GPIO_EXTIFLTCR_FLTSEL_POSS); - } - else { - CLEAR_BIT(EXTI->EXTIFLTCR, pin); - } - - return; -} -/** - * @} - */ - -/** @defgroup GPIO_Public_Functions_Group2 IO operation functions - * @brief GPIO Read and Write - * - @verbatim - =============================================================================== - ##### IO operation functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to manage the GPIOs. - - @endverbatim - * @{ - */ - -/** - * @brief Read the specified input port pin. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: Specifies the pin to read. - * @retval The input pin value - */ -uint8_t ald_gpio_read_pin(GPIO_TypeDef *GPIOx, uint16_t pin) -{ - assert_param(IS_GPIO_PORT(GPIOx)); - assert_param(IS_GPIO_PIN(pin)); - - if (READ_BIT(GPIOx->DIN, pin)) - return 1; - else - return 0; -} - -/** - * @brief Set or clear the select Pin data. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: The specified pin to be written. - * @param val: The specifies value to be written. - * @retval None - */ -void ald_gpio_write_pin(GPIO_TypeDef *GPIOx, uint16_t pin, uint8_t val) -{ - assert_param(IS_GPIO_PORT(GPIOx)); - assert_param(IS_GPIO_PIN(pin)); - - if ((val & (0x01)) == 0x00) - CLEAR_BIT(GPIOx->DOUT, pin); - else - SET_BIT(GPIOx->DOUT, pin); - - return; -} - -/** - * @brief Turn over the select data. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: Specifies the pin to turn over. - * @retval None - */ -void ald_gpio_toggle_pin(GPIO_TypeDef *GPIOx, uint16_t pin) -{ - assert_param(IS_GPIO_PORT(GPIOx)); - assert_param(IS_GPIO_PIN(pin)); - - WRITE_REG(GPIOx->BIR, pin); - return; -} - -/** - * @brief Turn over the direction. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: Specifies the pin to turn over. - * @retval None - */ -void ald_gpio_toggle_dir(GPIO_TypeDef *GPIOx, uint16_t pin) -{ - uint32_t i, pos, mask, tmp, value; - - assert_param(IS_GPIO_PORT(GPIOx)); - assert_param(IS_GPIO_PIN(pin)); - - for (i = 0; i < 16; ++i) { - if (((pin >> i) & 0x1) == 0) - continue; - - /* Get position and 2-bits mask */ - pos = i << 1; - mask = 0x3 << pos; - - /* Get the new direction */ - tmp = READ_REG(GPIOx->MODE); - value = (tmp >> pos) & 0x3; - - if ((value == 2) || (value == 3)) - value = 1; - else if (value == 1) { - value = 2; - } - else { - continue; /* do nothing */ - } - - /* Set PIN mode */ - tmp &= ~mask; - tmp |= (value << pos); - WRITE_REG(GPIOx->MODE, tmp); - } - - return; -} - -/** - * @brief Lock the GPIO prot. Once locked, can - * only change the output data. Only when the CPU - * reset to unlock the GPIO port. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param pin: The specified Pin to be written. - * @retval None - */ -void ald_gpio_lock_pin(GPIO_TypeDef *GPIOx, uint16_t pin) -{ - assert_param(IS_GPIO_PORT(GPIOx)); - assert_param(IS_GPIO_PIN(pin)); - - MODIFY_REG(GPIOx->LOCK, GPIO_LOCK_KEY_MSK, UNLOCK_KEY << GPIO_LOCK_KEY_POSS); - WRITE_REG(GPIOx->LOCK, pin); - - return; -} - -/** - * @brief Read the specified input port pin. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @retval The value; - */ -uint16_t ald_gpio_read_port(GPIO_TypeDef *GPIOx) -{ - assert_param(IS_GPIO_PORT(GPIOx)); - - return READ_REG(GPIOx->DIN); -} - -/** - * @brief Set or clear the select Pin data. - * @param GPIOx: Where x can be (A--H) to select the GPIO peripheral. - * @param val: The specifies value to be written. - * @retval None - */ -void ald_gpio_write_port(GPIO_TypeDef *GPIOx, uint16_t val) -{ - assert_param(IS_GPIO_PORT(GPIOx)); - - WRITE_REG(GPIOx->DOUT, val); - return; -} - - -/** - * @} - */ - -/** @defgroup GPIO_Public_Functions_Group3 Control functions - * @brief EXTI Control functions - * - @verbatim - =============================================================================== - ##### Control functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to - control external interrupt. - - @endverbatim - * @{ - */ - -/** - * @brief Configure the interrupt according to the specified parameter. - * @param pin: The Pin which need to configure. - * @param style: External interrupt trigger style. - * @param status: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_gpio_exti_interrupt_config(uint16_t pin, exti_trigger_style_t style, type_func_t status) -{ - assert_param(IS_GPIO_PIN(pin)); - assert_param(IS_TRIGGER_STYLE(style)); - assert_param(IS_FUNC_STATE(status)); - - if (status == ENABLE) { - if (style == EXTI_TRIGGER_RISING_EDGE) { - SET_BIT(EXTI->EXTIRER, pin); - } - else if (style == EXTI_TRIGGER_TRAILING_EDGE) { - SET_BIT(EXTI->EXTIFER, pin); - } - else if (style == EXTI_TRIGGER_BOTH_EDGE) { - SET_BIT(EXTI->EXTIRER, pin); - SET_BIT(EXTI->EXTIFER, pin); - } - else { - ; /* do nothing */ - } - - WRITE_REG(EXTI->EXTICFR, 0xffff); - SET_BIT(EXTI->EXTIEN, pin); - } - else { - if (style == EXTI_TRIGGER_RISING_EDGE) { - CLEAR_BIT(EXTI->EXTIRER, pin); - } - else if (style == EXTI_TRIGGER_TRAILING_EDGE) { - CLEAR_BIT(EXTI->EXTIFER, pin); - } - else if (style == EXTI_TRIGGER_BOTH_EDGE) { - CLEAR_BIT(EXTI->EXTIRER, pin); - CLEAR_BIT(EXTI->EXTIFER, pin); - } - else { - ; /* do nothing */ - } - - CLEAR_BIT(EXTI->EXTIEN, pin); - } - - return; -} - -/** - * @brief Get the Flag about external interrupt. - * @param pin: The pin which belong to external interrupt. - * @retval Flag status - * - SET - * - RESET - */ -flag_status_t ald_gpio_exti_get_flag_status(uint16_t pin) -{ - assert_param(IS_GPIO_PIN(pin)); - - if (READ_BIT(EXTI->EXTIFLAG, pin)) - return SET; - - return RESET; -} - -/** - * @brief Clear the external interrupt flag. - * @param pin: The pin which belong to external interrupt. - * @retval None - */ -void ald_gpio_exti_clear_flag_status(uint16_t pin) -{ - assert_param(IS_GPIO_PIN(pin)); - - WRITE_REG(EXTI->EXTICFR, pin); - return; -} -/** - * @} - */ - -/** - * @} - */ - -#endif /* ALD_GPIO */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_i2c.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_i2c.c deleted file mode 100644 index 82faa31502..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_i2c.c +++ /dev/null @@ -1,3109 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_i2c.c - * @brief I2C module driver. - * - * @version V1.0 - * @date 15 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - The I2C driver can be used as follows: - - (#) Declare a i2c_handle_t handle structure, for example: - i2c_handle_t hperh; - - (#) Configure the Communication Speed, Duty cycle, Addressing mode, Own Address1, - Dual Addressing mode, Own Address2, General call and Nostretch mode in the hperh init structure. - - (#) Initialize the I2C registers by calling the ald_i2c_init(). - (#) To check if target device is ready for communication, use the function ald_i2c_is_device_ready() - - (#) For I2C IO and IO MEM operations, three operation modes are available within this driver : - - *** Polling mode IO operation *** - ================================= - [..] - (+) Transmit in master mode an amount of data in blocking mode using ald_i2c_master_send() - (+) Receive in master mode an amount of data in blocking mode using ald_i2c_master_recv() - (+) Transmit in slave mode an amount of data in blocking mode using ald_i2c_slave_send() - (+) Receive in slave mode an amount of data in blocking mode using ald_i2c_slave_recv() - - *** Polling mode IO MEM operation *** - ===================================== - [..] - (+) Write an amount of data in blocking mode to a specific memory address using ald_i2c_mem_write() - (+) Read an amount of data in blocking mode from a specific memory address using ald_i2c_mem_read() - - - *** Interrupt mode IO operation *** - =================================== - [..] - (+) The I2C interrupts should have the highest priority in the application in order - to make them uninterruptible. - (+) Transmit in master mode an amount of data in non-blocking mode using ald_i2c_master_send_by_it() - (+) At transmission end of transfer, hperh->master_tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->master_tx_cplt_cbk() - (+) Receive in master mode an amount of data in non-blocking mode using ald_i2c_master_recv_by_it() - (+) At reception end of transfer, hperh->master_rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->master_rx_cplt_cbk() - (+) Transmit in slave mode an amount of data in non-blocking mode using ald_i2c_slave_send_by_it() - (+) At transmission end of transfer, hperh->slave_tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->slave_tx_cplt_cbk() - (+) Receive in slave mode an amount of data in non-blocking mode using ald_i2c_slave_recv_by_it() - (+) At reception end of transfer, hperh->slave_rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->slave_rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_callback() function is executed and user can - add his own code by customization of function pointer hperh->error_callback() - - *** Interrupt mode IO MEM operation *** - ======================================= - [..] - (+) The I2C interrupts should have the highest priority in the application in order - to make them uninterruptible. - (+) Write an amount of data in non-blocking mode with Interrupt to a specific memory address using - ald_i2c_mem_write_by_it() - (+) At Memory end of write transfer, hperh->mem_tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->mem_tx_cplt_cbk() - (+) Read an amount of data in non-blocking mode with Interrupt from a specific memory address using - ald_i2c_mem_read_by_it() - (+) At Memory end of read transfer, hperh->mem_rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->mem_rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_callback() function is executed and user can - add his own code by customization of function pointer hperh->error_callback() - - *** DMA mode IO operation *** - ============================== - [..] - (+) Transmit in master mode an amount of data in non-blocking mode (DMA) using - ald_i2c_master_send_by_dma() - (+) At transmission end of transfer, hperh->master_tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->master_tx_cplt_cbk() - (+) Receive in master mode an amount of data in non-blocking mode (DMA) using - ald_i2c_master_recv_by_dma() - (+) At reception end of transfer, hperh->master_rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->master_rx_cplt_cbk() - (+) Transmit in slave mode an amount of data in non-blocking mode (DMA) using - ald_i2c_slave_send_by_dma() - (+) At transmission end of transfer, hperh->slave_tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->slave_tx_cplt_cbk() - (+) Receive in slave mode an amount of data in non-blocking mode (DMA) using - ald_i2c_slave_recv_by_dma() - (+) At reception end of transfer, hperh->slave_rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->slave_rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_callback() function is executed and user can - add his own code by customization of function pointer hperh->error_callback() - - *** DMA mode IO MEM operation *** - ================================= - [..] - (+) Write an amount of data in non-blocking mode with DMA to a specific memory address using - ald_i2c_mem_write_by_dma() - (+) At Memory end of write transfer, hperh->mem_tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->mem_tx_cplt_cbk() - (+) Read an amount of data in non-blocking mode with DMA from a specific memory address using - ald_i2c_mem_read_by_dma() - (+) At Memory end of read transfer, hperh->mem_rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->mem_rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_callback() function is executed and user can - add his own code by customization of function pointer hperh->error_callback() - - - *** I2C ald_status_t driver macros list *** - ================================== - [..] - Below the list of most used macros in I2C ald_status_t driver. - - (+) I2C_ENABLE: Enable the I2C peripheral - (+) I2C_DISABLE: Disable the I2C peripheral - (@) You can refer to the I2C ald_status_t driver header file for more useful macros - - - *** I2C Workarounds linked to Silicon Limitation *** - ==================================================== - [..] - Below the list of all silicon limitations implemented for library on our product. - (@) See ErrataSheet to know full silicon limitation list of your product. - - (#) Workarounds Implemented inside I2C library - (##) Wrong data read into data register (Polling and Interrupt mode) - (##) Start cannot be generated after a misplaced Stop - (##) Some software events must be managed before the current byte is being transferred: - Workaround: Use DMA in general, except when the Master is receiving a single byte. - For Interupt mode, I2C should have the highest priority in the application. - (##) Mismatch on the "Setup time for a repeated Start condition" timing parameter: - Workaround: Reduce the frequency down to 88 kHz or use the I2C Fast-mode if - supported by the slave. - (##) Data valid time (tVD;DAT) violated without the OVR flag being set: - Workaround: If the slave device allows it, use the clock stretching mechanism - by programming no_stretch = I2C_NOSTRETCH_DISABLE in ald_i2c_init. - - @endverbatim - ********************************************************************************* - */ - -#include "ald_i2c.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup I2C I2C - * @brief I2C module driver - * @{ - */ -#ifdef ALD_I2C - -/** @addtogroup I2C_Private_Constants I2C Private Constants - * @{ - */ -#define I2C_TIMEOUT_FLAG (__systick_interval / 20 + 1) -#define I2C_TIMEOUT_ADDR_SLAVE (__systick_interval * 10) -#define I2C_TIMEOUT_BUSY_FLAG (__systick_interval * 10) -#define I2C_MAX_DELAY 0xFFFFFFFF -/** - * @} - */ - -/** @addtogroup I2C_Private_Functions I2C Private Functions - * @{ - */ -#ifdef ALD_DMA -static void i2c_dma_master_send_cplt(void *argv); -static void i2c_dma_master_recv_cplt(void *argv); -static void i2c_dma_slave_send_cplt(void *argv); -static void i2c_dma_slave_recv_cplt(void *argv); -static void i2c_dma_mem_send_cplt(void *argv); -static void i2c_dma_mem_recv_cplt(void *argv); -static void i2c_dma_error(void *argv); -#endif -static ald_status_t i2c_master_req_write(i2c_handle_t *hperh, uint16_t dev_addr, uint32_t timeout); -static ald_status_t i2c_master_req_read(i2c_handle_t *hperh, uint16_t dev_addr, uint32_t timeout); -static ald_status_t i2c_req_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - uint16_t add_size, uint32_t timeout); -static ald_status_t i2c_req_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - uint16_t add_size, uint32_t timeout); -static ald_status_t i2c_wait_flag_to_timeout(i2c_handle_t *hperh, i2c_flag_t flag, - flag_status_t status, uint32_t timeout); -static ald_status_t i2c_wait_master_addr_to_timeout(i2c_handle_t *hperh, i2c_flag_t flag, uint32_t timeout); -static ald_status_t i2c_wait_txe_to_timeout(i2c_handle_t *hperh, uint32_t timeout); -static ald_status_t i2c_wait_btf_to_timeout(i2c_handle_t *hperh, uint32_t timeout); -static ald_status_t i2c_wait_rxne_to_timeout(i2c_handle_t *hperh, uint32_t timeout); -static ald_status_t i2c_wait_stop_to_timeout(i2c_handle_t *hperh, uint32_t timeout); -static ald_status_t i2c_is_ack_failed(i2c_handle_t *hperh); -static ald_status_t i2c_master_send_txe(i2c_handle_t *hperh); -static ald_status_t i2c_master_send_btf(i2c_handle_t *hperh); -static ald_status_t i2c_master_recv_rxne(i2c_handle_t *hperh); -static ald_status_t i2c_master_recv_btf(i2c_handle_t *hperh); -static ald_status_t i2c_slave_send_txe(i2c_handle_t *hperh); -static ald_status_t i2c_slave_send_btf(i2c_handle_t *hperh); -static ald_status_t i2c_slave_recv_rxne(i2c_handle_t *hperh); -static ald_status_t i2c_slave_recv_btf(i2c_handle_t *hperh); -static ald_status_t i2c_slave_addr(i2c_handle_t *hperh); -static ald_status_t i2c_slave_stopf(i2c_handle_t *hperh); -static ald_status_t i2c_slave_af(i2c_handle_t *hperh); -static uint32_t i2c_configure_speed(i2c_handle_t *hperh, uint32_t i2c_clk); -/** - * @} - */ - -/** @defgroup I2C_Public_Functions I2C Public functions - * @{ - */ - -/** @defgroup I2C_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * -@verbatim - =============================================================================== - ##### Initialization and Configuration functions ##### - =============================================================================== - [..] This subsection provides a set of functions allowing to initialize and - de-initialiaze the I2Cx peripheral: - - (+) Call the function ald_i2c_init() to configure the selected device with - the selected configuration: - (++) Communication Speed - (++) Duty cycle - (++) Addressing mode - (++) Own Address 1 - (++) Dual Addressing mode - (++) Own Address 2 - (++) General call mode - (++) Nostretch mode - - (+) Call the function ald_i2c_reset() to restore the default configuration - of the selected I2Cx periperal. - -@endverbatim - * @{ - */ - -/** - * @brief Initializes the I2C according to the specified parameters - * in the i2c_init_t and initialize the associated handle. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_init(i2c_handle_t *hperh) -{ - uint32_t freqrange = 0; - uint32_t pclk1 = 0; - - if (hperh == NULL) - return ERROR; - - /* Check the parameters */ - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_CLOCK_SPEED(hperh->init.clk_speed)); - assert_param(IS_I2C_DUTY_CYCLE(hperh->init.duty)); - assert_param(IS_I2C_OWN_ADDRESS1(hperh->init.own_addr1)); - assert_param(IS_I2C_ADDRESSING_MODE(hperh->init.addr_mode)); - assert_param(IS_I2C_GENERAL_CALL(hperh->init.general_call)); - assert_param(IS_I2C_NO_STRETCH(hperh->init.no_stretch)); - - if (hperh->init.dual_addr == I2C_DUALADDR_ENABLE) - assert_param(IS_I2C_OWN_ADDRESS2(hperh->init.own_addr2)); - - if (hperh->state == I2C_STATE_RESET) - hperh->lock = UNLOCK; - - hperh->state = I2C_STATE_BUSY; - pclk1 = ald_cmu_get_pclk1_clock(); - I2C_DISABLE(hperh); - - freqrange = I2C_FREQ_RANGE(pclk1); - WRITE_REG(hperh->perh->CON2, freqrange); - WRITE_REG(hperh->perh->RT, I2C_RISE_TIME(freqrange, hperh->init.clk_speed)); - WRITE_REG(hperh->perh->CKCFG, i2c_configure_speed(hperh, pclk1)); - WRITE_REG(hperh->perh->CON1, hperh->init.general_call); - SET_BIT(hperh->perh->CON1, hperh->init.no_stretch); - - if (hperh->init.addr_mode == I2C_ADDR_7BIT) { - WRITE_REG(hperh->perh->ADDR1, (0x7FFF & hperh->init.own_addr1)); - } - else { - WRITE_REG(hperh->perh->ADDR1, (0x8000 | hperh->init.own_addr1)); - } - - WRITE_REG(hperh->perh->ADDR2, (hperh->init.dual_addr | hperh->init.own_addr2)); - - I2C_ENABLE(hperh); - - hperh->error_code = I2C_ERROR_NONE; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - - return OK; -} - -/** - * @brief DeInitialize the I2C peripheral. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_reset(i2c_handle_t *hperh) -{ - if (hperh == NULL) - return ERROR; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - hperh->state = I2C_STATE_BUSY; - I2C_DISABLE(hperh); - - hperh->error_code = I2C_ERROR_NONE; - hperh->state = I2C_STATE_RESET; - hperh->mode = I2C_MODE_NONE; - - __UNLOCK(hperh); - - return OK; -} -/** - * @} - */ - -/** @defgroup I2C_Public_Functions_Group2 Input and Output operation functions - * @brief Data transfers functions - * -@verbatim - =============================================================================== - ##### IO operation functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to manage the I2C data - transfers. - - (#) There are two modes of transfer: - (++) Blocking mode : The communication is performed in the polling mode. - The status of all data processing is returned by the same function - after finishing transfer. - (++) No-Blocking mode : The communication is performed using Interrupts - or DMA. These functions return the status of the transfer startup. - The end of the data processing will be indicated through the - dedicated I2C IRQ when using Interrupt mode or the DMA IRQ when - using DMA mode. - - (#) Blocking mode functions are : - (++) ald_i2c_master_send() - (++) ald_i2c_master_recv() - (++) ald_i2c_slave_send() - (++) ald_i2c_slave_recv() - (++) ald_i2c_mem_write() - (++) ald_i2c_mem_read() - (++) ald_i2c_is_device_ready() - - (#) No-Blocking mode functions with Interrupt are : - (++) ald_i2c_master_send_by_it() - (++) ald_i2c_master_recv_by_it() - (++) ald_i2c_slave_send_by_it() - (++) ald_i2c_slave_recv_by_it() - (++) ald_i2c_mem_write_by_it() - (++) ald_i2c_mem_read_by_it() - - (#) No-Blocking mode functions with DMA are : - (++) ald_i2c_master_send_by_dma() - (++) ald_i2c_master_recv_by_dma() - (++) ald_i2c_slave_send_by_dma() - (++) ald_i2c_slave_recv_by_dma() - (++) ald_i2c_mem_write_by_dma() - (++) ald_i2c_mem_read_by_dma() - - (#) A set of Transfer Complete Callbacks are provided in non Blocking mode: - (++) hperh->mem_tx_cplt_cbk() - (++) hperh->mem_rx_cplt_cbk() - (++) hperh->master_tx_cplt_cbk() - (++) hperh->master_rx_cplt_cbk() - (++) hperh->slave_tx_cplt_cbk() - (++) hperh->slave_rx_cplt_cbk() - (++) hperh->error_callback() - -@endverbatim - * @{ - */ - -/** - * @brief Transmits in master mode an amount of data in blocking mode. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_master_send(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, - uint16_t size, uint32_t timeout) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_MASTER; - hperh->error_code = I2C_ERROR_NONE; - - if (i2c_master_req_write(hperh, dev_addr, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - I2C_CLEAR_ADDRFLAG(hperh); - - while (size > 0) { - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - hperh->perh->DATA = (*buf++); - --size; - - if ((ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == SET) && (size != 0)) { - hperh->perh->DATA = (*buf++); - --size; - } - } - - if (i2c_wait_btf_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return OK; - -} - -/** - * @brief Receives in master mode an amount of data in blocking mode. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_master_recv(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, - uint16_t size, uint32_t timeout) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - __LOCK(hperh); - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_MASTER; - hperh->error_code = I2C_ERROR_NONE; - - if (i2c_master_req_read(hperh, dev_addr, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - if (size == 1) { - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __disable_irq(); - I2C_CLEAR_ADDRFLAG(hperh); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - __enable_irq(); - } - else if (size == 2) { - SET_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - __disable_irq(); - I2C_CLEAR_ADDRFLAG(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __enable_irq(); - } - else { - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - I2C_CLEAR_ADDRFLAG(hperh); - } - - while (size > 3) { - if (i2c_wait_rxne_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_TIMEOUT) { - __UNLOCK(hperh); - return TIMEOUT; - } - else { - __UNLOCK(hperh); - return ERROR; - } - } - - (*buf++) = hperh->perh->DATA; - --size; - - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == SET) { - (*buf++) = hperh->perh->DATA; - --size; - } - } - - switch (size) { - case 1: - if (i2c_wait_rxne_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_TIMEOUT) { - __UNLOCK(hperh); - return TIMEOUT; - } - else { - __UNLOCK(hperh); - return ERROR; - } - } - - (*buf++) = hperh->perh->DATA; - break; - - case 2: - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - __disable_irq(); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - (*buf++) = hperh->perh->DATA; - __enable_irq(); - (*buf++) = hperh->perh->DATA; - break; - - case 3: - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __disable_irq(); - (*buf++) = hperh->perh->DATA; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, timeout) != OK) { - __UNLOCK(hperh); - __enable_irq(); - return TIMEOUT; - } - - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - (*buf++) = hperh->perh->DATA; - __enable_irq(); - (*buf++) = hperh->perh->DATA; - break; - - default : - break; - } - - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Transmits in slave mode an amount of data in blocking mode. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_slave_send(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_SLAVE; - hperh->error_code = I2C_ERROR_NONE; - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_ADDR, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - - if (hperh->init.addr_mode == I2C_ADDR_10BIT) { - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_ADDR, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - } - - while (size > 0) { - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - hperh->perh->DATA = (*buf++); - --size; - - if ((ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == SET) && (size != 0)) { - hperh->perh->DATA = (*buf++); - --size; - } - } - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_AF, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - ald_i2c_clear_flag_status(hperh, I2C_FLAG_AF); - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Receive in slave mode an amount of data in blocking mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_slave_recv(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_SLAVE; - hperh->error_code = I2C_ERROR_NONE; - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_ADDR, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - - while (size > 0) { - if (i2c_wait_rxne_to_timeout(hperh, timeout) != OK) { - hperh->perh->CON1 &= (uint32_t)(~I2C_CON1_ACKEN); - - if (hperh->error_code == I2C_ERROR_TIMEOUT) { - __UNLOCK(hperh); - return TIMEOUT; - } - else { - __UNLOCK(hperh); - return ERROR; - } - } - - (*buf++) = hperh->perh->DATA; - --size; - - if ((ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == SET) && (size != 0)) { - (*buf++) = hperh->perh->DATA; - --size; - } - } - - if (i2c_wait_stop_to_timeout(hperh, I2C_TIMEOUT_FLAG) != OK) { - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - __I2C_CLEAR_STOPFLAG(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Transmit in master mode an amount of data in non-blocking mode with Interrupt - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_master_send_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, uint16_t size) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_MASTER; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (i2c_master_req_write(hperh, dev_addr, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - I2C_CLEAR_ADDRFLAG(hperh); - - __UNLOCK(hperh); - - /* Note : The I2C interrupts must be enabled after unlocking current process - * to avoid the risk of I2C interrupt handle execution before current - * process unlock */ - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, ENABLE); - return OK; -} - -/** - * @brief Receive in master mode an amount of data in non-blocking mode with Interrupt - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_master_recv_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, uint16_t size) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_MASTER; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (i2c_master_req_read(hperh, dev_addr, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - if (hperh->xfer_count == 1) { - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - I2C_CLEAR_ADDRFLAG(hperh); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - } - else if (hperh->xfer_count == 2) { - SET_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - I2C_CLEAR_ADDRFLAG(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - } - else { - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - I2C_CLEAR_ADDRFLAG(hperh); - } - - __UNLOCK(hperh); - - /* Note : The I2C interrupts must be enabled after unlocking current process - * to avoid the risk of I2C interrupt handle execution before current - * process unlock */ - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, ENABLE); - return OK; -} - -/** - * @brief Transmit in slave mode an amount of data in non-blocking mode with Interrupt - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_slave_send_by_it(i2c_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_SLAVE; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __UNLOCK(hperh); - - /* Note : The I2C interrupts must be enabled after unlocking current process - * to avoid the risk of I2C interrupt handle execution before current - * process unlock */ - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, ENABLE); - - return OK; -} - -/** - * @brief Receive in slave mode an amount of data in non-blocking mode with Interrupt - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_slave_recv_by_it(i2c_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_SLAVE; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __UNLOCK(hperh); - - /* Note : The I2C interrupts must be enabled after unlocking current process - * to avoid the risk of I2C interrupt handle execution before current - * process unlock */ - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, ENABLE); - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Transmit in master mode an amount of data in non-blocking mode with DMA - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as I2C transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_master_send_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, - uint16_t size, uint8_t channel) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_MASTER; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - hperh->hdmatx.cplt_cbk = i2c_dma_master_send_cplt; - hperh->hdmatx.cplt_arg = hperh; - hperh->hdmatx.err_cbk = i2c_dma_error; - hperh->hdmatx.err_arg = hperh; - - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_BYTE; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_I2C_TXEMPTY; - hperh->hdmatx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmatx); - - if (i2c_master_req_write(hperh, dev_addr, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - SET_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - I2C_CLEAR_ADDRFLAG(hperh); - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Receive in master mode an amount of data in non-blocking mode with DMA - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as I2C receive - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_master_recv_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint8_t *buf, - uint16_t size, uint8_t channel) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_MASTER; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - hperh->hdmarx.cplt_cbk = i2c_dma_master_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = i2c_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_BYTE; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_I2C_RNR; - hperh->hdmarx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmarx); - - if (i2c_master_req_read(hperh, dev_addr, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - if (size == 1) - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - else - SET_BIT(hperh->perh->CON2, I2C_CON2_LDMA); - - SET_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - I2C_CLEAR_ADDRFLAG(hperh); - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Transmit in slave mode an amount of data in non-blocking mode with DMA - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as I2C Transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_slave_send_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_SLAVE; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - hperh->hdmatx.cplt_cbk = i2c_dma_slave_send_cplt; - hperh->hdmatx.cplt_arg = hperh; - hperh->hdmatx.err_cbk = i2c_dma_error; - hperh->hdmatx.err_arg = hperh; - - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_BYTE; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_I2C_TXEMPTY; - hperh->hdmatx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmatx); - - SET_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_ADDR, RESET, I2C_TIMEOUT_ADDR_SLAVE) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.addr_mode == I2C_ADDR_7BIT) { - I2C_CLEAR_ADDRFLAG(hperh); - } - else { - I2C_CLEAR_ADDRFLAG(hperh); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_ADDR, RESET, I2C_TIMEOUT_ADDR_SLAVE) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - } - - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Receive in slave mode an amount of data in non-blocking mode with DMA - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as I2C receive - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_slave_recv_by_dma(i2c_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_SLAVE; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - hperh->hdmarx.cplt_cbk = i2c_dma_slave_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = i2c_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_BYTE; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_I2C_RNR; - hperh->hdmarx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmarx); - - SET_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_ADDR, RESET, I2C_TIMEOUT_ADDR_SLAVE) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - __UNLOCK(hperh); - return OK; -} -#endif - -/** - * @brief Write an amount of data in blocking mode to a specific memory address - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_MEMADD_size(add_size)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_MEM; - hperh->error_code = I2C_ERROR_NONE; - - if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - while (size > 0) { - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - hperh->perh->DATA = (*buf++); - --size; - - if ((ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == SET) && (size != 0)) { - hperh->perh->DATA = (*buf++); - --size; - } - } - - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - ald_delay_ms(10); - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Read an amount of data in blocking mode from a specific memory address - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, i2c_addr_size_t add_size, - uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_MEMADD_size(add_size)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_MEM; - hperh->error_code = I2C_ERROR_NONE; - - if (i2c_req_mem_read(hperh, dev_addr, mem_addr, add_size, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - if (size == 1) { - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __disable_irq(); - I2C_CLEAR_ADDRFLAG(hperh); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - __enable_irq(); - } - else if (size == 2) { - SET_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - __disable_irq(); - I2C_CLEAR_ADDRFLAG(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __enable_irq(); - } - else { - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - I2C_CLEAR_ADDRFLAG(hperh); - } - - while (size > 3) { - if (i2c_wait_rxne_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_TIMEOUT) { - __UNLOCK(hperh); - return TIMEOUT; - } - else { - __UNLOCK(hperh); - return ERROR; - } - } - - (*buf++) = hperh->perh->DATA; - --size; - - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == SET) { - (*buf++) = hperh->perh->DATA; - --size; - } - } - - switch (size) { - case 1: - if (i2c_wait_rxne_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_TIMEOUT) { - __UNLOCK(hperh); - return TIMEOUT; - } - else { - __UNLOCK(hperh); - return ERROR; - } - } - - (*buf++) = hperh->perh->DATA; - break; - - case 2: - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - __disable_irq(); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - (*buf++) = hperh->perh->DATA; - __enable_irq(); - (*buf++) = hperh->perh->DATA; - break; - - case 3: - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - __disable_irq(); - (*buf++) = hperh->perh->DATA; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, timeout) != OK) { - __UNLOCK(hperh); - __enable_irq(); - return TIMEOUT; - } - - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - (*buf++) = hperh->perh->DATA; - __enable_irq(); - (*buf++) = hperh->perh->DATA; - break; - - default: - break; - } - - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Write an amount of data in non-blocking mode with Interrupt to a specific memory address - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_mem_write_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_MEMADD_size(add_size)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_MEM; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - __UNLOCK(hperh); - - /* Note : The I2C interrupts must be enabled after unlocking current process - * to avoid the risk of I2C interrupt handle execution before current - * process unlock */ - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, ENABLE); - - return OK; -} - -/** - * @brief Read an amount of data in non-blocking mode with Interrupt from a specific memory address - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_mem_read_by_it(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, - i2c_addr_size_t add_size, uint8_t *buf, uint16_t size) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_MEMADD_size(add_size)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_MEM; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (i2c_req_mem_read(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - if (hperh->xfer_count == 1) { - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - I2C_CLEAR_ADDRFLAG(hperh); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - } - else if (hperh->xfer_count == 2) { - SET_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - I2C_CLEAR_ADDRFLAG(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - } - else { - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - I2C_CLEAR_ADDRFLAG(hperh); - } - - __UNLOCK(hperh); - - /* Note : The I2C interrupts must be enabled after unlocking current process - * to avoid the risk of I2C interrupt handle execution before current - * process unlock */ - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, ENABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, ENABLE); - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Write an amount of data in non-blocking mode with DMA to a specific memory address - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_mem_write_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, i2c_addr_size_t add_size, - uint8_t *buf, uint16_t size, uint8_t channel) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_MEMADD_size(add_size)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_TX; - hperh->mode = I2C_MODE_MEM; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - hperh->hdmatx.cplt_cbk = i2c_dma_mem_send_cplt; - hperh->hdmatx.cplt_arg = hperh; - hperh->hdmatx.err_cbk = i2c_dma_error; - hperh->hdmatx.err_arg = hperh; - ald_dma_config_struct(&hperh->hdmatx.config); - - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_BYTE; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_I2C_TXEMPTY; - hperh->hdmatx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmatx); - - if (i2c_req_mem_write(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - SET_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Reads an amount of data in non-blocking mode with DMA from a specific memory address. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param buf: Pointer to data buffer - * @param size: Amount of data to be read - * @param channel: DMA channel - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_mem_read_by_dma(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, i2c_addr_size_t add_size, - uint8_t *buf, uint16_t size, uint8_t channel) -{ - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_MEMADD_size(add_size)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY_RX; - hperh->mode = I2C_MODE_MEM; - hperh->error_code = I2C_ERROR_NONE; - hperh->p_buff = buf; - hperh->xfer_size = size; - hperh->xfer_count = size; - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - hperh->hdmarx.cplt_cbk = i2c_dma_mem_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = i2c_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - ald_dma_config_struct(&hperh->hdmarx.config); - - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_BYTE; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = hperh->perh == I2C0 ? DMA_MSEL_I2C0 : DMA_MSEL_I2C1; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_I2C_RNR; - hperh->hdmarx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmarx); - - if (i2c_req_mem_read(hperh, dev_addr, mem_addr, add_size, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - __UNLOCK(hperh); - return ERROR; - } - else { - __UNLOCK(hperh); - return TIMEOUT; - } - } - - if (size == 1) - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - else - SET_BIT(hperh->perh->CON2, I2C_CON2_LDMA); - - SET_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - I2C_CLEAR_ADDRFLAG(hperh); - __UNLOCK(hperh); - return OK; -} -#endif - -/** - * @brief Checks if target device is ready for communication. - * @note This function is used with Memory devices - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param trials: Number of trials - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_i2c_is_device_ready(i2c_handle_t *hperh, uint16_t dev_addr, uint32_t trials, uint32_t timeout) -{ - uint32_t tickstart = 0; - uint32_t tmp1 = 0; - uint32_t tmp2 = 0; - uint32_t tmp3 = 0; - uint32_t I2C_Trials = 1; - - if (hperh->state != I2C_STATE_READY) - return BUSY; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != OK) - return BUSY; - - assert_param(IS_I2C_TYPE(hperh->perh)); - - __LOCK(hperh); - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - - hperh->state = I2C_STATE_BUSY; - hperh->error_code = I2C_ERROR_NONE; - - do { - SET_BIT(hperh->perh->CON1, I2C_CON1_START); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_SB, RESET, timeout) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - hperh->perh->DATA = I2C_7BIT_ADD_WRITE(dev_addr); - tickstart = ald_get_tick(); - tmp1 = ald_i2c_get_flag_status(hperh, I2C_FLAG_ADDR); - tmp2 = ald_i2c_get_flag_status(hperh, I2C_FLAG_AF); - tmp3 = hperh->state; - - while ((tmp1 == RESET) && (tmp2 == RESET) && (tmp3 != I2C_STATE_TIMEOUT)) { - if ((timeout == 0) || ((ald_get_tick() - tickstart ) > timeout)) - hperh->state = I2C_STATE_TIMEOUT; - - tmp1 = ald_i2c_get_flag_status(hperh, I2C_FLAG_ADDR); - tmp2 = ald_i2c_get_flag_status(hperh, I2C_FLAG_AF); - tmp3 = hperh->state; - } - hperh->state = I2C_STATE_READY; - - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_ADDR) == SET) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - I2C_CLEAR_ADDRFLAG(hperh); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, - I2C_TIMEOUT_BUSY_FLAG) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return OK; - } - else { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - ald_i2c_clear_flag_status(hperh, I2C_FLAG_AF); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BUSY, SET, - I2C_TIMEOUT_BUSY_FLAG) != OK) { - __UNLOCK(hperh); - return TIMEOUT; - } - } - } while (I2C_Trials++ < trials); - - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return OK; -} -/** - * @} - */ - -/** @defgroup I2C_Public_Functions_Group3 Peripheral Control functions - * @brief Peripheral state and Errors functions - * -@verbatim - =============================================================================== - ##### Peripheral Control functions ##### - =============================================================================== - [..] - This subsection permits to get in run-time the status of the peripheral - and the data flow. - -@endverbatim - * @{ - */ - -/** - * @brief Enable/disable the specified i2c interrupts. - * @param hperh: Pointer to a i2c_handle_t structure. - * @param it: Specifies the i2c interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref i2c_interrupt_t. - * @param state: New state of the specified i2c interrupts. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_i2c_interrupt_config(i2c_handle_t *hperh, i2c_interrupt_t it, type_func_t state) -{ - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_IT_TYPE(it)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - SET_BIT((hperh)->perh->CON2, (it)); - else - CLEAR_BIT((hperh)->perh->CON2, (it)); - - return; -} - -/** - * @brief Get the status of I2C_SR register. - * @param hperh: Pointer to a i2c_handle_t structure. - * @param flag: Specifies the I2C status type. - * This parameter can be one of the @ref i2c_flag_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_i2c_get_flag_status(i2c_handle_t *hperh, i2c_flag_t flag) -{ - flag_status_t state = RESET; - - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_FLAG(flag)); - - if ((flag & 0xFF0000) == 0) { - if ((hperh->perh->STAT1 & flag) == flag) - state = SET; - } - else { - if ((hperh->perh->STAT2 & (flag >> 16)) == (flag >> 16)) - state = SET; - } - - return state; -} - -/** - * @brief Get the status of interrupt. - * @param hperh: Pointer to a i2c_handle_t structure. - * @param it: Specifies the i2c interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref i2c_interrupt_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_i2c_get_it_status(i2c_handle_t *hperh, i2c_interrupt_t it) -{ - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_IT_TYPE(it)); - - if ((hperh->perh->CON2 & it) == it) - return SET; - else - return RESET; -} - -/** - * @brief Clear the UART interrupt flag. - * @param hperh: Pointer to a uart_handle_t structure. - * @param flag: Specifies the UART interrupt flag. - * This parameter can be one of the @ref uart_flag_t. - * @retval None - */ -void ald_i2c_clear_flag_status(i2c_handle_t *hperh, i2c_flag_t flag) -{ - assert_param(IS_I2C_TYPE(hperh->perh)); - assert_param(IS_I2C_FLAG(flag)); - - if (flag > 65535) - return; - - hperh->perh->STAT1 = (hperh->perh->STAT1 & (uint32_t)(~flag)); - - return; - -} - -/** - * @brief Return the I2C handle state. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval ald_status_t state - */ -i2c_state_t ald_i2c_get_state(i2c_handle_t *hperh) -{ - return hperh->state; -} - -/** - * @brief Return the I2C error code. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval I2C Error Code - */ -uint32_t ald_i2c_get_error(i2c_handle_t *hperh) -{ - return hperh->error_code; -} -/** - * @} - */ - -/** @defgroup I2C_Public_Functions_Group4 IRQ Handler and Callbacks - * @{ - */ - -/** - * @brief This function handles I2C event interrupt request. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval None - */ -void ald_i2c_ev_irq_handler(i2c_handle_t *hperh) -{ - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_ADDR) == SET) - i2c_slave_addr(hperh); - - if ((ald_i2c_get_it_status(hperh, I2C_IT_BUF) == SET) && (ald_i2c_get_flag_status(hperh, I2C_FLAG_TXE) == SET)) { - if ((hperh->mode == I2C_MODE_MASTER) || (hperh->mode == I2C_MODE_MEM)) - i2c_master_send_txe(hperh); - else - i2c_slave_send_txe(hperh); - } - - if ((ald_i2c_get_it_status(hperh, I2C_IT_BUF) == SET) && (ald_i2c_get_flag_status(hperh, I2C_FLAG_RXNE) == SET)) { - if ((hperh->mode == I2C_MODE_MASTER) || (hperh->mode == I2C_MODE_MEM)) - i2c_master_recv_rxne(hperh); - else - i2c_slave_recv_rxne(hperh); - } - - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == SET) { - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_TRA) == SET) { - if ((hperh->mode == I2C_MODE_MASTER) || (hperh->mode == I2C_MODE_MEM)) - i2c_master_send_btf(hperh); - else - i2c_slave_send_btf(hperh); - } - else { - if ((hperh->mode == I2C_MODE_MASTER) || (hperh->mode == I2C_MODE_MEM)) - i2c_master_recv_btf(hperh); - else - i2c_slave_recv_btf(hperh); - } - } - - if ((hperh->mode == I2C_MODE_SLAVE) && (ald_i2c_get_flag_status(hperh, I2C_FLAG_STOPF) == SET)) - i2c_slave_stopf(hperh); -} - -/** - * @brief This function handles I2C error interrupt request. - * @param hperh: pointer to a i2c_handle_t structure that contains - * the configuration information for I2C module - * @retval NONE - */ -void ald_i2c_er_irq_handler(i2c_handle_t *hperh) -{ - uint32_t tmp1 = 0; - uint32_t tmp2 = 0; - uint32_t tmp3 = 0; - - tmp1 = ald_i2c_get_flag_status(hperh, I2C_FLAG_BERR); - tmp2 = ald_i2c_get_it_status(hperh, I2C_IT_ERR); - - /* I2C Bus error interrupt occurred */ - if ((tmp1 == SET) && (tmp2 == SET)) { - hperh->error_code |= I2C_ERROR_BERR; - ald_i2c_clear_flag_status(hperh, I2C_FLAG_BERR); - SET_BIT(hperh->perh->CON1, I2C_CON1_SRST); - } - - tmp1 = ald_i2c_get_flag_status(hperh, I2C_FLAG_ARLO); - tmp2 = ald_i2c_get_it_status(hperh, I2C_IT_ERR); - - /* I2C Arbitration Loss error interrupt occurred */ - if ((tmp1 == SET) && (tmp2 == SET)) { - hperh->error_code |= I2C_ERROR_ARLO; - ald_i2c_clear_flag_status(hperh, I2C_FLAG_ARLO); - } - - tmp1 = ald_i2c_get_flag_status(hperh, I2C_FLAG_AF); - tmp2 = ald_i2c_get_it_status(hperh, I2C_IT_ERR); - - /* I2C Acknowledge failure error interrupt occurred */ - if ((tmp1 == SET) && (tmp2 == SET)) { - tmp1 = hperh->mode; - tmp2 = hperh->xfer_count; - tmp3 = hperh->state; - if ((tmp1 == I2C_MODE_SLAVE) && (tmp2 == 0) && \ - (tmp3 == I2C_STATE_BUSY_TX)) { - i2c_slave_af(hperh); - } - else { - hperh->error_code |= I2C_ERROR_AF; - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - ald_i2c_clear_flag_status(hperh, I2C_FLAG_AF); - } - } - - tmp1 = ald_i2c_get_flag_status(hperh, I2C_FLAG_OVR); - tmp2 = ald_i2c_get_it_status(hperh, I2C_IT_ERR); - - /* I2C Over-Run/Under-Run interrupt occurred */ - if ((tmp1 == SET) && (tmp2 == SET)) { - hperh->error_code |= I2C_ERROR_OVR; - ald_i2c_clear_flag_status(hperh, I2C_FLAG_OVR); - } - - if (hperh->error_code != I2C_ERROR_NONE) { - hperh->state = I2C_STATE_READY; - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_POSAP); - if (hperh->error_callback) - hperh->error_callback(hperh); - } -} -/** - * @} - */ - -/** - * @} - */ - -/** @addtogroup I2C_Private_Functions - * @{ - */ - -/** - * @brief Handle TXE flag for Master Transmit mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_master_send_txe(i2c_handle_t *hperh) -{ - if (hperh->xfer_count == 0) { - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, DISABLE); - } - else { - hperh->perh->DATA = (*hperh->p_buff++); - hperh->xfer_count--; - } - - return OK; -} - -/** - * @brief Handle BTF flag for Master Transmit mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_master_send_btf(i2c_handle_t *hperh) -{ - if (hperh->xfer_count != 0) { - hperh->perh->DATA = (*hperh->p_buff++); - hperh->xfer_count--; - } - else { - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, DISABLE); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - if (hperh->mode == I2C_MODE_MEM) { - hperh->state = I2C_STATE_READY; - if (hperh->mem_tx_cplt_cbk) - hperh->mem_tx_cplt_cbk(hperh); - } - else { - hperh->state = I2C_STATE_READY; - if (hperh->master_tx_cplt_cbk) - hperh->master_tx_cplt_cbk(hperh); - } - } - return OK; -} - -/** - * @brief Handle RXNE flag for Master Receive mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_master_recv_rxne(i2c_handle_t *hperh) -{ - uint32_t tmp = 0; - - tmp = hperh->xfer_count; - if (tmp > 3) { - (*hperh->p_buff++) = hperh->perh->DATA; - hperh->xfer_count--; - } - else if ((tmp == 2) || (tmp == 3)) { - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, DISABLE); - } - else { - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, DISABLE); - (*hperh->p_buff++) = hperh->perh->DATA; - hperh->xfer_count--; - - if (hperh->mode == I2C_MODE_MEM) { - hperh->state = I2C_STATE_READY; - if (hperh->mem_rx_cplt_cbk) - hperh->mem_rx_cplt_cbk(hperh); - } - else { - hperh->state = I2C_STATE_READY; - if (hperh->master_rx_cplt_cbk) - hperh->master_rx_cplt_cbk(hperh); - } - } - return OK; -} - -/** - * @brief Handle BTF flag for Master Receive mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_master_recv_btf(i2c_handle_t *hperh) -{ - if (hperh->xfer_count == 3) { - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - (*hperh->p_buff++) = hperh->perh->DATA; - --hperh->xfer_count; - } - else if (hperh->xfer_count == 2) { - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, DISABLE); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - (*hperh->p_buff++) = hperh->perh->DATA; - --hperh->xfer_count; - - (*hperh->p_buff++) = hperh->perh->DATA; - --hperh->xfer_count; - - if (hperh->mode == I2C_MODE_MEM) { - hperh->state = I2C_STATE_READY; - if (hperh->mem_rx_cplt_cbk) - hperh->mem_rx_cplt_cbk(hperh); - } - else { - hperh->state = I2C_STATE_READY; - if (hperh->master_rx_cplt_cbk) - hperh->master_rx_cplt_cbk(hperh); - } - } - else { - (*hperh->p_buff++) = hperh->perh->DATA; - --hperh->xfer_count; - } - return OK; -} - -/** - * @brief Handle TXE flag for Slave Transmit mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_slave_send_txe(i2c_handle_t *hperh) -{ - if (hperh->xfer_count != 0) { - hperh->perh->DATA = (*hperh->p_buff++); - --hperh->xfer_count; - } - return OK; -} - -/** - * @brief Handle BTF flag for Slave Transmit mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_slave_send_btf(i2c_handle_t *hperh) -{ - if (hperh->xfer_count != 0) { - hperh->perh->DATA = (*hperh->p_buff++); - --hperh->xfer_count; - } - return OK; -} - -/** - * @brief Handle RXNE flag for Slave Receive mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_slave_recv_rxne(i2c_handle_t *hperh) -{ - if (hperh->xfer_count != 0) { - (*hperh->p_buff++) = hperh->perh->DATA; - --hperh->xfer_count; - } - return OK; -} - -/** - * @brief Handle BTF flag for Slave Receive mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_slave_recv_btf(i2c_handle_t *hperh) -{ - if (hperh->xfer_count != 0) { - (*hperh->p_buff++) = hperh->perh->DATA; - --hperh->xfer_count; - } - return OK; -} - -/** - * @brief Handle ADD flag for Slave - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_slave_addr(i2c_handle_t *hperh) -{ - I2C_CLEAR_ADDRFLAG(hperh); - - return OK; -} - -/** - * @brief Handle STOPF flag for Slave mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_slave_stopf(i2c_handle_t *hperh) -{ - if (hperh->xfer_count != 0) { - (*hperh->p_buff++) = hperh->perh->DATA; - --hperh->xfer_count; - } - - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, DISABLE); - __I2C_CLEAR_STOPFLAG(hperh); - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - hperh->state = I2C_STATE_READY; - - if (hperh->slave_rx_cplt_cbk) - hperh->slave_rx_cplt_cbk(hperh); - - return OK; -} - -/** - * @brief Handle Acknowledge Failed for Slave mode - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_slave_af(i2c_handle_t *hperh) -{ - ald_i2c_interrupt_config(hperh, I2C_IT_EVT, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_BUF, DISABLE); - ald_i2c_interrupt_config(hperh, I2C_IT_ERR, DISABLE); - ald_i2c_clear_flag_status(hperh, I2C_FLAG_AF); - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - hperh->state = I2C_STATE_READY; - - if (hperh->slave_tx_cplt_cbk) - hperh->slave_tx_cplt_cbk(hperh); - - return OK; -} - -/** - * @brief Master sends target device address followed by internal memory address for write request. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_master_req_write(i2c_handle_t *hperh, uint16_t dev_addr, uint32_t timeout) -{ - SET_BIT(hperh->perh->CON1, I2C_CON1_START); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_SB, RESET, timeout) != OK) - return TIMEOUT; - - if (hperh->init.addr_mode == I2C_ADDR_7BIT) { - hperh->perh->DATA = I2C_7BIT_ADD_WRITE(dev_addr); - } - else { - hperh->perh->DATA = I2C_10BIT_HEADER_WRITE(dev_addr); - - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADD10, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - return ERROR; - } - else { - return TIMEOUT; - } - } - - hperh->perh->DATA = I2C_10BIT_ADDRESS(dev_addr); - } - - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADDR, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - return ERROR; - else - return TIMEOUT; - } - return OK; -} - -/** - * @brief Master sends target device address followed by internal memory address for read request. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_master_req_read(i2c_handle_t *hperh, uint16_t dev_addr, uint32_t timeout) -{ - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - SET_BIT(hperh->perh->CON1, I2C_CON1_START); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_SB, RESET, timeout) != OK) - return TIMEOUT; - - if (hperh->init.addr_mode == I2C_ADDR_7BIT) { - hperh->perh->DATA = I2C_7BIT_ADD_READ(dev_addr); - } - else { - hperh->perh->DATA = I2C_10BIT_HEADER_WRITE(dev_addr); - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADD10, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - return ERROR; - else - return TIMEOUT; - } - - hperh->perh->DATA = I2C_10BIT_ADDRESS(dev_addr); - - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADDR, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - return ERROR; - else - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - SET_BIT(hperh->perh->CON1, I2C_CON1_START); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_SB, RESET, timeout) != OK) - return TIMEOUT; - - hperh->perh->DATA = I2C_10BIT_HEADER_READ(dev_addr); - } - - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADDR, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - return ERROR; - else - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - return OK; -} - -/** - * @brief Master sends target device address followed by internal memory address for write request. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_req_mem_write(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, uint16_t add_size, uint32_t timeout) -{ - SET_BIT(hperh->perh->CON1, I2C_CON1_START); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_SB, RESET, timeout) != OK) { - return TIMEOUT; - } - - hperh->perh->DATA = I2C_7BIT_ADD_WRITE(dev_addr); - - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADDR, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - return ERROR; - else - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - return ERROR; - } - else { - return TIMEOUT; - } - } - - if (add_size == I2C_MEMADD_SIZE_8BIT) { - hperh->perh->DATA = I2C_MEM_ADD_LSB(mem_addr); - } - else { - hperh->perh->DATA = I2C_MEM_ADD_MSB(mem_addr); - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - return ERROR; - } - else { - return TIMEOUT; - } - } - hperh->perh->DATA = I2C_MEM_ADD_LSB(mem_addr); - } - - return OK; -} - -/** - * @brief Master sends target device address followed by internal memory address for read request. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param dev_addr: Target device address - * @param mem_addr: Internal memory address - * @param add_size: size of internal memory address - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_req_mem_read(i2c_handle_t *hperh, uint16_t dev_addr, uint16_t mem_addr, uint16_t add_size, uint32_t timeout) -{ - SET_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - SET_BIT(hperh->perh->CON1, I2C_CON1_START); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_SB, RESET, timeout) != OK) - return TIMEOUT; - - hperh->perh->DATA = I2C_7BIT_ADD_WRITE(dev_addr); - - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADDR, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - return ERROR; - else - return TIMEOUT; - } - - I2C_CLEAR_ADDRFLAG(hperh); - - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - return ERROR; - } - else { - return TIMEOUT; - } - } - - if (add_size == I2C_MEMADD_SIZE_8BIT) { - hperh->perh->DATA = I2C_MEM_ADD_LSB(mem_addr); - } - else { - hperh->perh->DATA = I2C_MEM_ADD_MSB(mem_addr); - - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - return ERROR; - } - else { - return TIMEOUT; - } - } - hperh->perh->DATA = I2C_MEM_ADD_LSB(mem_addr); - } - - if (i2c_wait_txe_to_timeout(hperh, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - return ERROR; - } - else { - return TIMEOUT; - } - } - - SET_BIT(hperh->perh->CON1, I2C_CON1_START); - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_SB, RESET, timeout) != OK) - return TIMEOUT; - - hperh->perh->DATA = I2C_7BIT_ADD_READ(dev_addr); - - if (i2c_wait_master_addr_to_timeout(hperh, I2C_FLAG_ADDR, timeout) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - return ERROR; - else - return TIMEOUT; - } - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief DMA I2C master transmit process complete callback. - * @param argv: I2C handle - * @retval None - */ -static void i2c_dma_master_send_cplt(void *argv) -{ - i2c_handle_t* hperh = (i2c_handle_t*)argv; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, I2C_TIMEOUT_FLAG) != OK) - hperh->error_code |= I2C_ERROR_TIMEOUT; - - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - - hperh->xfer_count = 0; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - - if (hperh->error_code != I2C_ERROR_NONE) { - if (hperh->error_callback) - hperh->error_callback(hperh); - } - else { - if (hperh->master_tx_cplt_cbk) - hperh->master_tx_cplt_cbk(hperh); - } -} - -/** - * @brief DMA I2C slave transmit process complete callback. - * @param argv: I2C handle - * @retval None - */ -static void i2c_dma_slave_send_cplt(void *argv) -{ - i2c_handle_t* hperh = (i2c_handle_t*)argv; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_AF, RESET, I2C_TIMEOUT_FLAG) != OK) - hperh->error_code |= I2C_ERROR_TIMEOUT; - - ald_i2c_clear_flag_status(hperh, I2C_FLAG_AF); - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - - hperh->xfer_count = 0; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - - if (hperh->error_code != I2C_ERROR_NONE) { - if (hperh->error_callback) - hperh->error_callback(hperh); - } - else { - if (hperh->slave_tx_cplt_cbk) - hperh->slave_tx_cplt_cbk(hperh); - } -} - -/** - * @brief DMA I2C master receive process complete callback - * @param argv: I2C handle - * @retval None - */ -static void i2c_dma_master_recv_cplt(void *argv) -{ - i2c_handle_t* hperh = (i2c_handle_t*)argv; - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_LDMA); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - - hperh->xfer_count = 0; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - - if (hperh->error_code != I2C_ERROR_NONE) { - if (hperh->error_callback) - hperh->error_callback(hperh); - } - else { - if (hperh->master_rx_cplt_cbk) - hperh->master_rx_cplt_cbk(hperh); - } -} - -/** - * @brief DMA I2C slave receive process complete callback. - * @param argv: I2C handle - * @retval None - */ -static void i2c_dma_slave_recv_cplt(void *argv) -{ - i2c_handle_t* hperh = (i2c_handle_t*)argv; - - if (i2c_wait_stop_to_timeout(hperh, I2C_TIMEOUT_FLAG) != OK) { - if (hperh->error_code == I2C_ERROR_AF) - hperh->error_code |= I2C_ERROR_AF; - else - hperh->error_code |= I2C_ERROR_TIMEOUT; - } - - __I2C_CLEAR_STOPFLAG(hperh); - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - - hperh->xfer_count = 0; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - - if (hperh->error_code != I2C_ERROR_NONE) { - if (hperh->error_callback) - hperh->error_callback(hperh); - } - else { - if (hperh->slave_rx_cplt_cbk) - hperh->slave_rx_cplt_cbk(hperh); - } -} - -/** - * @brief DMA I2C Memory Write process complete callback - * @param argv: I2C handle - * @retval None - */ -static void i2c_dma_mem_send_cplt(void *argv) -{ - i2c_handle_t* hperh = (i2c_handle_t*)argv; - - if (i2c_wait_flag_to_timeout(hperh, I2C_FLAG_BTF, RESET, I2C_TIMEOUT_FLAG) != OK) - hperh->error_code |= I2C_ERROR_TIMEOUT; - - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - - hperh->xfer_count = 0; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - - if (hperh->error_code != I2C_ERROR_NONE) { - if (hperh->error_callback) - hperh->error_callback(hperh); - } - else { - if (hperh->mem_tx_cplt_cbk) - hperh->mem_tx_cplt_cbk(hperh); - } -} - -/** - * @brief DMA I2C Memory Read process complete callback - * @param argv: I2C handle - * @retval None - */ -static void i2c_dma_mem_recv_cplt(void *argv) -{ - i2c_handle_t* hperh = (i2c_handle_t*)argv; - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_LDMA); - CLEAR_BIT(hperh->perh->CON2, I2C_CON2_DMAEN); - - hperh->xfer_count = 0; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - - if (hperh->error_code != I2C_ERROR_NONE) { - if (hperh->error_callback) - hperh->error_callback(hperh); - } - else { - if (hperh->mem_rx_cplt_cbk) - hperh->mem_rx_cplt_cbk(hperh); - } -} -#endif - -/** - * @brief I2C Configuration Speed function - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param i2c_clk: PCLK frequency from RCC. - * @retval CCR Speed: Speed to set in I2C CCR Register - */ -static uint32_t i2c_configure_speed(i2c_handle_t *hperh, uint32_t i2c_clk) -{ - uint32_t tmp1 = 0; - - if (hperh->init.clk_speed <= I2C_STANDARD_MODE_MAX_CLK) { - tmp1 = (i2c_clk / (hperh->init.clk_speed << 1)); - if ((tmp1 & I2C_CKCFG_CLKSET) < 4 ) - return 4; - else - return tmp1; - } - else { - tmp1 = I2C_CKCFG_CLKMOD; - - if (hperh->init.duty == I2C_DUTYCYCLE_2) { - tmp1 |= (i2c_clk / (hperh->init.clk_speed * 3)) | I2C_DUTYCYCLE_2; - CLEAR_BIT(hperh->perh->CKCFG, I2C_CKCFG_CLKMOD_MSK); - } - else { - tmp1 |= (i2c_clk / (hperh->init.clk_speed * 25)) | I2C_DUTYCYCLE_16_9; - SET_BIT(hperh->perh->CKCFG, I2C_CKCFG_CLKMOD_MSK); - } - - if ((tmp1 & I2C_CKCFG_CLKSET) < 1 ) - return 1; - else - return tmp1; - } -} - -#ifdef ALD_DMA -/** - * @brief DMA I2C communication error callback. - * @param argv: I2C handle - * @retval None - */ -static void i2c_dma_error(void *argv) -{ - i2c_handle_t* hperh = (i2c_handle_t*)argv; - - CLEAR_BIT(hperh->perh->CON1, I2C_CON1_ACKEN); - - hperh->xfer_count = 0; - hperh->state = I2C_STATE_READY; - hperh->mode = I2C_MODE_NONE; - hperh->error_code |= I2C_ERROR_DMA; - - if (hperh->error_callback) - hperh->error_callback(hperh); -} -#endif - -/** - * @brief This function handles I2C Communication timeout. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param flag: specifies the I2C flag to check. - * @param status: The new flag status (SET or RESET). - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_wait_flag_to_timeout(i2c_handle_t *hperh, i2c_flag_t flag, flag_status_t status, uint32_t timeout) -{ - uint32_t tickstart = 0; - - tickstart = ald_get_tick(); - - if (status == RESET) { - while (ald_i2c_get_flag_status(hperh, flag) == RESET) { - if ((timeout == 0) || ((ald_get_tick() - tickstart ) > timeout)) { - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - } - } - else { - while (ald_i2c_get_flag_status(hperh, flag) != RESET) { - if ((timeout == 0) || ((ald_get_tick() - tickstart ) > timeout)) { - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - } - } - return OK; -} - -/** - * @brief This function handles I2C Communication timeout for Master addressing phase. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param flag: specifies the I2C flag to check. - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_wait_master_addr_to_timeout(i2c_handle_t *hperh, i2c_flag_t flag, uint32_t timeout) -{ - uint32_t tickstart = 0; - - tickstart = ald_get_tick(); - while (ald_i2c_get_flag_status(hperh, flag) == RESET) { - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_AF) == SET) { - SET_BIT(hperh->perh->CON1, I2C_CON1_STOP); - ald_i2c_clear_flag_status(hperh, I2C_FLAG_AF); - - hperh->error_code = I2C_ERROR_AF; - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return ERROR; - } - - if (timeout != I2C_MAX_DELAY) { - if ((timeout == 0) || ((ald_get_tick() - tickstart ) > timeout)) { - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - } - } - return OK; -} - -/** - * @brief This function handles I2C Communication timeout for specific usage of TXE flag. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_wait_txe_to_timeout(i2c_handle_t *hperh, uint32_t timeout) -{ - uint32_t tickstart = ald_get_tick(); - - while (ald_i2c_get_flag_status(hperh, I2C_FLAG_TXE) == RESET) { - if (i2c_is_ack_failed(hperh) != OK) - return ERROR; - - if (timeout != I2C_MAX_DELAY) { - if ((timeout == 0) || ((ald_get_tick() - tickstart) > timeout)) { - hperh->error_code |= I2C_ERROR_TIMEOUT; - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - } - } - return OK; -} - -/** - * @brief This function handles I2C Communication timeout for specific usage of BTF flag. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_wait_btf_to_timeout(i2c_handle_t *hperh, uint32_t timeout) -{ - uint32_t tickstart = ald_get_tick(); - - while (ald_i2c_get_flag_status(hperh, I2C_FLAG_BTF) == RESET) { - if (i2c_is_ack_failed(hperh) != OK) { - return ERROR; - } - - if (timeout != I2C_MAX_DELAY) { - if ((timeout == 0) || ((ald_get_tick() - tickstart) > timeout)) { - hperh->error_code |= I2C_ERROR_TIMEOUT; - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - } - } - return OK; -} - -/** - * @brief This function handles I2C Communication timeout for specific usage of STOP flag. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_wait_stop_to_timeout(i2c_handle_t *hperh, uint32_t timeout) -{ - uint32_t tickstart = 0x00; - tickstart = ald_get_tick(); - - while (ald_i2c_get_flag_status(hperh, I2C_FLAG_STOPF) == RESET) { - if (i2c_is_ack_failed(hperh) != OK) - return ERROR; - - if ((timeout == 0) || ((ald_get_tick() - tickstart) > timeout)) { - hperh->error_code |= I2C_ERROR_TIMEOUT; - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - } - return OK; -} - -/** - * @brief This function handles I2C Communication timeout for specific usage of RXNE flag. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_wait_rxne_to_timeout(i2c_handle_t *hperh, uint32_t timeout) -{ - uint32_t tickstart = 0x00; - tickstart = ald_get_tick(); - - while (ald_i2c_get_flag_status(hperh, I2C_FLAG_RXNE) == RESET) { - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_STOPF) == SET) { - ald_i2c_clear_flag_status(hperh, I2C_FLAG_STOPF); - hperh->error_code = I2C_ERROR_NONE; - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return ERROR; - } - - if ((timeout == 0) || ((ald_get_tick() - tickstart) > timeout)) { - hperh->error_code |= I2C_ERROR_TIMEOUT; - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - } - return OK; -} - -/** - * @brief This function handles Acknowledge failed detection during an I2C Communication. - * @param hperh: Pointer to a i2c_handle_t structure that contains - * the configuration information for the specified I2C. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t i2c_is_ack_failed(i2c_handle_t *hperh) -{ - if (ald_i2c_get_flag_status(hperh, I2C_FLAG_AF) == SET) { - ald_i2c_clear_flag_status(hperh, I2C_FLAG_AF); - hperh->error_code = I2C_ERROR_AF; - hperh->state = I2C_STATE_READY; - __UNLOCK(hperh); - - return ERROR; - } - - return OK; -} -/** - * @} - */ - -#endif /* ALD_I2C */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_iap.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_iap.c deleted file mode 100644 index ccb9b5170b..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_iap.c +++ /dev/null @@ -1,149 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_iap.c - * @brief IAP module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_iap.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup IAP IAP - * @brief IAP module driver - * @{ - */ -#ifdef ALD_IAP - - -/** @defgroup IAP_Public_Functions IAP Public Functions - * - * @verbatim - ============================================================================== - ##### Erase and Program flash functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Erase flash. - (+) Program flash. - - @endverbatim - * @{ - */ - -/** - * @brief Erases a specified page. - * @param addr: The beginning address of the page to be erased. - * @retval The result: - * - 0: SUCCESS - * - 1: ERROR - */ -uint32_t ald_iap_erase_page(uint32_t addr) -{ - uint32_t status; - IAP_PE iap_pe = (IAP_PE)(*(uint32_t *)IAP_PE_ADDR); - - __disable_irq(); - status = (*iap_pe)(addr); - __enable_irq(); - - return !status; -} - -/** - * @brief Programs a word at a specified address. - * @param addr: Specifies the address to be programmed. - * Bit0-1 must be zero. - * @param data: Specifies the data to be programmed. - * @retval The result: - * - 0: SUCCESS - * - 1: ERROR - */ -uint32_t ald_iap_program_word(uint32_t addr, uint32_t data) -{ - uint32_t status; - IAP_WP iap_wp = (IAP_WP)(*(uint32_t *)IAP_WP_ADDR); - - if (addr & 0x3) - return 1; - - __disable_irq(); - status = (*iap_wp)(addr, data); - __enable_irq(); - - return !status; -} - -/** - * @brief Programs double words at a specified address. - * @param addr: Specifies the address to be programmed. - * Bit0-1 must be zero. - * @param data_l: Specifies the LSB data to be programmed. - * @param data_h: Specifies the MSB data to be programmed. - * @retval The result: - * - 0: SUCCESS - * - 1: ERROR - */ -uint32_t ald_iap_program_dword(uint32_t addr, uint32_t data_l, uint32_t data_h) -{ - uint32_t status; - IAP_DWP iap_dwp = (IAP_DWP)(*(uint32_t *)IAP_DWP_ADDR); - - if (addr & 0x3) - return 1; - - __disable_irq(); - status = (*iap_dwp)(addr, data_l, data_h); - __enable_irq(); - - return !status; -} - -/** - * @brief Programs datas at a specified address. - * @param addr: Specifies the address to be programmed. - * Bit0-1 must be zero. - * @param data: Specifies the data to be programmed. - * @param len: Specifies the data length to be programmed. - * Bit0-1 must be zero. - * @param erase: Erase page flag before programming. - * @retval The result: - * - 0: SUCCESS - * - 1: ERROR - */ -uint32_t ald_iap_program_words(uint32_t addr, uint8_t *data, uint32_t len, uint32_t erase) -{ - uint32_t status; - IAP_WSP iap_wsp = (IAP_WSP)(*(uint32_t *)IAP_WSP_ADDR); - - if ((addr & 0x3) || (len & 0x3)) - return 1; - - __disable_irq(); - status = (*iap_wsp)(addr, data, len, erase); - __enable_irq(); - - return !status; -} -/** - * @} - */ -#endif /* ALD_IAP */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lcd.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lcd.c deleted file mode 100644 index b4d955a98b..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lcd.c +++ /dev/null @@ -1,345 +0,0 @@ - /** - ********************************************************************************* - * - * @file ald_lcd.c - * @brief LCD module driver. - * - * @version V1.0 - * @date 29 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_lcd.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup LCD LCD - * @brief LCD module library - * @{ - */ -#ifdef ALD_LCD - -/** @defgroup LCD_Public_Functions LCD Public Functions - * @{ - */ - -/** @defgroup LCD_Public_Functions_Group1 Initialize and Enable functions - * @brief Initialize and Enable Functions - * @{ - */ - -/** - * @brief Initializes the LCD Peripheral according to the specified parameters. - * @note This function can be used only when the LCD is disabled. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lcd_init(lcd_handle_t *hperh) -{ - uint16_t delay = 0; - - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_VCHPS_TYPE(hperh->init.lcd_vchps)); - assert_param(IS_LCD_VSEL_TYPE(hperh->init.lcd_vsel)); - assert_param(IS_LCD_FUNC_TYPE(hperh->init.lcd_vbufld)); - assert_param(IS_LCD_FUNC_TYPE(hperh->init.lcd_vbufhd)); - assert_param(IS_LCD_LEVEL_TYPE(hperh->init.lcd_dsld)); - assert_param(IS_LCD_LEVEL_TYPE(hperh->init.lcd_dshd)); - assert_param(IS_LCD_RES_TYPE(hperh->init.lcd_resld)); - assert_param(IS_LCD_RES_TYPE(hperh->init.lcd_reshd)); - assert_param(IS_LCD_BIAS_TYPE(hperh->init.lcd_bias)); - assert_param(IS_LCD_DUTY_TYPE(hperh->init.lcd_duty)); - assert_param(IS_LCD_WFS_TYPE(hperh->init.lcd_wfs)); - assert_param(IS_LCD_PRS_TYPE(hperh->init.lcd_prs)); - assert_param(IS_LCD_DIV_TYPE(hperh->init.lcd_div)); - assert_param(IS_LCD_DEAD_TYPE(hperh->init.lcd_dead)); - assert_param(IS_LCD_PON_TYPE(hperh->init.lcd_pon)); - assert_param(IS_LCD_VGS_TYPE(hperh->init.lcd_vgs)); - - __LOCK(hperh); - - ald_cmu_lcd_clock_select(hperh->init.clock); - - MODIFY_REG(hperh->perh->FCR, LCD_FCR_WFS_MSK, hperh->init.lcd_wfs << LCD_FCR_WFS_POS); - MODIFY_REG(hperh->perh->FCR, LCD_FCR_PRS_MSK, hperh->init.lcd_prs << LCD_FCR_PRS_POSS); - for (delay = 0; delay < 3000; delay++); - MODIFY_REG(hperh->perh->FCR, LCD_FCR_DIV_MSK, hperh->init.lcd_div << LCD_FCR_DIV_POSS); - MODIFY_REG(hperh->perh->FCR, LCD_FCR_DEAD_MSK, hperh->init.lcd_dead << LCD_FCR_DEAD_POSS); - MODIFY_REG(hperh->perh->FCR, LCD_FCR_PON_MSK, hperh->init.lcd_pon << LCD_FCR_PON_POSS); - MODIFY_REG(hperh->perh->FCR, LCD_FCR_VGS_MSK, hperh->init.lcd_vgs << LCD_FCR_VGS_POSS); - - MODIFY_REG(hperh->perh->CR, LCD_CR_DUTY_MSK, hperh->init.lcd_duty << LCD_CR_DUTY_POSS); - MODIFY_REG(hperh->perh->CR, LCD_CR_BIAS_MSK, hperh->init.lcd_bias << LCD_CR_BIAS_POSS); - MODIFY_REG(hperh->perh->CR, LCD_CR_VBUFHD_MSK, hperh->init.lcd_vbufhd << LCD_CR_VBUFHD_POS); - MODIFY_REG(hperh->perh->CR, LCD_CR_VBUFLD_MSK, hperh->init.lcd_vbufld << LCD_CR_VBUFLD_POS); - MODIFY_REG(hperh->perh->CR, LCD_CR_DSHD_MSK, hperh->init.lcd_dshd << LCD_CR_DSHD_POSS); - MODIFY_REG(hperh->perh->CR, LCD_CR_DSLD_MSK, hperh->init.lcd_dsld << LCD_CR_DSLD_POSS); - MODIFY_REG(hperh->perh->CR, LCD_CR_RESHD_MSK, hperh->init.lcd_reshd << LCD_CR_RESHD_POSS); - MODIFY_REG(hperh->perh->CR, LCD_CR_RESLD_MSK, hperh->init.lcd_resld << LCD_CR_RESLD_POSS); - MODIFY_REG(hperh->perh->CR, LCD_CR_VSEL_MSK, hperh->init.lcd_vsel << LCD_CR_VSEL_POSS); - MODIFY_REG(hperh->perh->CR, LCD_CR_VCHPS_MSK, hperh->init.lcd_vchps << LCD_CR_VCHPS_POSS); - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Enables or disables the LCD controller. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param state: This parameter can be: ENABLE or DISABLE. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lcd_cmd(lcd_handle_t *hperh, type_func_t state) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_FUNC_STATE(state)); - - __LOCK(hperh); - - MODIFY_REG(hperh->perh->CR, LCD_CR_OE_MSK, state << LCD_CR_OE_POS); - MODIFY_REG(hperh->perh->CR, LCD_CR_EN_MSK, state << LCD_CR_EN_POS); - - __UNLOCK(hperh); - return OK; -} -/** - * @} - */ - -/** @defgroup LCD_Public_Functions_Group2 Config output functions - * @brief Config output and blink functions - * @{ - */ - -/** - * @brief Configures the LCD blink mode and blink frequency. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param blink_mode: Specifies the LCD blink mode. - * @param blink_freq: Specifies the LCD blink frequency. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lcd_blink_config(lcd_handle_t *hperh, lcd_blink_t blink_mode, lcd_blfrq_t blink_freq) -{ - uint16_t delay = 0; - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_BLINK_MODE(blink_mode)); - assert_param(IS_LCD_BLFRQ_TYPE(blink_freq)); - __LOCK(hperh); - - MODIFY_REG(hperh->perh->FCR, LCD_FCR_BLMOD_MSK, blink_mode << LCD_FCR_BLMOD_POSS); - for (delay = 0; delay < 3000; delay++); - MODIFY_REG(hperh->perh->FCR, LCD_FCR_BLFRQ_MSK, blink_freq << LCD_FCR_BLFRQ_POSS); - - __UNLOCK(hperh); - return OK; - } - -/** - * @brief Control segment port enable or disable - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param seg: Specifies the LCD segment index - * @param seg_data: Specifies LCD segment data to be written to control segment output enable. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lcd_write_seg(lcd_handle_t *hperh, lcd_seg_t seg, uint32_t seg_data) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_SEG_TYPE(seg)); - __LOCK(hperh); - - if (seg == SEG_0_TO_31) - WRITE_REG(hperh->perh->SEGCR0, seg_data); - else - WRITE_REG(hperh->perh->SEGCR1, seg_data); - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Writes a word in the specific LCD buffer to determine display. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param buf: Specifies the LCD buffer index. - * @param buf_data: Specifies LCD buffer data to be written to control display. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lcd_write(lcd_handle_t *hperh, uint8_t buf, uint32_t buf_data) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_BUFFER_TYPE(buf)); - - __LOCK(hperh); - WRITE_REG(hperh->perh->BUF[buf], buf_data); - __UNLOCK(hperh); - - return OK; -} -/** - * @} - */ - -/** @defgroup LCD_Public_Functions_Group3 Peripheral State functions - * @brief LCD State functions - * @{ - */ - -/** - * @brief Checks whether the specified LCD flag is set or not. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param lcd_status: Specifies the flag to check. - * @retval The new state of LCD_STATUS - */ -uint32_t ald_lcd_get_status(lcd_handle_t *hperh, lcd_status_t lcd_status) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_STATUS_TYPE(lcd_status)); - - if (lcd_status == LCD_STATUS_ALL) - return hperh->perh->SR; - else - return hperh->perh->SR & lcd_status ? 1 : 0; -} -/** - * @} - */ - -/** @defgroup LCD_Public_Functions_Group4 Interrupt functions - * @brief LCD Interrupt functions - * @{ - */ - -/** - * @brief Enable or disable the specified interrupt - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param it: Specifies the interrupt type to be enabled or disabled - * @arg @ref LCD_IT_SOF Start of frame interrupt enable - * @arg @ref LCD_IT_UDD Update display done interrupt - * @param state: New state of the specified interrupt. - * This parameter can be: ENABLE or DISABLE - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lcd_interrupt_config(lcd_handle_t *hperh, lcd_it_t it, type_func_t state) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_IT_TYPE(it)); - assert_param(IS_FUNC_STATE(state)); - __LOCK(hperh); - - if (state) - SET_BIT(hperh->perh->IE, it); - else - CLEAR_BIT(hperh->perh->IE, it); - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Checks whether the specified interrupt has set or not. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param it: Specifies the interrupt type to check - * This parameter can be one of the following values: - * @arg @ref LCD_IT_SOF Start of frame interrupt enable - * @arg @ref LCD_IT_UDD Update display done interrupt - * @retval The new state of the LCD_IT - */ -flag_status_t ald_lcd_get_it_status(lcd_handle_t *hperh, lcd_it_t it) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_IT_TYPE(it)); - - return hperh->perh->IE & it ? SET : RESET; -} - -/** - * @brief Checks whether the specified interrupt has occurred or not. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param flag: Specifies the interrupt type to check - * This parameter can be one of the following values: - * @arg @ref LCD_FLAG_SOF Start of frame interrupt enable - * @arg @ref LCD_FLAG_UDD Update display done interrupt - * @retval The new state of the LCD_IT - */ -it_status_t ald_lcd_get_flag_status(lcd_handle_t *hperh, lcd_flag_t flag) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_FLAG_TYPE(flag)); - - return hperh->perh->IF & flag ? SET : RESET; -} - -/** - * @brief Clear interrupt state flag - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @param flag: Specifies the interrupt type to clear - * This parameter can be one of the following values: - * @arg @ref LCD_FLAG_SOF Start of frame interrupt enable - * @arg @ref LCD_FLAG_UDD Update display done interrupt - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lcd_clear_flag_status(lcd_handle_t *hperh, lcd_flag_t flag) -{ - assert_param(IS_LCD_PERH_TYPE(hperh->perh)); - assert_param(IS_LCD_FLAG_TYPE(flag)); - - __LOCK(hperh); - WRITE_REG(hperh->perh->IFCR, flag); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief This function handles LCD event interrupt request. - * @param hperh: Pointer to a lcd_handle_t structure that contains - * the configuration information for the specified LCD. - * @retval None - */ -void ald_lcd_irq_handler(lcd_handle_t *hperh) -{ - if (ald_lcd_get_flag_status(hperh, LCD_FLAG_UDD)) { - ald_lcd_clear_flag_status(hperh, LCD_FLAG_UDD); - - if (hperh->display_cplt_cbk) - hperh->display_cplt_cbk(hperh); - } - - if (ald_lcd_get_flag_status(hperh, LCD_FLAG_SOF)) { - ald_lcd_clear_flag_status(hperh, LCD_FLAG_SOF); - - if (hperh->frame_start_cbk) - hperh->frame_start_cbk(hperh); - } - - return; -} -/** - * @} - */ -/** - * @} - */ -#endif /* ALD_LCD */ -/** - * @} - */ -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lptim.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lptim.c deleted file mode 100644 index 5b615f0b77..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lptim.c +++ /dev/null @@ -1,801 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_lptim.c - * @brief LPTIM module driver. - * This is the common part of the LPTIM initialization - * - * @version V1.0 - * @date 09 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_lptim.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup LPTIM LPTIM - * @brief LPTIM module driver - * @{ - */ -#ifdef ALD_LPTIM - -/** @defgroup LPTIM_Public_Functions LPTIM Public Functions - * @{ - */ - -/** @defgroup LPTIM_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * - * @{ - */ -/** - * @brief Reset the LPTIM peripheral. - * @param hperh: Pointer to a lptim_handle_t. - * @retval None - */ -void ald_lptim_reset(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - hperh->state = LPTIM_STATE_BUSY; - LPTIM_DISABLE(hperh); - hperh->state = LPTIM_STATE_RESET; - __UNLOCK(hperh); - - return; -} - -/** - * @brief Configure the LPTIM trigger mode according to the specified parameters in - * the lptim_trigger_init_t. - * @param hperh: Pointer to a lptim_handle_t. - * @param config: Pointer to a lptim_trigger_init_t. - * @retval None - */ -void ald_lptim_trigger_config(lptim_handle_t *hperh, lptim_trigger_init_t *config) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_TRIGEN(config->mode)); - assert_param(IS_LPTIM_TRIGSEL(config->sel)); - - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_TRIGEN_MSK, (config->mode) << LP16T_CON0_TRIGEN_POSS); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_TRIGSEL_MSK, (config->sel) << LP16T_CON0_TRIGSEL_POSS); - - return; -} - -/** - * @brief Configure the LPTIM clock source according to the specified parameters in - * the lptim_clock_source_init_t. - * @param hperh: Pointer to a lptim_handle_t. - * @param config: Pointer to a lptim_clock_source_init_t. - * @retval None - */ -void ald_lptim_clock_source_config(lptim_handle_t *hperh, lptim_clock_source_init_t *config) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_CKSEL(config->sel)); - assert_param(IS_LPTIM_CKPOL(config->polarity)); - - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_CKSEL_MSK, (config->sel) << LP16T_CON0_CKSEL_POS); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_CKPOL_MSK, (config->polarity) << LP16T_CON0_CKPOL_POS); - - return; -} - -/** - * @brief Configure the LPTIM trigger filter parameter according to - * the specified parameters in the lptim_trgflt_t. - * @param hperh: Pointer to a lptim_handle_t. - * @param flt: Pointer to a lptim_trgflt_t. - * @retval None - */ -void ald_lptim_trigger_filter_config(lptim_handle_t *hperh, lptim_trgflt_t flt) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_TRGFLT(flt)); - - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_TRGFLT_MSK, flt << LP16T_CON0_TRGFLT_POSS); - - return; -} - -/** - * @brief Configure the LPTIM clock filter parameter according to - * the specified parameters in the lptim_ckflt_t. - * @param hperh: Pointer to a lptim_handle_t. - * @param flt: Pointer to a lptim_ckflt_t. - * @retval None - */ -void ald_lptim_clock_filter_config(lptim_handle_t *hperh, lptim_ckflt_t flt) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_CKFLT(flt)); - - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_CKFLT_MSK, flt << LP16T_CON0_CKFLT_POSS); - - return; -} -/** - * @} - */ - -/** @defgroup LPTIM_Public_Functions_Group2 LPTIM base functions - * @brief LPTIM base functions - * - * @verbatim - ============================================================================== - ##### Low Pow Time Base functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize the LPTIM . - (+) Start the LPTIM. - (+) Stop the LPTIM. - (+) Start the LPTIM and enable interrupt. - (+) Stop the LPTIM and disable interrupt. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIM according to the specified - * parameters in the tim_handle_t. - * @param hperh: LPTIM handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lptim_base_init(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_PRESC(hperh->init.psc)); - - __LOCK(hperh); - hperh->state = LPTIM_STATE_BUSY; - - ald_cmu_lptim0_clock_select(hperh->init.clock); - - WRITE_REG(hperh->perh->UPDATE, 1); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_WAVE_MSK, LPTIM_WAVE_NONE << LP16T_CON0_WAVE_POSS); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_PRESC_MSK, (hperh->init.psc) << LP16T_CON0_PRESC_POSS); - WRITE_REG(hperh->perh->ARR, hperh->init.arr); - WRITE_REG(hperh->perh->CMP, hperh->init.cmp); - WRITE_REG(hperh->perh->UPDATE, 0); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_ARRWBSY_MSK)); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CMPWBSY_MSK)); - - hperh->state = LPTIM_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Starts the LPTIM. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_base_start(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_base_stop(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Starts the LPTIM in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_base_start_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_ARRMAT, ENABLE); - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM Output toggle in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_base_stop_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_ARRMAT, DISABLE); - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} -/** - * @} - */ - -/** @defgroup LPTIM_Public_Functions_Group3 LPTIM output toggle functions - * @brief LPTIM output toggle functions - * - * @verbatim - ============================================================================== - ##### Time Output Compare functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize the LPTIM Output Toggle. - (+) Start the LPTIM Output Toggle. - (+) Stop the LPTIM Output Toggle. - (+) Start the LPTIM Output Toggle and enable interrupt. - (+) Stop the LPTIM Output Toggle and disable interrupt. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIM Output toggle according to the specified - * parameters in the tim_handle_t. - * @param hperh: LPTIM handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lptim_toggle_init(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_PRESC(hperh->init.psc)); - - __LOCK(hperh); - hperh->state = LPTIM_STATE_BUSY; - - ald_cmu_lptim0_clock_select(hperh->init.clock); - - WRITE_REG(hperh->perh->UPDATE, 1); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_WAVE_MSK, LPTIM_WAVE_TOGGLE << LP16T_CON0_WAVE_POSS); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_PRESC_MSK, (hperh->init.psc) << LP16T_CON0_PRESC_POSS); - WRITE_REG(hperh->perh->ARR, hperh->init.arr); - WRITE_REG(hperh->perh->CMP, hperh->init.cmp); - WRITE_REG(hperh->perh->UPDATE, 0); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_ARRWBSY_MSK)); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CMPWBSY_MSK)); - - hperh->state = LPTIM_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Starts the LPTIM Output toggle. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_toggle_start(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM Output toggle. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_toggle_stop(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Starts the LPTIM Output toggle in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_toggle_start_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_ARRMAT, ENABLE); - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM Output toggle in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_toggle_stop_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_ARRMAT, DISABLE); - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} -/** - * @} - */ - -/** @defgroup LPTIM_Public_Functions_Group4 LPTIM output pulse functions - * @brief LPTIM output pulse functions - * - * @verbatim - ============================================================================== - ##### Time Output Compare functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize the LPTIM Output pulse. - (+) Start the LPTIM Output pulse. - (+) Stop the LPTIM Output pulse. - (+) Start the LPTIM Output pulse and enable interrupt. - (+) Stop the LPTIM Output pulse and disable interrupt. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIM Output pulse according to the specified - * parameters in the tim_handle_t. - * @param hperh: LPTIM handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lptim_pulse_init(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_PRESC(hperh->init.psc)); - - __LOCK(hperh); - hperh->state = LPTIM_STATE_BUSY; - ald_cmu_lptim0_clock_select(hperh->init.clock); - - WRITE_REG(hperh->perh->UPDATE, 1); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_WAVE_MSK, LPTIM_WAVE_PULSE << LP16T_CON0_WAVE_POSS); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_PRESC_MSK, (hperh->init.psc) << LP16T_CON0_PRESC_POSS); - WRITE_REG(hperh->perh->ARR, hperh->init.arr); - WRITE_REG(hperh->perh->CMP, hperh->init.cmp); - WRITE_REG(hperh->perh->UPDATE, 0); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_ARRWBSY_MSK)); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CMPWBSY_MSK)); - - hperh->state = LPTIM_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Starts the LPTIM Output pulse. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pulse_start(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM Output pulse. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pulse_stop(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - return; -} - -/** - * @brief Starts the LPTIM Output pulse in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pulse_start_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_ARRMAT, ENABLE); - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM Output pulse in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pulse_stop_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_ARRMAT, DISABLE); - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - return; -} -/** - * @} - */ - -/** @defgroup LPTIM_Public_Functions_Group5 LPTIM output pwm functions - * @brief LPTIM output pwm functions - * - * @verbatim - ============================================================================== - ##### Time Output Compare functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize the LPTIM Output pwm. - (+) Start the LPTIM Output pwm. - (+) Stop the LPTIM Output pwm. - (+) Start the LPTIM Output pwm and enable interrupt. - (+) Stop the LPTIM Output pwm and disable interrupt. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIM Output pwm according to the specified - * parameters in the tim_handle_t. - * @param hperh: LPTIM handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lptim_pwm_init(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_PRESC(hperh->init.psc)); - - __LOCK(hperh); - hperh->state = LPTIM_STATE_BUSY; - - WRITE_REG(hperh->perh->UPDATE, 1); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_WAVE_MSK, LPTIM_WAVE_PWM << LP16T_CON0_WAVE_POSS); - MODIFY_REG(hperh->perh->CON0, LP16T_CON0_PRESC_MSK, (hperh->init.psc) << LP16T_CON0_PRESC_POSS); - WRITE_REG(hperh->perh->ARR, hperh->init.arr); - WRITE_REG(hperh->perh->CMP, hperh->init.cmp); - WRITE_REG(hperh->perh->UPDATE, 0); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_ARRWBSY_MSK)); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CMPWBSY_MSK)); - - hperh->state = LPTIM_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Starts the LPTIM Output pwm. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pwm_start(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM Output pwm. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pwm_stop(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - return; -} - -/** - * @brief Starts the LPTIM Output pwm in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pwm_start_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_MODE(hperh->init.mode)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_CMPMAT, ENABLE); - LPTIM_ENABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) - LPTIM_CNTSTART(hperh); - else - LPTIM_SNGSTART(hperh); - - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - return; -} - -/** - * @brief Stops the LPTIM Output pwm in interrupt mode. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_pwm_stop_by_it(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - ald_lptim_interrupt_config(hperh, LPTIM_IT_CMPMAT, DISABLE); - LPTIM_DISABLE(hperh); - while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); - - return; -} -/** - * @} - */ - - -/** @defgroup LPTIM_Public_Functions_Group6 Control functions - * @brief LPTIM Control functions - * - * @{ - */ -/** - * @brief This function handles LPTIM interrupts requests. - * @param hperh: LPTIM handle - * @retval None - */ -void ald_lptim_irq_handler(lptim_handle_t *hperh) -{ - assert_param(IS_LPTIM(hperh->perh)); - - /* Output compare event */ - if (((ald_lptim_get_it_status(hperh, LPTIM_IT_CMPMAT)) != RESET) && - ((ald_lptim_get_flag_status(hperh, LPTIM_FLAG_CMPMAT)) != RESET)) { - ald_lptim_clear_flag_status(hperh, LPTIM_FLAG_CMPMAT); - - if (hperh->cmp_cbk) - hperh->cmp_cbk(hperh); - } - - /* Output update event */ - if (((ald_lptim_get_it_status(hperh, LPTIM_IT_ARRMAT)) != RESET) && - ((ald_lptim_get_flag_status(hperh, LPTIM_FLAG_ARRMAT)) != RESET)) { - ald_lptim_clear_flag_status(hperh, LPTIM_FLAG_ARRMAT); - - if (hperh->update_cbk) - hperh->update_cbk(hperh); - } - - /* Trigger event */ - if (((ald_lptim_get_it_status(hperh, LPTIM_IT_EXTTRIG)) != RESET) && - ((ald_lptim_get_flag_status(hperh, LPTIM_FLAG_EXTTRIG)) != RESET)) { - ald_lptim_clear_flag_status(hperh, LPTIM_FLAG_EXTTRIG); - - if (hperh->trig_cbk) - hperh->trig_cbk(hperh); - } - - return; -} - -/** - * @brief Enables or disables the specified LPTIM interrupts. - * @param hperh: Pointer to a lptim_handle_t structure that contains - * the configuration information for the specified LPTIM module. - * @param it: Specifies the SPI interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref lptim_it_t. - * @param state: New status - * - ENABLE - * - DISABLE - * @retval None - */ -void ald_lptim_interrupt_config(lptim_handle_t *hperh, lptim_it_t it, type_func_t state) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_IT(it)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - SET_BIT(hperh->perh->IER, (uint32_t)it); - else - CLEAR_BIT(hperh->perh->IER, (uint32_t)it); - return; -} - -/** - * @brief Checks whether the specified LPTIM interrupt has occurred or not. - * @param hperh: Pointer to a lptim_handle_t structure that contains - * the configuration information for the specified LPTIM module. - * @param it: Specifies the LPTIM interrupt source to check. - * This parameter can be one of the @ref lptim_it_t. - * @retval Status - * - SET - * - RESET - */ -it_status_t ald_lptim_get_it_status(lptim_handle_t *hperh, lptim_it_t it) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_IT(it)); - - if (READ_BIT(hperh->perh->IER, it)) - return SET; - - return RESET; -} - -/** @brief Check whether the specified LPTIM flag is set or not. - * @param hperh: Pointer to a lptim_handle_t structure that contains - * the configuration information for the specified LPTIM module. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref lptim_flag_t. - * @retval Status - * - SET - * - RESET - */ -flag_status_t ald_lptim_get_flag_status(lptim_handle_t *hperh, lptim_flag_t flag) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_FLAG(flag)); - - if (READ_BIT(hperh->perh->ISR, flag)) - return SET; - - return RESET; -} - -/** @brief Clear the specified LPTIM pending flags. - * @param hperh: Pointer to a lptim_handle_t structure that contains - * the configuration information for the specified LPTIM module. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref lptim_flag_t. - * @retval None - */ -void ald_lptim_clear_flag_status(lptim_handle_t *hperh, lptim_flag_t flag) -{ - assert_param(IS_LPTIM(hperh->perh)); - assert_param(IS_LPTIM_FLAG(flag)); - - WRITE_REG(hperh->perh->IFC, (uint32_t)flag); - return; -} -/** - * @} - */ - -/** @defgroup LPTIM_Public_Functions_Group7 Peripheral State functions - * @brief Peripheral State functions - * - * @verbatim - ============================================================================== - ##### Peripheral State functions ##### - ============================================================================== - [..] - This subsection permit to get in run-time the status of the peripheral. - - @endverbatim - * @{ - */ - -/** - * @brief Return the LPTIM state - * @param hperh: LPTIM handle - * @retval LPTIM peripheral state - */ -lptim_state_t ald_lptim_get_state(lptim_handle_t *hperh) -{ - return hperh->state; -} -/** - * @} - */ -/** - * @} - */ -#endif /* ALD_LPTIM */ -/** - * @} - */ -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lpuart.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lpuart.c deleted file mode 100644 index 8a296925c1..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_lpuart.c +++ /dev/null @@ -1,1192 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_lpuart.c - * @brief Low Power UART module driver. - * This file provides firmware functions to manage the following - * functionalities of the Low Power Universal Asynchronous Receiver - * Transmitter (LPUART) peripheral: - * + Initialization and Configuration functions - * + IO operation functions - * + Peripheral Control functions - * + Peripheral State and Errors functions - * - * @version V1.0 - * @date 30 May 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - The LPUART driver can be used as follows: - - (#) Declare a lpuart_handle_t handle structure. - - (#) Initialize the LPUART resources: - (##) Enable the LPUART interface clock. - (##) LPUART pins configuration: - (+++) Enable the clock for the LPUART GPIOs. - (+++) Configure the LPUART pins (TX as alternate function pull-up, RX as alternate function Input). - (##) NVIC configuration if you need to use interrupt process (ald_lpuart_send_by_it() - and ald_lpuart_recv_by_it() APIs): - (+++) Configure the LPUART interrupt priority. - (+++) Enable the NVIC LPUART IRQ handle. - (##) DMA Configuration if you need to use DMA process (ald_lpuart_send_by_dma() - and ald_lpuart_recv_by_dma() APIs): - (+++) Declare a DMA handle structure for the Tx/Rx channel. - (+++) Enable the DMAx interface clock. - (+++) Configure the declared DMA handle structure with the required - Tx/Rx parameters. - (+++) Configure the DMA Tx/Rx channel. - (+++) Associate the initialized DMA handle to the LPUART DMA Tx/Rx handle. - - (#) Program the Baud Rate, Word Length, Stop Bit, Parity, Hardware - flow control and Mode(Receiver/Transmitter) in the hperh Init structure. - - (#) Initialize the LPUART registers by calling the ald_lpuart_init() API. - - [..] - Three operation modes are available within this driver: - - *** Polling mode IO operation *** - ================================= - [..] - (+) Send an amount of data in blocking mode using ald_lpuart_send() - (+) Receive an amount of data in blocking mode using ald_lpuart_recv() - - *** Interrupt mode IO operation *** - =================================== - [..] - (+) Send an amount of data in non blocking mode using ald_lpuart_send_by_it() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode using ald_lpuart_recv_by_it() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - - *** DMA mode IO operation *** - ============================== - [..] - (+) Send an amount of data in non blocking mode (DMA) using ald_lpuart_send_by_dma() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode (DMA) using ald_lpuart_recv_by_dma() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - (+) Pause the DMA Transfer using ald_lpuart_dma_pause() - (+) Resume the DMA Transfer using ald_lpuart_dma_resume() - (+) Stop the DMA Transfer using ald_lpuart_dma_stop() - - @endverbatim - ****************************************************************************** - */ - -#include "ald_lpuart.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup LPUART LPUART - * @brief Low Power UART module driver - * @{ - */ -#ifdef ALD_LPUART - -/** @defgroup LPUART_Private_Functions LPUART Private Functions - * @brief LPUART Private functions - * @{ - */ - -#ifdef ALD_DMA -/** - * @brief DMA LPUART transmit process complete callback. - * @param arg: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval None - */ -static void lpuart_dma_send_cplt(void *arg) -{ - lpuart_handle_t *hperh = (lpuart_handle_t *)arg; - - hperh->tx_count = 0; - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_TX, DISABLE); - ald_lpuart_interrupt_config(hperh, LPUART_IT_TC, ENABLE); -} - -/** - * @brief DMA LPUART receive process complete callback. - * @param arg: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval None - */ -static void lpuart_dma_recv_cplt(void *arg) -{ - lpuart_handle_t *hperh = (lpuart_handle_t *)arg; - - hperh->rx_count = 0; - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_RX, DISABLE); - CLEAR_BIT(hperh->state, LPUART_STATE_RX_MASK); - - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); -} - -/** - * @brief DMA LPUART communication error callback. - * @param arg: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval None - */ -static void lpuart_dma_error(void *arg) -{ - lpuart_handle_t *hperh = (lpuart_handle_t *)arg; - - hperh->rx_count = 0; - hperh->tx_count = 0; - hperh->state = LPUART_STATE_READY; - hperh->err_code |= LPUART_ERROR_DMA; - - if (hperh->error_cbk) - hperh->error_cbk(hperh); -} -#endif - -/** - * @brief This function handles uart Communication Timeout. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param flag: specifies the uart flag to check. - * @param status: The new Flag status (SET or RESET). - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t lpuart_wait_flag(lpuart_handle_t *hperh, lpuart_status_t flag, flag_status_t status, uint32_t timeout) -{ - uint32_t tick; - - if (timeout == 0) - return OK; - - tick = ald_get_tick(); - - /* Waiting for flag */ - while ((ald_lpuart_get_status(hperh, flag)) != status) { - if (((ald_get_tick()) - tick) > timeout) - return TIMEOUT; - } - - return OK; -} - -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __lpuart_send_by_it(lpuart_handle_t *hperh) -{ - if ((hperh->state & LPUART_STATE_TX_MASK) == 0x0) - return BUSY; - - WRITE_REG(hperh->perh->TXDR, *hperh->tx_buf++); - - if (--hperh->tx_count == 0) { - ald_lpuart_interrupt_config(hperh, LPUART_IT_TBEMP, DISABLE); - ald_lpuart_interrupt_config(hperh, LPUART_IT_TC, ENABLE); - } - - return OK; -} - - -/** - * @brief Wraps up transmission in non blocking mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __lpuart_end_send_by_it(lpuart_handle_t *hperh) -{ - ald_lpuart_interrupt_config(hperh, LPUART_IT_TC, DISABLE); - CLEAR_BIT(hperh->state, LPUART_STATE_TX_MASK); - - if (hperh->tx_cplt_cbk) - hperh->tx_cplt_cbk(hperh); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __lpuart_recv_by_it(lpuart_handle_t *hperh) -{ - uint32_t tmp; - uint16_t i; - - if ((hperh->state & LPUART_STATE_RX_MASK) == 0x0) - return BUSY; - - do { - i = 10000; - tmp = hperh->perh->STAT & LPUART_STAT_RXPTR_MSK; - *hperh->rx_buf++ = (uint8_t)(hperh->perh->RXDR & 0xFF); - --hperh->rx_count; - - while (((hperh->perh->STAT & LPUART_STAT_RXPTR_MSK) != (uint32_t)(tmp - 1)) && (i--)); - } while (hperh->perh->STAT & LPUART_STAT_RXPTR_MSK); - - if (hperh->rx_count == 0) { - ald_lpuart_interrupt_config(hperh, LPUART_IT_RBR, DISABLE); - CLEAR_BIT(hperh->state, LPUART_STATE_RX_MASK); - - if (hperh->state == LPUART_STATE_READY) { - ald_lpuart_interrupt_config(hperh, LPUART_IT_PERR, DISABLE); - ald_lpuart_interrupt_config(hperh, LPUART_IT_FERR, DISABLE); - } - - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); - } - - return OK; -} -/** - * @} - */ - -/** @defgroup LPUART_Public_Functions LPUART Public Functions - * @{ - */ - -/** @defgroup LPUART_Public_Functions_Group1 Initialization and Configuration functions - * @brief Initialization and Configuration functions - * -@verbatim -=============================================================================== - ##### Initialization and Configuration functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to initialize the LPUART - and configure LPUART param. - (+) For the LPUART only these parameters can be configured: - (++) Baud Rate - (++) Word Length - (++) Stop Bit - (++) Parity - (++) Hardware flow control - (+) For RS485 mode, user also need configure some parameters by - ald_lpuart_rs485_config(): - (++) Enable/disable normal point mode - (++) Enable/disable auto-address detect - (++) Enable/disable auto-direction - (++) Enable/disable address detect - (++) Enable/disable address for compare - - @endverbatim - * @{ - */ - -/** - * @brief Reset LPUART peripheral - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval None - */ -void ald_lpuart_reset(lpuart_handle_t *hperh) -{ - WRITE_REG(hperh->perh->CON0, 0x3000); - WRITE_REG(hperh->perh->CON1, 0x4); - WRITE_REG(hperh->perh->CLKDIV, 0x0); - WRITE_REG(hperh->perh->FIFOCON, 0x0); - WRITE_REG(hperh->perh->IER, 0x0); - hperh->err_code = LPUART_ERROR_NONE; - hperh->state = LPUART_STATE_RESET; - - __UNLOCK(hperh); - return; -} - -/** - * @brief Initializes the LPUART according to the specified - * parameters in the lpuart_handle_t. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval None - */ -void ald_lpuart_init(lpuart_handle_t *hperh) -{ - uint32_t tmp; - - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_BAUDRATE(hperh->init.baud)); - assert_param(IS_LPUART_WORD_LENGTH(hperh->init.word_length)); - assert_param(IS_LPUART_STOPBITS(hperh->init.stop_bits)); - assert_param(IS_LPUART_PARITY(hperh->init.parity)); - assert_param(IS_LPUART_MODE(hperh->init.mode)); - assert_param(IS_LPUART_HARDWARE_FLOW_CONTROL(hperh->init.fctl)); - - if ((hperh->init.clock != CMU_LP_PERH_CLOCK_SEL_LOSC) - && (hperh->init.clock != CMU_LP_PERH_CLOCK_SEL_LRC)) - hperh->init.clock = CMU_LP_PERH_CLOCK_SEL_LRC; - - ald_cmu_lpuart0_clock_select(hperh->init.clock); - ald_lpuart_reset(hperh); - LPUART_UPDATE_DISABLE(hperh); - - tmp = READ_REG(hperh->perh->CON0); - MODIFY_REG(tmp, LPUART_CON0_DATLENTH_MSK, hperh->init.word_length << LPUART_CON0_DATLENTH_POSS); - MODIFY_REG(tmp, LPUART_CON0_STPLENTH_MSK, hperh->init.stop_bits << LPUART_CON0_STPLENTH_POS); - - if (hperh->init.parity == LPUART_PARITY_NONE) - CLEAR_BIT(tmp, LPUART_CON0_PARCHKE_MSK); - else - SET_BIT(tmp, LPUART_CON0_PARCHKE_MSK); - - if (hperh->init.parity == LPUART_PARITY_EVEN) - SET_BIT(tmp, LPUART_CON0_EVENPARSEL_MSK); - else - CLEAR_BIT(tmp, LPUART_CON0_EVENPARSEL_MSK); - - MODIFY_REG(tmp, LPUART_CON0_ATRTSE_MSK, (hperh->init.fctl & 1) << LPUART_CON0_ATRTSE_POS); - MODIFY_REG(tmp, LPUART_CON0_ATCTSE_MSK, ((hperh->init.fctl >> 1) & 1) << LPUART_CON0_ATCTSE_POS); - WRITE_REG(hperh->perh->CON0, tmp); - WRITE_REG(hperh->perh->CLKDIV, (32768 << 8) / hperh->init.baud); - - if (hperh->init.mode == LPUART_MODE_IrDA) - CLEAR_BIT(hperh->perh->CON1, LPUART_CON1_IRRXINV_MSK); - - MODIFY_REG(hperh->perh->CON0, LPUART_CON0_MODESEL_MSK, hperh->init.mode << LPUART_CON0_MODESEL_POSS); - LPUART_UPDATE_ENABLE(hperh); - - while (hperh->perh->SYNCSTAT & 0xF) - ; - - hperh->state = LPUART_STATE_READY; - return; -} - -/** - * @brief Configure the RS485 mode according to the specified - * parameters in the lpuart_rs485_config_Typedef. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param config: Specifies the RS485 parameters. - * @retval None - */ -void ald_lpuart_rs485_config(lpuart_handle_t *hperh, lpuart_rs485_config_t *config) -{ - uint32_t tmp; - - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_FUNC_STATE(config->RS485_NMM)); - assert_param(IS_FUNC_STATE(config->RS485_AAD)); - assert_param(IS_FUNC_STATE(config->RS485_AUD)); - assert_param(IS_FUNC_STATE(config->RS485_ADD_DET)); - - tmp = READ_REG(hperh->perh->CON1); - MODIFY_REG(tmp, LPUART_CON1_NMPMOD_MSK, config->RS485_NMM << LPUART_CON1_NMPMOD_POS); - MODIFY_REG(tmp, LPUART_CON1_ATADETE_MSK, config->RS485_AAD << LPUART_CON1_ATADETE_POS); - MODIFY_REG(tmp, LPUART_CON1_ATDIRM_MSK, config->RS485_AUD << LPUART_CON1_ATDIRM_POS); - MODIFY_REG(tmp, LPUART_CON1_ADETE_MSK, config->RS485_ADD_DET << LPUART_CON1_ADETE_POS); - MODIFY_REG(tmp, LPUART_CON1_ADDCMP_MSK, config->RS485_ADDCMP << LPUART_CON1_ADDCMP_POSS); - WRITE_REG(hperh->perh->CON1, tmp); - - return; -} - -/** - * @} - */ - -/** @defgroup LPUART_Public_Functions_Group2 IO operation functions - * @brief LPUART Transmit and Receive functions - * @verbatim - ============================================================================== - ##### IO operation functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to manage the LPUART data transfers. - - (#) There are two modes of transfer: - (++) Blocking mode: The communication is performed in polling mode. - The status of all data processing is returned by the same function - after finishing transfer. - (++) Non blocking mode: The communication is performed using Interrupts - or DMA, these APIs return the status. - The end of the data processing will be indicated through the - dedicated LPUART IRQ when using Interrupt mode or the DMA IRQ when - using DMA mode. - The hperh->tx_cplt_cbk(), hperh->rx_cplt_cbk() user callbacks - will be executed respectively at the end of the transmit or receive process. - The hperh->error_cbk() user callback will be executed when - a communication error is detected. - - (#) Blocking mode APIs are: - (++) ald_lpuart_send() - (++) ald_lpuart_recv() - - (#) Non Blocking mode APIs with Interrupt are: - (++) ald_lpuart_send_by_it() - (++) ald_lpuart_recv_by_it() - (++) ald_lpuart_irq_handler() - - (#) Non Blocking mode functions with DMA are: - (++) ald_lpuart_send_by_dma() - (++) ald_lpuart_recv_by_dma() - (++) ald_lpuart_dma_pause() - (++) ald_lpuart_dma_resume() - (++) ald_lpuart_dma_stop() - - (#) A set of Transfer Complete Callbacks are provided in non blocking mode: - (++) hperh->tx_cplt_cbk() - (++) hperh->rx_cplt_cbk() - (++) hperh->error_cbk() - - @endverbatim - * @{ - */ - -/** - * @brief Sends an amount of data in blocking mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_send(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if ((hperh->state != LPUART_STATE_READY) && (hperh->state != LPUART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - hperh->err_code = LPUART_ERROR_NONE; - SET_BIT(hperh->state, LPUART_STATE_TX_MASK); - - hperh->tx_size = size; - hperh->tx_count = size; - - while (hperh->tx_count-- > 0) { - if (lpuart_wait_flag(hperh, LPUART_STAT_TXEMP, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = LPUART_STATE_READY; - return TIMEOUT; - } - - WRITE_REG(hperh->perh->TXDR, *buf++); - - if (lpuart_wait_flag(hperh, LPUART_STAT_TXEMP, RESET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = LPUART_STATE_READY; - return TIMEOUT; - } - } - - if (lpuart_wait_flag(hperh, LPUART_STAT_TXIDLE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = LPUART_STATE_READY; - return TIMEOUT; - } - - CLEAR_BIT(hperh->state, LPUART_STATE_TX_MASK); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Receives an amount of data in blocking mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_recv(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if ((hperh->state != LPUART_STATE_READY) && (hperh->state != LPUART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->err_code = LPUART_ERROR_NONE; - SET_BIT(hperh->state, LPUART_STATE_RX_MASK); - - hperh->rx_size = size; - hperh->rx_count = size; - - /* Check the remain data to be received */ - while (hperh->rx_count-- > 0) { - if (lpuart_wait_flag(hperh, LPUART_STAT_RXEMP, RESET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = LPUART_STATE_READY; - return TIMEOUT; - } - - *buf++ = (uint8_t)(hperh->perh->RXDR & 0xFF); - } - - CLEAR_BIT(hperh->state, LPUART_STATE_RX_MASK); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_send_by_it(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if ((hperh->state != LPUART_STATE_READY) && (hperh->state != LPUART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = LPUART_ERROR_NONE; - SET_BIT(hperh->state, LPUART_STATE_TX_MASK); - - __UNLOCK(hperh); - ald_lpuart_interrupt_config(hperh, LPUART_IT_TBEMP, ENABLE); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_recv_by_it(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if ((hperh->state != LPUART_STATE_READY) && (hperh->state != LPUART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = LPUART_ERROR_NONE; - SET_BIT(hperh->state, LPUART_STATE_RX_MASK); - - __UNLOCK(hperh); - - ald_lpuart_interrupt_config(hperh, LPUART_IT_PERR, ENABLE); - ald_lpuart_interrupt_config(hperh, LPUART_IT_FERR, ENABLE); - ald_lpuart_interrupt_config(hperh, LPUART_IT_RBR, ENABLE); - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as LPUART transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_send_by_dma(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if ((hperh->state != LPUART_STATE_READY) && (hperh->state != LPUART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = LPUART_ERROR_NONE; - SET_BIT(hperh->state, LPUART_STATE_TX_MASK); - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - /* Set the dma parameters */ - hperh->hdmatx.cplt_cbk = lpuart_dma_send_cplt; - hperh->hdmatx.cplt_arg = (void *)hperh; - hperh->hdmatx.err_cbk = lpuart_dma_error; - hperh->hdmatx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->TXDR; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = DMA_MSEL_LPUART0; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_LPUART_TXEMPTY; - hperh->hdmatx.config.channel = channel; - - if (hperh->init.mode == LPUART_MODE_RS485) { - hperh->hdmatx.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmatx); - ald_lpuart_clear_flag_status(hperh, LPUART_IF_TC); - __UNLOCK(hperh); - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_TX, ENABLE); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param channel: DMA channel as LPUART receive - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_recv_by_dma(lpuart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if ((hperh->state != LPUART_STATE_READY) && (hperh->state != LPUART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->err_code = LPUART_ERROR_NONE; - SET_BIT(hperh->state, LPUART_STATE_RX_MASK); - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - /* Set the dma parameters */ - hperh->hdmarx.cplt_cbk = lpuart_dma_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = lpuart_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->RXDR; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = DMA_MSEL_LPUART0; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_LPUART_RNR; - hperh->hdmarx.config.channel = channel; - - if (hperh->init.mode == LPUART_MODE_RS485) { - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmarx); - __UNLOCK(hperh); - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_RX, ENABLE); - - return OK; -} - -/** - * @brief Pauses the DMA Transfer. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_dma_pause(lpuart_handle_t *hperh) -{ - __LOCK(hperh); - - if (hperh->state == LPUART_STATE_BUSY_TX) { - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_TX, DISABLE); - } - else if (hperh->state == LPUART_STATE_BUSY_RX) { - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_RX, DISABLE); - } - else if (hperh->state == LPUART_STATE_BUSY_TX_RX) { - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_TX, DISABLE); - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_RX, DISABLE); - } - else { - __UNLOCK(hperh); - return ERROR; - } - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Resumes the DMA Transfer. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_dma_resume(lpuart_handle_t *hperh) -{ - __LOCK(hperh); - - if (hperh->state == LPUART_STATE_BUSY_TX) { - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_TX, ENABLE); - } - else if (hperh->state == LPUART_STATE_BUSY_RX) { - ald_lpuart_clear_flag_status(hperh, LPUART_IF_RXOV); - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_RX, ENABLE); - } - else if (hperh->state == LPUART_STATE_BUSY_TX_RX) { - ald_lpuart_clear_flag_status(hperh, LPUART_IF_RXOV); - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_TX, ENABLE); - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_RX, ENABLE); - } - else { - __UNLOCK(hperh); - return ERROR; - } - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Stops the DMA Transfer. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_lpuart_dma_stop(lpuart_handle_t *hperh) -{ - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_TX, DISABLE); - ald_lpuart_dma_req_config(hperh, LPUART_DMA_REQ_RX, DISABLE); - - hperh->state = LPUART_STATE_READY; - return OK; -} -#endif - -/** - * @brief This function handles LPUART interrupt request. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval None - */ -void ald_lpuart_irq_handler(lpuart_handle_t *hperh) -{ - uint32_t flag; - uint32_t source; - - /* Handle CTS wakeup */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_CTSWK); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_CTSWK); - if ((flag != RESET) && (source != RESET)) - ald_lpuart_clear_flag_status(hperh, LPUART_IF_CTSWK); - - /* Handle DATA wakeup */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_DATWK); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_DATWK); - if ((flag != RESET) && (source != RESET)) - ald_lpuart_clear_flag_status(hperh, LPUART_IF_DATWK); - - /* Handle parity error */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_PERR); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_PERR); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= LPUART_ERROR_PE; - - /* Handle frame error */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_FERR); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_FERR); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= LPUART_ERROR_FE; - - /* Handle overflow error */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_RXOV); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_RXOV); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= LPUART_ERROR_ORE; - - /* Receive */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_RBR); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_RBR); - if ((flag != RESET) && (source != RESET)) - __lpuart_recv_by_it(hperh); - - /* Transmite */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_TBEMP); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_TBEMP); - if ((flag != RESET) && (source != RESET)) - __lpuart_send_by_it(hperh); - - /* End Transmite */ - flag = ald_lpuart_get_flag_status(hperh, LPUART_IF_TC); - source = ald_lpuart_get_it_status(hperh, LPUART_IT_TC); - if ((flag != RESET) && (source != RESET)) - __lpuart_end_send_by_it(hperh); - - /* Handle error state */ - if (hperh->err_code != LPUART_ERROR_NONE) { - ald_lpuart_clear_flag_status(hperh, LPUART_IF_PERR); - ald_lpuart_clear_flag_status(hperh, LPUART_IF_FERR); - ald_lpuart_clear_flag_status(hperh, LPUART_IF_RXOV); - hperh->state = LPUART_STATE_READY; - - if (hperh->error_cbk) - hperh->error_cbk(hperh); - } -} -/** - * @} - */ - -/** @defgroup LPUART_Public_Functions_Group3 Peripheral Control functions - * @brief Low Power UART control functions - * - * @verbatim - ============================================================================== - ##### Peripheral Control functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to control the LPUART: - (+) ald_lpuart_interrupt_config() API can be helpful to configure LPUART interrupt source. - (+) ald_lpuart_tx_interval_config() API can be helpful to configure TX interval. - (+) ald_lpuart_dma_req_config() API can be helpful to configure LPUART DMA request. - (+) ald_lpuart_rx_fifo_it_config() API can be helpful to configure LPUART RX FIFO interrupt. - (+) ald_lpuart_rx_fifo_rts_config() API can be helpful to configure RTS threshold value. - (+) ald_lpuart_get_flag_status() API can get the status of LPUART flag. - (+) ald_lpuart_clear_flag_status() API can clear LPUART flag. - (+) ald_lpuart_get_it_status() API can get the status of interrupt source. - - @endverbatim - * @{ - */ - -/** - * @brief Enable/disable the specified LPUART interrupts. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param it: Specifies the LPUART interrupt sources to be enabled or - * disabled. This parameter can be one of the @ref lpuart_it_t. - * @param status: New state of the specified LPUART interrupts. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_lpuart_interrupt_config(lpuart_handle_t *hperh, lpuart_it_t it, type_func_t status) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_IT(it)); - assert_param(IS_FUNC_STATE(status)); - - if (status == ENABLE) - SET_BIT(hperh->perh->IER, it); - else - CLEAR_BIT(hperh->perh->IER, it); - - return; -} - -/** - * @brief Configure transmite interval. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param val: The value of interval. - * @retval None - */ -void ald_lpuart_tx_interval_config(lpuart_handle_t *hperh, uint8_t val) -{ - assert_param(IS_LPUART(hperh->perh)); - - MODIFY_REG(hperh->perh->CON0, LPUART_CON0_INTERVAL_MSK, val << LPUART_CON0_INTERVAL_POSS); - return; -} - -/** - * @brief Configure LPUART DMA request. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param req: The DMA type: - * @arg LPUART_DMA_REQ_TX - * @arg LPUART_DMA_REQ_RX - * @param status: New state of the specified DMA request. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_lpuart_dma_req_config(lpuart_handle_t *hperh, lpuart_dma_req_t req, type_func_t status) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_DMAREQ(req)); - assert_param(IS_FUNC_STATE(status)); - - if (req == LPUART_DMA_REQ_TX) { - if (status == ENABLE) - SET_BIT(hperh->perh->CON0, LPUART_CON0_TXDMAE_MSK); - else - CLEAR_BIT(hperh->perh->CON0, LPUART_CON0_TXDMAE_MSK); - } - else { - if (status == ENABLE) - SET_BIT(hperh->perh->CON0, LPUART_CON0_RXDMAE_MSK); - else - CLEAR_BIT(hperh->perh->CON0, LPUART_CON0_RXDMAE_MSK); - } - - return; -} - -/** - * @brief Configure receive FIFO interrupt threshold value. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param config: The value of RX FIFO interrupt threshold value. - * @retval None - */ -void ald_lpuart_rx_fifo_it_config(lpuart_handle_t *hperh, lpuart_rxfifo_t config) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_RXFIFO(config)); - - MODIFY_REG(hperh->perh->FIFOCON, LPUART_FIFOCON_RXTRGLVL_MSK, config << LPUART_FIFOCON_RXTRGLVL_POSS); - return; -} - -/** - * @brief Configure receive FIFO RTS threshold value. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param config: The value of RX FIFO RTS threshold value. - * @retval None - */ -void ald_lpuart_rx_fifo_rts_config(lpuart_handle_t *hperh, lpuart_rxfifo_t config) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_RXFIFO(config)); - - MODIFY_REG(hperh->perh->FIFOCON, LPUART_FIFOCON_RTSTRGLVL_MSK, config << LPUART_FIFOCON_RTSTRGLVL_POSS); - return; -} - -/** - * @brief Send address in RS485 mode. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param addr: the address of RS485 device. - * @param timeout: Timeout duration - * @retval The hal status. - */ -ald_status_t ald_lpuart_rs485_send_addr(lpuart_handle_t *hperh, uint16_t addr, uint32_t timeout) -{ - assert_param(IS_LPUART(hperh->perh)); - - if ((hperh->state != LPUART_STATE_READY) && (hperh->state != LPUART_STATE_BUSY_RX)) - return BUSY; - - SET_BIT(hperh->state, LPUART_STATE_TX_MASK); - - if (lpuart_wait_flag(hperh, LPUART_STAT_TXEMP, SET, timeout) != OK) { - hperh->state = LPUART_STATE_READY; - return TIMEOUT; - } - - WRITE_REG(hperh->perh->TXDR, addr | 0x100); - - if (lpuart_wait_flag(hperh, LPUART_STAT_TXEMP, RESET, timeout) != OK) { - hperh->state = LPUART_STATE_READY; - return TIMEOUT; - } - - if (lpuart_wait_flag(hperh, LPUART_STAT_TXIDLE, SET, timeout) != OK) { - hperh->state = LPUART_STATE_READY; - return TIMEOUT; - } - - CLEAR_BIT(hperh->state, LPUART_STATE_TX_MASK); - return OK; -} - -/** - * @brief Get the status of LPUART status. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param flag: Specifies the LPUART status flag. - * This parameter can be one of the @ref lpuart_status_t. - * @retval Status: - * - RESET - * - SET - */ -flag_status_t ald_lpuart_get_status(lpuart_handle_t *hperh, lpuart_status_t flag) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_STAT(flag)); - - if (READ_BIT(hperh->perh->STAT, flag)) - return SET; - - return RESET; -} - -/** - * @brief Get the status of LPUART interrupt flag. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param flag: Specifies the LPUART interrupt flag. - * This parameter can be one of the @ref lpuart_flag_t. - * @retval Status: - * - RESET - * - SET - */ -flag_status_t ald_lpuart_get_flag_status(lpuart_handle_t *hperh, lpuart_flag_t flag) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_IF(flag)); - - if (READ_BIT(hperh->perh->IFLAG, flag)) - return SET; - - return RESET; -} - -/** - * @brief Clear the LPUART interrupt flag. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param flag: Specifies the LPUART interrupt flag. - * This parameter can be one of the @ref lpuart_flag_t. - * @retval None - */ -void ald_lpuart_clear_flag_status(lpuart_handle_t *hperh, lpuart_flag_t flag) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_IF(flag)); - - WRITE_REG(hperh->perh->IFC, flag); - return; -} - -/** - * @brief Get the status of LPUART interrupt source. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @param it: Specifies the LPUART interrupt source. - * This parameter can be one of the @ref lpuart_it_t. - * @retval Status: - * - RESET - * - SET - */ -it_status_t ald_lpuart_get_it_status(lpuart_handle_t *hperh, lpuart_it_t it) -{ - assert_param(IS_LPUART(hperh->perh)); - assert_param(IS_LPUART_IT(it)); - - if (READ_BIT(hperh->perh->IER, it)) - return SET; - - return RESET; -} -/** - * @} - */ - -/** @defgroup LPUART_Public_Functions_Group4 Peripheral State and Errors functions - * @brief LPUART State and Errors functions - * -@verbatim - ============================================================================== - ##### Peripheral State and Errors functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to return the State of - LPUART communication process, return Peripheral Errors occurred during communication - process - (+) ald_lpuart_get_state() API can be helpful to check in run-time the state of the LPUART peripheral. - (+) ald_lpuart_get_error() check in run-time errors that could be occurred during communication. - -@endverbatim - * @{ - */ - -/** - * @brief Returns the LPUART state. - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART module. - * @retval HAL state - */ -lpuart_state_t ald_lpuart_get_state(lpuart_handle_t *hperh) -{ - return hperh->state; -} - -/** - * @brief Return the LPUART error code - * @param hperh: Pointer to a lpuart_handle_t structure that contains - * the configuration information for the specified LPUART. - * @retval LPUART Error Code - */ -uint32_t ald_lpuart_get_error(lpuart_handle_t *hperh) -{ - return hperh->err_code; -} - -/** - * @} - */ - -/** - * @} - */ -#endif /* ALD_LPUART */ - -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_pis.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_pis.c deleted file mode 100644 index d9067499ea..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_pis.c +++ /dev/null @@ -1,316 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_pis.c - * @brief PIS module driver. - * - * @version V1.0 - * @date 27 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_pis.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup PIS PIS - * @brief PIS module driver - * @{ - */ -#ifdef ALD_PIS - -/** @defgroup PIS_Public_Functions PIS Public Functions - * @{ - */ - -/** @defgroup PIS_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * @{ - */ - -/** - * @brief Create the PIS mode according to the specified parameters in - * the pis_handle_t and create the associated handle. - * @param hperh: Pointer to a pis_handle_t structure that contains - * the configuration information for the specified PIS module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_pis_create(pis_handle_t *hperh) -{ - uint8_t clock_menu = 0; - - if (hperh == NULL) - return ERROR; - - assert_param(IS_PIS_SRC(hperh->init.producer_src)); - assert_param(IS_PIS_TRIG(hperh->init.consumer_trig)); - assert_param(IS_PIS_CLOCK(hperh->init.producer_clk)); - assert_param(IS_PIS_CLOCK(hperh->init.consumer_clk)); - assert_param(IS_PIS_EDGE(hperh->init.producer_edge)); - - __LOCK(hperh); - hperh->perh = PIS; - - /* get location of consumer in channel and position of con0/con1 - * accord to comsumer_trig information */ - hperh->consumer_ch = (pis_ch_t)(hperh->init.consumer_trig & 0x0F); - hperh->consumer_con = (pis_con_t)(((uint32_t)hperh->init.consumer_trig >> 4) & 0x0F); - hperh->consumer_pos = (1U << (uint32_t)(((uint32_t)hperh->init.consumer_trig >> 8) & 0xFF)); - - /* union producer clock and consumer clock */ - clock_menu = (hperh->init.producer_clk << 4) | (hperh->init.consumer_clk); - - if (hperh->perh->CH_CON[hperh->consumer_ch] != 0) { - __UNLOCK(hperh); - return BUSY; - } - - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SRCS_MSK, ((hperh->init.producer_src) >> 4) << PIS_CH0_CON_SRCS_POSS); - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_MSIGS_MSK, ((hperh->init.producer_src) & 0xf) << PIS_CH0_CON_MSIGS_POSS); - - /* configure sync clock, judging by producer clock with consumer clock */ - switch (clock_menu) { - case 0x00: - case 0x11: - case 0x22: - case 0x33: - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SYNCSEL_MSK, 0 << PIS_CH0_CON_SYNCSEL_POSS); - break; - case 0x01: - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SYNCSEL_MSK, 5 << PIS_CH0_CON_SYNCSEL_POSS); - break; - case 0x02: - case 0x12: - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SYNCSEL_MSK, 6 << PIS_CH0_CON_SYNCSEL_POSS); - break; - case 0x21: - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SYNCSEL_MSK, 4 << PIS_CH0_CON_SYNCSEL_POSS); - break; - case 0x30: - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SYNCSEL_MSK, 1 << PIS_CH0_CON_SYNCSEL_POSS); - break; - case 0x31: - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SYNCSEL_MSK, 2 << PIS_CH0_CON_SYNCSEL_POSS); - break; - case 0x32: - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_SYNCSEL_MSK, 3 << PIS_CH0_CON_SYNCSEL_POSS); - break; - default: - break; - } - - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_PULCK_MSK, hperh->init.consumer_clk << PIS_CH0_CON_PULCK_POSS); - MODIFY_REG(hperh->perh->CH_CON[hperh->consumer_ch], PIS_CH0_CON_EDGS_MSK, hperh->init.producer_edge << PIS_CH0_CON_EDGS_POSS); - hperh->check_info = hperh->perh->CH_CON[hperh->consumer_ch]; - - /* enable consumer bit, switch pin of consumer */ - switch (hperh->consumer_con) { - case PIS_CON_0: - PIS->TAR_CON0 |= hperh->consumer_pos; - break; - case PIS_CON_1: - PIS->TAR_CON1 |= hperh->consumer_pos; - break; - default: - break; - } - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Destroy the PIS mode according to the specified parameters in - * the pis_init_t and create the associated handle. - * @param hperh: Pointer to a pis_handle_t structure that contains - * the configuration information for the specified PIS module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_pis_destroy(pis_handle_t *hperh) -{ - assert_param(IS_PIS(hperh->perh)); - - if (hperh->check_info != hperh->perh->CH_CON[hperh->consumer_ch]) - return ERROR; - - __LOCK(hperh); - - CLEAR_BIT(PIS->CH_OER, (1U << (uint32_t)hperh->consumer_ch)); - WRITE_REG(hperh->perh->CH_CON[hperh->consumer_ch], 0x0); - - switch (hperh->consumer_con) { - case PIS_CON_0: - PIS->TAR_CON0 &= ~(hperh->consumer_pos); - break; - case PIS_CON_1: - PIS->TAR_CON1 &= ~(hperh->consumer_pos); - break; - default: - break; - } - - hperh->state = PIS_STATE_RESET; - __UNLOCK(hperh); - - return OK; -} -/** - * @} - */ - -/** @defgroup PIS_Public_Functions_Group2 Operation functions - * @brief PIS output enable or disable functions - * @{ - */ - -/** - * @brief Start the PIS output function. - * @param hperh: Pointer to a pis_handle_t structure that contains - * the configuration information for the specified PIS module. - * @param ch: The PIS channel enable output - * This parameter can be one of the following values: - * @arg PIS_OUT_CH_0 - * @arg PIS_OUT_CH_1 - * @arg PIS_OUT_CH_2 - * @arg PIS_OUT_CH_3 - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_pis_output_start(pis_handle_t *hperh, pis_out_ch_t ch) -{ - assert_param(IS_PIS(hperh->perh)); - assert_param(IS_PIS_OUPUT_CH(ch)); - __LOCK(hperh); - SET_BIT(PIS->CH_OER, (1 << ch)); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Stop the PIS output function. - * @param hperh: Pointer to a pis_handle_t structure that contains - * the configuration information for the specified PIS module. - * @param ch: The PIS channel disable output - * This parameter can be one of the following values: - * @arg PIS_OUT_CH_0 - * @arg PIS_OUT_CH_1 - * @arg PIS_OUT_CH_2 - * @arg PIS_OUT_CH_3 - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_pis_output_stop(pis_handle_t *hperh, pis_out_ch_t ch) -{ - assert_param(IS_PIS(hperh->perh)); - assert_param(IS_PIS_OUPUT_CH(ch)); - __LOCK(hperh); - CLEAR_BIT(PIS->CH_OER, (1 << ch)); - __UNLOCK(hperh); - - return OK; -} -/** - * @} - */ - -/** @defgroup PIS_Public_Functions_Group3 Peripheral State and Errors functions - * @brief PIS State and Errors functions - * @{ - */ - -/** - * @brief Returns the PIS state. - * @param hperh: Pointer to a pis_handle_t structure that contains - * the configuration information for the specified PIS module. - * @retval ALD state - */ -pis_state_t ald_pis_get_state(pis_handle_t *hperh) -{ - assert_param(IS_PIS(hperh->perh)); - return hperh->state; -} - -/** - * @} - */ - -/** @defgroup PIS_Public_Functions_Group4 modulate output functions - * @brief PIS modulate output signal functions - * @{ - */ - -/** - * @brief Config the PIS modulate signal function - * @param hperh: Pointer to a pis_handle_t structure that contains - * the configuration information for the specified PIS module. - * @param config: Pointer to a pis_modulate_config_t structure that - * contains the selected target (UART0,UART1,UART2,UART3 or - * LPUART0) how to modulate the target output signal. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_pis_modu_config(pis_handle_t *hperh, pis_modulate_config_t *config) -{ - assert_param(IS_PIS(hperh->perh)); - assert_param(IS_PIS_MODU_TARGET(config->target)); - assert_param(IS_PIS_MODU_LEVEL(config->level)); - assert_param(IS_PIS_MODU_SRC(config->src)); - assert_param(IS_PIS_MODU_CHANNEL(config->channel)); - __LOCK(hperh); - - switch (config->target) { - case PIS_UART0_TX: - MODIFY_REG(hperh->perh->UART0_TXMCR, PIS_TXMCR_TXMLVLS_MSK, config->level << PIS_TXMCR_TXMLVLS_POS); - MODIFY_REG(hperh->perh->UART0_TXMCR, PIS_TXMCR_TXMSS_MSK, config->src << PIS_TXMCR_TXMSS_POSS); - MODIFY_REG(hperh->perh->UART0_TXMCR, PIS_TXMCR_TXSIGS_MSK, config->channel << PIS_TXMCR_TXSIGS_POSS); - break; - - case PIS_UART1_TX: - MODIFY_REG(hperh->perh->UART1_TXMCR, PIS_TXMCR_TXMLVLS_MSK, config->level << PIS_TXMCR_TXMLVLS_POS); - MODIFY_REG(hperh->perh->UART1_TXMCR, PIS_TXMCR_TXMSS_MSK, config->src << PIS_TXMCR_TXMSS_POSS); - MODIFY_REG(hperh->perh->UART1_TXMCR, PIS_TXMCR_TXSIGS_MSK, config->channel << PIS_TXMCR_TXSIGS_POSS); - break; - - case PIS_UART2_TX: - MODIFY_REG(hperh->perh->UART2_TXMCR, PIS_TXMCR_TXMLVLS_MSK, config->level << PIS_TXMCR_TXMLVLS_POS); - MODIFY_REG(hperh->perh->UART2_TXMCR, PIS_TXMCR_TXMSS_MSK, config->src << PIS_TXMCR_TXMSS_POSS); - MODIFY_REG(hperh->perh->UART2_TXMCR, PIS_TXMCR_TXSIGS_MSK, config->channel << PIS_TXMCR_TXSIGS_POSS); - break; - - case PIS_UART3_TX: - MODIFY_REG(hperh->perh->UART3_TXMCR, PIS_TXMCR_TXMLVLS_MSK, config->level << PIS_TXMCR_TXMLVLS_POS); - MODIFY_REG(hperh->perh->UART3_TXMCR, PIS_TXMCR_TXMSS_MSK, config->src << PIS_TXMCR_TXMSS_POSS); - MODIFY_REG(hperh->perh->UART3_TXMCR, PIS_TXMCR_TXSIGS_MSK, config->channel << PIS_TXMCR_TXSIGS_POSS); - break; - - case PIS_LPUART0_TX: - MODIFY_REG(hperh->perh->LPUART0_TXMCR, PIS_TXMCR_TXMLVLS_MSK, config->level << PIS_TXMCR_TXMLVLS_POS); - MODIFY_REG(hperh->perh->LPUART0_TXMCR, PIS_TXMCR_TXMSS_MSK, config->src << PIS_TXMCR_TXMSS_POSS); - MODIFY_REG(hperh->perh->LPUART0_TXMCR, PIS_TXMCR_TXSIGS_MSK, config->channel << PIS_TXMCR_TXSIGS_POSS); - break; - - default: - break; - } - - __UNLOCK(hperh); - return OK; -} -/** - * @} - */ -/** - * @} - */ -#endif /* ALD_PIS */ -/** - * @} - */ -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_pmu.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_pmu.c deleted file mode 100644 index 42094fc298..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_pmu.c +++ /dev/null @@ -1,256 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_pmu.c - * @brief PMU module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_pmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup PMU PMU - * @brief PMU module driver - * @{ - */ -#ifdef ALD_PMU - - -/** @defgroup PMU_Private_Functions PMU Private Functions - * @{ - */ - -/** - * @brief PMU module interrupt handler - * @retval None - */ -void ald_lvd_irq_handler(void) -{ - SYSCFG_UNLOCK(); - SET_BIT(PMU->LVDCR, PMU_LVDCR_LVDCIF_MSK); - SYSCFG_LOCK(); - - return; -} -/** - * @} - */ - -/** @defgroup PMU_Public_Functions PMU Public Functions - * @{ - */ - -/** @addtogroup PMU_Public_Functions_Group1 Low Power Mode - * @brief Low power mode select functions - * - * @verbatim - ============================================================================== - ##### Low power mode select functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Enter stop1 mode. - (+) Enter stop2 mode. - (+) Enter standby mode. - (+) Get wakeup status. - (+) Clear wakeup status. - - @endverbatim - * @{ - */ - -/** - * @brief Enter stop1 mode - * @retval None - */ -void ald_pmu_stop1_enter(void) -{ - SYSCFG_UNLOCK(); - SET_BIT(PMU->CR, PMU_CR_LPSTOP_MSK); - MODIFY_REG(PMU->CR, PMU_CR_LPM_MSK, PMU_LP_STOP1 << PMU_CR_LPM_POSS); - SYSCFG_LOCK(); - - SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - __WFI(); - SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk; - - return; -} - -/** - * @brief Enter stop2 mode - * @retval None - */ -void ald_pmu_stop2_enter(void) -{ - SYSCFG_UNLOCK(); - SET_BIT(PMU->CR, PMU_CR_LPSTOP_MSK); - MODIFY_REG(PMU->CR, PMU_CR_LPM_MSK, PMU_LP_STOP2 << PMU_CR_LPM_POSS); - SYSCFG_LOCK(); - - SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - __WFI(); - SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk; - - return; -} - -/** - * @brief Enter standby mode - * @param port: The port whick wake up the standby mode. - * @param level: Wakeup level. - * @retval None - */ -void ald_pmu_standby_enter(bkpc_wakeup_port_t port, bkpc_wakeup_level_t level) -{ - ald_bkpc_standby_wakeup_config(port, level); - - SYSCFG_UNLOCK(); - SET_BIT(PMU->CR, PMU_CR_LPSTOP_MSK); - MODIFY_REG(PMU->CR, PMU_CR_LPM_MSK, PMU_LP_STANDBY << PMU_CR_LPM_POSS); - SYSCFG_LOCK(); - - SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - __WFI(); - SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk; - - return; -} - -/** - * @brief Configures low power mode. The system clock must - * be less than 2MHz. Such as: LOSC or LRC. - * @param vol: LDO output voltage select in low power mode. - * @param state: New state, ENABLE/DISABLE; - * @retval None - */ -void ald_pmu_lprun_config(pmu_ldo_lpmode_output_t vol, type_func_t state) -{ - assert_param(IS_FUNC_STATE(state)); - SYSCFG_UNLOCK(); - - if (state) { - assert_param(IS_PMU_LDO_LPMODE_OUTPUT(vol)); - - MODIFY_REG(PMU->CR, PMU_CR_LPVS_MSK, vol << PMU_CR_LPVS_POSS); - SET_BIT(PMU->CR, PMU_CR_LPRUN_MSK); - } - else { - CLEAR_BIT(PMU->CR, PMU_CR_LPRUN_MSK); - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Get wakup status. - * @param sr: Status bit. - * @retval Status. - */ -flag_status_t ald_pmu_get_status(pmu_status_t sr) -{ - assert_param(IS_PMU_STATUS(sr)); - - if (READ_BIT(PMU->SR, sr)) - return SET; - - return RESET; -} - -/** - * @brief Clear wakup status. - * @param sr: Status bit. - * @retval None - */ -void ald_pmu_clear_status(pmu_status_t sr) -{ - assert_param(IS_PMU_STATUS(sr)); - SYSCFG_UNLOCK(); - - if (sr == PMU_SR_WUF) - SET_BIT(PMU->CR, PMU_CR_CWUF_MSK); - else - SET_BIT(PMU->CR, PMU_CR_CSTANDBYF_MSK); - - SYSCFG_LOCK(); - return; -} -/** - * @} - */ - -/** @addtogroup PMU_Public_Functions_Group2 LVD Configure - * @brief LVD configure functions - * - * @verbatim - ============================================================================== - ##### LVD configure functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) Configure lvd parameters. - (+) Interrupt callback function. - - @endverbatim - * @{ - */ - -/** - * @brief Configure lvd using specified parameters. - * @param sel: LVD threshold voltage. - * @param mode: LVD trigger mode. - * @param state: New state, ENABLE/DISABLE; - * @retval None - */ -void ald_pmu_lvd_config(pmu_lvd_voltage_sel_t sel, pmu_lvd_trigger_mode_t mode, type_func_t state) -{ - assert_param(IS_FUNC_STATE(state)); - SYSCFG_UNLOCK(); - - if (state) { - assert_param(IS_PMU_LVD_VOL_SEL(sel)); - assert_param(IS_PMU_LVD_TRIGGER_MODE(mode)); - - MODIFY_REG(PMU->LVDCR, PMU_LVDCR_LVDS_MSK, sel << PMU_LVDCR_LVDS_POSS); - MODIFY_REG(PMU->LVDCR, PMU_LVDCR_LVIFS_MSK, mode << PMU_LVDCR_LVIFS_POSS); - SET_BIT(PMU->LVDCR, PMU_LVDCR_LVDFLT_MSK); - SET_BIT(PMU->LVDCR, PMU_LVDCR_LVDCIF_MSK); - SET_BIT(PMU->LVDCR, PMU_LVDCR_LVDIE_MSK); - SET_BIT(PMU->LVDCR, PMU_LVDCR_LVDEN_MSK); - } - else { - SET_BIT(PMU->LVDCR, PMU_LVDCR_LVDCIF_MSK); - CLEAR_BIT(PMU->LVDCR, PMU_LVDCR_LVDIE_MSK); - CLEAR_BIT(PMU->LVDCR, PMU_LVDCR_LVDEN_MSK); - } - - SYSCFG_LOCK(); - return; -} -/** - * @} - */ -/** - * @} - */ -#endif /* ALD_PMU */ -/** - * @} - */ -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_rmu.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_rmu.c deleted file mode 100644 index 2b04f2719c..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_rmu.c +++ /dev/null @@ -1,146 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_rmu.c - * @brief RMU module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_rmu.h" -#include "ald_syscfg.h" - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup RMU RMU - * @brief RMU module driver - * @{ - */ -#ifdef ALD_RMU - -/** @defgroup RMU_Public_Functions RMU Public Functions - * @{ - */ - -/** - * @brief Configure BOR parameters. - * @param flt: filter time. - * @param vol: The voltage. - * @param state: The new status: ENABLE/DISABLE. - * @retval None - */ -void ald_rmu_bor_config(rmu_bor_filter_t flt, rmu_bor_vol_t vol, type_func_t state) -{ - assert_param(IS_FUNC_STATE(state)); - - SYSCFG_UNLOCK(); - - if (state) { - assert_param(IS_RMU_BORFLT(flt)); - assert_param(IS_RMU_BORVOL(vol)); - - MODIFY_REG(RMU->CR, RMU_CR_BORFLT_MSK, flt << RMU_CR_BORFLT_POSS); - MODIFY_REG(RMU->CR, RMU_CR_BORVS_MSK, vol << RMU_CR_BORVS_POSS); - SET_BIT(RMU->CR, RMU_CR_BOREN_MSK); - } - else { - CLEAR_BIT(RMU->CR, RMU_CR_BOREN_MSK); - } - - SYSCFG_LOCK(); - return; -} - -/** - * @brief Get specified reset status - * @param state: Speicifies the type of the reset, - * @retval The status. - */ -uint32_t ald_rmu_get_reset_status(rmu_state_t state) -{ - assert_param(IS_RMU_STATE(state)); - - if (state == RMU_RST_ALL) - return RMU->RSTSR; - - if (READ_BIT(RMU->RSTSR, state)) - return SET; - - return RESET; -} - -/** - * @brief Clear the specified reset status - * @param state: Specifies the type of the reset, - * @retval None - */ -void ald_rmu_clear_reset_status(rmu_state_t state) -{ - assert_param(IS_RMU_STATE_CLEAR(state)); - - SYSCFG_UNLOCK(); - WRITE_REG(RMU->CRSTSR, state); - SYSCFG_LOCK(); - - return; -} -/** - * @brief Reset peripheral device - * @param perh: The peripheral device, - * @retval None - */ -void ald_rmu_reset_periperal(rmu_peripheral_t perh) -{ - uint32_t idx, pos; - - assert_param(IS_RMU_PERH(perh)); - - idx = ((uint32_t)perh >> 27) & 0x7; - pos = perh & ~(0x7 << 27); - SYSCFG_UNLOCK(); - - switch (idx) { - case 0: - WRITE_REG(RMU->AHB1RSTR, pos); - break; - - case 1: - WRITE_REG(RMU->AHB2RSTR, pos); - break; - - case 2: - WRITE_REG(RMU->APB1RSTR, pos); - break; - - case 4: - WRITE_REG(RMU->APB2RSTR, pos); - break; - - default: - break; - } - - SYSCFG_LOCK(); - return; -} - -/** - * @} - */ -#endif /* ALD_RMU */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_rtc.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_rtc.c deleted file mode 100644 index 7391045a62..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_rtc.c +++ /dev/null @@ -1,1192 +0,0 @@ -/** - ****************************************************************************** - * @file ald_rtc.c - * @brief RTC module driver. - * This file provides firmware functions to manage the following - * functionalities of the RTC peripheral: - * + Initialization functions - * + Time and date functions - * + Alarm functions - * + Time stamp functions - * + Tamper functions - * + Wake-up functions - * + Clock output functions - * + Peripheral Control functions - * @version V1.0 - * @date 25 Apr 2017 - * @author AE Team - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ******************************************************************************** - * @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - (+) Enable the RTC controller interface clock. - (+) Select the RTC source clock(default LOSC). - (+) Configure the RTC asynchronous prescaler, synchronous prescaler and hour - format using the ald_rtc_init() function. - - *** Time and date operation *** - ================================= - [..] - (+) To configure the time use the ald_rtc_set_time() function. - (+) To configure the date use the ald_rtc_set_date() function. - (+) To read the time use the ald_rtc_get_time() function. - (+) To read the date use the ald_rtc_get_date() function. - - *** Alarm operation *** - =================================== - [..] - (+) To configure the alarm use ald_rtc_set_alarm() function - (+) To read the alarm use ald_rtc_get_alarm() function - (+) To cancel the alarm use ald_rtc_alarm_cmd() function - - *** Time stamp operation *** - =================================== - [..] - (+) To configure the time stamp use ald_rtc_set_time_stamp() function - (+) To read the time stamp use ald_rtc_get_time_stamp() function - (+) To cancel the time stamp use ald_rtc_cancel_time_stamp() function - - *** Tamper operation *** - =================================== - [..] - (+) To configure the tamper use ald_rtc_set_tamper() function - (+) To cancel the tamper use ald_rtc_alarm_cmd() function - - *** Wake-up operation *** - =================================== - [..] - (+) To configure the wake-up parameters use ald_rtc_set_wakeup() function - (+) To read the re-load register value use ald_rtc_get_wakeup_timer_value() function - (+) To cancel the wake-up use ald_rtc_cancel_wakeup() function - - *** Output clock operation *** - =================================== - [..] - (+) To configure the clock output type use ald_rtc_set_clock_output() function - (+) To cancel the clock output use ald_rtc_cancel_clock_output() function - - *** Control functions *** - =================================== - [..] - (+) Configure interrupt enable/disable. - (+) Enable/disable alarm. - (+) Configure rtc shift. - (+) Calibrate time. - (+) Get interrupt source status. - (+) Get interrupt flag status. - (+) Clear interrupt flag. - - ================================================================== - ##### RTC and low power modes ##### - ================================================================== - [..] The MCU can be woken up from a low power mode by an RTC alternate function. - [..] The RTC alternate functions are the RTC alarms (Alarm A and Alarm B), - RTC wake-up, RTC tamper event detection and RTC time stamp event detection. - These RTC alternate functions can wake up the system from the Stop and - Standby low power modes. - [..] The system can also wake up from low power modes without depending - on an external interrupt (Auto-wake-up mode), by using the RTC alarm - or the RTC wake-up events. - [..] The RTC provides a programmable time base for waking up from the Stop or - Standby mode at regular intervals. Wake-up from STOP and STANDBY modes - is possible only when the RTC clock source is LSE or LSI. - - *** RTC driver macros list *** - ============================================= - [..] - Below the list of most used macros in RTC driver. - - (+) RTC_UNLOCK() Disable the protect. - (+) RTC_LOCK() Enable the protect. - (+) RTC_BY_PASS_ENABLE() Enable the by-pass shadow register. - (+) RTC_BY_PASS_DISABLE() Disable the by-pass shadow register. - (+) RTC_SUMMER_TIME_ENABLE() Enable summer time. - (+) RTC_SUMMER_TIME_DISABLE() Disable summer time. - (+) RTC_WINTER_TIME_ENABLE() Enable winter time. - (+) RTC_WINTER_TIME_DISABLE() Disable winter time. - [..] - (@) You can refer to the RTC driver header file for used the macros - - @endverbatim - ****************************************************************************** - */ - -#include "ald_rtc.h" -#include "ald_bkpc.h" -#include "ald_tsense.h" -#include "ald_syscfg.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup RTC RTC - * @brief RTC module driver - * @{ - */ -#ifdef ALD_RTC - -/** @addtogroup RTC_Private_Functions RTC Private Functions - * @{ - */ -/** - * @brief Converts form 2 digit BCD to Binary. - * @param bcd: BCD value to be converted. - * @retval Converted word. - */ -static uint32_t bcd_to_dec(uint32_t bcd) -{ - return ((bcd & 0xF) + ((bcd >> 4) & 0xF) * 10); -} - -/** - * @brief Converts a 2 digit decimal to BCD format. - * @param dec: Byte to be converted. - * @retval Converted byte. - */ -static uint32_t dec_to_bcd(uint32_t dec) -{ - return (((dec / 10) << 4) | (dec % 10)); -} - -/** - * @brief Time and Date consistency check. - * @param t_last: Last time. - * @param d_last: Last date. - * @param time: Current time. - * @param date: Current time. - * @retval status: - * 0 - Not consistency - * 1 - Consistency - */ -static int32_t rtc_consistency_check(rtc_time_t *t_last, - rtc_date_t *d_last, rtc_time_t *time, rtc_date_t *date) -{ - if (t_last->second != time->second) - return 0; - if (t_last->minute != time->minute) - return 0; - if (t_last->hour != time->hour) - return 0; - if (d_last->day != date->day) - return 0; - if (d_last->month != date->month) - return 0; - if (d_last->year != date->year) - return 0; - - return 1; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions RTC Public Functions - * @{ - */ - -/** @defgroup RTC_Public_Functions_Group1 Initialization functions - * @brief Initialization functions - * - * @verbatim - =============================================================================== - ##### Initialization function ##### - =============================================================================== - [..] This section provides functions allowing to initialize and configure the - RTC Prescaler (Synchronous and Asynchronous), RTC Hour format, disable - RTC registers Write protection. - (#) The RTC Prescaler is programmed to generate the RTC 1Hz time base. - It is split into 2 programmable prescalers to minimize power consumption. - (++) A 7-bit asynchronous prescaler and a 13-bit synchronous prescaler. - (++) When both prescalers are used, it is recommended to configure the - asynchronous prescaler to a high value to minimize power consumption. - (#) All RTC registers are Write protected. Writing to the RTC registers - is enabled by writing a key into the Write Protection register. - - @endverbatim - * @{ - */ - -/** - * @brief Reset RTC register. - * @retval None - */ -void ald_rtc_reset(void) -{ - RTC_UNLOCK(); - - WRITE_REG(RTC->CON, 0x0); - WRITE_REG(RTC->TAMPCON, 0x0); - WRITE_REG(RTC->WUMAT, 0x0); - WRITE_REG(RTC->IER, 0x0); - WRITE_REG(RTC->IFCR, ~0x0); - - RTC_LOCK(); - return; -} - -/** - * @brief Initialize the RTC module. - * @param init: Pointer to rtc_init_t structure which contains - * the configuration parameters. - * @retval None - */ -void ald_rtc_init(rtc_init_t *init) -{ - assert_param(IS_RTC_HOUR_FORMAT(init->hour_format)); - assert_param(IS_RTC_OUTPUT_SEL(init->output)); - assert_param(IS_RTC_OUTPUT_POLARITY(init->output_polarity)); - - ald_rtc_reset(); - RTC_UNLOCK(); - - MODIFY_REG(RTC->CON, RTC_CON_HFM_MSK, init->hour_format << RTC_CON_HFM_POS); - MODIFY_REG(RTC->CON, RTC_CON_EOS_MSK, init->output << RTC_CON_EOS_POSS); - MODIFY_REG(RTC->CON, RTC_CON_POL_MSK, init->output_polarity << RTC_CON_POL_POS); - MODIFY_REG(RTC->PSR, RTC_PSR_SPRS_MSK, init->synch_pre_div << RTC_PSR_SPRS_POSS); - MODIFY_REG(RTC->PSR, RTC_PSR_APRS_MSK, init->asynch_pre_div << RTC_PSR_APRS_POSS); - SET_BIT(RTC->CON, RTC_CON_GO_MSK); - - RTC_LOCK(); - return; -} - -/** - * @brief Configure the RTC source. - * @param sel: RTC source type. - * @retval None - */ -void ald_rtc_source_select(rtc_source_sel_t sel) -{ - assert_param(IS_RTC_SOURCE_SEL(sel)); - - BKPC_UNLOCK(); - MODIFY_REG(BKPC->PCCR, BKPC_PCCR_RTCCS_MSK, sel << BKPC_PCCR_RTCCS_POSS); - - if (sel == RTC_SOURCE_LOSC) { - SET_BIT(BKPC->CR, BKPC_CR_LOSCEN_MSK); - } - else if (sel == RTC_SOURCE_LRC) { - SET_BIT(BKPC->CR, BKPC_CR_LRCEN_MSK); - } - else { - ; /* do nothing */ - } - - BKPC_LOCK(); - return; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions_Group2 Time and Date functions - * @brief RTC Time and Date functions - * - * @verbatim - =============================================================================== - ##### Time and Date functions ##### - =============================================================================== - - [..] This section provides functions allowing: - [#] - (+) To configure the time use the ald_rtc_set_time() function. - (+) To configure the date use the ald_rtc_set_date() function. - (+) To read the time use the ald_rtc_get_time() function. - (+) To read the date use the ald_rtc_get_date() function. - - @endverbatim - * @{ - */ - -/** - * @brief Set specified time. - * @param time: pointer to a rtc_time_t structure. - * @param format: Data format. - * @retval ALD status. - */ -ald_status_t ald_rtc_set_time(rtc_time_t *time, rtc_format_t format) -{ - uint32_t tmp; - - assert_param(IS_RTC_FORMAT(format)); - - if (format == RTC_FORMAT_DEC) { - assert_param(IS_RTC_SECOND(time->second)); - assert_param(IS_RTC_MINUTE(time->minute)); - assert_param(IS_RTC_HOUR(time->hour)); - - tmp = (dec_to_bcd(time->second)) | - (dec_to_bcd(time->minute) << 8) | - (dec_to_bcd(time->hour) << 16); - } - else { - assert_param(IS_RTC_SECOND(bcd_to_dec(time->second))); - assert_param(IS_RTC_MINUTE(bcd_to_dec(time->minute))); - assert_param(IS_RTC_HOUR(bcd_to_dec(time->hour))); - - tmp = time->second | (time->minute << 8) | (time->hour << 16); - } - - RTC_UNLOCK(); - WRITE_REG(RTC->TIME, tmp); - RTC_LOCK(); - - tmp = ald_get_tick(); - - while (READ_BIT(RTC->CON, RTC_CON_BUSY_MSK)) { - if ((ald_get_tick() - tmp) > RTC_TIMEOUT_VALUE) - return TIMEOUT; - } - - return OK; -} - -/** - * @brief Set specified date. - * @param date: pointer to a rtc_date_t structure. - * @param format: Data format. - * @retval ALD status. - */ -ald_status_t ald_rtc_set_date(rtc_date_t *date, rtc_format_t format) -{ - uint32_t tmp; - - assert_param(IS_RTC_FORMAT(format)); - - if (format == RTC_FORMAT_DEC) { - assert_param(IS_RTC_DAY(date->day)); - assert_param(IS_RTC_MONTH(date->month)); - assert_param(IS_RTC_YEAR(date->year)); - - tmp = (dec_to_bcd(date->day)) | - (dec_to_bcd(date->month) << 8) | - (dec_to_bcd(date->year) << 16) | - (dec_to_bcd(date->week) << 24); - } - else { - assert_param(IS_RTC_DAY(bcd_to_dec(date->day))); - assert_param(IS_RTC_MONTH(bcd_to_dec(date->month))); - assert_param(IS_RTC_YEAR(bcd_to_dec(date->year))); - - tmp = date->day | (date->month << 8) | - (date->year << 16) | (date->week << 24); - } - - RTC_UNLOCK(); - WRITE_REG(RTC->DATE, tmp); - RTC_LOCK(); - - tmp = ald_get_tick(); - - while (READ_BIT(RTC->CON, RTC_CON_BUSY_MSK)) { - if ((ald_get_tick() - tmp) > RTC_TIMEOUT_VALUE) - return TIMEOUT; - } - - return OK; -} - -/** - * @brief Get current time. - * @param time: pointer to a rtc_time_t structure. - * @param format: Data format. - * @retval None - */ -void ald_rtc_get_time(rtc_time_t *time, rtc_format_t format) -{ - uint32_t tmp; - - assert_param(time != NULL); - assert_param(IS_RTC_FORMAT(format)); - - time->sub_sec = RTC->SSEC & 0xFFFF; - tmp = RTC->TIME; - - if (format == RTC_FORMAT_DEC) { - time->second = bcd_to_dec(tmp & 0x7F); - time->minute = bcd_to_dec((tmp >> 8) & 0x7F); - time->hour = bcd_to_dec((tmp >> 16) & 0x7F); - } - else { - time->second = tmp & 0x7F; - time->minute = (tmp >> 8) & 0x7F; - time->hour = (tmp >> 16) & 0x7F; - } - - return; -} - -/** - * @brief Get current date. - * @param date: pointer to a rtc_date_t structure. - * @param format: Data format. - * @retval None - */ -void ald_rtc_get_date(rtc_date_t *date, rtc_format_t format) -{ - uint32_t tmp = RTC->DATE; - - assert_param(date != NULL); - assert_param(IS_RTC_FORMAT(format)); - - if (format == RTC_FORMAT_DEC) { - date->day = bcd_to_dec(tmp & 0x3F); - date->month = bcd_to_dec((tmp >> 8) & 0x1F); - date->year = bcd_to_dec((tmp >> 16) & 0xFF); - date->week = bcd_to_dec((tmp >> 24) & 0x7); - } - else { - date->day = tmp & 0x3F; - date->month = (tmp >> 8) & 0x1F; - date->year = (tmp >> 16) & 0xFF; - date->week = (tmp >> 24) & 0x7; - } - - return; -} - -/** - * @brief Get time and date consistency. - * @param date: pointer to a rtc_date_t structure. - * @param time: pointer to a rtc_time_t structure. - * @param format: Data format. - * @retval Status: - * 0 - Consistency - * -1 - Not consistency - */ -int32_t ald_rtc_get_date_time(rtc_date_t *date, rtc_time_t *time, rtc_format_t format) -{ - int32_t nr = 3; - rtc_date_t d_last; - rtc_time_t t_last; - - while (nr--) { - ald_rtc_get_time(&t_last, format); - ald_rtc_get_date(&d_last, format); - ald_rtc_get_time(time, format); - ald_rtc_get_date(date, format); - - if (rtc_consistency_check(&t_last, &d_last, time, date)) - return 0; - } - - return -1; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions_Group3 Alarm functions - * @brief RTC alarm functions - * - * @verbatim - =============================================================================== - ##### Alarm functions ##### - =============================================================================== - - [..] This section provides functions allowing: - [#] - (+) To configure the alarm use ald_rtc_set_alarm() function - (+) To read the alarm use ald_rtc_get_alarm() function - - @endverbatim - * @{ - */ - -/** - * @brief Set alarm. - * @param alarm: pointer to rtc_alarm_t struct. - * @param format: Data format. - * @retval None - */ -void ald_rtc_set_alarm(rtc_alarm_t *alarm, rtc_format_t format) -{ - unsigned int tmp, ss_tmp; - - assert_param(IS_RTC_ALARM(alarm->idx)); - assert_param(IS_RTC_ALARM_SEL(alarm->sel)); - assert_param(IS_RTC_ALARM_SS_MASK(alarm->ss_mask)); - assert_param(IS_RTC_FORMAT(format)); - - if (format == RTC_FORMAT_DEC) { - assert_param(IS_RTC_SECOND(alarm->time.second)); - assert_param(IS_RTC_MINUTE(alarm->time.minute)); - assert_param(IS_RTC_HOUR(alarm->time.hour)); - - tmp = (dec_to_bcd(alarm->time.second)) | - (dec_to_bcd(alarm->time.minute) << 8) | - (dec_to_bcd(alarm->time.hour) << 16) | - alarm->mask; - - if (alarm->sel == RTC_SELECT_DAY) { - assert_param(IS_RTC_DAY(alarm->day)); - - tmp |= (dec_to_bcd(alarm->day) << 24); - tmp &= 0x7FFFFFFF; /* Reset bit31 */ - } - else { - tmp |= (1 << (alarm->week + 24)); - tmp |= 0x80000000; /* Set bit31 */ - } - } - else { - assert_param(IS_RTC_SECOND(bcd_to_dec(alarm->time.second))); - assert_param(IS_RTC_MINUTE(bcd_to_dec(alarm->time.minute))); - assert_param(IS_RTC_HOUR(bcd_to_dec(alarm->time.hour))); - - tmp = alarm->time.second | - (alarm->time.minute << 8) | - (alarm->time.hour << 16) | - alarm->mask; - - if (alarm->sel == RTC_SELECT_DAY) { - assert_param(IS_RTC_DAY(bcd_to_dec(alarm->day))); - - tmp |= (alarm->day << 24); - tmp &= 0x7FFFFFFF; /* Reset bit31 */ - } - else { - tmp |= (1 << (alarm->week + 24)); - tmp |= 0x80000000; /* Set bit31 */ - } - } - - ss_tmp = (alarm->time.sub_sec & 0x7F) | - (alarm->ss_mask << 24); - - RTC_UNLOCK(); - - if (alarm->idx == RTC_ALARM_A) { - WRITE_REG(RTC->ALMA, tmp); - WRITE_REG(RTC->ALMASSEC, ss_tmp); - SET_BIT(RTC->CON, RTC_CON_ALMAEN_MSK); - } - else { - WRITE_REG(RTC->ALMB, tmp); - WRITE_REG(RTC->ALMBSSEC, ss_tmp); - SET_BIT(RTC->CON, RTC_CON_ALMBEN_MSK); - } - - RTC_LOCK(); - return; -} - -/** - * @brief Get alarm parameters. - * @param alarm: pointer to rtc_alarm_t struct. - * @param format: Data format. - * @retval None - */ -void ald_rtc_get_alarm(rtc_alarm_t *alarm, rtc_format_t format) -{ - uint8_t week; - uint32_t tmp, ss_tmp; - - assert_param(alarm != NULL); - assert_param(IS_RTC_FORMAT(format)); - - if (alarm->idx == RTC_ALARM_A) { - tmp = RTC->ALMA; - ss_tmp = RTC->ALMASSEC; - } - else { - tmp = RTC->ALMB; - ss_tmp = RTC->ALMBSSEC; - } - - if ((tmp >> 31) & 0x1) { - alarm->sel = RTC_SELECT_WEEK; - week = ((tmp >> 24) & 0x7F); - - switch (week) { - case 1: - alarm->week = 0; - break; - case 2: - alarm->week = 1; - break; - case 4: - alarm->week = 2; - break; - case 8: - alarm->week = 3; - break; - case 16: - alarm->week = 4; - break; - case 32: - alarm->week = 5; - break; - case 64: - alarm->week = 6; - break; - default: - break; - } - } - else { - alarm->sel = RTC_SELECT_DAY; - - if (format == RTC_FORMAT_DEC) - alarm->day = bcd_to_dec((tmp >> 24) & 0x3F); - else - alarm->day = (tmp >> 24) & 0x3F; - } - - if (format == RTC_FORMAT_DEC) { - alarm->time.second = bcd_to_dec(tmp & 0x7F); - alarm->time.minute = bcd_to_dec((tmp >> 8) & 0x7F); - alarm->time.hour = bcd_to_dec((tmp >> 16) & 0x3F); - } - else { - alarm->time.second = tmp & 0x7F; - alarm->time.minute = (tmp >> 8) & 0x7F; - alarm->time.hour = (tmp >> 16) & 0x3F; - } - - alarm->time.sub_sec = ss_tmp & 0x7FFF; - alarm->ss_mask = (rtc_sub_second_mask_t)((ss_tmp >> 24) & 0xF); - alarm->mask = tmp & ALARM_MASK_ALL; - - return; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions_Group4 Time stamp functions - * @brief RTC time stamp functions - * - * @verbatim - =============================================================================== - ##### Time stamp functions ##### - =============================================================================== - - [..] This section provides functions allowing: - [#] - (+) To configure the time stamp use ald_rtc_set_time_stamp() function - (+) To read the time stamp use ald_rtc_get_time_stamp() function - (+) To cancel the time stamp use ald_rtc_cancel_time_stamp() function - - @endverbatim - * @{ - */ - -/** - * @brief Set time stamp. - * @param sel: time stamp signal select: - * @arg RTC_TS_SIGNAL_SEL_TAMPER0 - * @arg RTC_TS_SIGNAL_SEL_TAMPER1 - * @param style: time stamp trigger style: - * @arg RTC_TS_RISING_EDGE - * @arg RTC_TS_FALLING_EDGE - * @retval None - */ -void ald_rtc_set_time_stamp(rtc_ts_signal_sel_t sel, rtc_ts_trigger_style_t style) -{ - assert_param(IS_RTC_TS_SIGNAL(sel)); - assert_param(IS_RTC_TS_STYLE(style)); - - RTC_UNLOCK(); - - CLEAR_BIT(RTC->CON, RTC_CON_TSEN_MSK); - MODIFY_REG(RTC->CON, RTC_CON_TSSEL_MSK, style << RTC_CON_TSSEL_POS); - MODIFY_REG(RTC->CON, RTC_CON_TSPIN_MSK, sel << RTC_CON_TSPIN_POS); - SET_BIT(RTC->CON, RTC_CON_TSEN_MSK); - - RTC_LOCK(); - return; -} - -/** - * @brief Cancel time stamp. - * @retval None - */ -void ald_rtc_cancel_time_stamp(void) -{ - RTC_UNLOCK(); - CLEAR_BIT(RTC->CON, RTC_CON_TSEN_MSK); - RTC_LOCK(); - - return; -} - -/** - * @brief Get time stamp value. - * @param ts_time: pointer to rtc_time_t structure. - * @param ts_date: pointer to rtc_date_t structure. - * @param format: Data format. - * @retval None - */ -void ald_rtc_get_time_stamp(rtc_time_t *ts_time, rtc_date_t *ts_date, rtc_format_t format) -{ - uint32_t tmp0, tmp1; - - assert_param(ts_time != NULL); - assert_param(ts_date != NULL); - assert_param(IS_RTC_FORMAT(format)); - - ts_time->sub_sec = RTC->TSSSEC & 0xFFFF; - tmp0 = RTC->TSTIME; - tmp1 = RTC->TSDATE; - - if (format == RTC_FORMAT_DEC) { - ts_time->second = bcd_to_dec(tmp0 & 0x7F); - ts_time->minute = bcd_to_dec((tmp0 >> 8) & 0x7F); - ts_time->hour = bcd_to_dec((tmp0 >> 16) & 0x3F); - ts_date->day = bcd_to_dec(tmp1 & 0x3F); - ts_date->month = bcd_to_dec((tmp1 >> 8) & 0x1F); - ts_date->year = bcd_to_dec((tmp1 >> 16) & 0xFF); - ts_date->week = bcd_to_dec((tmp1 >> 24) & 0x7); - } - else { - ts_time->second = tmp0 & 0x7F; - ts_time->minute = (tmp0 >> 8) & 0x7F; - ts_time->hour = (tmp0 >> 16) & 0x3F; - ts_date->day = tmp1 & 0x3F; - ts_date->month = (tmp1 >> 8) & 0x1F; - ts_date->year = (tmp1 >> 16) & 0xFF; - ts_date->week = (tmp1 >> 24) & 0x7; - } - - return; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions_Group5 Tamper functions - * @brief RTC tamper functions - * - * @verbatim - =============================================================================== - ##### Tamper functions ##### - =============================================================================== - - [..] This section provides functions allowing: - [#] - (+) To configure the tamper use ald_rtc_set_tamper() function - (+) To cancel the tamper use ald_rtc_alarm_cmd() function - - @endverbatim - * @{ - */ -/** - * @brief Set tamper parameters. - * @param tamper: pointer to rtc_tamper_t structure. - * @retval None - */ -void ald_rtc_set_tamper(rtc_tamper_t *tamper) -{ - assert_param(IS_RTC_TAMPER(tamper->idx)); - assert_param(IS_RTC_TAMPER_TRIGGER(tamper->trig)); - assert_param(IS_RTC_TAMPER_SAMPLING_FREQ(tamper->freq)); - assert_param(IS_RTC_TAMPER_DURATION(tamper->dur)); - assert_param(IS_FUNC_STATE(tamper->ts)); - - RTC_UNLOCK(); - MODIFY_REG(RTC->TAMPCON, RTC_TAMPCON_TAMPTS_MSK, tamper->ts << RTC_TAMPCON_TAMPTS_POS); - MODIFY_REG(RTC->TAMPCON, RTC_TAMPCON_TAMPCKS_MSK, tamper->freq << RTC_TAMPCON_TAMPCKS_POSS); - MODIFY_REG(RTC->TAMPCON, RTC_TAMPCON_TAMPFLT_MSK, tamper->dur << RTC_TAMPCON_TAMPFLT_POSS); - - if (tamper->idx == RTC_TAMPER_0) { - MODIFY_REG(RTC->TAMPCON, RTC_TAMPCON_TAMP0LV_MSK, tamper->trig << RTC_TAMPCON_TAMP0LV_POS); - SET_BIT(RTC->TAMPCON, RTC_TAMPCON_TAMP0EN_MSK); - } - else { - MODIFY_REG(RTC->TAMPCON, RTC_TAMPCON_TAMP1LV_MSK, tamper->trig << RTC_TAMPCON_TAMP1LV_POS); - SET_BIT(RTC->TAMPCON, RTC_TAMPCON_TAMP1EN_MSK); - } - - RTC_LOCK(); - return; -} - -/** - * @brief Cancel tamper. - * @param idx: index of tamper: - * @arg RTC_TAMPER_0 - * @arg RTC_TAMPER_1 - * @retval None - */ -void ald_rtc_cancel_tamper(rtc_tamper_idx_t idx) -{ - assert_param(IS_RTC_TAMPER(idx)); - - RTC_UNLOCK(); - - if (idx == RTC_TAMPER_0) - CLEAR_BIT(RTC->TAMPCON, RTC_TAMPCON_TAMP0EN_MSK); - else - CLEAR_BIT(RTC->TAMPCON, RTC_TAMPCON_TAMP1EN_MSK); - - RTC_LOCK(); - return; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions_Group6 Wake-up functions - * @brief RTC wake-up functions - * - * @verbatim - =============================================================================== - ##### Wake-up functions ##### - =============================================================================== - - [..] This section provides functions allowing: - [#] - (+) To configure the wake-up parameters use ald_rtc_set_wakeup() function - (+) To read the re-load register value use ald_rtc_get_wakeup_timer_value() function - (+) To cancel the wake-up use ald_rtc_cancel_wakeup() function - - @endverbatim - * @{ - */ -/** - * @brief Set wake-up parameters. - * @param clock: pointer to rtc_wakeup_clock_t structure. - * @param value: re-load value. - * @retval None - */ -void ald_rtc_set_wakeup(rtc_wakeup_clock_t clock, uint16_t value) -{ - assert_param(IS_RTC_WAKEUP_CLOCK(clock)); - - RTC_UNLOCK(); - MODIFY_REG(RTC->CON, RTC_CON_WUCKS_MSK, clock << RTC_CON_WUCKS_POSS); - WRITE_REG(RTC->WUMAT, value & 0xFFFF); - SET_BIT(RTC->CON, RTC_CON_WUTE_MSK); - RTC_LOCK(); - - return; -} - -/** - * @brief Cancel wake-up. - * @retval None - */ -void ald_rtc_cancel_wakeup(void) -{ - RTC_UNLOCK(); - CLEAR_BIT(RTC->CON, RTC_CON_WUTE_MSK); - RTC_LOCK(); - - return; -} - -/** - * @brief Get wake-up re-load register value. - * @retval Value of re-load register. - */ -uint16_t ald_rtc_get_wakeup_timer_value(void) -{ - return RTC->WUMAT & 0xFFFF; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions_Group7 Clock output functions - * @brief RTC clock output functions - * - * @verbatim - =============================================================================== - ##### Clock output functions ##### - =============================================================================== - - [..] This section provides functions allowing: - [#] - (+) To configure the clock output type use ald_rtc_set_clock_output() function - (+) To cancel the clock output use ald_rtc_cancel_clock_output() function - - @endverbatim - * @{ - */ -/** - * @brief Set clock output parameters. - * @param clock: pointer to rtc_clock_output_t structure. - * @retval ALD status. - */ -ald_status_t ald_rtc_set_clock_output(rtc_clock_output_t clock) -{ - uint32_t cnt = 4000; - assert_param(IS_RTC_CLOCK_OUTPUT(clock)); - - SYSCFG_UNLOCK(); - - if (clock == RTC_CLOCK_OUTPUT_EXA_1) { - SET_BIT(CMU->CLKENR, CMU_CLKENR_PLL2EN_MSK); - while ((READ_BIT(CMU->PLLCFG, CMU_PLLCFG_PLL2LCKN_MSK)) && (--cnt)); - cnt = 4000; - while ((!(READ_BIT(CMU->CLKSR, CMU_CLKSR_PLL2RDY_MSK))) && (--cnt)); - } - else { - CLEAR_BIT(CMU->CLKENR, CMU_CLKENR_PLL2EN_MSK); - } - - SYSCFG_LOCK(); - RTC_UNLOCK(); - MODIFY_REG(RTC->CON, RTC_CON_CKOS_MSK, clock << RTC_CON_CKOS_POSS); - SET_BIT(RTC->CON, RTC_CON_CKOE_MSK); - RTC_LOCK(); - - return OK; -} - -/** - * @brief Cancel clock output. - * @retval None - */ -void ald_rtc_cancel_clock_output(void) -{ - RTC_UNLOCK(); - CLEAR_BIT(RTC->CON, RTC_CON_CKOE_MSK); - RTC_LOCK(); - - return; -} -/** - * @} - */ - -/** @defgroup RTC_Public_Functions_Group8 Control functions - * @brief RTC control functions - * - * @verbatim - =============================================================================== - ##### Control functions ##### - =============================================================================== - - [..] This section provides functions allowing: - [#] - (+) Configure interrupt enable/disable. - (+) Enable/disable alarm. - (+) Configure rtc shift. - (+) Calibrate time. - (+) Get interrupt source status. - (+) Get interrupt flag status. - (+) Clear interrupt flag. - - @endverbatim - * @{ - */ -/** - * @brief Enable/disable the specified RTC interrupts. - * @param it: Specifies the RTC interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref rtc_it_t. - * @param state: New state of the specified RTC interrupts. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_rtc_interrupt_config(rtc_it_t it, type_func_t state) -{ - assert_param(IS_RTC_IT(it)); - assert_param(IS_FUNC_STATE(state)); - - RTC_UNLOCK(); - - if (state == ENABLE) - SET_BIT(RTC->IER, it); - else - CLEAR_BIT(RTC->IER, it); - - RTC_LOCK(); - return; -} - -/** - * @brief Enable/Disable alarm. - * @param idx: index of alarm: - * @arg RTC_ALARM_A - * @arg RTC_ALARM_B - * @param state: New status of the specified alarm: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_rtc_alarm_cmd(rtc_alarm_idx_t idx, type_func_t state) -{ - assert_param(IS_RTC_ALARM(idx)); - assert_param(IS_FUNC_STATE(state)); - - RTC_UNLOCK(); - - if (idx == RTC_ALARM_A) - MODIFY_REG(RTC->CON, RTC_CON_ALMAEN_MSK, state << RTC_CON_ALMAEN_POS); - else - MODIFY_REG(RTC->CON, RTC_CON_ALMBEN_MSK, state << RTC_CON_ALMBEN_POS); - - RTC_LOCK(); - return; -} - -/** - * @brief Set shift parameters. - * @param add_1s: Enable/Disable added 1 second. - * @param sub_ss: value of sub-sconde. - * @retval ALD status. - */ -ald_status_t ald_rtc_set_shift(type_func_t add_1s, uint16_t sub_ss) -{ - uint32_t tick; - - assert_param(IS_FUNC_STATE(add_1s)); - assert_param(IS_SHIFT_SUB_SS(sub_ss)); - - RTC_UNLOCK(); - MODIFY_REG(RTC->SSECTR, RTC_SSECTR_TRIM_MSK, sub_ss << RTC_SSECTR_TRIM_POSS); - MODIFY_REG(RTC->SSECTR, RTC_SSECTR_INC_MSK, add_1s << RTC_SSECTR_INC_POS); - RTC_LOCK(); - - tick = ald_get_tick(); - - while (READ_BIT(RTC->CON, RTC_CON_SSEC_MSK)) { - if ((ald_get_tick() - tick) > RTC_TIMEOUT_VALUE) - return TIMEOUT; - } - - return OK; -} - -/** - * @brief Set calibation - * @param config: pointer to rtc_cali_t structure. - * @retval None - */ -void ald_rtc_set_cali(rtc_cali_t *config) -{ - assert_param(IS_RTC_CALI_FREQ(config->cali_freq)); - assert_param(IS_RTC_CALI_TC(config->tc)); - assert_param(IS_RTC_CALC_FREQ(config->calc_freq)); - assert_param(IS_RTC_CALI_CALC(config->calc)); - assert_param(IS_FUNC_STATE(config->acc)); - - RTC_UNLOCK(); - RTC_CALI_UNLOCK(); - - MODIFY_REG(RTC->CALCON, RTC_CALCON_CALP_MSK, config->cali_freq << RTC_CALCON_CALP_POSS); - MODIFY_REG(RTC->CALCON, RTC_CALCON_TCM_MSK, config->tc << RTC_CALCON_TCM_POSS); - MODIFY_REG(RTC->CALCON, RTC_CALCON_TCP_MSK, config->calc_freq << RTC_CALCON_TCP_POSS); - MODIFY_REG(RTC->CALCON, RTC_CALCON_ALG_MSK, config->calc << RTC_CALCON_ALG_POS); - MODIFY_REG(RTC->CALCON, RTC_CALCON_DCMACC_MSK, config->acc << RTC_CALCON_DCMACC_POS); - SET_BIT(RTC->CALCON, RTC_CALCON_CALEN_MSK); - - RTC_CALI_LOCK(); - RTC_LOCK(); - - return; -} - -/** - * @brief Cancel calibration - * @retval None - */ -void ald_rtc_cancel_cali(void) -{ - RTC_CALI_UNLOCK(); - CLEAR_BIT(RTC->CALCON, RTC_CALCON_CALEN_MSK); - RTC_CALI_LOCK(); - - return; -} - -/** - * @brief Get calibration status. - * @retval ALD status. - */ -ald_status_t ald_rtc_get_cali_status(void) -{ - if (READ_BIT(RTC->CALCON, RTC_CALCON_ERR_MSK)) - return ERROR; - else - return OK; -} - -/** - * @brief Write temperature value. - * @param temp: the value of temperature. - * @retval None - */ -void ald_rtc_write_temp(uint16_t temp) -{ - RTC_CALI_UNLOCK(); - MODIFY_REG(RTC->TEMPR, RTC_TEMPR_VAL_MSK, temp << RTC_TEMPR_VAL_POSS); - RTC_CALI_LOCK(); - - return; -} - -/** - * @brief Get the status of RTC interrupt source. - * @param it: Specifies the RTC interrupt source. - * This parameter can be one of the @ref rtc_it_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -it_status_t ald_rtc_get_it_status(rtc_it_t it) -{ - assert_param(IS_RTC_IT(it)); - - if (READ_BIT(RTC->IER, it)) - return SET; - - return RESET; -} - -/** - * @brief Get the status of RTC interrupt flag. - * @param flag: Specifies the RTC interrupt flag. - * This parameter can be one of the @ref rtc_flag_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_rtc_get_flag_status(rtc_flag_t flag) -{ - assert_param(IS_RTC_IF(flag)); - - if (READ_BIT(RTC->IFR, flag)) - return SET; - - return RESET; -} - -/** @brief Clear the specified RTC pending flag. - * @param flag: specifies the flag to check. - * @retval None. - */ -void ald_rtc_clear_flag_status(rtc_flag_t flag) -{ - assert_param(IS_RTC_IF(flag)); - - RTC_UNLOCK(); - WRITE_REG(RTC->IFCR, flag); - RTC_LOCK(); - - return; -} -/** - * @} - */ -/** - * @} - */ -#endif /* ALD_RTC */ -/** - * @} - */ -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_smartcard.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_smartcard.c deleted file mode 100644 index 2b3552ab77..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_smartcard.c +++ /dev/null @@ -1,925 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_smartcard.c - * @brief SMARTCARD module driver. - * This file provides firmware functions to manage the following - * functionalities of the SMARTCARD peripheral: - * + Initialization functions - * + IO operation functions - * + Peripheral State and Errors functions - * - * @version V1.0 - * @date 25 Apr 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - The SMARTCARD driver can be used as follows: - - (#) Declare a smartcard_handle_t handle structure. - (##) Enable the interface clock of the USARTx associated to the SMARTCARD. - (##) SMARTCARD pins configuration: - (+++) Enable the clock for the SMARTCARD GPIOs. - (+++) Configure the USART pins (TX as alternate function pull-up, RX as alternate function Input). - (##) NVIC configuration if you need to use interrupt process (ald_smartcard_send_by_it() - and ald_smartcard_recv_by_it() APIs): - (+++) Configure the USARTx interrupt priority. - (+++) Enable the NVIC USART IRQ handle. - (##) DMA Configuration if you need to use DMA process (ald_smartcard_send_by_dma() - and ald_smartcard_recv_by_dma() APIs): - (+++) Declare a DMA handle structure for the Tx/Rx channel. - (+++) Enable the DMAx interface clock. - (+++) Configure the declared DMA handle structure with the required Tx/Rx parameters. - (+++) Configure the DMA Tx/Rx channel. - (+++) Associate the initilalized DMA handle to the SMARTCARD DMA Tx/Rx handle. - (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the DMA Tx/Rx channel. - (+++) Configure the USARTx interrupt priority and enable the NVIC USART IRQ handle - (used for last byte sending completion detection in DMA non circular mode) - - (#) Program the Baud Rate, Word Length , Stop Bit, Parity, Hardware - flow control and Mode(Receiver/Transmitter) in the SMARTCARD Init structure. - - (#) Initialize the SMARTCARD registers by calling the ald_smartcard_init() API. - - (#) Three operation modes are available within this driver : - - *** Polling mode IO operation *** - ================================= - [..] - (+) Send an amount of data in blocking mode using ald_smartcard_send() - (+) Receive an amount of data in blocking mode using ald_smartcard_recv() - - *** Interrupt mode IO operation *** - =================================== - [..] - (+) Send an amount of data in non blocking mode using ald_smartcard_send_by_it() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode using ald_smartcard_recv_by_it() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - - *** DMA mode IO operation *** - ============================== - [..] - (+) Send an amount of data in non blocking mode (DMA) using ald_smartcard_send_by_dma() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode (DMA) using ald_smartcard_recv_by_dma() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk()() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - - *** SMARTCARD ALD driver macros list *** - ======================================== - [..] - Below the list of most used macros in SMARTCARD ALD driver. - - (+) SMARTCARD_ENABLE: Enable the SmartCard peripheral. - (+) SMARTCARD_DISABLE: Disable the SmartCard peripheral. - (+) smartcard_reset_HANDLE_STATE : Reset SmartCard handle. - (+) SMARTCARD_FLUSH_DRREGISTER : Flush SmartCard data. - - [..] - (@) You can refer to the SMARTCARD library header file for more useful macros - - @endverbatim - ****************************************************************************** - */ - - -#include "ald_smartcard.h" -#include "ald_cmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup SMARTCARD SMARTCARD - * @brief SMARTCARD module driver - * @{ - */ - -#ifdef ALD_SMARTCARD - -/** @addtogroup SMARTCARD_Private_Functions SMARTCARD Private Functions - * @{ - */ -static ald_status_t __smartcard_send_by_it(smartcard_handle_t *hperh); -static ald_status_t __smartcard_end_send_by_it(smartcard_handle_t *hsmartcard); -static ald_status_t __smartcard_recv_by_it(smartcard_handle_t *hperh); -static void smartcard_set_config(smartcard_handle_t *hperh); -#ifdef ALD_DMA -static void smartcard_dma_send_cplt(void *arg); -static void smartcard_dma_recv_cplt(void *arg); -static void smartcard_dma_error(void *arg); -#endif -static ald_status_t smartcard_wait_flag(smartcard_handle_t *hperh, usart_flag_t flag, flag_status_t status, uint32_t timeout); -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Functions SMARTCARD Public Functions - * @{ - */ - -/** @defgroup SMARTCARD_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * - * @verbatim - - ============================================================================== - ##### Initialization and Configuration functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to initialize the USART - in Smartcard mode. - [..] - The Smartcard interface is designed to support asynchronous protocol Smartcards as - defined in the ISO 7816-3 standard. - [..] - The USART can provide a clock to the smartcard through the SCLK output. - In smartcard mode, SCLK is not associated to the communication but is simply derived - from the internal peripheral input clock through a 5-bit prescaler. - [..] - (+) For the Smartcard mode only these parameters can be configured: - (++) Baud Rate - (++) Word Length => Should be 9 bits (8 bits + parity) - (++) Stop Bit - (++) Parity: => Should be enabled - (++) USART polarity - (++) USART phase - (++) USART LastBit - (++) Receiver/transmitter modes - (++) Prescaler - (++) GuardTime - (++) NACKState: The Smartcard NACK state - - (+) Recommended SmartCard interface configuration to get the Answer to Reset from the Card: - (++) word Length = 9 Bits - (++) 1.5 Stop Bit - (++) Even parity - (++) BaudRate = 12096 baud - (++) Tx and Rx enabled - [..] - Please refer to the ISO 7816-3 specification for more details. - - (@) It is also possible to choose 0.5 stop bit for receiving but it is recommended - to use 1.5 stop bits for both transmitting and receiving to avoid switching - between the two configurations. - [..] - The ald_smartcard_init() function follows the USART SmartCard configuration procedure. - - @endverbatim - * @{ - */ - -/* - Additionnal remark on the smartcard frame: - +-------------------------------------------------------------+ - | M bit | PCE bit | SMARTCARD frame | - |---------------------|---------------------------------------| - | 1 | 1 | | SB | 8 bit data | PB | STB | | - +-------------------------------------------------------------+ -*/ - -/** - * @brief Initializes the SmartCard mode according to the specified - * parameters in the smartcard_handle_t and create the associated handle. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_init(smartcard_handle_t *hperh) -{ - assert_param(IS_USART_WORD_LENGTH(hperh->init.word_length)); - assert_param(IS_USART_STOPBITS(hperh->init.stop_bits)); - assert_param(IS_USART_PARITY(hperh->init.parity)); - assert_param(IS_USART(hperh->perh)); - assert_param(IS_FUNC_STATE(hperh->init.nack)); - assert_param(IS_SMARTCARD_PRESCALER(hperh->init.prescaler)); - - if (hperh->state == SMARTCARD_STATE_RESET) - hperh->lock = UNLOCK; - - hperh->state = SMARTCARD_STATE_BUSY; - SMARTCARD_DISABLE(hperh); - - MODIFY_REG(hperh->perh->GP, USART_GP_PSC_MSK, hperh->init.prescaler << USART_GP_PSC_POSS); - MODIFY_REG(hperh->perh->GP, USART_GP_GTVAL_MSK, hperh->init.guard_time << USART_GP_GTVAL_POSS); - smartcard_set_config(hperh); - - CLEAR_BIT(hperh->perh->CON2, USART_CON2_IREN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_HDPSEL_MSK); - - SMARTCARD_ENABLE(hperh); - MODIFY_REG(hperh->perh->CON2, USART_CON2_NACK_MSK, hperh->init.nack << USART_CON2_NACK_POS); - SET_BIT(hperh->perh->CON2, USART_CON2_SMARTEN_MSK); - - hperh->err_code = SMARTCARD_ERROR_NONE; - hperh->state = SMARTCARD_STATE_READY; - return OK; -} - -/** - * @brief Reset SMARTCARD register. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_reset(smartcard_handle_t *hperh) -{ - assert_param(IS_USART(hperh->perh)); - - hperh->state = SMARTCARD_STATE_BUSY; - SMARTCARD_DISABLE(hperh); - - WRITE_REG(hperh->perh->CON0, 0x0); - WRITE_REG(hperh->perh->CON1, 0x0); - WRITE_REG(hperh->perh->CON2, 0x0); - WRITE_REG(hperh->perh->BAUDCON, 0x0); - WRITE_REG(hperh->perh->GP, 0x0); - - hperh->err_code = SMARTCARD_ERROR_NONE; - hperh->state = SMARTCARD_STATE_RESET; - __UNLOCK(hperh); - - return OK; -} -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Functions_Group2 IO operation functions - * @brief SMARTCARD Transmit and Receive functions - * - * @verbatim - ============================================================================== - ##### IO operation functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to manage the SMARTCARD data transfers. - - [..] - (#) Smartcard is a single wire half duplex communication protocol. - The Smartcard interface is designed to support asynchronous protocol Smartcards as - defined in the ISO 7816-3 standard. - (#) The USART should be configured as: - (++) 8 bits plus parity: where M=1 and PCE=1 in the USART_CR1 register - (++) 1.5 stop bits when transmitting and receiving: where STOP=11 in the USART_CR2 register. - - (#) There are two modes of transfer: - (++) Blocking mode: The communication is performed in polling mode. - The library status of all data processing is returned by the same function - after finishing transfer. - (++) No-Blocking mode: The communication is performed using Interrupts - or DMA, the relevant API's return the library status. - The end of the data processing will be indicated through the - dedicated SMARTCARD IRQ when using Interrupt mode or the DMA IRQ when - using DMA mode. - The hperh->tx_cplt_cbk(), hperh->rx_cplt_cbk() user callbacks - will be executed respectively at the end of the Transmit or Receive process - The hperh->error_cbk() user callback will be executed when a communication - error is detected. - - (#) Blocking mode APIs are : - (++) ald_smartcard_send() - (++) ald_smartcard_recv() - - (#) Non Blocking mode APIs with Interrupt are : - (++) ald_smartcard_send_by_it() - (++) ald_smartcard_recv_by_it() - (++) ald_smartcard_irq_handler() - - (#) Non Blocking mode functions with DMA are : - (++) ald_smartcard_send_by_dma() - (++) ald_smartcard_recv_by_dma() - - * @endverbatim - * @{ - */ - -/** - * @brief Sends an amount of data in blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Specify timeout value - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_send(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if ((hperh->state != SMARTCARD_STATE_READY) && (hperh->state != SMARTCARD_STATE_BUSY_RX)) - return BUSY; - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - hperh->err_code = SMARTCARD_ERROR_NONE; - SET_BIT(hperh->state, USART_STATE_TX_MASK); - - hperh->tx_size = size; - hperh->tx_count = size; - - while (hperh->tx_count-- > 0) { - if (smartcard_wait_flag(hperh, USART_FLAG_TXE, SET, timeout) != OK) { - hperh->state = SMARTCARD_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - WRITE_REG(hperh->perh->DATA, *buf++); - } - - if (smartcard_wait_flag(hperh, USART_FLAG_TC, SET, timeout) != OK) { - hperh->state = SMARTCARD_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - CLEAR_BIT(hperh->state, USART_STATE_TX_MASK); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Receive an amount of data in blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param timeout: Specify timeout value - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_recv(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if ((hperh->state != SMARTCARD_STATE_READY) && (hperh->state != SMARTCARD_STATE_BUSY_TX)) - return BUSY; - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - hperh->err_code = SMARTCARD_ERROR_NONE; - SET_BIT(hperh->state, USART_STATE_RX_MASK); - - hperh->rx_size = size; - hperh->rx_count = size; - - while (hperh->rx_count-- > 0) { - if (smartcard_wait_flag(hperh, USART_FLAG_RXNE, SET, timeout) != OK) { - hperh->state = SMARTCARD_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - *buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - } - - __UNLOCK(hperh); - CLEAR_BIT(hperh->state, USART_STATE_RX_MASK); - - return OK; -} - -/** - * @brief Sends an amount of data in non-blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_send_by_it(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if ((hperh->state != SMARTCARD_STATE_READY) && (hperh->state != SMARTCARD_STATE_BUSY_RX)) - return BUSY; - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_TX_MASK); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = SMARTCARD_ERROR_NONE; - - __UNLOCK(hperh); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_ERR, ENABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_TXE, ENABLE); - - return OK; -} - -/** - * @brief Receives an amount of data in non-blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_recv_by_it(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if ((hperh->state != SMARTCARD_STATE_READY) && (hperh->state != SMARTCARD_STATE_BUSY_TX)) - return BUSY; - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_RX_MASK); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = SMARTCARD_ERROR_NONE; - - __UNLOCK(hperh); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_RXNE, ENABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_PE, ENABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_ERR, ENABLE); - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Sends an amount of data in non-blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as USART transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_send_by_dma(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if ((hperh->state != SMARTCARD_STATE_READY) && (hperh->state != SMARTCARD_STATE_BUSY_RX)) - return BUSY; - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_TX_MASK); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = SMARTCARD_ERROR_NONE; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - hperh->hdmatx.cplt_cbk = smartcard_dma_send_cplt; - hperh->hdmatx.cplt_arg = (void *)hperh; - hperh->hdmatx.err_cbk = smartcard_dma_error; - hperh->hdmatx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_USART_TXEMPTY; - hperh->hdmatx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmatx); - - ald_usart_clear_flag_status((usart_handle_t *)hperh, USART_FLAG_TC); - __UNLOCK(hperh); - ald_usart_dma_req_config((usart_handle_t *)hperh, USART_DMA_REQ_TX, ENABLE); - - return OK; -} - -/** - * @brief Receive an amount of data in non-blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param channel: DMA channel as USART transmit - * @note When the SMARTCARD parity is enabled (PCE = 1) the data received contain the parity bit. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_smartcard_recv_by_dma(smartcard_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if ((hperh->state != SMARTCARD_STATE_READY) && (hperh->state != SMARTCARD_STATE_BUSY_TX)) - return BUSY; - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_RX_MASK); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = SMARTCARD_ERROR_NONE; - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - hperh->hdmarx.cplt_cbk = smartcard_dma_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = smartcard_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_USART_RNR; - hperh->hdmarx.config.channel = channel; - ald_dma_config_basic(&hperh->hdmarx); - - __UNLOCK(hperh); - ald_usart_dma_req_config((usart_handle_t *)hperh, USART_DMA_REQ_RX, ENABLE); - - return OK; -} -#endif - -/** - * @brief This function handles SMARTCARD interrupt request. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval None - */ -void ald_smartcard_irq_handler(smartcard_handle_t *hperh) -{ - uint32_t flag; - uint32_t source; - - /* Handle parity error */ - flag = ald_usart_get_flag_status((usart_handle_t *)hperh, USART_FLAG_PE); - source = ald_usart_get_it_status((usart_handle_t *)hperh, USART_IT_PE); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= SMARTCARD_ERROR_PE; - - /* Handle frame error */ - flag = ald_usart_get_flag_status((usart_handle_t *)hperh, USART_FLAG_FE); - source = ald_usart_get_it_status((usart_handle_t *)hperh, USART_IT_ERR); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= SMARTCARD_ERROR_FE; - - /* Handle noise error */ - flag = ald_usart_get_flag_status((usart_handle_t *)hperh, USART_FLAG_NE); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= SMARTCARD_ERROR_NE; - - /* Handle overrun error */ - flag = ald_usart_get_flag_status((usart_handle_t *)hperh, USART_FLAG_ORE); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= SMARTCARD_ERROR_ORE; - - /* Handle receive */ - flag = ald_usart_get_flag_status((usart_handle_t *)hperh, USART_FLAG_RXNE); - source = ald_usart_get_it_status((usart_handle_t *)hperh, USART_IT_RXNE); - if ((flag != RESET) && (source != RESET)) - __smartcard_recv_by_it(hperh); - - /* Handle transmit */ - flag = ald_usart_get_flag_status((usart_handle_t *)hperh, USART_FLAG_TXE); - source = ald_usart_get_it_status((usart_handle_t *)hperh, USART_IT_TXE); - if ((flag != RESET) && (source != RESET)) - __smartcard_send_by_it(hperh); - - /* Handle transmit complete */ - flag = ald_usart_get_flag_status((usart_handle_t *)hperh, USART_FLAG_TC); - source = ald_usart_get_it_status((usart_handle_t *)hperh, USART_IT_TC); - if ((flag != RESET) && (source != RESET)) - __smartcard_end_send_by_it(hperh); - - /* Handle error */ - if (hperh->err_code != SMARTCARD_ERROR_NONE) { - USART_CLEAR_PEFLAG(hperh); - hperh->state = SMARTCARD_STATE_READY; - - if (hperh->error_cbk) - hperh->error_cbk(hperh); - } -} -/** - * @} - */ - -/** @defgroup SMARTCARD_Public_Functions_Group3 Peripheral State and Errors functions - * @brief SMARTCARD State and Errors functions - * -@verbatim - ============================================================================== - ##### Peripheral State and Errors functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to return the State of SmartCard - communication process and also return Peripheral Errors occurred during communication process - (+) ald_smartcard_get_state() API can be helpful to check in run-time the state - of the SMARTCARD peripheral. - (+) ald_smartcard_get_error() check in run-time errors that could be occurred during - communication. - -@endverbatim - * @{ - */ - -/** - * @brief Returns the SMARTCARD state. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval ALD state - */ -smartcard_state_t ald_smartcard_get_state(smartcard_handle_t *hperh) -{ - return hperh->state; -} - -/** - * @brief Return the SMARTCARD error code - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval SMARTCARD Error Code - */ -uint32_t ald_smartcard_get_error(smartcard_handle_t *hperh) -{ - return hperh->err_code; -} - -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup SMARTCARD_Private_Functions SMARTCARD Private Functions - * @brief SMARTCARD Private functions - * @{ - */ - -#ifdef ALD_DMA -/** - * @brief DMA SMARTCARD transmit process complete callback. - * @param arg: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified DMA module. - * @retval None - */ -static void smartcard_dma_send_cplt(void *arg) -{ - smartcard_handle_t* hperh = ( smartcard_handle_t *)arg; - - hperh->tx_count = 0; - ald_usart_dma_req_config((usart_handle_t *)hperh, USART_DMA_REQ_TX, DISABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_TC, ENABLE); - - return; -} - -/** - * @brief DMA SMARTCARD receive process complete callback. - * @param arg: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified DMA module. - * @retval None - */ -static void smartcard_dma_recv_cplt(void *arg) -{ - smartcard_handle_t* hperh = ( smartcard_handle_t* )arg; - - hperh->rx_count = 0; - ald_usart_dma_req_config((usart_handle_t *)hperh, USART_DMA_REQ_RX, DISABLE); - CLEAR_BIT(hperh->state, USART_STATE_RX_MASK); - - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); - - return; -} - -/** - * @brief DMA SMARTCARD communication error callback. - * @param arg: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified DMA module. - * @retval None - */ -static void smartcard_dma_error(void *arg) -{ - smartcard_handle_t* hperh = ( smartcard_handle_t* )arg; - - hperh->rx_count = 0; - hperh->tx_count = 0; - hperh->err_code = SMARTCARD_ERROR_DMA; - hperh->state = SMARTCARD_STATE_READY; - - ald_usart_dma_req_config((usart_handle_t *)hperh, USART_DMA_REQ_TX, DISABLE); - ald_usart_dma_req_config((usart_handle_t *)hperh, USART_DMA_REQ_RX, DISABLE); - - if (hperh->error_cbk) - hperh->error_cbk(hperh); - - return; -} -#endif - -/** - * @brief This function handles USART Communication Timeout. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param flag: specifies the USART flag to check. - * @param status: The new Flag status (SET or RESET). - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t smartcard_wait_flag(smartcard_handle_t *hperh, usart_flag_t flag, flag_status_t status, uint32_t timeout) -{ - uint32_t tick; - - if (timeout == 0) - return OK; - - tick = ald_get_tick(); - - while ((ald_usart_get_flag_status((usart_handle_t *)hperh, flag)) != status) { - if (((ald_get_tick()) - tick) > timeout) { - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_TXE, DISABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_RXNE, DISABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_PE, DISABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_ERR, DISABLE); - - return TIMEOUT; - } - } - - return OK; -} - -/** - * @brief Send an amount of data in non-blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * Function called under interruption only, once - * interruptions have been enabled by ald_smartcard_send_by_it() - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __smartcard_send_by_it(smartcard_handle_t *hperh) -{ - if ((hperh->state != SMARTCARD_STATE_BUSY_TX) && (hperh->state != SMARTCARD_STATE_BUSY_TX_RX)) - return BUSY; - - WRITE_REG(hperh->perh->DATA, *hperh->tx_buf++); - - if (--hperh->tx_count == 0) { - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_TXE, DISABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_TC, ENABLE); - } - - return OK; -} - - -/** - * @brief Wraps up transmission in non blocking mode. - * @param hperh: pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __smartcard_end_send_by_it(smartcard_handle_t *hperh) -{ - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_TC, DISABLE); - CLEAR_BIT(hperh->state, USART_STATE_TX_MASK); - - if (hperh->state == SMARTCARD_STATE_READY) - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_ERR, DISABLE); - - if (hperh->tx_cplt_cbk) - hperh->tx_cplt_cbk(hperh); - - return OK; -} - - -/** - * @brief Receive an amount of data in non-blocking mode. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __smartcard_recv_by_it(smartcard_handle_t *hperh) -{ - if ((hperh->state != SMARTCARD_STATE_BUSY_RX) && (hperh->state != SMARTCARD_STATE_BUSY_TX_RX)) - return BUSY; - - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - - if (--hperh->rx_count == 0) { - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_RXNE, DISABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_PE, DISABLE); - ald_usart_interrupt_config((usart_handle_t *)hperh, USART_IT_ERR, DISABLE); - CLEAR_BIT(hperh->state, USART_STATE_RX_MASK); - - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); - } - - return OK; -} - -/** - * @brief Configures the SMARTCARD peripheral. - * @param hperh: Pointer to a smartcard_handle_t structure that contains - * the configuration information for the specified SMARTCARD module. - * @retval None - */ -static void smartcard_set_config(smartcard_handle_t *hperh) -{ - uint32_t tmp; - uint32_t integer; - uint32_t fractional; - - /* Check the parameters */ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_BAUDRATE(hperh->init.baud)); - assert_param(IS_USART_WORD_LENGTH(hperh->init.word_length)); - assert_param(IS_USART_STOPBITS(hperh->init.stop_bits)); - assert_param(IS_USART_PARITY(hperh->init.parity)); - assert_param(IS_USART_MODE(hperh->init.mode)); - - MODIFY_REG(hperh->perh->CON1, USART_CON1_STPLEN_MSK, hperh->init.stop_bits << USART_CON1_STPLEN_POSS); - tmp = READ_REG(hperh->perh->CON0); - MODIFY_REG(tmp, USART_CON0_DLEN_MSK, hperh->init.word_length << USART_CON0_DLEN_POS); - - if (hperh->init.parity == USART_PARITY_NONE) - CLEAR_BIT(tmp, USART_CON0_PEN_MSK); - else - SET_BIT(tmp, USART_CON0_PEN_MSK); - - if (hperh->init.parity == USART_PARITY_ODD) - SET_BIT(tmp, USART_CON0_PSEL_MSK); - else - CLEAR_BIT(tmp, USART_CON0_PSEL_MSK); - - WRITE_REG(hperh->perh->CON0, tmp); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_RTSEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_CTSEN_MSK); - MODIFY_REG(hperh->perh->CON0, USART_CON0_RXEN_MSK, (hperh->init.mode & 0x1) << USART_CON0_RXEN_POS); - MODIFY_REG(hperh->perh->CON0, USART_CON0_TXEN_MSK, ((hperh->init.mode >> 1) & 0x1) << USART_CON0_TXEN_POS); - tmp = READ_REG(hperh->perh->CON1); - SET_BIT(tmp, USART_CON1_SCKEN_MSK); - MODIFY_REG(tmp, USART_CON1_SCKPOL_MSK, hperh->init.polarity << USART_CON1_SCKPOL_POS); - MODIFY_REG(tmp, USART_CON1_SCKPHA_MSK, hperh->init.phase << USART_CON1_SCKPHA_POS); - MODIFY_REG(tmp, USART_CON1_LBCP_MSK, hperh->init.last_bit << USART_CON1_LBCP_POS); - - /* Determine the integer part */ - if (READ_BIT(hperh->perh->CON0, (1 << 15))) { - /* Integer part computing in case Oversampling mode is 8 Samples */ - integer = ((25 * ald_cmu_get_pclk1_clock()) / (2 * (hperh->init.baud))); - } - else { - /* Integer part computing in case Oversampling mode is 16 Samples */ - integer = ((25 * ald_cmu_get_pclk1_clock()) / (4 * (hperh->init.baud))); - } - tmp = (integer / 100) << 4; - - /* Determine the fractional part */ - fractional = integer - (100 * (tmp >> 4)); - - /* Implement the fractional part in the register */ - if (READ_BIT(hperh->perh->CON0, (1 << 15))) - tmp |= ((((fractional * 8) + 50) / 100)) & ((uint8_t)0x07); - else - tmp |= ((((fractional * 16) + 50) / 100)) & ((uint8_t)0x0F); - - WRITE_REG(hperh->perh->BAUDCON, (uint16_t)tmp); - return; -} - -/** - * @} - */ - -#endif /* ALD_SMARTCARD */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_spi.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_spi.c deleted file mode 100644 index f756f6785d..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_spi.c +++ /dev/null @@ -1,1789 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_spi.c - * @brief SPI module driver. - * This file provides firmware functions to manage the following - * functionalities of SPI peripheral: - * + Initialization functions - * + IO operation functions - * + Peripheral Control functions - * + Peripheral State functions - * - * @version V1.0 - * @date 13 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - The SPI driver can be used as follows: - - (#) Declare a spi_handle_t structure, for example: - spi_handle_t hperh; - - (#) Initialize the SPI low level resources: - (##) Enable the SPIx interface clock - (##) SPI pins configuration - (+++) Enable the clock for the SPI GPIOs - (+++) Configure these SPI pins as push-pull - (##) NVIC configuration if you need to use interrupt process - by implementing the ald_mcu_irq_config() API. - Invoked ald_spi_irq_handler() function in SPI-IRQ function - (##) DMA Configuration if you need to use DMA process - (+++) Define ALD_DMA in ald_conf.h - (+++) Enable the DMAx clock - - (#) Program the Mode, Direction , Data size, Baudrate Prescaler, NSS - management, Clock polarity and phase, FirstBit and CRC configuration in the hspi Init structure. - - (#) Initialize the SPI module by invoking the ald_spi_init() API. - - [..] - Circular mode restriction: - (#) The DMA circular mode cannot be used when the SPI is configured in these modes: - (##) Master 2Lines RxOnly - (##) Master 1Line Rx - (#) When the SPI DMA Pause/Stop features are used, we must use the following APIs - the ald_spi_dma_pause()/ ald_spi_dma_stop(). - - * @endverbatim - */ - -#include "ald_spi.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup SPI SPI - * @brief SPI module driver - * @{ - */ -#ifdef ALD_SPI - -/** @addtogroup SPI_Private_Functions SPI Private Functions - * @{ - */ -static ald_status_t spi_wait_flag(spi_handle_t *hperh, spi_flag_t flag, flag_status_t status, uint32_t timeout); -static ald_status_t spi_wait_flag_irq(spi_handle_t *hperh, spi_flag_t flag, flag_status_t status, uint32_t timeout); -static void __spi_send_by_it(spi_handle_t *hperh); -static void __spi_recv_by_it(spi_handle_t *hperh); -static void __spi_send_recv_by_it(spi_handle_t *hperh, spi_sr_status_t status); -#ifdef ALD_DMA -static void spi_dma_send_cplt(void *arg); -static void spi_dma_recv_cplt(void *arg); -static void spi_dma_send_recv_cplt(void *arg); -static void spi_dma_error(void *arg); -#endif -/** - * @} - */ - -/** @defgroup SPI_Public_Functions SPI Public Functions - * @{ - */ - -/** @defgroup SPI_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * - * @verbatim - =============================================================================== - ##### Initialization and de-initialization functions ##### - =============================================================================== - [..] This subsection provides a set of functions allowing to initialize and - reset the SPIx peripheral: - - (+) User must configure all related peripherals resources - (CLOCK, GPIO, DMA, NVIC). - - (+) Call the function ald_spi_init() to configure the selected device with - the selected configuration: - (++) Mode - (++) Direction - (++) Data Size - (++) Clock Polarity and Phase - (++) NSS Management - (++) BaudRate Prescaler - (++) FirstBit - (++) TIMode - (++) CRC Calculation - (++) CRC Polynomial if CRC enabled - - (+) Call the function ald_spi_reset() to reset the selected SPIx periperal. - - @endverbatim - * @{ - */ - -/** - * @brief Reset the SPI peripheral. - * @param hperh: Pointer to a spi_handle_t structure that contains - * the configuration information for the specified SPI module. - * @retval None - */ -void ald_spi_reset(spi_handle_t *hperh) -{ - hperh->perh->CON1 = 0x0; - hperh->perh->CON2 = 0x0; - hperh->perh->CRCPOLY = 0x00000007; - - SPI_RESET_HANDLE_STATE(hperh); - __UNLOCK(hperh); - - return; -} - -/** - * @brief Initializes the SPI mode according to the specified parameters in - * the SPI_init_t and create the associated handle. - * @param hperh: Pointer to a spi_handle_t structure that contains - * the configuration information for the specified SPI module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_init(spi_handle_t *hperh) -{ - uint32_t tmp = 0; - - if (hperh == NULL) - return ERROR; - - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_MODE(hperh->init.mode)); - assert_param(IS_SPI_DIRECTION(hperh->init.dir)); - assert_param(IS_SPI_BAUD(hperh->init.baud)); - assert_param(IS_SPI_FIRSTBIT(hperh->init.first_bit)); - assert_param(IS_FUNC_STATE(hperh->init.ss_en)); - assert_param(IS_FUNC_STATE(hperh->init.crc_calc)); - assert_param(IS_SPI_DATASIZE(hperh->init.data_size)); - assert_param(IS_SPI_CPHA(hperh->init.phase)); - assert_param(IS_SPI_CPOL(hperh->init.polarity)); - - ald_spi_reset(hperh); - - tmp = hperh->perh->CON1; - - if (hperh->init.mode == SPI_MODE_MASTER) - tmp |= 1 << SPI_CON1_SSOUT_POS; - - tmp |= ((hperh->init.phase << SPI_CON1_CPHA_POS) | (hperh->init.polarity << SPI_CON1_CPOL_POS) | - (hperh->init.baud << SPI_CON1_BAUD_POSS) | (hperh->init.data_size << SPI_CON1_FLEN_POS) | - (hperh->init.mode << SPI_CON1_MSTREN_POS) | (hperh->init.ss_en << SPI_CON1_SSEN_POS) | - (hperh->init.first_bit << SPI_CON1_LSBFST_POS)); - - hperh->perh->CON1 = tmp; - - if (hperh->init.dir == SPI_DIRECTION_2LINES) { - CLEAR_BIT(hperh->perh->CON1, SPI_CON1_BIDEN_MSK); - CLEAR_BIT(hperh->perh->CON1, SPI_CON1_RXO_MSK); - } - else if (hperh->init.dir == SPI_DIRECTION_2LINES_RXONLY) { - CLEAR_BIT(hperh->perh->CON1, SPI_CON1_BIDEN_MSK); - SET_BIT(hperh->perh->CON1, SPI_CON1_RXO_MSK); - } - else { - SET_BIT(hperh->perh->CON1, SPI_CON1_BIDEN_MSK); - } - - /* configure CRC */ - hperh->perh->CON1 |= (hperh->init.crc_calc << SPI_CON1_CRCEN_POS); - hperh->perh->CRCPOLY = hperh->init.crc_poly; - - hperh->err_code = SPI_ERROR_NONE; - hperh->state = SPI_STATE_READY; - - if (hperh->init.dir == SPI_DIRECTION_2LINES) - SPI_ENABLE(hperh); - - return OK; -} -/** - * @} - */ - -/** @defgroup SPI_Public_Functions_Group2 IO operation functions - * @brief SPI Transmit and Receive functions - * - * @verbatim - ============================================================================== - ##### IO operation functions ##### - =============================================================================== - This subsection provides a set of functions allowing to manage the SPI - data transfers. - - [..] The SPI supports master or slave mode: - - (#) There are two modes of transfer: - (++) Blocking mode: The communication is performed in polling mode. - The ALD status of all data processing is returned by the same function - after finishing transfer. - (++) No-Blocking mode: The communication is performed using Interrupts - or DMA, These APIs return the ALD status. - The end of the data processing will be indicated through the - dedicated SPI IRQ when using Interrupt mode or the DMA IRQ when - using DMA mode. - The hperh->tx_cplt_cbk(), hperh->rx_cplt_cbk() and hperh->tx_rx_cplt_cbk() user callbacks - will be executed respectivelly at the end of the transmit or Receive process - The hperh->err_cbk() user callback will be executed when a communication error is detected - - (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA) - exist for 1Line (simplex) and 2Lines (full duplex) modes. - - * @endverbatim - * @{ - */ - -/** - * @brief transmit one byte fast in blocking mode. - * @param hperh: Pointer to a spi_handle_t structure. - * @param data: Data to be sent - * @retval status: - * - 0 Success - * - -1 Failed - */ -int32_t ald_spi_send_byte_fast(spi_handle_t *hperh, uint8_t data) -{ - uint16_t cnt = 2000, temp; - - hperh->perh->DATA = data; - while (((hperh->perh->STAT & (1 << SPI_STAT_TXBE_POS)) == 0) && (--cnt)); - cnt = 2000; - while ((hperh->perh->STAT & (1 << SPI_STAT_RXBNE_POS)) == 0 && (--cnt)); - temp = hperh->perh->DATA; - UNUSED(temp); - - return cnt == 0 ? -1 : 0; -} - -/** - * @brief transmit one byte fast in blocking mode(1line). - * @param hperh: Pointer to a spi_handle_t structure. - * @param data: Data to be sent - * @retval status: - * - 0 Success - * - -1 Failed - */ -int32_t ald_spi_send_byte_fast_1line(spi_handle_t *hperh, uint8_t data) -{ - uint16_t cnt = 2000; - - hperh->perh->DATA = data; - while (((hperh->perh->STAT & (1 << SPI_STAT_TXBE_POS)) == 0) && (--cnt)); - - return cnt == 0 ? -1 : 0; -} - -/** - * @brief Receive one byte fast in blocking mode. - * @param hperh: Pointer to a spi_handle_t structure. - * @retval Data. - */ -uint8_t ald_spi_recv_byte_fast(spi_handle_t *hperh) -{ - uint16_t cnt = 2000; - - if (hperh->init.mode == SPI_MODE_MASTER) { - hperh->perh->DATA = 0xFF; - while (((hperh->perh->STAT & (1 << SPI_STAT_TXBE_POS)) == 0) && (--cnt)); - } - - cnt = 2000; - while (((hperh->perh->STAT & (1 << SPI_STAT_RXBNE_POS)) == 0) && (--cnt)); - return (uint8_t)hperh->perh->DATA; -} - -/** - * @brief transmit an amount of data in blocking mode. - * @param hperh: Pointer to a spi_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_send(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - - hperh->state = SPI_STATE_BUSY_TX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->rx_buf = NULL; - hperh->rx_size = 0; - hperh->rx_count = 0; - - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - if (hperh->init.dir == SPI_DIRECTION_1LINE) - SPI_1LINE_TX(hperh); - if (READ_BIT(hperh->perh->CON1, SPI_CON1_SPIEN_MSK) == 0) - SPI_ENABLE(hperh); - - if ((hperh->init.mode == SPI_MODE_SLAVER) || (hperh->tx_count == 1)) { - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - hperh->perh->DATA = *hperh->tx_buf; - ++hperh->tx_buf; - --hperh->tx_count; - } - else { - hperh->perh->DATA = (*(uint16_t *)hperh->tx_buf); - hperh->tx_buf += 2; - --hperh->tx_count; - } - } - - while (hperh->tx_count > 0) { - if (spi_wait_flag(hperh, SPI_IF_TXBE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - hperh->perh->DATA = *hperh->tx_buf; - ++hperh->tx_buf; - --hperh->tx_count; - } - else { - hperh->perh->DATA = (*(uint16_t *)hperh->tx_buf); - hperh->tx_buf += 2; - --hperh->tx_count; - } - } - - if (hperh->init.crc_calc) - SPI_CRCNEXT_ENABLE(hperh); - - if ((spi_wait_flag(hperh, SPI_IF_TXBE, SET, timeout) != OK) - || (spi_wait_flag(hperh, SPI_IF_BUSY, RESET, timeout) != OK)) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.dir == SPI_DIRECTION_2LINES) - ald_spi_clear_flag_status(hperh, SPI_IF_OVE); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Receive an amount of data in blocking mode. - * @param hperh: Pointer to a spi_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_recv(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - uint16_t temp; - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_RX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->tx_buf = NULL; - hperh->tx_size = 0; - hperh->tx_count = 0; - - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - if (hperh->init.dir == SPI_DIRECTION_1LINE_RX) - SPI_1LINE_RX(hperh); - - if ((hperh->init.mode == SPI_MODE_MASTER) && (hperh->init.dir == SPI_DIRECTION_2LINES)) { - __UNLOCK(hperh); - hperh->state = SPI_STATE_READY; - return ald_spi_send_recv(hperh, buf, buf, size, timeout); - } - - if ((hperh->init.dir == SPI_DIRECTION_2LINES_RXONLY) || (hperh->init.dir == SPI_DIRECTION_1LINE_RX)) - SPI_ENABLE(hperh); - - while (hperh->rx_count > 1) { - if (spi_wait_flag(hperh, SPI_IF_RXBNE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - *hperh->rx_buf = hperh->perh->DATA; - ++hperh->rx_buf; - --hperh->rx_count; - } - else { - *(uint16_t *)hperh->rx_buf = hperh->perh->DATA; - hperh->rx_buf += 2; - --hperh->rx_count; - } - } - - if (hperh->init.crc_calc) - SPI_CRCNEXT_ENABLE(hperh); - - if (spi_wait_flag(hperh, SPI_IF_RXBNE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - *hperh->rx_buf = hperh->perh->DATA; - ++hperh->rx_buf; - --hperh->rx_count; - } - else { - *(uint16_t *)hperh->rx_buf = hperh->perh->DATA; - hperh->rx_buf += 2; - --hperh->rx_count; - } - - if (hperh->init.crc_calc) { - if (spi_wait_flag(hperh, SPI_IF_RXBNE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - temp = hperh->perh->DATA; - UNUSED(temp); - } - - if ((hperh->init.crc_calc) && (ald_spi_get_flag_status(hperh, SPI_IF_CRCERR) != RESET)) { - hperh->err_code |= SPI_ERROR_CRC; - SPI_CRC_RESET(hperh); - ald_spi_clear_flag_status(hperh, SPI_IF_CRCERR); - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return ERROR; - } - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Full-Duplex Send receive an amount of data in full-duplex mode (blocking mode). - * @param hperh: Pointer to a spi_handle_t structure. - * @param tx_buf: Pointer to data transmitted buffer - * @param rx_buf: Pointer to data received buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_send_recv(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint32_t timeout) -{ - uint16_t temp; - - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (hperh->init.dir != SPI_DIRECTION_2LINES) - return ERROR; - if (tx_buf == NULL || rx_buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_TX_RX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->tx_buf = tx_buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->rx_buf = rx_buf; - hperh->rx_size = size; - hperh->rx_count = size; - - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - if ((hperh->init.mode == SPI_MODE_SLAVER) || ((hperh->init.mode == SPI_MODE_SLAVER) && (hperh->tx_size == 1))) { - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - hperh->perh->DATA = *hperh->tx_buf; - ++hperh->tx_buf; - --hperh->tx_count; - } - else { - hperh->perh->DATA = (*(uint16_t *)hperh->tx_buf); - hperh->tx_buf += 2; - --hperh->tx_count; - } - } - - if (hperh->tx_count == 0) { - if (hperh->init.crc_calc) - SPI_CRCNEXT_ENABLE(hperh); - - if (spi_wait_flag(hperh, SPI_IF_TXBE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - *hperh->rx_buf = hperh->perh->DATA; - ++hperh->rx_buf; - --hperh->rx_count; - } - else { - (*(uint16_t *)hperh->rx_buf) = hperh->perh->DATA; - hperh->rx_buf += 2; - --hperh->rx_count; - } - } - - while (hperh->tx_count > 0) { - if (spi_wait_flag(hperh, SPI_IF_TXBE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - hperh->perh->DATA = *hperh->tx_buf; - ++hperh->tx_buf; - --hperh->tx_count; - } - else { - hperh->perh->DATA = (*(uint16_t *)hperh->tx_buf); - hperh->tx_buf += 2; - --hperh->tx_count; - } - - if ((hperh->tx_count == 0) && (hperh->init.crc_calc)) - SPI_CRCNEXT_ENABLE(hperh); - - if (spi_wait_flag(hperh, SPI_IF_RXBNE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - *hperh->rx_buf = hperh->perh->DATA; - ++hperh->rx_buf; - --hperh->rx_count; - } - else { - (*(uint16_t *)hperh->rx_buf) = hperh->perh->DATA; - - hperh->rx_buf += 2; - --hperh->rx_count; - } - } - - if (hperh->init.mode == SPI_MODE_SLAVER) { - if (spi_wait_flag(hperh, SPI_IF_RXBNE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - *hperh->rx_buf = hperh->perh->DATA; - ++hperh->rx_buf; - --hperh->rx_count; - } - else { - (*(uint16_t *)hperh->rx_buf) = hperh->perh->DATA; - - hperh->rx_buf += 2; - --hperh->rx_count; - } - } - - if (hperh->init.crc_calc) { - if (spi_wait_flag(hperh, SPI_IF_RXBNE, SET, timeout) != OK) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - temp = hperh->perh->DATA; - UNUSED(temp); - } - - if ((spi_wait_flag(hperh, SPI_IF_BUSY, RESET, timeout) != OK)) { - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - return TIMEOUT; - } - - if ((hperh->init.crc_calc) && (ald_spi_get_flag_status(hperh, SPI_IF_CRCERR) != RESET)) { - hperh->err_code |= SPI_ERROR_CRC; - SPI_CRC_RESET(hperh); - ald_spi_clear_flag_status(hperh, SPI_IF_CRCERR); - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - - return ERROR; - } - - hperh->state = SPI_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Wraps up transmission in non blocking mode. - * @param hperh: pointer to a spi_handle_t structure. - * @param buf: Pointer to data transmitted buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_send_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_TX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->rx_buf = NULL; - hperh->rx_size = 0; - hperh->rx_count = 0; - __UNLOCK(hperh); - - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - if (hperh->init.dir == SPI_DIRECTION_1LINE) - SPI_1LINE_TX(hperh); - - if (hperh->init.dir == SPI_DIRECTION_2LINES) { - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, ENABLE); - } - else { - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, ENABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, ENABLE); - } - - if (READ_BIT(hperh->perh->CON1, SPI_CON1_SPIEN_MSK) == 0) - SPI_ENABLE(hperh); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode - * @param hperh: Pointer to a spi_handle_t structure. - * @param buf: Pointer to data received buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_recv_by_it(spi_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (buf == NULL || size == 0) - return ERROR; - if ((hperh->init.dir == SPI_DIRECTION_2LINES) && (hperh->init.mode == SPI_MODE_MASTER)) - return ERROR; /* Please call ald_spi_send_recv_by_it() */ - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_RX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->tx_buf = NULL; - hperh->tx_size = 0; - hperh->tx_count = 0; - __UNLOCK(hperh); - - if (hperh->init.dir == SPI_DIRECTION_1LINE_RX) - SPI_1LINE_RX(hperh); - - if (hperh->init.crc_calc == ENABLE) - SPI_CRC_RESET(hperh); - - ald_spi_interrupt_config(hperh, SPI_IT_RXBNE, ENABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, ENABLE); - - if ((hperh->init.dir == SPI_DIRECTION_2LINES_RXONLY) || (hperh->init.dir == SPI_DIRECTION_1LINE_RX)) - SPI_ENABLE(hperh); - - return OK; -} - -/** - * @brief Transmit and Receives an amount of data in non blocking mode - * @param hperh: Pointer to a spi_handle_t structure that contains - * the configuration information for the specified SPI module. - * @param tx_buf: Pointer to data transmitted buffer - * @param rx_buf: Pointer to data received buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_send_recv_by_it(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size) -{ - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (tx_buf == NULL || rx_buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_TX_RX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->tx_buf = tx_buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->rx_buf = rx_buf; - hperh->rx_size = size; - hperh->rx_count = size; - __UNLOCK(hperh); - - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - ald_spi_interrupt_config(hperh, SPI_IT_RXBNE, ENABLE); - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, ENABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, ENABLE); - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Transmit an amount of data used dma channel - * @param hperh: Pointer to a spi_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as SPI transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_send_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_TX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->rx_buf = NULL; - hperh->rx_size = 0; - hperh->rx_count = 0; - - if (hperh->init.dir == SPI_DIRECTION_1LINE) - SPI_1LINE_TX(hperh); - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - hperh->hdmatx.cplt_arg = (void *)hperh; - hperh->hdmatx.cplt_cbk = spi_dma_send_cplt; - hperh->hdmatx.err_arg = (void *)hperh; - hperh->hdmatx.err_cbk = spi_dma_error; - - /* Configure SPI DMA transmit */ - ald_dma_config_struct(&(hperh->hdmatx.config)); - hperh->hdmatx.config.data_width = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_SIZE_BYTE : DMA_DATA_SIZE_HALFWORD; - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_INC_BYTE : DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == SPI0 ? DMA_MSEL_SPI0 : (hperh->perh == SPI1 ? DMA_MSEL_SPI1 : DMA_MSEL_SPI2); - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_SPI_TXEMPTY; - hperh->hdmatx.config.channel = channel; - ald_dma_config_basic(&(hperh->hdmatx)); - - __UNLOCK(hperh); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, ENABLE); - - if (READ_BIT(hperh->perh->CON1, SPI_CON1_SPIEN_MSK) == 0) - SPI_ENABLE(hperh); - - return OK; -} - -/** - * @brief Receive an amount of data used dma channel - * @param hperh: Pointer to a spi_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as SPI transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_recv_by_dma(spi_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY) - return BUSY; - if (buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_RX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->tx_buf = NULL; - hperh->tx_size = 0; - hperh->tx_count = 0; - - if (hperh->init.dir == SPI_DIRECTION_1LINE_RX) - SPI_1LINE_RX(hperh); - if ((hperh->init.dir == SPI_DIRECTION_2LINES) && (hperh->init.mode == SPI_MODE_MASTER)) { - __UNLOCK(hperh); - return ERROR; /* Please use ald_spi_send_recv_by_dma() */ - } - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.cplt_cbk = spi_dma_recv_cplt; - hperh->hdmarx.err_arg = (void *)hperh; - hperh->hdmarx.err_cbk = spi_dma_error; - - /* Configure DMA Receive */ - ald_dma_config_struct(&(hperh->hdmarx.config)); - hperh->hdmarx.config.data_width = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_SIZE_BYTE : DMA_DATA_SIZE_HALFWORD; - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_INC_BYTE : DMA_DATA_INC_HALFWORD;; - hperh->hdmarx.config.msel = hperh->perh == SPI0 ? DMA_MSEL_SPI0 : (hperh->perh == SPI1 ? DMA_MSEL_SPI1 : DMA_MSEL_SPI2); - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_SPI_RNR; - hperh->hdmarx.config.channel = channel; - ald_dma_config_basic(&(hperh->hdmarx)); - - __UNLOCK(hperh); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, ENABLE); - - if ((hperh->init.dir == SPI_DIRECTION_2LINES_RXONLY) || (hperh->init.dir == SPI_DIRECTION_1LINE_RX)) - SPI_ENABLE(hperh); - - return OK; -} - -/** - * @brief Transmit and Receive an amount of data used dma channel - * @param hperh: Pointer to a spi_handle_t structure. - * @param tx_buf: Pointer to data buffer - * @param rx_buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param tx_channel: DMA channel as SPI transmit - * @param rx_channel: DMA channel as SPI receive - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_spi_send_recv_by_dma(spi_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel) -{ - assert_param(IS_SPI(hperh->perh)); - - if (hperh->state != SPI_STATE_READY && hperh->state != SPI_STATE_BUSY_RX) - return BUSY; - if (tx_buf == NULL || rx_buf == NULL || size == 0) - return ERROR; - - __LOCK(hperh); - hperh->state = SPI_STATE_BUSY_RX; - hperh->err_code = SPI_ERROR_NONE; - - hperh->tx_buf = tx_buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->rx_buf = rx_buf; - hperh->rx_size = size; - hperh->rx_count = size; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - hperh->hdmatx.cplt_arg = NULL; - hperh->hdmatx.cplt_cbk = NULL; - hperh->hdmatx.err_arg = (void *)hperh; - hperh->hdmatx.err_cbk = spi_dma_error; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.cplt_cbk = spi_dma_send_recv_cplt; - hperh->hdmarx.err_arg = (void *)hperh; - hperh->hdmarx.err_cbk = spi_dma_error; - - if (hperh->init.crc_calc) - SPI_CRC_RESET(hperh); - - /* Configure SPI DMA transmit */ - ald_dma_config_struct(&(hperh->hdmatx.config)); - hperh->hdmatx.config.data_width = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_SIZE_BYTE : DMA_DATA_SIZE_HALFWORD; - hperh->hdmatx.config.src = (void *)tx_buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_INC_BYTE : DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == SPI0 ? DMA_MSEL_SPI0 : (hperh->perh == SPI1 ? DMA_MSEL_SPI1 : DMA_MSEL_SPI2); - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_SPI_TXEMPTY; - hperh->hdmatx.config.channel = tx_channel; - ald_dma_config_basic(&(hperh->hdmatx)); - - /* Configure DMA Receive */ - ald_dma_config_struct(&(hperh->hdmarx.config)); - hperh->hdmarx.config.data_width = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_SIZE_BYTE : DMA_DATA_SIZE_HALFWORD; - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)rx_buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = hperh->init.data_size == SPI_DATA_SIZE_8 ? DMA_DATA_INC_BYTE : DMA_DATA_INC_HALFWORD;; - hperh->hdmarx.config.msel = hperh->perh == SPI0 ? DMA_MSEL_SPI0 : (hperh->perh == SPI1 ? DMA_MSEL_SPI1 : DMA_MSEL_SPI2); - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_SPI_RNR; - hperh->hdmarx.config.channel = rx_channel; - ald_dma_config_basic(&(hperh->hdmarx)); - - __UNLOCK(hperh); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, ENABLE); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, ENABLE); - - return OK; -} - -/** - * @brief Pauses the DMA Transfer. - * @param hperh: Pointer to a spi_handle_t structure. - * @retval Status - */ -ald_status_t ald_spi_dma_pause(spi_handle_t *hperh) -{ - assert_param(IS_SPI(hperh->perh)); - - __LOCK(hperh); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, DISABLE); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, DISABLE); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Resumes the DMA Transfer. - * @param hperh: Pointer to a spi_handle_t structure. - * @retval Status - */ -ald_status_t ald_spi_dma_resume(spi_handle_t *hperh) -{ - assert_param(IS_SPI(hperh->perh)); - - __LOCK(hperh); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, ENABLE); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, ENABLE); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Stops the DMA Transfer. - * @param hperh: Pointer to a spi_handle_t structure. - * @retval Status - */ -ald_status_t ald_spi_dma_stop(spi_handle_t *hperh) -{ - assert_param(IS_SPI(hperh->perh)); - - __LOCK(hperh); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, DISABLE); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, DISABLE); - __UNLOCK(hperh); - - hperh->state = SPI_STATE_READY; - return OK; -} -#endif -/** - * @} - */ - -/** @defgroup SPI_Public_Functions_Group3 Control functions - * @brief SPI Control functions - * - * @verbatim - =============================================================================== - ##### Peripheral Control functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to control the SPI. - (+) Handle interrupt about SPI module. The ald_spi_irq_handler() function must - be invoked by SPI-IRQ function. - (+) Configure the interrupt DISABLE/ENABLE. - (+) Configure the DMA request. - (+) Get interrupt source status. - (+) Get interrupt flag status. - (+) Clear interrupt flag - - @endverbatim - * @{ - */ - -/** - * @brief This function handles SPI interrupt request. - * @param hperh: Pointer to a spi_handle_t structure. - * @retval None - */ -void ald_spi_irq_handler(spi_handle_t *hperh) -{ - if ((hperh->state == SPI_STATE_BUSY_RX) || (hperh->state == SPI_STATE_BUSY_TX)) { - if ((ald_spi_get_it_status(hperh, SPI_IT_RXBNE) != RESET) && (ald_spi_get_flag_status(hperh, SPI_IF_RXBNE) != RESET)) - __spi_recv_by_it(hperh); - - if ((ald_spi_get_it_status(hperh, SPI_IT_TXBE) != RESET) && (ald_spi_get_flag_status(hperh, SPI_IF_TXBE) != RESET)) - __spi_send_by_it(hperh); - } - - else if (hperh->state == SPI_STATE_BUSY_TX_RX) { - if (hperh->tx_size == hperh->tx_count) { - if ((ald_spi_get_it_status(hperh, SPI_IT_TXBE) != RESET) && (ald_spi_get_flag_status(hperh, SPI_IF_TXBE) != RESET)) - __spi_send_recv_by_it(hperh, SPI_SR_TXBE); - } - else { - if (hperh->init.mode == SPI_MODE_MASTER) { - if ((ald_spi_get_it_status(hperh, SPI_IT_TXBE) != RESET) && (ald_spi_get_flag_status(hperh, SPI_IF_TXBE) != RESET) - && (ald_spi_get_it_status(hperh, SPI_IT_RXBNE) != RESET) && (ald_spi_get_flag_status(hperh, SPI_IF_RXBNE) != RESET)) - __spi_send_recv_by_it(hperh, SPI_SR_TXBE_RXBNE); - } - else { - if ((ald_spi_get_it_status(hperh, SPI_IT_RXBNE) != RESET) && (ald_spi_get_flag_status(hperh, SPI_IF_RXBNE) != RESET)) - __spi_send_recv_by_it(hperh, SPI_SR_RXBNE); - - if ((ald_spi_get_it_status(hperh, SPI_IT_TXBE) != RESET) && (ald_spi_get_flag_status(hperh, SPI_IF_TXBE) != RESET)) - __spi_send_recv_by_it(hperh, SPI_SR_TXBE); - } - - - } - } - - if ((ald_spi_get_it_status(hperh, SPI_IT_ERR) != RESET)) { - if (ald_spi_get_flag_status(hperh, SPI_IF_CRCERR) != RESET) { - hperh->err_code |= SPI_ERROR_CRC; - ald_spi_clear_flag_status(hperh, SPI_IF_CRCERR); - } - if (ald_spi_get_flag_status(hperh, SPI_IF_MODF) != RESET) { - hperh->err_code |= SPI_ERROR_MODF; - ald_spi_clear_flag_status(hperh, SPI_IF_MODF); - } - if (ald_spi_get_flag_status(hperh, SPI_IF_OVE) != RESET) { - if ((hperh->state != SPI_STATE_BUSY_TX) && (hperh->state != SPI_STATE_READY)) { - hperh->err_code |= SPI_ERROR_OVE; - ald_spi_clear_flag_status(hperh, SPI_IF_OVE); - } - } - - if (hperh->err_code != SPI_ERROR_NONE) { - ald_spi_interrupt_config(hperh, SPI_IT_RXBNE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, DISABLE); - hperh->state = SPI_STATE_READY; - - if (hperh->err_cbk) - hperh->err_cbk(hperh); - } - } - - return; -} - -/** - * @brief Enables or disables the specified SPI interrupts. - * @param hperh: Pointer to a spi_handle_t structure. - * @param it: Specifies the SPI interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref spi_it_t. - * @param state: New status - * - ENABLE - * - DISABLE - * @retval None - */ -void ald_spi_interrupt_config(spi_handle_t *hperh, spi_it_t it, type_func_t state) -{ - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_IT(it)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - hperh->perh->CON2 |= (uint32_t)it; - else - hperh->perh->CON2 &= ~((uint32_t)it); - - return; -} - -/** - * @brief Configure the specified SPI speed. - * @param hperh: Pointer to a spi_handle_t structure. - * @param speed: Specifies the SPI speed. - * This parameter can be one of the @ref spi_baud_t. - * @retval None - */ -void ald_spi_speed_config(spi_handle_t *hperh, spi_baud_t speed) -{ - uint32_t tmp = 0; - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_BAUD(speed)); - - tmp = hperh->perh->CON1; - tmp &= ~(0x7U << SPI_CON1_BAUD_POSS); - tmp |= (speed << SPI_CON1_BAUD_POSS); - hperh->perh->CON1 = tmp; - return; -} - -/** - * @brief Enables or disables the dma request. - * @param hperh: Pointer to a spi_handle_t structure. - * @param req: Specifies the SPI dma request sources to be enabled or disabled. - * This parameter can be one of the @ref spi_dma_req_t. - * @param state: New status - * - ENABLE - * - DISABLE - * @retval None - */ -void ald_spi_dma_req_config(spi_handle_t *hperh, spi_dma_req_t req, type_func_t state) -{ - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_DMA_REQ(req)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) { - if (req == SPI_DMA_REQ_TX) - SET_BIT(hperh->perh->CON2, SPI_CON2_TXDMA_MSK); - else - SET_BIT(hperh->perh->CON2, SPI_CON2_RXDMA_MSK); - } - else { - if (req == SPI_DMA_REQ_TX) - CLEAR_BIT(hperh->perh->CON2, SPI_CON2_TXDMA_MSK); - else - CLEAR_BIT(hperh->perh->CON2, SPI_CON2_RXDMA_MSK); - } - - return; -} - -/** @brief Check whether the specified SPI state flag is set or not. - * @param hperh: Pointer to a spi_handle_t structure. - * @param status: specifies the flag to check. - * This parameter can be one of the @ref spi_status_t. - * @retval Status - * - SET - * - RESET - */ -flag_status_t spi_get_status(spi_handle_t *hperh, spi_status_t status) -{ - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_STATUS(status)); - - if (hperh->perh->STAT & status) - return SET; - - return RESET; -} - -/** - * @brief Checks whether the specified SPI interrupt has occurred or not. - * @param hperh: Pointer to a spi_handle_t structure. - * @param it: Specifies the SPI interrupt source to check. - * This parameter can be one of the @ref spi_it_t. - * @retval Status - * - SET - * - RESET - */ -it_status_t ald_spi_get_it_status(spi_handle_t *hperh, spi_it_t it) -{ - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_IT(it)); - - if (hperh->perh->CON2 & it) - return SET; - - return RESET; -} - -/** @brief Check whether the specified SPI flag is set or not. - * @param hperh: Pointer to a spi_handle_t structure. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref spi_flag_t. - * @retval Status - * - SET - * - RESET - */ -flag_status_t ald_spi_get_flag_status(spi_handle_t *hperh, spi_flag_t flag) -{ - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_IF(flag)); - - if (hperh->perh->STAT & flag) - return SET; - - return RESET; -} - -/** @brief Clear the specified SPI pending flags. - * @param hperh: Pointer to a spi_handle_t structure. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref spi_flag_t. - * @retval None - */ -void ald_spi_clear_flag_status(spi_handle_t *hperh, spi_flag_t flag) -{ - uint32_t temp; - - assert_param(IS_SPI(hperh->perh)); - assert_param(IS_SPI_IF(flag)); - - if (flag == SPI_IF_CRCERR) { - SET_BIT(hperh->perh->STAT, SPI_STAT_CRCERR_MSK); - return; - } - if (flag == SPI_IF_OVE) { - temp = hperh->perh->DATA; - temp = hperh->perh->STAT; - UNUSED(temp); - return; - } - if (flag == SPI_IF_MODF) { - temp = hperh->perh->STAT; - UNUSED(temp); - hperh->perh->CON1 = hperh->perh->CON1; - return; - } - - return; -} - -/** - * @brief This function handles SPI communication timeout. - * @param hperh: Pointer to a spi_handle_t structure. - * @param flag: specifies the SPI flag to check. - * @param status: The new Flag status (SET or RESET). - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t spi_wait_flag(spi_handle_t *hperh, spi_flag_t flag, flag_status_t status, uint32_t timeout) -{ - uint32_t tick = ald_get_tick(); - - assert_param(timeout > 0); - - while ((ald_spi_get_flag_status(hperh, flag)) != status) { - if (((ald_get_tick()) - tick) > timeout) { - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_RXBNE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, DISABLE); - return TIMEOUT; - } - } - - return OK; -} - -/** - * @brief This function handles SPI communication timeout in interrupt function. - * @param hperh: Pointer to a spi_handle_t structure. - * @param flag: specifies the SPI flag to check. - * @param status: The new Flag status (SET or RESET). - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t spi_wait_flag_irq(spi_handle_t *hperh, spi_flag_t flag, flag_status_t status, uint32_t timeout) -{ - assert_param(timeout > 0); - - while (((ald_spi_get_flag_status(hperh, flag)) != status) && (--timeout)); - - if (timeout) - return OK; - - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_RXBNE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, DISABLE); - - return TIMEOUT; -} - -/** - * @} - */ - -/** @defgroup SPI_Public_Functions_Group4 Peripheral State and Errors functions - * @brief SPI State and Errors functions - * - * @verbatim - =============================================================================== - ##### Peripheral State and Errors functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to control the SPI. - (+) ald_spi_get_state() API can check in run-time the state of the SPI peripheral - (+) ald_spi_get_error() check in run-time Errors occurring during communication - - @endverbatim - * @{ - */ - -/** - * @brief Returns the SPI state. - * @param hperh: Pointer to a spi_handle_t structure. - * @retval ALD state - */ -spi_state_t ald_spi_get_state(spi_handle_t *hperh) -{ - assert_param(IS_SPI(hperh->perh)); - return hperh->state; -} - -/** - * @brief Return the SPI error code - * @param hperh: Pointer to a spi_handle_t structure. - * @retval SPI Error Code - */ -uint32_t ald_spi_get_error(spi_handle_t *hperh) -{ - assert_param(IS_SPI(hperh->perh)); - return hperh->err_code; -} -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup SPI_Private_Functions SPI Private Functions - * @brief SPI Private functions - * @{ - */ - -/** - * @brief handle program when an tx empty interrupt flag arrived in non block mode - * @param hperh: Pointer to a spi_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -static void __spi_send_by_it(spi_handle_t *hperh) -{ - if (hperh->tx_count == 0) { - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, DISABLE); - hperh->state = SPI_STATE_READY; - - if (hperh->init.dir == SPI_DIRECTION_2LINES) - ald_spi_clear_flag_status(hperh, SPI_IF_OVE); - - if ((spi_wait_flag_irq(hperh, SPI_IF_BUSY, RESET, 5000)) != OK) { - if (hperh->err_cbk) - hperh->err_cbk(hperh); - - return; - } - - if (hperh->tx_cplt_cbk) - hperh->tx_cplt_cbk(hperh); - - return; - } - - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - hperh->perh->DATA = *hperh->tx_buf; - ++hperh->tx_buf; - } - else { - hperh->perh->DATA = *(uint16_t *)hperh->tx_buf; - hperh->tx_buf += 2; - } - --hperh->tx_count; - - if (hperh->tx_count == 0) { - if (hperh->init.crc_calc) - SPI_CRCNEXT_ENABLE(hperh); - } - - return; -} - -/** - * @brief handle program when an rx no empty interrupt flag arrived in non block mode - * @param hperh: Pointer to a spi_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -static void __spi_recv_by_it(spi_handle_t *hperh) -{ - uint16_t temp; - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - *hperh->rx_buf = hperh->perh->DATA; - ++hperh->rx_buf; - } - else { - *(uint16_t *)hperh->rx_buf = hperh->perh->DATA; - hperh->rx_buf += 2; - } - --hperh->rx_count; - - if ((hperh->rx_count == 1) && (hperh->init.crc_calc)) - SPI_CRCNEXT_ENABLE(hperh); - - if (hperh->rx_count == 0) { - ald_spi_interrupt_config(hperh, SPI_IT_RXBNE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, DISABLE); - hperh->state = SPI_STATE_READY; - - if ((hperh->init.crc_calc) && (ald_spi_get_flag_status(hperh, SPI_IF_CRCERR) != RESET)) { - hperh->err_code |= SPI_ERROR_CRC; - ald_spi_clear_flag_status(hperh, SPI_IF_CRCERR); - - if (hperh->err_cbk) - hperh->err_cbk(hperh); - - return; - } - - if (hperh->init.crc_calc) { - temp = hperh->perh->DATA; - UNUSED(temp); - } - - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); - } - - return; -} - -/** - * @brief handle program when an rx no empty interrupt flag arrived in non block mode(2 lines) - * @param hperh: Pointer to a spi_handle_t structure. - * @param status: SR.TXE or SR.RXNE set. - * @retval Status, see @ref ald_status_t. - */ -static void __spi_send_recv_by_it(spi_handle_t *hperh, spi_sr_status_t status) -{ - assert_param(IS_SPI_SR_STATUS(status)); - - if (hperh->rx_count != 0) { - if ((status == SPI_SR_RXBNE) || (status == SPI_SR_TXBE_RXBNE)) { - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - *hperh->rx_buf = hperh->perh->DATA; - ++hperh->rx_buf; - } - else { - *(uint16_t *)hperh->rx_buf = hperh->perh->DATA; - hperh->rx_buf += 2; - } - - --hperh->rx_count; - } - } - - if (hperh->tx_count != 0) { - if ((status == SPI_SR_TXBE) || (status == SPI_SR_TXBE_RXBNE)) { - if (hperh->tx_count == 1) { - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - hperh->perh->DATA = *hperh->tx_buf; - ++hperh->tx_buf; - } - else { - hperh->perh->DATA = *(uint16_t *)hperh->tx_buf; - hperh->tx_buf += 2; - } - - --hperh->tx_count; - - if (hperh->init.crc_calc) - SPI_CRCNEXT_ENABLE(hperh); - } - else { - if (hperh->init.data_size == SPI_DATA_SIZE_8) { - hperh->perh->DATA = *hperh->tx_buf; - ++hperh->tx_buf; - } - else { - hperh->perh->DATA = *(uint16_t *)hperh->tx_buf; - hperh->tx_buf += 2; - } - - if (--hperh->tx_count == 0) { - if (hperh->init.crc_calc) - SPI_CRCNEXT_ENABLE(hperh); - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, DISABLE); - } - } - } - } - - if (hperh->rx_count == 0) { - ald_spi_interrupt_config(hperh, SPI_IT_TXBE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_RXBNE, DISABLE); - ald_spi_interrupt_config(hperh, SPI_IT_ERR, DISABLE); - hperh->state = SPI_STATE_READY; - - if ((hperh->init.crc_calc) && (ald_spi_get_flag_status(hperh, SPI_IF_CRCERR) != RESET)) { - hperh->err_code |= SPI_ERROR_CRC; - ald_spi_clear_flag_status(hperh, SPI_IF_CRCERR); - - if (hperh->err_cbk) - hperh->err_cbk(hperh); - - return; - } - - if (hperh->tx_rx_cplt_cbk) - hperh->tx_rx_cplt_cbk(hperh); - } - - return; -} - -#ifdef ALD_DMA -/** - * @brief DMA SPI transmit process complete callback. - * @param arg: Pointer to a spi_handle_t structure. - * @retval None - */ -static void spi_dma_send_cplt(void *arg) -{ - uint16_t delay; - spi_handle_t *hperh = (spi_handle_t *)arg; - - hperh->tx_count = 0; - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, DISABLE); - hperh->state = SPI_STATE_READY; - - if (hperh->init.dir == SPI_DIRECTION_2LINES) - ald_spi_clear_flag_status(hperh, SPI_IF_OVE); - - if ((spi_wait_flag_irq(hperh, SPI_IF_BUSY, RESET, 5000)) != OK) - hperh->err_code |= SPI_ERROR_FLAG; - - for (delay = 0; delay < 3000; delay++); - - if (hperh->err_code == SPI_ERROR_NONE) { - if (hperh->tx_cplt_cbk) - hperh->tx_cplt_cbk(hperh); - } - else { - if (hperh->err_cbk) - hperh->err_cbk(hperh); - } - - return; -} - -/** - * @brief DMA SPI receive process complete callback. - * @param arg: Pointer to a spi_handle_t structure. - * @retval None - */ -static void spi_dma_recv_cplt(void *arg) -{ - uint32_t tmp; - spi_handle_t *hperh = (spi_handle_t *)arg; - - hperh->rx_count = 0; - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, DISABLE); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, DISABLE); - hperh->state = SPI_STATE_READY; - - if (hperh->init.crc_calc) { - if ((spi_wait_flag_irq(hperh, SPI_IF_RXBNE, SET, 5000)) != OK) - hperh->err_code |= SPI_ERROR_FLAG; - - tmp = hperh->perh->DATA; - UNUSED(tmp); - - if (ald_spi_get_flag_status(hperh, SPI_IF_CRCERR) == SET) { - SET_BIT(hperh->err_code, SPI_ERROR_CRC); - SPI_CRC_RESET(hperh); - ald_spi_clear_flag_status(hperh, SPI_IF_CRCERR); - } - } - - if (hperh->err_code == SPI_ERROR_NONE) { - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); - } - else { - if (hperh->err_cbk) - hperh->err_cbk(hperh); - } - - return; -} - -/** - * @brief DMA SPI transmit and receive process complete callback. - * @param arg: Pointer to a SPI_handle_t structure. - * @retval None - */ -static void spi_dma_send_recv_cplt(void *arg) -{ - uint32_t tmp; - uint16_t delay; - spi_handle_t *hperh = (spi_handle_t *)arg; - - if (hperh->init.crc_calc) { - if ((spi_wait_flag_irq(hperh, SPI_IF_RXBNE, SET, 5000)) != OK) - hperh->err_code |= SPI_ERROR_FLAG; - - tmp = hperh->perh->DATA; - UNUSED(tmp); - - if (ald_spi_get_flag_status(hperh, SPI_IF_CRCERR) == SET) { - SET_BIT(hperh->err_code, SPI_ERROR_CRC); - ald_spi_clear_flag_status(hperh, SPI_IF_CRCERR); - } - } - - if ((spi_wait_flag_irq(hperh, SPI_IF_BUSY, RESET, 5000)) != OK) - hperh->err_code |= SPI_ERROR_FLAG; - - for (delay = 0; delay < 3000; delay++); - - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, DISABLE); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, DISABLE); - hperh->tx_count = 0; - hperh->rx_count = 0; - hperh->state = SPI_STATE_READY; - - if (hperh->err_code == SPI_ERROR_NONE) { - if (hperh->tx_rx_cplt_cbk) - hperh->tx_rx_cplt_cbk(hperh); - } - else { - if (hperh->err_cbk) - hperh->err_cbk(hperh); - } - - return; -} - -/** - * @brief DMA SPI communication error callback. - * @param arg: Pointer to a spi_handle_t structure that contains - * the configuration information for the specified SPI module. - * @retval None - */ -static void spi_dma_error(void *arg) -{ - spi_handle_t *hperh = (spi_handle_t *)arg; - - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_TX, DISABLE); - ald_spi_dma_req_config(hperh, SPI_DMA_REQ_RX, DISABLE); - SET_BIT(hperh->err_code, SPI_ERROR_DMA); - - hperh->tx_count = 0; - hperh->rx_count = 0; - hperh->state = SPI_STATE_READY; - - if (hperh->err_cbk) - hperh->err_cbk(hperh); - - return; -} -#endif /* ALD_DMA */ -/** - * @} - */ -#endif /* ALD_SPI */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_timer.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_timer.c deleted file mode 100644 index dc0a285368..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_timer.c +++ /dev/null @@ -1,3675 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_timer.c - * @brief TIMER module driver. - * This is the common part of the TIMER initialization - * - * @version V1.0 - * @date 06 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include -#include "ald_timer.h" -#include "ald_cmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup TIMER TIMER - * @brief TIMER module driver - * @{ - */ -#ifdef ALD_TIMER - -/** @defgroup TIMER_Private_Functions TIMER Private Functions - * @{ - */ -static void timer_base_set_config(TIMER_TypeDef *TIMERx, timer_base_init_t *init); -static void timer_oc1_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config); -static void timer_oc2_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config); -static void timer_oc3_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config); -static void timer_oc4_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config); -static void timer_ccx_channel_cmd(TIMER_TypeDef* TIMERx, timer_channel_t ch, type_func_t state); -static void timer_ccxn_channel_cmd(TIMER_TypeDef* TIMERx, timer_channel_t ch, type_func_t state); -static void timer_ti1_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter); -static void timer_ti1_set_config_stage(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, uint32_t filter); -static void timer_ti2_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter); -static void timer_ti2_set_config_stage(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, uint32_t filter); -static void timer_ti3_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter); -static void timer_ti4_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter); -static void timer_etr_set_config(TIMER_TypeDef* TIMERx, timer_etr_psc_t psc, timer_clock_polarity_t polarity, uint32_t filter); -static void timer_slave_set_config(timer_handle_t *hperh, timer_slave_config_t *config); -#ifdef ALD_DMA -static void timer_dma_oc_cplt(void *arg); -static void timer_dma_capture_cplt(void *arg); -static void timer_dma_period_elapse_cplt(void *arg); -static void timer_dma_error(void *arg); -static void timer_dma_msel(TIMER_TypeDef *hperh, dma_config_t *config); -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions TIMER Public Functions - * @{ - */ - -/** @defgroup TIMER_Public_Functions_Group1 TIMER Base functions - * @brief Time Base functions - * - * @verbatim - ============================================================================== - ##### Timer Base functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize and configure the TIMER base. - (+) Reset the TIMER base. - (+) Start the Time Base. - (+) Stop the Time Base. - (+) Start the Time Base and enable interrupt. - (+) Stop the Time Base and disable interrupt. - (+) Start the Time Base and enable DMA transfer. - (+) Stop the Time Base and disable DMA transfer. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER Time base Unit according to the specified - * parameters in the timer_handle_t and create the associated handle. - * @param hperh: TIMER base handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_base_init(timer_handle_t *hperh) -{ - if (hperh == NULL) - return ERROR; - - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_COUNTER_MODE(hperh->init.mode)); - assert_param(IS_TIMER_CLOCK_DIVISION(hperh->init.clk_div)); - - if (hperh->state == TIMER_STATE_RESET) - hperh->lock = UNLOCK; - - hperh->state = TIMER_STATE_BUSY; - timer_base_set_config(hperh->perh, &hperh->init); - hperh->state = TIMER_STATE_READY; - - return OK; -} - -/** - * @brief Reset the TIMER base peripheral - * @param hperh: TIMER base handle - * @retval Status, see @ref ald_status_t. - */ -void ald_timer_base_reset(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - hperh->state = TIMER_STATE_BUSY; - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_RESET; - __UNLOCK(hperh); - - return; -} - -/** - * @brief Starts the TIMER Base generation. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_base_start(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - hperh->state = TIMER_STATE_BUSY; - SET_BIT(hperh->perh->SGE, TIMER_SGE_SGU_MSK); - SET_BIT(hperh->perh->ICR, TIMER_ICR_UEIC_MSK); - TIMER_ENABLE(hperh); - hperh->state = TIMER_STATE_READY; - - return; -} - -/** - * @brief Stops the TIMER Base generation. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_base_stop(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - hperh->state = TIMER_STATE_BUSY; - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - - return; -} - -/** - * @brief Starts the TIMER Base generation in interrupt mode. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_base_start_by_it(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - ald_timer_interrupt_config(hperh, TIMER_IT_UPDATE, ENABLE); - TIMER_ENABLE(hperh); - - return; -} - -/** - * @brief Stops the TIMER Base generation in interrupt mode. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_base_stop_by_it(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - ald_timer_interrupt_config(hperh, TIMER_IT_UPDATE, DISABLE); - TIMER_DISABLE(hperh); - - return; -} - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER Base generation in DMA mode. - * @param hperh: TIMER handle - * @param buf: The source Buffer address. - * @param len: The length of buffer to be transferred from memory to TIMER peripheral - * @param dma_ch: Channel of DMA. - * @retval Status, see @ref ald_status_t. -*/ -ald_status_t ald_timer_base_start_by_dma(timer_handle_t *hperh, - uint16_t *buf, uint32_t len, uint8_t dma_ch) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - if ((hperh->state == TIMER_STATE_BUSY)) - return BUSY; - if ((hperh->state == TIMER_STATE_READY)) { - if (((uint32_t)buf == 0 ) || (len == 0)) - return ERROR; - } - - hperh->state = TIMER_STATE_BUSY; - - if (hperh->hdma1.perh == NULL) - hperh->hdma1.perh = DMA0; - - hperh->hdma1.cplt_cbk = timer_dma_period_elapse_cplt; - hperh->hdma1.cplt_arg = (void *)hperh; - hperh->hdma1.err_cbk = timer_dma_error; - hperh->hdma1.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdma1.config); - hperh->hdma1.config.src = (void *)buf; - hperh->hdma1.config.dst = (void *)&hperh->perh->AR; - hperh->hdma1.config.size = len; - hperh->hdma1.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma1.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdma1.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_UPDATE; - hperh->hdma1.config.channel = dma_ch; - - timer_dma_msel(hperh->perh, &hperh->hdma1.config); - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_UPDATE, ENABLE); - TIMER_ENABLE(hperh); - - return OK; -} - -/** - * @brief Stops the TIMER Base generation in DMA mode. - * @param hperh: TIMER handle - * @retval None -*/ -void ald_timer_base_stop_by_dma(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - ald_timer_dma_req_config(hperh, TIMER_DMA_UPDATE, DISABLE); - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - - return; -} -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group2 TIMER Output Compare functions - * @brief Time Output Compare functions - * - * @verbatim - ============================================================================== - ##### Time Output Compare functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize and configure the TIMER Output Compare. - (+) Start the Time Output Compare. - (+) Stop the Time Output Compare. - (+) Start the Time Output Compare and enable interrupt. - (+) Stop the Time Output Compare and disable interrupt. - (+) Start the Time Output Compare and enable DMA transfer. - (+) Stop the Time Output Compare and disable DMA transfer. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER Output Compare according to the specified - * parameters in the timer_handle_t and create the associated handle. - * @param hperh: TIMER handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_oc_init(timer_handle_t *hperh) -{ - return ald_timer_base_init(hperh); -} - -/** - * @brief Starts the TIMER Output Compare signal generation. - * @param hperh: TIMER handle - * @param ch : TIMER Channel to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_oc_start(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - timer_ccx_channel_cmd(hperh->perh, ch, ENABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_ENABLE(hperh); - - TIMER_ENABLE(hperh); - return; -} - -/** - * @brief Stops the TIMER Output Compare signal generation. - * @param hperh: TIMER handle - * @param ch: TIMER Channel to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_oc_stop(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - timer_ccx_channel_cmd(hperh->perh, ch, DISABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_DISABLE(hperh); - - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - return; -} - -/** - * @brief Starts the TIMER Output Compare signal generation in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channel to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_oc_start_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, ENABLE); - break; - - case TIMER_CHANNEL_2: - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, ENABLE); - break; - - case TIMER_CHANNEL_3: - ald_timer_interrupt_config(hperh, TIMER_IT_CC3, ENABLE); - break; - - case TIMER_CHANNEL_4: - ald_timer_interrupt_config(hperh, TIMER_IT_CC4, ENABLE); - break; - - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, ENABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_ENABLE(hperh); - - TIMER_ENABLE(hperh); - return; -} - -/** - * @brief Stops the TIMER Output Compare signal generation in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channel to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_oc_stop_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, DISABLE); - break; - - case TIMER_CHANNEL_2: - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, DISABLE); - break; - - case TIMER_CHANNEL_3: - ald_timer_interrupt_config(hperh, TIMER_IT_CC3, DISABLE); - break; - - case TIMER_CHANNEL_4: - ald_timer_interrupt_config(hperh, TIMER_IT_CC4, DISABLE); - break; - - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, DISABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_DISABLE(hperh); - - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - return; -} - - - - - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER Output Compare signal generation in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @param buf: The source Buffer address. - * @param len: The length of buffer to be transferred from memory to TIMER peripheral - * @param dma_ch: Channel of DMA. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_oc_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf, uint32_t len, uint8_t dma_ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - if ((hperh->state == TIMER_STATE_BUSY)) - return BUSY; - if ((hperh->state == TIMER_STATE_READY)) { - if (((uint32_t)buf == 0 ) || (len == 0)) - return ERROR; - } - - hperh->state = TIMER_STATE_BUSY; - - if (hperh->hdma1.perh == NULL) - hperh->hdma1.perh = DMA0; - - hperh->hdma1.cplt_cbk = timer_dma_oc_cplt; - hperh->hdma1.cplt_arg = (void *)hperh; - hperh->hdma1.err_cbk = timer_dma_error; - hperh->hdma1.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdma1.config); - hperh->hdma1.config.src = (void *)buf; - hperh->hdma1.config.size = len; - hperh->hdma1.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma1.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdma1.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma1.config.channel = dma_ch; - - - timer_dma_msel(hperh->perh, &hperh->hdma1.config); - - switch (ch) { - case TIMER_CHANNEL_1: - hperh->hdma1.config.dst = (void *)&hperh->perh->CCVAL1; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH1; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_1; - break; - - case TIMER_CHANNEL_2: - hperh->hdma1.config.dst = (void *)&hperh->perh->CCVAL2; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH2; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_2; - break; - - case TIMER_CHANNEL_3: - hperh->hdma1.config.dst = (void *)&hperh->perh->CCVAL3; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH3; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC3, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_3; - break; - - case TIMER_CHANNEL_4: - hperh->hdma1.config.dst = (void *)&hperh->perh->CCVAL4; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH4; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC4, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_4; - break; - - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, ENABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_ENABLE(hperh); - - TIMER_ENABLE(hperh); - return OK; -} - -/** - * @brief Stops the TIMER Output Compare signal generation in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None -*/ -void ald_timer_oc_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, DISABLE); - break; - - case TIMER_CHANNEL_2: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, DISABLE); - break; - - case TIMER_CHANNEL_3: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC3, DISABLE); - break; - - case TIMER_CHANNEL_4: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC4, DISABLE); - break; - - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, DISABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_DISABLE(hperh); - - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - return; -} -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group3 TIMER PWM functions - * @brief TIMER PWM functions - * - * @verbatim - ============================================================================== - ##### Time PWM functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize and configure the TIMER PWM. - (+) Start the Time PWM. - (+) Stop the Time PWM. - (+) Start the Time PWM and enable interrupt. - (+) Stop the Time PWM and disable interrupt. - (+) Start the Time PWM and enable DMA transfer. - (+) Stop the Time PWM and disable DMA transfer. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER PWM Time Base according to the specified - * parameters in the timer_handle_t and create the associated handle. - * @param hperh: TIMER handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_pwm_init(timer_handle_t *hperh) -{ - return ald_timer_base_init(hperh); -} - -/** - * @brief Starts the PWM signal generation. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_pwm_start(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_oc_start(hperh, ch); - return; -} - -/** - * @brief Stops the PWM signal generation. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_pwm_stop(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_oc_stop(hperh, ch); - return; -} - -/** - * @brief Starts the PWM signal generation in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channel to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_pwm_start_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_oc_start_by_it(hperh, ch); - return; -} - -/** - * @brief Stops the PWM signal generation in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_pwm_stop_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_oc_stop_by_it(hperh, ch); - return; -} - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER PWM signal generation in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @param buf: The source Buffer address. - * @param len: The length of buffer to be transferred from memory to TIMER peripheral - * @param dma_ch: Channel of DMA. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_pwm_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf, uint32_t len, uint8_t dma_ch) -{ - return ald_timer_oc_start_by_dma(hperh, ch, buf, len, dma_ch); -} - -/** - * @brief Stops the TIMER PWM signal generation in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_pwm_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_oc_stop_by_dma(hperh, ch); - return; -} -#endif -/** - * @brief Set the PWM freq. - * @param hperh: TIMER handle - * @param freq: PWM freq to set - * @retval None - */ -void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint16_t freq) -{ - uint32_t _arr; - - if (freq == 0) - return; - - _arr = ald_cmu_get_pclk1_clock() / (hperh->init.prescaler + 1) / freq - 1; - WRITE_REG(hperh->perh->AR, _arr); - hperh->init.period = _arr; -} - -/** - * @brief Set the PWM duty. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @param duty: PWM duty to set - * @retval None - */ -void ald_timer_pwm_set_duty(timer_handle_t *hperh, timer_channel_t ch, uint16_t duty) -{ - uint32_t tmp = (hperh->init.period + 1) * duty / 100 - 1; - - if (ch == TIMER_CHANNEL_1) - WRITE_REG(hperh->perh->CCVAL1, tmp); - else if (ch == TIMER_CHANNEL_2) - WRITE_REG(hperh->perh->CCVAL2, tmp); - else if (ch == TIMER_CHANNEL_3) - WRITE_REG(hperh->perh->CCVAL3, tmp); - else if (ch == TIMER_CHANNEL_4) - WRITE_REG(hperh->perh->CCVAL4, tmp); - else { - ;/* do nothing */ - } -} - -/** - * @brief Set capture the PWM. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be captured the PWM - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_pwm_set_input(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_PWM_INPUT_INSTANCE(hperh->perh, ch)); - - CLEAR_BIT(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK); - switch (ch) { - case TIMER_CHANNEL_1: - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CC1SSEL_MSK, TIMER_IC_SEL_DIRECT << TIMER_CHMR1_CC1SSEL_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CC2SSEL_MSK, TIMER_IC_SEL_INDIRECT << TIMER_CHMR1_CC2SSEL_POSS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC1POL_MSK, TIMER_IC_POLARITY_RISE << TIMER_CCEP_CC1POL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC1NPOL_MSK, TIMER_IC_POLARITY_RISE << TIMER_CCEP_CC1NPOL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC2POL_MSK, TIMER_IC_POLARITY_FALL << TIMER_CCEP_CC2POL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC2NPOL_MSK, TIMER_IC_POLARITY_FALL << TIMER_CCEP_CC2NPOL_POS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI1FP1 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_RESET << TIMER_SMCON_SMODS_POSS); - break; - case TIMER_CHANNEL_2: - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CC1SSEL_MSK, TIMER_IC_SEL_INDIRECT << TIMER_CHMR1_CC1SSEL_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CC2SSEL_MSK, TIMER_IC_SEL_DIRECT << TIMER_CHMR1_CC2SSEL_POSS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC1POL_MSK, TIMER_IC_POLARITY_RISE << TIMER_CCEP_CC1POL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC1NPOL_MSK, TIMER_IC_POLARITY_FALL << TIMER_CCEP_CC1NPOL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC2POL_MSK, TIMER_IC_POLARITY_FALL << TIMER_CCEP_CC2POL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC2NPOL_MSK, TIMER_IC_POLARITY_RISE << TIMER_CCEP_CC2NPOL_POS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI2FP2 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_RESET << TIMER_SMCON_SMODS_POSS); - break; - default: - break; - } - - SET_BIT(hperh->perh->CCEP, TIMER_CCEP_CC1EN_MSK); - SET_BIT(hperh->perh->CCEP, TIMER_CCEP_CC2EN_MSK); - - return; -} -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group4 TIMER Input Capture functions - * @brief Time Input Capture functions - * - * @verbatim - ============================================================================== - ##### Time Input Capture functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize and configure the TIMER Input Capture. - (+) Start the Time Input Capture. - (+) Stop the Time Input Capture. - (+) Start the Time Input Capture and enable interrupt. - (+) Stop the Time Input Capture and disable interrupt. - (+) Start the Time Input Capture and enable DMA transfer. - (+) Stop the Time Input Capture and disable DMA transfer. - - * @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER Input Capture Time base according to the specified - * parameters in the timer_handle_t and create the associated handle. - * @param hperh: TIMER handle - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_ic_init(timer_handle_t *hperh) -{ - return ald_timer_base_init(hperh); -} - -/** - * @brief Starts the TIMER Input Capture measurement. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_ic_start(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - timer_ccx_channel_cmd(hperh->perh, ch, ENABLE); - TIMER_ENABLE(hperh); - return; -} - -/** - * @brief Stops the TIMER Input Capture measurement. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_ic_stop(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - timer_ccx_channel_cmd(hperh->perh, ch, DISABLE); - TIMER_DISABLE(hperh); - return; -} - -/** - * @brief Starts the TIMER Input Capture measurement in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_ic_start_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, ENABLE); - break; - case TIMER_CHANNEL_2: - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, ENABLE); - break; - case TIMER_CHANNEL_3: - ald_timer_interrupt_config(hperh, TIMER_IT_CC3, ENABLE); - break; - case TIMER_CHANNEL_4: - ald_timer_interrupt_config(hperh, TIMER_IT_CC4, ENABLE); - break; - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, ENABLE); - TIMER_ENABLE(hperh); - return; -} - -/** - * @brief Stops the TIMER Input Capture measurement in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_ic_stop_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, DISABLE); - break; - case TIMER_CHANNEL_2: - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, DISABLE); - break; - case TIMER_CHANNEL_3: - ald_timer_interrupt_config(hperh, TIMER_IT_CC3, DISABLE); - break; - case TIMER_CHANNEL_4: - ald_timer_interrupt_config(hperh, TIMER_IT_CC4, DISABLE); - break; - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, DISABLE); - TIMER_DISABLE(hperh); - return; -} - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER Input Capture measurement in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @param buf: The destination Buffer address. - * @param len: The length of buffer to be transferred TIMER peripheral to memory - * @param dma_ch: Channel of DMA. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_ic_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf, uint32_t len, uint8_t dma_ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - if ((hperh->state == TIMER_STATE_BUSY)) - return BUSY; - if ((hperh->state == TIMER_STATE_READY)) { - if (((uint32_t)buf == 0 ) || (len == 0)) - return ERROR; - } - - hperh->state = TIMER_STATE_BUSY; - - if (hperh->hdma1.perh == NULL) - hperh->hdma1.perh = DMA0; - - hperh->hdma1.cplt_cbk = timer_dma_capture_cplt; - hperh->hdma1.cplt_arg = (void *)hperh; - hperh->hdma1.err_cbk = timer_dma_error; - hperh->hdma1.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdma1.config); - hperh->hdma1.config.dst = (void *)buf; - hperh->hdma1.config.size = len; - hperh->hdma1.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma1.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdma1.config.dst_inc = DMA_DATA_INC_HALFWORD; - hperh->hdma1.config.channel = dma_ch; - - timer_dma_msel(hperh->perh, &hperh->hdma1.config); - - switch (ch) { - case TIMER_CHANNEL_1: - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL1; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH1; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_1; - break; - - case TIMER_CHANNEL_2: - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL2; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH2; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_2; - break; - - case TIMER_CHANNEL_3: - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL3; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH3; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC3, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_3; - break; - - case TIMER_CHANNEL_4: - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL4; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH4; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC4, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_4; - break; - - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, ENABLE); - TIMER_ENABLE(hperh); - return OK; -} - -/** - * @brief Stops the TIMER Input Capture measurement in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval None - */ -void ald_timer_ic_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, DISABLE); - break; - case TIMER_CHANNEL_2: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, DISABLE); - break; - case TIMER_CHANNEL_3: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC3, DISABLE); - break; - case TIMER_CHANNEL_4: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC4, DISABLE); - break; - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, DISABLE); - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - return; -} -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group5 TIMER One Pulse functions - * @brief Time One Pulse functions - * - * @verbatim - ============================================================================== - ##### Time One Pulse functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize and configure the TIMER One Pulse. - (+) Start the Time One Pulse. - (+) Stop the Time One Pulse. - (+) Start the Time One Pulse and enable interrupt. - (+) Stop the Time One Pulse and disable interrupt. - (+) Start the Time One Pulse and enable DMA transfer. - (+) Stop the Time One Pulse and disable DMA transfer. - - * @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER One Pulse Time Base according to the specified - * parameters in the timer_handle_t and create the associated handle. - * @param hperh: TIMER handle - * @param mode: Select the One pulse mode. - * This parameter can be one of the following values: - * @arg TIMER_OP_MODE_SINGLE: Only one pulse will be generated. - * @arg TIMER_OP_MODE_REPEAT: Repetitive pulses wil be generated. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_one_pulse_init(timer_handle_t *hperh, timer_op_mode_t mode) -{ - if (hperh == NULL) - return ERROR; - - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_COUNTER_MODE(hperh->init.mode)); - assert_param(IS_TIMER_CLOCK_DIVISION(hperh->init.clk_div)); - assert_param(IS_TIMER_OP_MODE(mode)); - - if (hperh->state == TIMER_STATE_RESET) - hperh->lock = UNLOCK; - - hperh->state = TIMER_STATE_BUSY; - timer_base_set_config(hperh->perh, &hperh->init); - MODIFY_REG(hperh->perh->CON1, TIMER_CON1_SPMEN_MSK, mode << TIMER_CON1_SPMEN_POS); - hperh->state = TIMER_STATE_READY; - - return OK; -} - -/** - * @brief Starts the TIMER One Pulse signal generation. - * @param hperh: TIMER One Pulse handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_OP_OUTPUT_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_OP_OUTPUT_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_start(timer_handle_t *hperh, timer_op_output_channel_t ch) -{ - /* Enable the Capture compare and the Input Capture channels - * (in the OPM Mode the two possible channels that can be used are TIMER_CHANNEL_1 and TIMER_CHANNEL_2) - * if TIMER_CHANNEL_1 is used as output, the TIMER_CHANNEL_2 will be used as input and - * if TIMER_CHANNEL_1 is used as input, the TIMER_CHANNEL_2 will be used as output - * in all combinations, the TIMER_CHANNEL_1 and TIMER_CHANNEL_2 should be enabled together - */ - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_ENABLE(hperh); - - return; -} - -/** - * @brief Stops the TIMER One Pulse signal generation. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_OP_OUTPUT_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_OP_OUTPUT_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_stop(timer_handle_t *hperh, timer_op_output_channel_t ch) -{ - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_DISABLE(hperh); - - TIMER_DISABLE(hperh); - return; -} - -/** - * @brief Starts the TIMER One Pulse signal generation in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_OP_OUTPUT_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_OP_OUTPUT_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_start_by_it(timer_handle_t *hperh, timer_op_output_channel_t ch) -{ - /* Enable the Capture compare and the Input Capture channels - * (in the OPM Mode the two possible channels that can be used are TIMER_CHANNEL_1 and TIMER_CHANNEL_2) - * if TIMER_CHANNEL_1 is used as output, the TIMER_CHANNEL_2 will be used as input and - * if TIMER_CHANNEL_1 is used as input, the TIMER_CHANNEL_2 will be used as output - * in all combinations, the TIMER_CHANNEL_1 and TIMER_CHANNEL_2 should be enabled together - */ - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, ENABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_ENABLE(hperh); - - return; -} - -/** - * @brief Stops the TIMER One Pulse signal generation in interrupt mode. - * @param hperh : TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_OP_OUTPUT_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_OP_OUTPUT_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_stop_by_it(timer_handle_t *hperh, timer_op_output_channel_t ch) -{ - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, DISABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, DISABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - - if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) - TIMER_MOE_DISABLE(hperh); - - TIMER_DISABLE(hperh); - return; -} -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group6 TIMER Encoder functions - * @brief TIMER Encoder functions - * - * @verbatim - ============================================================================== - ##### Time Encoder functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize and configure the TIMER Encoder. - (+) Start the Time Encoder. - (+) Stop the Time Encoder. - (+) Start the Time Encoder and enable interrupt. - (+) Stop the Time Encoder and disable interrupt. - (+) Start the Time Encoder and enable DMA transfer. - (+) Stop the Time Encoder and disable DMA transfer. - - * @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER Encoder Interface and create the associated handle. - * @param hperh: TIMER handle - * @param config: TIMER Encoder Interface configuration structure - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_encoder_init(timer_handle_t *hperh, timer_encoder_init_t *config) -{ - if (hperh == NULL) - return ERROR; - - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_ENCODER_MODE(config->mode)); - assert_param(IS_TIMER_IC_POLARITY(config->ic1_polarity)); - assert_param(IS_TIMER_IC_POLARITY(config->ic2_polarity)); - assert_param(IS_TIMER_IC_SELECT(config->ic1_sel)); - assert_param(IS_TIMER_IC_SELECT(config->ic2_sel)); - assert_param(IS_TIMER_IC_PSC(config->ic1_psc)); - assert_param(IS_TIMER_IC_PSC(config->ic2_psc)); - assert_param(IS_TIMER_IC_FILTER(config->ic1_filter)); - assert_param(IS_TIMER_IC_FILTER(config->ic2_filter)); - - if (hperh->state == TIMER_STATE_RESET) - hperh->lock = UNLOCK; - - hperh->state = TIMER_STATE_BUSY; - CLEAR_BIT(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK); - timer_base_set_config(hperh->perh, &hperh->init); - - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, config->mode << TIMER_SMCON_SMODS_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CC1SSEL_MSK, config->ic1_sel << TIMER_CHMR1_CC1SSEL_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CC2SSEL_MSK, config->ic2_sel << TIMER_CHMR1_CC2SSEL_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_IC1PRES_MSK, config->ic1_psc << TIMER_CHMR1_IC1PRES_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_IC2PRES_MSK, config->ic2_psc << TIMER_CHMR1_IC2PRES_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_I1FLT_MSK, config->ic1_filter << TIMER_CHMR1_I1FLT_POSS); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_I2FLT_MSK, config->ic2_filter << TIMER_CHMR1_I2FLT_POSS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC1POL_MSK, (config->ic1_polarity & 0x1) << TIMER_CCEP_CC1POL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC1NPOL_MSK, ((config->ic1_polarity >> 1) & 0x1) << TIMER_CCEP_CC1NPOL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC2POL_MSK, (config->ic2_polarity & 0x1) << TIMER_CCEP_CC2POL_POS); - MODIFY_REG(hperh->perh->CCEP, TIMER_CCEP_CC2NPOL_MSK, ((config->ic2_polarity >> 1) & 0x1) << TIMER_CCEP_CC2NPOL_POS); - - hperh->state = TIMER_STATE_READY; - return OK; -} - -/** - * @brief Starts the TIMER Encoder Interface. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_ALL: TIMER Channel 1 and TIMER Channel 2 are selected - * @retval None - */ -void ald_timer_encoder_start(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - - switch (ch) { - case TIMER_CHANNEL_1: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - break; - case TIMER_CHANNEL_2: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - break; - default: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - break; - } - - TIMER_ENABLE(hperh); - return; -} - -/** - * @brief Stops the TIMER Encoder Interface. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_ALL: TIMER Channel 1 and TIMER Channel 2 are selected - * @retval None - */ -void ald_timer_encoder_stop(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - - switch (ch) { - case TIMER_CHANNEL_1: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - break; - case TIMER_CHANNEL_2: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - break; - default: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - break; - } - - TIMER_DISABLE(hperh); - return; -} - -/** - * @brief Starts the TIMER Encoder Interface in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_ALL: TIMER Channel 1 and TIMER Channel 2 are selected - * @retval None - */ -void ald_timer_encoder_start_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - - switch (ch) { - case TIMER_CHANNEL_1: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, ENABLE); - break; - case TIMER_CHANNEL_2: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, ENABLE); - break; - default: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, ENABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, ENABLE); - break; - } - - TIMER_ENABLE(hperh); - return; -} - -/** - * @brief Stops the TIMER Encoder Interface in interrupt mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_ALL: TIMER Channel 1 and TIMER Channel 2 are selected - * @retval None - */ -void ald_timer_encoder_stop_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - - switch (ch) { - case TIMER_CHANNEL_1: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, DISABLE); - break; - case TIMER_CHANNEL_2: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, DISABLE); - break; - default: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, DISABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, DISABLE); - break; - } - - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - return; -} - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER Encoder Interface in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_ALL: TIMER Channel 1 and TIMER Channel 2 are selected - * @param buf1: The destination Buffer address. Reading data from CCR1. - * @param buf2: The destination Buffer address. Reading data from CCR2. - * @param len: The length of buffer to be transferred TIMER peripheral to memory - * @param dma_ch1: Channel of DMA. - * @param dma_ch2: Channel of DMA. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_encoder_start_by_dma(timer_handle_t *hperh, timer_channel_t ch, - uint16_t *buf1, uint16_t *buf2, uint32_t len, - uint8_t dma_ch1, uint8_t dma_ch2) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - - if ((hperh->state == TIMER_STATE_BUSY)) - return BUSY; - if ((hperh->state == TIMER_STATE_READY)) { - if (((uint32_t)buf1 == 0) || ((uint32_t)buf2 == 0) || (len == 0)) - return ERROR; - } - - if (hperh->hdma1.perh == NULL) - hperh->hdma1.perh = DMA0; - if (hperh->hdma2.perh == NULL) - hperh->hdma2.perh = DMA0; - - hperh->state = TIMER_STATE_BUSY; - hperh->hdma1.cplt_cbk = timer_dma_capture_cplt; - hperh->hdma1.cplt_arg = (void *)hperh; - hperh->hdma1.err_cbk = timer_dma_error; - hperh->hdma1.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdma1.config); - hperh->hdma1.config.size = len; - hperh->hdma1.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma1.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdma1.config.dst_inc = DMA_DATA_INC_HALFWORD; - - timer_dma_msel(hperh->perh, &hperh->hdma1.config); - - switch (ch) { - case TIMER_CHANNEL_1: - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL1; - hperh->hdma1.config.dst = (void *)buf1; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH1; - hperh->hdma1.config.channel = dma_ch1; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - TIMER_ENABLE(hperh); - break; - - case TIMER_CHANNEL_2: - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL2; - hperh->hdma1.config.dst = (void *)buf2; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH2; - hperh->hdma1.config.channel = dma_ch2; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - TIMER_ENABLE(hperh); - break; - - default: - hperh->hdma2.cplt_cbk = timer_dma_capture_cplt; - hperh->hdma2.cplt_arg = (void *)hperh; - hperh->hdma2.err_cbk = timer_dma_error; - hperh->hdma2.err_arg = (void *)hperh; - memcpy(&hperh->hdma2.config, &hperh->hdma1.config, sizeof(dma_config_t)); - - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL1; - hperh->hdma1.config.dst = (void *)buf1; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH1; - hperh->hdma1.config.channel = dma_ch1; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, ENABLE); - - hperh->hdma2.config.src = (void *)&hperh->perh->CCVAL2; - hperh->hdma2.config.dst = (void *)buf2; - hperh->hdma2.config.msigsel = DMA_MSIGSEL_TIMER_CH2; - hperh->hdma2.config.channel = dma_ch2; - ald_dma_config_basic(&hperh->hdma2); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, ENABLE); - - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, ENABLE); - TIMER_ENABLE(hperh); - break; - } - - return OK; -} - -/** - * @brief Stops the TIMER Encoder Interface in DMA mode. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_ALL: TIMER Channel 1 and TIMER Channel 2 are selected - * @retval None - */ -void ald_timer_encoder_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - - switch (ch) { - case TIMER_CHANNEL_1: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, DISABLE); - break; - case TIMER_CHANNEL_2: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, DISABLE); - break; - default: - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_2, DISABLE); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, DISABLE); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, DISABLE); - break; - } - - TIMER_DISABLE(hperh); - hperh->state = TIMER_STATE_READY; - return; -} -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group7 TIMER Hall Sensor functions - * @brief TIMER Hall Sensor functions - * - * @verbatim - ============================================================================== - ##### Time Hall Sensor functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Initialize and configure the TIMER hall sensor. - (+) Start the hall sensor. - (+) Stop the hall sensor. - (+) Start the hall sensor and enable interrupt. - (+) Stop the hall sensor and disable interrupt. - (+) Start the hall sensor and enable DMA transfer. - (+) Stop the hal sensor and disable DMA transfer. - - * @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER Encoder Interface and create the associated handle. - * @param hperh: TIMER handle - * @param config: TIMER Encoder Interface configuration structure - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_hall_sensor_init(timer_handle_t *hperh, timer_hall_sensor_init_t *config) -{ - timer_oc_init_t oc; - - assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_COUNTER_MODE(hperh->init.mode)); - assert_param(IS_TIMER_CLOCK_DIVISION(hperh->init.clk_div)); - assert_param(IS_TIMER_IC_POLARITY(config->polarity)); - assert_param(IS_TIMER_IC_PSC(config->psc)); - assert_param(IS_TIMER_IC_FILTER(config->filter)); - - if (hperh->state == TIMER_STATE_RESET) - hperh->lock = UNLOCK; - - hperh->state = TIMER_STATE_READY; - timer_base_set_config(hperh->perh, &hperh->init); - timer_ti1_set_config(hperh->perh, config->polarity, TIMER_IC_SEL_TRC, config->filter); - - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_IC1PRES_MSK, config->psc << TIMER_CHMR1_IC1PRES_POSS); - SET_BIT(hperh->perh->CON2, TIMER_CON2_I1FSEL_MSK); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI1F_ED << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_RESET << TIMER_SMCON_SMODS_POSS); - - oc.oc_mode = TIMER_OC_MODE_PWM2; - oc.pulse = config->delay; - oc.oc_polarity = TIMER_OC_POLARITY_HIGH; - oc.ocn_polarity = TIMER_OCN_POLARITY_HIGH; - oc.oc_fast_en = DISABLE; - oc.oc_idle = TIMER_OC_IDLE_RESET; - oc.ocn_idle = TIMER_OCN_IDLE_RESET; - timer_oc2_set_config(hperh->perh, &oc); - - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_TRGO_OC2REF << TIMER_SMCON_SMODS_POSS); - return OK; -} -/** - * @brief Starts the TIMER hall sensor interface. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_hall_sensor_start(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); - - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - TIMER_ENABLE(hperh); - - return; -} - -/** - * @brief Stops the TIMER hall sensor interface. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_hall_sensor_stop(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); - - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - TIMER_DISABLE(hperh); - - return; -} - -/** - * @brief Starts the TIMER hall sensor interface in interrupt mode. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_hall_sensor_start_by_it(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); - - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - TIMER_ENABLE(hperh); - - return; -} - -/** - * @brief Stops the TIMER hall sensor interface in interrupt mode. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_hall_sensor_stop_by_it(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); - - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, DISABLE); - TIMER_DISABLE(hperh); - - return; -} - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER hall sensor interface in DMA mode. - * @param hperh: TIMER handle - * @param buf: The destination Buffer address. Reading data from CCR1. - * @param len: The length of buffer to be transferred TIMER peripheral to memory - * @param dma_ch: Channel of DMA. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_hall_sensor_start_by_dma(timer_handle_t *hperh, - uint16_t *buf, uint32_t len, uint8_t dma_ch) -{ - assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); - - if ((hperh->state == TIMER_STATE_BUSY)) - return BUSY; - if ((hperh->state == TIMER_STATE_READY)) { - if (((uint32_t)buf == 0) || (len == 0)) - return ERROR; - } - - if (hperh->hdma1.perh == NULL) - hperh->hdma1.perh = DMA0; - - hperh->state = TIMER_STATE_BUSY; - hperh->hdma1.cplt_cbk = timer_dma_capture_cplt; - hperh->hdma1.cplt_arg = (void *)hperh; - hperh->hdma1.err_cbk = timer_dma_error; - hperh->hdma1.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdma1.config); - hperh->hdma1.config.size = len; - hperh->hdma1.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma1.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdma1.config.dst_inc = DMA_DATA_INC_HALFWORD; - - timer_dma_msel(hperh->perh, &hperh->hdma1.config); - - hperh->hdma1.config.src = (void *)&hperh->perh->CCVAL1; - hperh->hdma1.config.dst = (void *)buf; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH1; - hperh->hdma1.config.channel = dma_ch; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, ENABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, ENABLE); - TIMER_ENABLE(hperh); - - return OK; -} -/** - * @brief Stops the TIMER hall sensor interface in DMA mode. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_hall_sensor_stop_by_dma(timer_handle_t *hperh) -{ - assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); - - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, DISABLE); - timer_ccx_channel_cmd(hperh->perh, TIMER_CHANNEL_1, DISABLE); - TIMER_DISABLE(hperh); - - return; -} -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group8 TIMER complementary output compare functions - * @brief TIMER complementary output compare functions - * - * @verbatim - ============================================================================== - ##### Time complementary output compare functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Start the Time complementary output compare. - (+) Stop the Time complementary output compare. - (+) Start the Time complementary output compare and enable interrupt. - (+) Stop the Time complementary output compare and disable interrupt. - (+) Start the Time complementary output compare and enable DMA transfer. - (+) Stop the Time complementary output compare and disable DMA transfer. - - * @endverbatim - * @{ - */ - -/** - * @brief Starts the TIMER output compare signal generation on the complementary output. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_ocn_start(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCXN_INSTANCE(hperh->perh, ch)); - - timer_ccxn_channel_cmd(hperh->perh, ch, ENABLE); - TIMER_MOE_ENABLE(hperh); - TIMER_ENABLE(hperh); - - return; -} - -/** - * @brief Stops the TIMER output compare signal generation on the complementary output. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_ocn_stop(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCXN_INSTANCE(hperh->perh, ch)); - - timer_ccxn_channel_cmd(hperh->perh, ch, DISABLE); - TIMER_MOE_DISABLE(hperh); - TIMER_DISABLE(hperh); - - return; -} - -/** - * @brief Starts the TIMER output compare signal generation on the complementary output. - * in interrupt mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_ocn_start_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCXN_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, ENABLE); - break; - - case TIMER_CHANNEL_2: - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, ENABLE); - break; - - case TIMER_CHANNEL_3: - ald_timer_interrupt_config(hperh, TIMER_IT_CC3, ENABLE); - break; - default: - break; - } - - ald_timer_interrupt_config(hperh, TIMER_IT_BREAK, ENABLE); - timer_ccxn_channel_cmd(hperh->perh, ch, ENABLE); - TIMER_MOE_ENABLE(hperh); - TIMER_ENABLE(hperh); - - return; -} - -/** - * @brief Stops the TIMER output compare signal generation on the complementary output. - * in interrupt mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_ocn_stop_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCXN_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_interrupt_config(hperh, TIMER_IT_CC1, DISABLE); - break; - - case TIMER_CHANNEL_2: - ald_timer_interrupt_config(hperh, TIMER_IT_CC2, DISABLE); - break; - - case TIMER_CHANNEL_3: - ald_timer_interrupt_config(hperh, TIMER_IT_CC3, DISABLE); - break; - default: - break; - } - - if ((!(READ_BIT(hperh->perh->CCEP, TIMER_CCEP_CC1NEN_MSK))) - && (!(READ_BIT(hperh->perh->CCEP, TIMER_CCEP_CC2NEN_MSK))) - && (!(READ_BIT(hperh->perh->CCEP, TIMER_CCEP_CC3NEN_MSK)))) { - ald_timer_interrupt_config(hperh, TIMER_IT_BREAK, DISABLE); - } - - timer_ccxn_channel_cmd(hperh->perh, ch, DISABLE); - TIMER_MOE_DISABLE(hperh); - TIMER_DISABLE(hperh); - - return; -} - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER output compare signal generation on the complementary output. - * in DMA mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @param buf: The destination Buffer address. Reading data from CCRx. - * @param len: The length of buffer to be transferred TIMER peripheral to memory - * @param dma_ch: Channel of DMA. - * @retval None - */ -ald_status_t ald_timer_ocn_start_by_dma(timer_handle_t *hperh, - timer_channel_t ch, uint16_t *buf, uint32_t len, uint8_t dma_ch) -{ - assert_param(IS_TIMER_CCXN_INSTANCE(hperh->perh, ch)); - - if ((hperh->state == TIMER_STATE_BUSY)) - return BUSY; - if ((hperh->state == TIMER_STATE_READY)) { - if (((uint32_t)buf == 0 ) || (len == 0)) - return ERROR; - } - - hperh->state = TIMER_STATE_BUSY; - - if (hperh->hdma1.perh == NULL) - hperh->hdma1.perh = DMA0; - - hperh->hdma1.cplt_cbk = timer_dma_oc_cplt; - hperh->hdma1.cplt_arg = (void *)hperh; - hperh->hdma1.err_cbk = timer_dma_error; - hperh->hdma1.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdma1.config); - hperh->hdma1.config.src = (void *)buf; - hperh->hdma1.config.size = len; - hperh->hdma1.config.data_width = DMA_DATA_SIZE_HALFWORD; - hperh->hdma1.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdma1.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdma1.config.channel = dma_ch; - hperh->hdma1.config.msel = DMA_MSEL_TIMER0; - - switch (ch) { - case TIMER_CHANNEL_1: - hperh->hdma1.config.dst = (void *)&hperh->perh->CCVAL1; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH1; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_1; - break; - - case TIMER_CHANNEL_2: - hperh->hdma1.config.dst = (void *)&hperh->perh->CCVAL2; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH2; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_2; - break; - - case TIMER_CHANNEL_3: - hperh->hdma1.config.dst = (void *)&hperh->perh->CCVAL3; - hperh->hdma1.config.msigsel = DMA_MSIGSEL_TIMER_CH3; - ald_dma_config_basic(&hperh->hdma1); - ald_timer_dma_req_config(hperh, TIMER_DMA_CC3, ENABLE); - hperh->ch = TIMER_ACTIVE_CHANNEL_3; - break; - - default: - break; - } - - timer_ccx_channel_cmd(hperh->perh, ch, ENABLE); - TIMER_MOE_ENABLE(hperh); - TIMER_ENABLE(hperh); - - return OK; -} - -/** - * @brief Starts the TIMER output compare signal generation on the complementary output. - * in DMA mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_ocn_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCXN_INSTANCE(hperh->perh, ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC1, DISABLE); - break; - - case TIMER_CHANNEL_2: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC2, DISABLE); - break; - - case TIMER_CHANNEL_3: - ald_timer_dma_req_config(hperh, TIMER_DMA_CC3, DISABLE); - break; - default: - break; - } - - timer_ccxn_channel_cmd(hperh->perh, ch, DISABLE); - TIMER_MOE_DISABLE(hperh); - TIMER_DISABLE(hperh); - - return; -} -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group9 TIMER complementary PWM functions - * @brief TIMER complementary PWM functions - * - * @verbatim - ============================================================================== - ##### Time complementary PWM functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Start the Time complementary PWM. - (+) Stop the Time complementary PWM. - (+) Start the Time complementary PWM and enable interrupt. - (+) Stop the Time complementary PWM and disable interrupt. - (+) Start the Time complementary PWM and enable DMA transfer. - (+) Stop the Time complementary PWM and disable DMA transfer. - - * @endverbatim - * @{ - */ - -/** - * @brief Starts the TIMER PWM signal generation on the complementary output. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_pwmn_start(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_start(hperh, ch); -} - -/** - * @brief Stops the TIMER PWM signal generation on the complementary output. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_pwmn_stop(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_stop(hperh, ch); -} - -/** - * @brief Starts the TIMER PWM signal generation on the complementary output. - * in interrupt mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_pwmn_start_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_start_by_it(hperh, ch); -} - -/** - * @brief Stops the TIMER PWM signal generation on the complementary output. - * in interrupt mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_pwmn_stop_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_stop_by_it(hperh, ch); -} - -#ifdef ALD_DMA -/** - * @brief Starts the TIMER PWM signal generation on the complementary output. - * in DMA mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @param buf: The destination Buffer address. Reading data from CCRx. - * @param len: The length of buffer to be transferred TIMER peripheral to memory - * @param dma_ch: Channel of DMA. - * @retval None - */ -ald_status_t ald_timer_pwmn_start_by_dma(timer_handle_t *hperh, - timer_channel_t ch, uint16_t *buf, uint32_t len, uint8_t dma_ch) -{ - return ald_timer_ocn_start_by_dma(hperh, ch, buf, len, dma_ch); -} - -/** - * @brief Starts the TIMER PWM signal generation on the complementary output. - * in DMA mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @retval None - */ -void ald_timer_pwmn_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_stop_by_dma(hperh, ch); -} -#endif -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group10 TIMER complementary one pulse functions - * @brief TIMER complementary one pulse functions - * - * @verbatim - ============================================================================== - ##### Time complementary one pulse functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Start the Time complementary one pulse. - (+) Stop the Time complementary one pulse. - (+) Start the Time complementary one pulse and enable interrupt. - (+) Stop the Time complementary one pulse and disable interrupt. - - * @endverbatim - * @{ - */ - -/** - * @brief Starts the TIMER one pulse signal generation on the complementary output. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_n_start(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_start(hperh, ch); -} - -/** - * @brief Stops the TIMER one pulse signal generation on the complementary output. - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_n_stop(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_stop(hperh, ch); -} - -/** - * @brief Starts the TIMER one pulse signal generation on the complementary output. - * in interrupt mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_n_start_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_start_by_it(hperh, ch); -} - -/** - * @brief Stops the TIMER one pulse signal generation on the complementary output. - * in interrupt mode - * @param hperh: TIMER handle - * @param ch: TIMER Channels to be disabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @retval None - */ -void ald_timer_one_pulse_n_stop_by_it(timer_handle_t *hperh, timer_channel_t ch) -{ - ald_timer_ocn_stop_by_it(hperh, ch); -} -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group11 Peripheral Control functions - * @brief Peripheral Control functions - * - * @verbatim - ============================================================================== - ##### Peripheral Control functions ##### - ============================================================================== - [..] - This section provides functions allowing to: - (+) Configure The Input Output channels for OC, PWM, IC or One Pulse mode. - (+) Configure External Clock source. - (+) Configure Complementary channels, break features and dead timere. - (+) Configure Master and the Slave synchronization. - (+) Handle TIMER interrupt. - (+) Get TIMER compare register's vale. - (+) Configure TIMER interrupt ENABLE/DISABLE. - (+) Get TIMER interrupt source status. - (+) Get TIMER interrupt flag status. - (+) Clear TIMER interrupt flag. - - @endverbatim - * @{ - */ -/** - * @brief Initializes the TIMER Output Compare Channels according to the specified - * parameters in the timer_oc_init_t. - * @param hperh: TIMER handle - * @param config: TIMER Output Compare configuration structure - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_oc_config_channel(timer_handle_t *hperh, timer_oc_init_t* config, timer_channel_t ch) -{ - assert_param(IS_TIMER_CCX_INSTANCE(hperh->perh, ch)); - assert_param(IS_TIMER_OC_MODE(config->oc_mode)); - assert_param(IS_TIMER_OC_POLARITY(config->oc_polarity)); - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - - switch (ch) { - case TIMER_CHANNEL_1: - timer_oc1_set_config(hperh->perh, config); - break; - - case TIMER_CHANNEL_2: - timer_oc2_set_config(hperh->perh, config); - break; - - case TIMER_CHANNEL_3: - timer_oc3_set_config(hperh->perh, config); - break; - - case TIMER_CHANNEL_4: - timer_oc4_set_config(hperh->perh, config); - break; - - default: - break; - } - - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Initializes the TIMER Input Capture Channels according to the specified - * parameters in the timer_ic_init_t. - * @param hperh: TIMER handle - * @param config: TIMER Input Capture configuration structure - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_ic_config_channel(timer_handle_t *hperh, timer_ic_init_t* config, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_IC_POLARITY(config->polarity)); - assert_param(IS_TIMER_IC_SELECT(config->sel)); - assert_param(IS_TIMER_IC_PSC(config->psc)); - assert_param(IS_TIMER_IC_FILTER(config->filter)); - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - - switch (ch) { - case TIMER_CHANNEL_1: - timer_ti1_set_config(hperh->perh, config->polarity, config->sel, config->filter); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_IC1PRES_MSK, config->psc << TIMER_CHMR1_IC1PRES_POSS); - break; - - case TIMER_CHANNEL_2: - timer_ti2_set_config(hperh->perh, config->polarity, config->sel, config->filter); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_IC2PRES_MSK, config->psc << TIMER_CHMR1_IC2PRES_POSS); - break; - - case TIMER_CHANNEL_3: - timer_ti3_set_config(hperh->perh, config->polarity, config->sel, config->filter); - MODIFY_REG(hperh->perh->CHMR2, TIMER_CHMR2_IC3PRES_MSK, config->psc << TIMER_CHMR2_IC3PRES_POSS); - break; - - case TIMER_CHANNEL_4: - timer_ti4_set_config(hperh->perh, config->polarity, config->sel, config->filter); - MODIFY_REG(hperh->perh->CHMR2, TIMER_CHMR2_IC4PRES_MSK, config->psc << TIMER_CHMR2_IC4PRES_POSS); - break; - - default: - break; - } - - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Initializes the TIMER One Pulse Channels according to the specified - * parameters in the timer_one_pulse_init_t. - * @param hperh: TIMER handle - * @param config: TIMER One Pulse configuration structure - * @param ch_out: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @param ch_in: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_one_pulse_config_channel(timer_handle_t *hperh, timer_one_pulse_init_t *config, - timer_channel_t ch_out, timer_channel_t ch_in) -{ - timer_oc_init_t tmp; - - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_OC_MODE(config->mode)); - assert_param(IS_TIMER_OC_POLARITY(config->oc_polarity)); - assert_param(IS_TIMER_OCN_POLARITY(config->ocn_polarity)); - assert_param(IS_TIMER_OCIDLE_STATE(config->oc_idle)); - assert_param(IS_TIMER_OCNIDLE_STATE(config->ocn_idle)); - assert_param(IS_TIMER_IC_POLARITY(config->polarity)); - assert_param(IS_TIMER_IC_SELECT(config->sel)); - assert_param(IS_TIMER_IC_FILTER(config->filter)); - - if (ch_out == ch_in) - return ERROR; - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - - tmp.oc_mode = config->mode; - tmp.pulse = config->pulse; - tmp.oc_polarity = config->oc_polarity; - tmp.ocn_polarity = config->ocn_polarity; - tmp.oc_idle = config->oc_idle; - tmp.ocn_idle = config->ocn_idle; - - switch (ch_out) { - case TIMER_CHANNEL_1: - timer_oc1_set_config(hperh->perh, &tmp); - break; - case TIMER_CHANNEL_2: - timer_oc2_set_config(hperh->perh, &tmp); - break; - default: - break; - } - - switch (ch_in) { - case TIMER_CHANNEL_1: - timer_ti1_set_config(hperh->perh, config->polarity, config->sel, config->filter); - CLEAR_BIT(hperh->perh->CHMR1, TIMER_CHMR1_IC1PRES_MSK); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI1FP1 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_TRIG << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_CHANNEL_2: - timer_ti2_set_config(hperh->perh, config->polarity, config->sel, config->filter); - CLEAR_BIT(hperh->perh->CHMR1, TIMER_CHMR1_IC2PRES_MSK); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI2FP2 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_TRIG << TIMER_SMCON_SMODS_POSS); - break; - default: - break; - } - - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Configures the OCRef clear feature - * @param hperh: TIMER handle - * @param config: pointer to a TIMER_ClearInputConfigTypeDef structure that - * contains the OCREF clear feature and parameters for the TIMER peripheral. - * @param ch: specifies the TIMER Channel - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 - * @arg TIMER_CHANNEL_2: TIMER Channel 2 - * @arg TIMER_CHANNEL_3: TIMER Channel 3 - * @arg TIMER_CHANNEL_4: TIMER Channel 4 - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_config_oc_ref_clear(timer_handle_t *hperh, timer_clear_input_config_t *config, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - assert_param(IS_FUNC_STATE(config->state)); - assert_param(IS_TIMER_CLEAR_INPUT_SOURCE(config->source)); - assert_param(IS_TIMER_CLEAR_INPUT_POLARITY(config->polarity)); - assert_param(IS_TIMER_ETR_PSC(config->psc)); - assert_param(IS_TIMER_IC_FILTER(config->filter)); - - if (config->source == TIMER_INPUT_NONE) { - timer_etr_set_config(hperh->perh, TIMER_ETR_PSC_DIV1, TIMER_CLK_POLARITY_NO_INV, 0); - } - else { - timer_etr_set_config(hperh->perh, config->psc, - (timer_clock_polarity_t)config->polarity, config->filter); - } - - switch (ch) { - case TIMER_CHANNEL_1: - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CH1OCLREN_MSK, config->state << TIMER_CHMR1_CH1OCLREN_POS); - break; - - case TIMER_CHANNEL_2: - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CH2OCLREN_MSK, config->state << TIMER_CHMR1_CH2OCLREN_POS); - break; - - case TIMER_CHANNEL_3: - assert_param(IS_TIMER_CC4_INSTANCE(hperh->perh)); - MODIFY_REG(hperh->perh->CHMR2, TIMER_CHMR2_CH3OCLREN_MSK, config->state << TIMER_CHMR2_CH3OCLREN_POS); - break; - - case TIMER_CHANNEL_4: - assert_param(IS_TIMER_CC4_INSTANCE(hperh->perh)); - MODIFY_REG(hperh->perh->CHMR2, TIMER_CHMR2_CH4OCLREN_MSK, config->state << TIMER_CHMR2_CH4OCLREN_POS); - break; - - default: - break; - } - - return OK; -} - -/** - * @brief Configures the clock source to be used - * @param hperh: TIMER handle - * @param config: pointer to a timer_clock_config_t structure that - * contains the clock source information for the TIMER peripheral. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_config_clock_source(timer_handle_t *hperh, timer_clock_config_t *config) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_CLOCK_SOURCE(config->source)); - assert_param(IS_TIMER_CLOCK_POLARITY(config->polarity)); - assert_param(IS_TIMER_ETR_PSC(config->psc)); - assert_param(IS_TIMER_IC_FILTER(config->filter)); - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - WRITE_REG(hperh->perh->SMCON, 0x0); - - switch (config->source) { - case TIMER_SRC_INTER: - CLEAR_BIT(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK); - break; - - case TIMER_SRC_ETRMODE1: - timer_etr_set_config(hperh->perh, config->psc, config->polarity, config->filter); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_ETRF << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_SRC_ETRMODE2: - timer_etr_set_config(hperh->perh, config->psc, config->polarity, config->filter); - SET_BIT(hperh->perh->SMCON, TIMER_SMCON_ECM2EN_MSK); - break; - - case TIMER_SRC_TI1: - timer_ti1_set_config_stage(hperh->perh, (timer_ic_polarity_t)config->polarity, config->filter); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI1FP1 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_SRC_TI2: - timer_ti2_set_config_stage(hperh->perh, (timer_ic_polarity_t)config->polarity, config->filter); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI2FP2 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_SRC_TI1ED: - timer_ti1_set_config_stage(hperh->perh, (timer_ic_polarity_t)config->polarity, config->filter); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_TI1F_ED << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_SRC_ITR0: - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_ITR0 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_SRC_ITR1: - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_ITR1 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_SRC_ITR2: - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_ITR2 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - - case TIMER_SRC_ITR3: - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, TIMER_TS_ITR3 << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, TIMER_MODE_EXTERNAL1 << TIMER_SMCON_SMODS_POSS); - break; - default: - break; - } - - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Selects the signal connected to the TI1 input: direct from CH1_input - * or a XOR combination between CH1_input, CH2_input & CH3_input - * @param hperh: TIMER handle. - * @param ti1_select: Indicate whether or not channel 1 is connected to the - * output of a XOR gate. - * This parameter can be one of the following values: - * @arg 0: The TIMERx_CH1 pin is connected to TI1 input - * @arg 1: The TIMERx_CH1, CH2 and CH3 - * pins are connected to the TI1 input (XOR combination) - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_config_ti1_input(timer_handle_t *hperh, uint32_t ti1_select) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - - MODIFY_REG(hperh->perh->CON2, TIMER_CON2_I1FSEL_MSK, ti1_select << TIMER_CON2_I1FSEL_POS); - return OK; -} - -/** - * @brief Configures the TIMER in Slave mode - * @param hperh: TIMER handle. - * @param config: pointer to a timer_slave_config_t structure that - * contains the selected trigger (internal trigger input, filtered - * timerer input or external trigger input) and the Slave - * mode (Disable, Reset, Gated, Trigger, External clock mode 1). - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_slave_config_sync(timer_handle_t *hperh, timer_slave_config_t *config) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_SLAVE_MODE(config->mode)); - assert_param(IS_TIMER_TS(config->input)); - assert_param(IS_TIMER_CLOCK_POLARITY(config->polarity)); - assert_param(IS_TIMER_ETR_PSC(config->psc)); - assert_param(IS_TIMER_IC_FILTER(config->filter)); - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - - timer_slave_set_config(hperh, config); - ald_timer_interrupt_config(hperh, TIMER_IT_TRIGGER, DISABLE); - ald_timer_dma_req_config(hperh, TIMER_DMA_TRIGGER, DISABLE); - - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Configures the TIMER in Slave mode in interrupt mode - * @param hperh: TIMER handle. - * @param config: pointer to a timer_slave_config_t structure that - * contains the selected trigger (internal trigger input, filtered - * timerer input or external trigger input) and the ) and the Slave - * mode (Disable, Reset, Gated, Trigger, External clock mode 1). - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_slave_config_sync_by_it(timer_handle_t *hperh, timer_slave_config_t *config) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_SLAVE_MODE(config->mode)); - assert_param(IS_TIMER_TS(config->input)); - assert_param(IS_TIMER_CLOCK_POLARITY(config->polarity)); - assert_param(IS_TIMER_ETR_PSC(config->psc)); - assert_param(IS_TIMER_IC_FILTER(config->filter)); - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - - timer_slave_set_config(hperh, config); - ald_timer_interrupt_config(hperh, TIMER_IT_TRIGGER, ENABLE); - ald_timer_dma_req_config(hperh, TIMER_DMA_TRIGGER, DISABLE); - - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Generate a software event - * @param hperh: TIMER handle - * @param event: specifies the event source. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_timer_generate_event(timer_handle_t *hperh, timer_event_source_t event) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_EVENT_SOURCE(event)); - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - WRITE_REG(hperh->perh->SGE, event); - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Read the captured value from Capture Compare unit - * @param hperh: TIMER handle. - * @param ch: TIMER Channels to be enabled - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1 : TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2 : TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3 : TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4 : TIMER Channel 4 selected - * @retval Captured value - */ -uint32_t ald_timer_read_capture_value(timer_handle_t *hperh, timer_channel_t ch) -{ - uint32_t tmp; - - __LOCK(hperh); - hperh->state = TIMER_STATE_BUSY; - - switch (ch) { - case TIMER_CHANNEL_1: - tmp = hperh->perh->CCVAL1; - break; - case TIMER_CHANNEL_2: - tmp = hperh->perh->CCVAL2; - break; - case TIMER_CHANNEL_3: - tmp = hperh->perh->CCVAL3; - break; - case TIMER_CHANNEL_4: - tmp = hperh->perh->CCVAL4; - break; - default: - tmp = hperh->perh->CCVAL1; - break; - } - - hperh->state = TIMER_STATE_READY; - __UNLOCK(hperh); - return tmp; -} - -/** - * @brief Sets TIMER output mode. - * @param hperh: TIMER handle. - * @param mode: TIMER output mode. - * @param ch: TIMER Channels. - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1 : TIMER Channel 1 selected - * @arg TIMER_CHANNEL_2 : TIMER Channel 2 selected - * @arg TIMER_CHANNEL_3 : TIMER Channel 3 selected - * @arg TIMER_CHANNEL_4 : TIMER Channel 4 selected - * @retval None - */ -void ald_timer_set_output_mode(timer_handle_t *hperh, timer_oc_mode_t mode, timer_channel_t ch) -{ - assert_param(IS_TIMER_CC2_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_OC_MODE(mode)); - assert_param(IS_TIMER_CHANNELS(ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CH1OMOD_MSK, mode << TIMER_CHMR1_CH1OMOD_POSS); - break; - case TIMER_CHANNEL_2: - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_CH2OMOD_MSK, mode << TIMER_CHMR1_CH2OMOD_POSS); - break; - case TIMER_CHANNEL_3: - MODIFY_REG(hperh->perh->CHMR2, TIMER_CHMR2_CH3OMOD_MSK, mode << TIMER_CHMR2_CH3OMOD_POSS); - break; - case TIMER_CHANNEL_4: - MODIFY_REG(hperh->perh->CHMR2, TIMER_CHMR2_CH4OMOD_MSK, mode << TIMER_CHMR2_CH4OMOD_POSS); - break; - default: - break; - } - - return; -} - -/** - * @brief Configure the channel in commutation event. - * @param hperh: TIMER handel - * @param config: Parameters of the channel. - * @retval None - */ -void ald_timer_com_change_config(timer_handle_t *hperh, timer_com_channel_config_t *config) -{ - uint32_t cm1, cm2, cce; - - assert_param(IS_TIMER_COM_EVENT_INSTANCE(hperh->perh)); - assert_param(IS_FUNC_STATE(config->ch[0].en)); - assert_param(IS_FUNC_STATE(config->ch[0].n_en)); - assert_param(IS_TIMER_OC_MODE(config->ch[0].mode)); - assert_param(IS_FUNC_STATE(config->ch[1].en)); - assert_param(IS_FUNC_STATE(config->ch[1].n_en)); - assert_param(IS_TIMER_OC_MODE(config->ch[1].mode)); - assert_param(IS_FUNC_STATE(config->ch[2].en)); - assert_param(IS_FUNC_STATE(config->ch[2].n_en)); - assert_param(IS_TIMER_OC_MODE(config->ch[2].mode)); - - TIMER_MOE_DISABLE(hperh); - TIMER_DISABLE(hperh); - - cm1 = hperh->perh->CHMR1; - cm2 = hperh->perh->CHMR2; - cce = hperh->perh->CCEP; - - MODIFY_REG(cm1, (0x7 << 4), (config->ch[0].mode << 4)); - MODIFY_REG(cm1, (0x7 << 12), (config->ch[1].mode << 12)); - MODIFY_REG(cm2, (0x7 << 4), (config->ch[2].mode << 4)); - MODIFY_REG(cce, (0x1 << 0), (config->ch[0].en << 0)); - MODIFY_REG(cce, (0x1 << 2), (config->ch[0].n_en << 2)); - MODIFY_REG(cce, (0x1 << 4), (config->ch[1].en << 4)); - MODIFY_REG(cce, (0x1 << 6), (config->ch[1].n_en << 6)); - MODIFY_REG(cce, (0x1 << 8), (config->ch[2].en << 8)); - MODIFY_REG(cce, (0x1 << 10), (config->ch[2].n_en << 10)); - - WRITE_REG(hperh->perh->CHMR1, cm1); - WRITE_REG(hperh->perh->CHMR2, cm2); - WRITE_REG(hperh->perh->CCEP, cce); - - TIMER_MOE_ENABLE(hperh); - TIMER_ENABLE(hperh); - return; -} - -/** - * @brief Configure the TIMER commutation event sequence. - * @param hperh: TIMER handel - * @param ts: the internal trigger corresponding to the timerer interfacing - * with the hall sensor. - * This parameter can be one of the following values: - * @arg TIMER_TS_ITR0 - * @arg TIMER_TS_ITR1 - * @arg TIMER_TS_ITR2 - * @arg TIMER_TS_ITR3 - * @param trgi: the commutation event source. - * This parameter can be one of the following values: - * @arg ENABLE: Commutation event source is TRGI - * @arg DISABLE: Commutation event source is set by software using the COMG bit - * @retval None - */ -void ald_timer_com_event_config(timer_handle_t *hperh, timer_ts_t ts, type_func_t trgi) -{ - assert_param(IS_TIMER_COM_EVENT_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_TS(ts)); - assert_param(IS_FUNC_STATE(trgi)); - - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, ts << TIMER_SMCON_TSSEL_POSS); - SET_BIT(hperh->perh->CON2, TIMER_CON2_CCPCEN_MSK); - MODIFY_REG(hperh->perh->CON2, TIMER_CON2_CCUSEL_MSK, trgi << TIMER_CON2_CCUSEL_POS); - - return; -} - -/** - * @brief Configure the TIMER commutation event sequence with interrupt. - * @param hperh: TIMER handel - * @param ts: the internal trigger corresponding to the timerer interfacing - * with the hall sensor. - * This parameter can be one of the following values: - * @arg TIMER_TS_ITR0 - * @arg TIMER_TS_ITR1 - * @arg TIMER_TS_ITR2 - * @arg TIMER_TS_ITR3 - * @param trgi: the commutation event source. - * This parameter can be one of the following values: - * @arg ENABLE: Commutation event source is TRGI - * @arg DISABLE: Commutation event source is set by software using the COMG bit - * @retval None - */ -void ald_timer_com_event_config_it(timer_handle_t *hperh, timer_ts_t ts, type_func_t trgi) -{ - ald_timer_com_event_config(hperh, ts, trgi); - ald_timer_interrupt_config(hperh, TIMER_IT_COM, ENABLE); -} - -/** - * @brief Configure the break, dead timere, lock level state. - * @param hperh: TIMER handle - * @param config: Pointer to the timer_break_dead_timere_t structure. - * @retval None - */ -void ald_timer_break_dead_time_config(timer_handle_t *hperh, timer_break_dead_time_t *config) -{ - uint32_t tmp; - - assert_param(IS_TIMER_BREAK_INSTANCE(hperh->perh)); - assert_param(IS_FUNC_STATE(config->off_run)); - assert_param(IS_FUNC_STATE(config->off_idle)); - assert_param(IS_TIMER_CLOCK_LEVEL(config->lock_level)); - assert_param(IS_TIMER_DEAD_TIMERE(config->dead_time)); - assert_param(IS_FUNC_STATE(config->break_state)); - assert_param(IS_TIMER_BREAK_POLARITY(config->polarity)); - assert_param(IS_FUNC_STATE(config->auto_out)); - - tmp = READ_REG(hperh->perh->BDCFG); - MODIFY_REG(tmp, TIMER_BDCFG_OFFSSR_MSK, config->off_run << TIMER_BDCFG_OFFSSR_POS); - MODIFY_REG(tmp, TIMER_BDCFG_OFFSSI_MSK, config->off_idle << TIMER_BDCFG_OFFSSI_POS); - MODIFY_REG(tmp, TIMER_BDCFG_LOCKLVL_MSK, config->lock_level << TIMER_BDCFG_LOCKLVL_POSS); - MODIFY_REG(tmp, TIMER_BDCFG_DT_MSK, config->dead_time << TIMER_BDCFG_DT_POSS); - MODIFY_REG(tmp, TIMER_BDCFG_BRKEN_MSK, config->break_state << TIMER_BDCFG_BRKEN_POS); - MODIFY_REG(tmp, TIMER_BDCFG_BRKP_MSK, config->polarity << TIMER_BDCFG_BRKP_POS); - MODIFY_REG(tmp, TIMER_BDCFG_AOEN_MSK, config->auto_out << TIMER_BDCFG_AOEN_POS); - WRITE_REG(hperh->perh->BDCFG, tmp); - - hperh->state = TIMER_STATE_READY; - return; -} - -/** - * @brief Configure the master mode - * @param hperh: TIMER handle - * @param config: Pointer to the timer_master_config_t structure. - * @retval None - */ -void ald_timer_master_sync_config(timer_handle_t *hperh, timer_master_config_t *config) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_MASTER_MODE_SEL(config->sel)); - assert_param(IS_FUNC_STATE(config->master_en)); - - hperh->state = TIMER_STATE_BUSY; - MODIFY_REG(hperh->perh->CON2, TIMER_CON2_TRGOSEL_MSK, config->sel << TIMER_CON2_TRGOSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_MSCFG_MSK, config->master_en << TIMER_SMCON_MSCFG_POS); - hperh->state = TIMER_STATE_READY; - - return; -} - -/** - * @brief This function handles TIMER interrupts requests. - * @param hperh: TIMER handle - * @retval None - */ -void ald_timer_irq_handler(timer_handle_t *hperh) -{ - uint32_t reg = hperh->perh->IFM; - - /* Capture or compare 1 event */ - if (READ_BIT(reg, TIMER_FLAG_CC1)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_CC1); - hperh->ch = TIMER_ACTIVE_CHANNEL_1; - - /* Input capture event */ - if (READ_BIT(hperh->perh->CHMR1, TIMER_CHMR1_CC1SSEL_MSK)) { - if (hperh->capture_cbk) - hperh->capture_cbk(hperh); - } - else { /* Output compare event */ - if (hperh->delay_elapse_cbk) - hperh->delay_elapse_cbk(hperh); - if (hperh->pwm_pulse_finish_cbk) - hperh->pwm_pulse_finish_cbk(hperh); - } - - hperh->ch = TIMER_ACTIVE_CHANNEL_CLEARED; - } - /* Capture or compare 2 event */ - if (READ_BIT(reg, TIMER_FLAG_CC2)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_CC2); - hperh->ch = TIMER_ACTIVE_CHANNEL_2; - - /* Input capture event */ - if (READ_BIT(hperh->perh->CHMR1, TIMER_CHMR1_CC2SSEL_MSK)) { - if (hperh->capture_cbk) - hperh->capture_cbk(hperh); - } - else { /* Output compare event */ - if (hperh->delay_elapse_cbk) - hperh->delay_elapse_cbk(hperh); - if (hperh->pwm_pulse_finish_cbk) - hperh->pwm_pulse_finish_cbk(hperh); - } - - hperh->ch = TIMER_ACTIVE_CHANNEL_CLEARED; - } - /* Capture or compare 3 event */ - if (READ_BIT(reg, TIMER_FLAG_CC3)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_CC3); - hperh->ch = TIMER_ACTIVE_CHANNEL_3; - - /* Input capture event */ - if (READ_BIT(hperh->perh->CHMR2, TIMER_CHMR2_CC3SSEL_MSK)) { - if (hperh->capture_cbk) - hperh->capture_cbk(hperh); - } - else { /* Output compare event */ - if (hperh->delay_elapse_cbk) - hperh->delay_elapse_cbk(hperh); - if (hperh->pwm_pulse_finish_cbk) - hperh->pwm_pulse_finish_cbk(hperh); - } - - hperh->ch = TIMER_ACTIVE_CHANNEL_CLEARED; - } - /* Capture or compare 4 event */ - if (READ_BIT(reg, TIMER_FLAG_CC4)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_CC4); - hperh->ch = TIMER_ACTIVE_CHANNEL_4; - - /* Input capture event */ - if (READ_BIT(hperh->perh->CHMR2, TIMER_CHMR2_CC4SSEL_MSK)) { - if (hperh->capture_cbk) - hperh->capture_cbk(hperh); - } - else { /* Output compare event */ - if (hperh->delay_elapse_cbk) - hperh->delay_elapse_cbk(hperh); - if (hperh->pwm_pulse_finish_cbk) - hperh->pwm_pulse_finish_cbk(hperh); - } - - hperh->ch = TIMER_ACTIVE_CHANNEL_CLEARED; - } - - /* TIMER Update event */ - if (READ_BIT(reg, TIMER_FLAG_UPDATE)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_UPDATE); - - if (hperh->period_elapse_cbk) - hperh->period_elapse_cbk(hperh); - } - - /* TIMER Break input event */ - if (READ_BIT(reg, TIMER_FLAG_BREAK)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_BREAK); - - if (hperh->break_cbk) - hperh->break_cbk(hperh); - } - - /* TIMER Trigger detection event */ - if (READ_BIT(reg, TIMER_FLAG_TRIGGER)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_TRIGGER); - - if (hperh->trigger_cbk) - hperh->trigger_cbk(hperh); - } - - /* TIMER commutation event */ - if (READ_BIT(reg, TIMER_FLAG_COM)) { - ald_timer_clear_flag_status(hperh, TIMER_FLAG_COM); - - if (hperh->com_cbk) - hperh->com_cbk(hperh); - } - - return; -} - -/** - * @brief Configure DMA request source. - * @param hperh: TIMER handle - * @param req: DMA request source. - * @param state: New state of the specified DMA request. - * @retval None - */ -void ald_timer_dma_req_config(timer_handle_t *hperh, timer_dma_req_t req, type_func_t state) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_DMA_REQ(req)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - SET_BIT(hperh->perh->DIER, req); - else - SET_BIT(hperh->perh->DIDR, req); - - return; -} - -/** - * @brief Enable/disable the specified TIMER interrupts. - * @param hperh: Pointer to a timer_handle_t structure. - * @param it: Specifies the timer interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref timer_it_t. - * @param state: New state of the specified TIMER interrupts. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_timer_interrupt_config(timer_handle_t *hperh, timer_it_t it, type_func_t state) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_IT(it)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - SET_BIT(hperh->perh->DIER, it); - else - SET_BIT(hperh->perh->DIDR, it); - - return; -} - -/** - * @brief Get the status of TIMER interrupt source. - * @param hperh: Pointer to a timer_handle_t structure. - * @param it: Specifies the TIMER interrupt source. - * This parameter can be one of the @ref timer_it_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -it_status_t ald_timer_get_it_status(timer_handle_t *hperh, timer_it_t it) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_IT(it)); - - if (hperh->perh->DIVS & it) - return SET; - - return RESET; -} - -/** - * @brief Get the status of TIMER interrupt flag. - * @param hperh: Pointer to a timer_handle_t structure. - * @param flag: Specifies the TIMER interrupt flag. - * This parameter can be one of the @ref timer_flag_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_timer_get_flag_status(timer_handle_t *hperh, timer_flag_t flag) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_FLAG(flag)); - - if (hperh->perh->RIF & flag) - return SET; - - return RESET; -} - -/** - * @brief Clear the TIMER interrupt flag. - * @param hperh: Pointer to a uart_handle_t structure. - * @param flag: Specifies the TIMER interrupt flag. - * This parameter can be one of the @ref timer_flag_t. - * @retval None - */ -void ald_timer_clear_flag_status(timer_handle_t *hperh, timer_flag_t flag) -{ - assert_param(IS_TIMER_INSTANCE(hperh->perh)); - assert_param(IS_TIMER_FLAG(flag)); - - hperh->perh->ICR = flag; - return; -} -/** - * @} - */ - -/** @defgroup TIMER_Public_Functions_Group12 Peripheral State functions - * @brief Peripheral State functions - * - * @verbatim - ============================================================================== - ##### Peripheral State functions ##### - ============================================================================== - [..] - This subsection permit to get in run-timere the status of the peripheral - and the data flow. - - @endverbatim - * @{ - */ - -/** - * @brief Return the TIMER Base state - * @param hperh: TIMER handle - * @retval TIMER peripheral state - */ -timer_state_t ald_timer_get_state(timer_handle_t *hperh) -{ - return hperh->state; -} -/** - * @} - */ -/** - * @} - */ - -/** @addtogroup TIMER_Private_Functions - * @{ - */ - -#ifdef ALD_DMA -/** - * @brief TIMER DMA out compare complete callback. - * @param arg: pointer to TIMER handle. - * @retval None - */ -void timer_dma_oc_cplt(void *arg) -{ - timer_handle_t *hperh = (timer_handle_t *)arg; - - if (hperh->delay_elapse_cbk) - hperh->delay_elapse_cbk(hperh); - - if (hperh->pwm_pulse_finish_cbk) - hperh->pwm_pulse_finish_cbk(hperh); - - hperh->ch = TIMER_ACTIVE_CHANNEL_CLEARED; - return; -} - -/** - * @brief TIMER DMA Capture complete callback. - * @param arg: pointer to TIMER handle. - * @retval None - */ -void timer_dma_capture_cplt(void *arg) -{ - timer_handle_t *hperh = (timer_handle_t *)arg; - - if (hperh->capture_cbk) - hperh->capture_cbk(hperh); - - hperh->ch = TIMER_ACTIVE_CHANNEL_CLEARED; - return; -} - -/** - * @brief TIMER DMA Period Elapse complete callback. - * @param arg: pointer to TIMER handle. - * @retval None - */ -void timer_dma_period_elapse_cplt(void *arg) -{ - timer_handle_t *hperh = (timer_handle_t *)arg; - - if (hperh->period_elapse_cbk) - hperh->period_elapse_cbk(hperh); - - hperh->state = TIMER_STATE_READY; - return; -} - -/** - * @brief TIMER DMA error callback - * @param arg: pointer to TIMER handle. - * @retval None - */ -void timer_dma_error(void *arg) -{ - timer_handle_t *hperh = (timer_handle_t *)arg; - - hperh->state = TIMER_STATE_READY; - if (hperh->error_cbk) - hperh->error_cbk(hperh); - - return; -} -#endif - -/** - * @brief Time Base configuration - * @param TIMERx: TIMER periheral - * @param init: TIMER Base configuration structure - * @retval None - */ -static void timer_base_set_config(TIMER_TypeDef *TIMERx, timer_base_init_t *init) -{ - assert_param(IS_TIMER_COUNTER_MODE(init->mode)); - assert_param(IS_TIMER_CLOCK_DIVISION(init->clk_div)); - - if (init->mode == TIMER_CNT_MODE_UP || init->mode == TIMER_CNT_MODE_DOWN) { - CLEAR_BIT(TIMERx->CON1, TIMER_CON1_CMSEL_MSK); - MODIFY_REG(TIMERx->CON1, TIMER_CON1_DIRSEL_MSK, init->mode << TIMER_CON1_DIRSEL_POS); - } - else { - MODIFY_REG(TIMERx->CON1, TIMER_CON1_CMSEL_MSK, (init->mode - 1) << TIMER_CON1_CMSEL_POSS); - } - - if (IS_TIMER_CLOCK_DIVISION_INSTANCE(TIMERx)) - MODIFY_REG(TIMERx->CON1, TIMER_CON1_DFCKSEL_MSK, init->clk_div << TIMER_CON1_DFCKSEL_POSS); - - WRITE_REG(TIMERx->AR, init->period); - WRITE_REG(TIMERx->PRES, init->prescaler); - - if (IS_TIMER_REPETITION_COUNTER_INSTANCE(TIMERx)) - WRITE_REG(TIMERx->REPAR, init->re_cnt); - - return; -} - -/** - * @brief Time Ouput Compare 1 configuration - * @param TIMERx: Select the TIMER peripheral - * @param oc_config: The ouput configuration structure - * @retval None - */ -static void timer_oc1_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC1EN_MSK); - CLEAR_BIT(TIMERx->CHMR1, TIMER_CHMR1_CH1OMOD_MSK); - CLEAR_BIT(TIMERx->CHMR1, TIMER_CHMR1_CC1SSEL_MSK); - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_CH1OMOD_MSK, oc_config->oc_mode << TIMER_CHMR1_CH1OMOD_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC1POL_MSK, oc_config->oc_polarity << TIMER_CCEP_CC1POL_POS); - - if (IS_TIMER_CCXN_INSTANCE(TIMERx, TIMER_CHANNEL_1)) { - assert_param(IS_TIMER_OCN_POLARITY(oc_config->ocn_polarity)); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC1NPOL_MSK, oc_config->ocn_polarity << TIMER_CCEP_CC1NPOL_POS); - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC1NEN_MSK); - } - - if (IS_TIMER_BREAK_INSTANCE(TIMERx)) { - assert_param(IS_TIMER_OCNIDLE_STATE(oc_config->ocn_idle)); - assert_param(IS_TIMER_OCIDLE_STATE(oc_config->oc_idle)); - - MODIFY_REG(TIMERx->CON2, TIMER_CON2_OISS1_MSK, oc_config->oc_idle << TIMER_CON2_OISS1_POS); - MODIFY_REG(TIMERx->CON2, TIMER_CON2_OISS1N_MSK, oc_config->ocn_idle << TIMER_CON2_OISS1N_POS); - } - - WRITE_REG(TIMERx->CCVAL1, oc_config->pulse); -} - -/** - * @brief Time Ouput Compare 2 configuration - * @param TIMERx: Select the TIMER peripheral - * @param oc_config: The ouput configuration structure - * @retval None - */ -static void timer_oc2_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC2EN_MSK); - CLEAR_BIT(TIMERx->CHMR1, TIMER_CHMR1_CH2OMOD_MSK); - CLEAR_BIT(TIMERx->CHMR1, TIMER_CHMR1_CC2SSEL_MSK); - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_CH2OMOD_MSK, oc_config->oc_mode << TIMER_CHMR1_CH2OMOD_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC2POL_MSK, oc_config->oc_polarity << TIMER_CCEP_CC2POL_POS); - - if (IS_TIMER_CCXN_INSTANCE(TIMERx, TIMER_CHANNEL_2)) { - assert_param(IS_TIMER_OCN_POLARITY(oc_config->ocn_polarity)); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC2NPOL_MSK, oc_config->ocn_polarity << TIMER_CCEP_CC2NPOL_POS); - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC2NEN_MSK); - } - - if (IS_TIMER_BREAK_INSTANCE(TIMERx)) { - assert_param(IS_TIMER_OCNIDLE_STATE(oc_config->ocn_idle)); - assert_param(IS_TIMER_OCIDLE_STATE(oc_config->oc_idle)); - - MODIFY_REG(TIMERx->CON2, TIMER_CON2_OISS2_MSK, oc_config->oc_idle << TIMER_CON2_OISS2_POS); - MODIFY_REG(TIMERx->CON2, TIMER_CON2_OISS2N_MSK, oc_config->ocn_idle << TIMER_CON2_OISS2N_POS); - } - - WRITE_REG(TIMERx->CCVAL2, oc_config->pulse); -} - -/** - * @brief Time Ouput Compare 3 configuration - * @param TIMERx: Select the TIMER peripheral - * @param oc_config: The ouput configuration structure - * @retval None - */ -static void timer_oc3_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC3EN_MSK); - CLEAR_BIT(TIMERx->CHMR2, TIMER_CHMR2_CH3OMOD_MSK); - CLEAR_BIT(TIMERx->CHMR2, TIMER_CHMR2_CC3SSEL_MSK); - MODIFY_REG(TIMERx->CHMR2, TIMER_CHMR2_CH3OMOD_MSK, oc_config->oc_mode << TIMER_CHMR2_CH3OMOD_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC3POL_MSK, oc_config->oc_polarity << TIMER_CCEP_CC3POL_POS); - - if (IS_TIMER_CCXN_INSTANCE(TIMERx, TIMER_CHANNEL_3)) { - assert_param(IS_TIMER_OCN_POLARITY(oc_config->ocn_polarity)); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC3NPOL_MSK, oc_config->ocn_polarity << TIMER_CCEP_CC3NPOL_POS); - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC3NEN_MSK); - } - - if (IS_TIMER_BREAK_INSTANCE(TIMERx)) { - assert_param(IS_TIMER_OCNIDLE_STATE(oc_config->ocn_idle)); - assert_param(IS_TIMER_OCIDLE_STATE(oc_config->oc_idle)); - - MODIFY_REG(TIMERx->CON2, TIMER_CON2_OISS3_MSK, oc_config->oc_idle << TIMER_CON2_OISS3_POS); - MODIFY_REG(TIMERx->CON2, TIMER_CON2_OISS3N_MSK, oc_config->ocn_idle << TIMER_CON2_OISS3N_POS); - } - - WRITE_REG(TIMERx->CCVAL3, oc_config->pulse); -} - -/** - * @brief Time Ouput Compare 4 configuration - * @param TIMERx: Select the TIMER peripheral - * @param oc_config: The ouput configuration structure - * @retval None - */ -static void timer_oc4_set_config(TIMER_TypeDef *TIMERx, timer_oc_init_t *oc_config) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC4EN_MSK); - CLEAR_BIT(TIMERx->CHMR2, TIMER_CHMR2_CH4OMOD_MSK); - CLEAR_BIT(TIMERx->CHMR2, TIMER_CHMR2_CC4SSEL_MSK); - MODIFY_REG(TIMERx->CHMR2, TIMER_CHMR2_CH4OMOD_MSK, oc_config->oc_mode << TIMER_CHMR2_CH4OMOD_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC4POL_MSK, oc_config->oc_polarity << TIMER_CCEP_CC4POL_POS); - - if (IS_TIMER_BREAK_INSTANCE(TIMERx)) { - assert_param(IS_TIMER_OCIDLE_STATE(oc_config->oc_idle)); - MODIFY_REG(TIMERx->CON2, TIMER_CON2_OISS4_MSK, oc_config->oc_idle << TIMER_CON2_OISS4_POS); - } - - WRITE_REG(TIMERx->CCVAL4, oc_config->pulse); -} - -/** - * @brief Enables or disables the TIMER Capture Compare Channel x. - * @param TIMERx: Select the TIMER peripheral - * @param ch: specifies the TIMER Channel - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 - * @arg TIMER_CHANNEL_2: TIMER Channel 2 - * @arg TIMER_CHANNEL_3: TIMER Channel 3 - * @arg TIMER_CHANNEL_4: TIMER Channel 4 - * @param state: specifies the TIMER Channel CCxE bit new state. - * @retval None - */ -static void timer_ccx_channel_cmd(TIMER_TypeDef* TIMERx, timer_channel_t ch, type_func_t state) -{ - assert_param(IS_TIMER_CC2_INSTANCE(TIMERx)); - assert_param(IS_TIMER_CHANNELS(ch)); - - switch (ch) { - case TIMER_CHANNEL_1: - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC1EN_MSK, state << TIMER_CCEP_CC1EN_POS); - break; - - case TIMER_CHANNEL_2: - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC2EN_MSK, state << TIMER_CCEP_CC2EN_POS); - break; - - case TIMER_CHANNEL_3: - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC3EN_MSK, state << TIMER_CCEP_CC3EN_POS); - break; - - case TIMER_CHANNEL_4: - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC4EN_MSK, state << TIMER_CCEP_CC4EN_POS); - break; - - default: - break; - } -} -/** - * @brief Enables or disables the TIMER Capture Compare Channel xN. - * @param TIMERx: Select the TIMER peripheral - * @param ch: specifies the TIMER Channel - * This parameter can be one of the following values: - * @arg TIMER_CHANNEL_1: TIMER Channel 1 - * @arg TIMER_CHANNEL_2: TIMER Channel 2 - * @arg TIMER_CHANNEL_3: TIMER Channel 3 - * @param state: specifies the TIMER Channel CCxNE bit new state. - * @retval None - */ -static void timer_ccxn_channel_cmd(TIMER_TypeDef* TIMERx, timer_channel_t ch, type_func_t state) -{ - switch (ch) { - case TIMER_CHANNEL_1: - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC1NEN_MSK, state << TIMER_CCEP_CC1NEN_POS); - break; - - case TIMER_CHANNEL_2: - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC2NEN_MSK, state << TIMER_CCEP_CC2NEN_POS); - break; - - case TIMER_CHANNEL_3: - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC3NEN_MSK, state << TIMER_CCEP_CC3NEN_POS); - break; - - default: - break; - } - -} - -/** - * @brief Configure the TI1 as Input. - * @param TIMERx: Select the TIMER peripheral. - * @param polarity: The Input Polarity. - * @param sel: specifies the input to be used. - * @param filter: Specifies the Input Capture Filter. - * This parameter must be a value between 0x00 and 0x0F. - * @retval None - */ -static void timer_ti1_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC1EN_MSK); - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_CC1SSEL_MSK, sel << TIMER_CHMR1_CC1SSEL_POSS); - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_I1FLT_MSK, filter << TIMER_CHMR1_I1FLT_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC1POL_MSK, polarity << TIMER_CCEP_CC1POL_POS); - - return; -} - -/** - * @brief Configure the Polarity and Filter for TI1. - * @param TIMERx: Select the TIMER peripheral. - * @param polarity: The Input Polarity. - * @param filter: Specifies the Input Capture Filter. - * This parameter must be a value between 0x00 and 0x0F. - * @retval None - */ -static void timer_ti1_set_config_stage(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, uint32_t filter) -{ - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_I1FLT_MSK, filter << TIMER_CHMR1_I1FLT_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC1POL_MSK, polarity << TIMER_CCEP_CC1POL_POS); - - - return; -} - -/** - * @brief Configure the TI2 as Input. - * @param TIMERx: Select the TIMER peripheral. - * @param polarity: The Input Polarity. - * @param sel: specifies the input to be used. - * @param filter: Specifies the Input Capture Filter. - * This parameter must be a value between 0x00 and 0x0F. - * @retval None - */ -static void timer_ti2_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC2EN_MSK); - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_CC2SSEL_MSK, sel << TIMER_CHMR1_CC2SSEL_POSS); - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_I2FLT_MSK, filter << TIMER_CHMR1_I2FLT_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC2POL_MSK, polarity << TIMER_CCEP_CC2POL_POS); - - - return; -} - -/** - * @brief Configure the Polarity and Filter for TI2. - * @param TIMERx: Select the TIMER peripheral. - * @param polarity: The Input Polarity. - * @param filter: Specifies the Input Capture Filter. - * This parameter must be a value between 0x00 and 0x0F. - * @retval None - */ -static void timer_ti2_set_config_stage(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, uint32_t filter) -{ - MODIFY_REG(TIMERx->CHMR1, TIMER_CHMR1_I2FLT_MSK, filter << TIMER_CHMR1_I2FLT_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC2POL_MSK, polarity << TIMER_CCEP_CC2POL_POS); - return; -} - -/** - * @brief Configure the TI3 as Input. - * @param TIMERx: Select the TIMER peripheral. - * @param polarity: The Input Polarity. - * @param sel: specifies the input to be used. - * @param filter: Specifies the Input Capture Filter. - * This parameter must be a value between 0x00 and 0x0F. - * @retval None - */ -static void timer_ti3_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC3EN_MSK); - MODIFY_REG(TIMERx->CHMR2, TIMER_CHMR2_CC3SSEL_MSK, sel << TIMER_CHMR2_CC3SSEL_POSS); - MODIFY_REG(TIMERx->CHMR2, TIMER_CHMR2_I3FLT_MSK, filter << TIMER_CHMR2_I3FLT_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC3POL_MSK, polarity << TIMER_CCEP_CC3POL_POS); - - return; -} - -/** - * @brief Configure the TI4 as Input. - * @param TIMERx: Select the TIMER peripheral. - * @param polarity: The Input Polarity. - * @param sel: specifies the input to be used. - * @param filter: Specifies the Input Capture Filter. - * This parameter must be a value between 0x00 and 0x0F. - * @retval None - */ -static void timer_ti4_set_config(TIMER_TypeDef *TIMERx, timer_ic_polarity_t polarity, - timer_ic_select_t sel, uint32_t filter) -{ - CLEAR_BIT(TIMERx->CCEP, TIMER_CCEP_CC4EN_MSK); - MODIFY_REG(TIMERx->CHMR2, TIMER_CHMR2_CC4SSEL_MSK, sel << TIMER_CHMR2_CC4SSEL_POSS); - MODIFY_REG(TIMERx->CHMR2, TIMER_CHMR2_I4FLT_MSK, filter << TIMER_CHMR2_I4FLT_POSS); - MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC4POL_MSK, polarity << TIMER_CCEP_CC4POL_POS); - return; -} - -/** - * @brief Configures the TIMERx External Trigger (ETR). - * @param TIMERx: Select the TIMER peripheral - * @param psc: The external Trigger Prescaler. - * @param polarity: The external Trigger Polarity. - * @param filter: External Trigger Filter. - * This parameter must be a value between 0x00 and 0x0F - * @retval None - */ -static void timer_etr_set_config(TIMER_TypeDef* TIMERx, timer_etr_psc_t psc, timer_clock_polarity_t polarity, uint32_t filter) -{ - MODIFY_REG(TIMERx->SMCON, TIMER_SMCON_ETFLT_MSK, filter << TIMER_SMCON_ETFLT_POSS); - MODIFY_REG(TIMERx->SMCON, TIMER_SMCON_ETPSEL_MSK, psc << TIMER_SMCON_ETPSEL_POSS); - CLEAR_BIT(TIMERx->SMCON, TIMER_SMCON_ECM2EN_MSK); - MODIFY_REG(TIMERx->SMCON, TIMER_SMCON_ETPOL_MSK, polarity << TIMER_SMCON_ETPOL_POS); - return; -} - -/** - * @brief Time Slave configuration - * @param hperh: pointer to a timer_handle_t structure that contains - * the configuration information for TIMER module. - * @param config: The slave configuration structure - * @retval None - */ -static void timer_slave_set_config(timer_handle_t *hperh, timer_slave_config_t *config) -{ - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_TSSEL_MSK, config->input << TIMER_SMCON_TSSEL_POSS); - MODIFY_REG(hperh->perh->SMCON, TIMER_SMCON_SMODS_MSK, config->mode << TIMER_SMCON_SMODS_POSS); - - switch (config->input) { - case TIMER_TS_ETRF: - timer_etr_set_config(hperh->perh, config->psc, config->polarity, config->filter); - break; - - case TIMER_TS_TI1F_ED: - CLEAR_BIT(hperh->perh->CCEP, TIMER_CCEP_CC1EN_MSK); - MODIFY_REG(hperh->perh->CHMR1, TIMER_CHMR1_I1FLT_MSK, config->filter << TIMER_CHMR1_I1FLT_POSS); - break; - - case TIMER_TS_TI1FP1: - timer_ti1_set_config_stage(hperh->perh, (timer_ic_polarity_t)config->polarity, config->filter); - break; - - case TIMER_TS_TI2FP2: - timer_ti2_set_config_stage(hperh->perh, (timer_ic_polarity_t)config->polarity, config->filter); - break; - - default: - break; - } -} - -#ifdef ALD_DMA - -/** - * @brief Timer DMA msel signal configuration - * @param hperh: pointer to a timer_handle_t structure that contains - * the configuration information for TIMER module. - * @param config: DMA configuration structure - * @retval None - */ -static void timer_dma_msel(TIMER_TypeDef *hperh, dma_config_t *config) -{ - #if defined (ES32F065x) - if (hperh == AD16C4T0) - config->msel = DMA_MSEL_TIMER0; - if (hperh == GP16C4T0) - config->msel = DMA_MSEL_TIMER6; - #elif defined (ES32F033x) || defined (ES32F093x) - if (hperh == GP16C4T0) - config->msel = DMA_MSEL_TIMER0; - if (hperh == GP16C4T1) - config->msel = DMA_MSEL_TIMER6; - #endif - - if (hperh == GP16C2T0) - config->msel = DMA_MSEL_TIMER2; - if (hperh == GP16C2T1) - config->msel = DMA_MSEL_TIMER3; - if (hperh == BS16T0) - config->msel = DMA_MSEL_TIMER1; - if (hperh == BS16T1) - config->msel = DMA_MSEL_TIMER4; - if (hperh == BS16T2) - config->msel = DMA_MSEL_TIMER5; - if (hperh == BS16T3) - config->msel = DMA_MSEL_TIMER7; -} - -#endif - -/** - * @} - */ -#endif /* ALD_TIMER */ -/** - * @} - */ -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_trng.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_trng.c deleted file mode 100644 index 8e4d13a4d0..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_trng.c +++ /dev/null @@ -1,309 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_trng.c - * @brief TRNG module driver. - * - * @version V1.0 - * @date 04 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_trng.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup TRNG TRNG - * @brief TRNG module driver - * @{ - */ -#ifdef ALD_TRNG - -/** @addtogroup CRYPT_Private_Functions CRYPT Private Functions - * @{ - */ -void trng_reset(trng_handle_t *hperh); -/** - * @} - */ - -/** @defgroup TRNG_Public_Functions TRNG Public Functions - * @{ - */ - -/** @addtogroup TRNG_Public_Functions_Group1 Initialization functions - * @brief Initialization functions - * - * @verbatim - ============================================================================== - ##### Initialization functions ##### - ============================================================================== - [..] This section provides functions allowing to initialize the TRNG: - (+) This parameters can be configured: - (++) Word Width - (++) Seed Type - (++) Seed - (++) Start Time - (++) Adjust parameter - - @endverbatim - * @{ - */ - - -/** - * @brief Initializes the TRNG according to the specified - * parameters in the trng_init_t. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_trng_init(trng_handle_t *hperh) -{ - uint32_t tmp = 0; - - if (hperh == NULL) - return ERROR; - - assert_param(IS_TRNG_DATA_WIDTH(hperh->init.data_width)); - assert_param(IS_TRNG_SEED_TYPE(hperh->init.seed_type)); - assert_param(IS_TRNG_ADJC(hperh->init.adjc)); - assert_param(IS_FUNC_STATE(hperh->init.posten)); - assert_param(IS_TRNG_T_START(hperh->init.t_start)); - - __LOCK(hperh); - trng_reset(hperh); - - if (hperh->state == TRNG_STATE_RESET) - __UNLOCK(hperh); - - tmp = TRNG->CR; - - if (hperh->init.adjc == 0) - tmp = (0 << TRNG_CR_ADJM_POS); - else - tmp = (1 << TRNG_CR_ADJM_POS); - - tmp |= ((1 << TRNG_CR_TRNGSEL_POS) | (hperh->init.data_width << TRNG_CR_DSEL_POSS) | - (hperh->init.seed_type << TRNG_CR_SDSEL_POSS) | (hperh->init.adjc << TRNG_CR_ADJC_POSS) | - (hperh->init.posten << TRNG_CR_POSTEN_MSK)); - - TRNG->CR = tmp; - - WRITE_REG(TRNG->SEED, hperh->init.seed); - MODIFY_REG(TRNG->CFGR, TRNG_CFGR_TSTART_MSK, (hperh->init.t_start) << TRNG_CFGR_TSTART_POSS); - - hperh->state = TRNG_STATE_READY; - __UNLOCK(hperh); - return OK; -} -/** - * @} - */ - -/** @addtogroup TRNG_Public_Functions_Group2 Peripheral Control functions - * @brief Peripheral Control functions - * - * @verbatim - ============================================================================== - ##### Peripheral Control functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) ald_trng_get_result() API can Get the result. - (+) ald_trng_interrupt_config() API can be helpful to configure TRNG interrupt source. - (+) ald_trng_get_it_status() API can get the status of interrupt source. - (+) ald_trng_get_status() API can get the status of SR register. - (+) ald_trng_get_flag_status() API can get the status of interrupt flag. - (+) ald_trng_clear_flag_status() API can clear interrupt flag. - - @endverbatim - * @{ - */ - -/** - * @brief Get the result. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @retval The resultl - */ -uint32_t ald_trng_get_result(trng_handle_t *hperh) -{ - hperh->state = TRNG_STATE_READY; - hperh->data = hperh->perh->DR; - return (uint32_t)hperh->perh->DR; -} - -/** - * @brief Enable/disable the specified interrupts. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @param it: Specifies the interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref trng_it_t. - * @param state: New state of the specified interrupts. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_trng_interrupt_config(trng_handle_t *hperh, trng_it_t it, type_func_t state) -{ - assert_param(IS_TRNG_IT(it)); - assert_param(IS_FUNC_STATE(state)); - - if (state) - SET_BIT(hperh->perh->IER, it); - else - CLEAR_BIT(hperh->perh->IER, it); - - return; -} - -/** - * @brief Get the status of SR register. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @param status: Specifies the TRNG status type. - * This parameter can be one of the @ref trng_status_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_trng_get_status(trng_handle_t *hperh, trng_status_t status) -{ - assert_param(IS_TRNG_STATUS(status)); - - if (READ_BIT(hperh->perh->SR, status)) - return SET; - - return RESET; -} - -/** - * @brief Get the status of interrupt source. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @param it: Specifies the interrupt source. - * This parameter can be one of the @ref trng_it_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -it_status_t ald_trng_get_it_status(trng_handle_t *hperh, trng_it_t it) -{ - assert_param(IS_TRNG_IT(it)); - - if (READ_BIT(hperh->perh->IER, it)) - return SET; - - return RESET; -} - -/** - * @brief Get the status of interrupt flag. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @param flag: Specifies the interrupt flag. - * This parameter can be one of the @ref trng_flag_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_trng_get_flag_status(trng_handle_t *hperh, trng_flag_t flag) -{ - assert_param(IS_TRNG_FLAG(flag)); - - if (READ_BIT(hperh->perh->IFR, flag)) - return SET; - - return RESET; -} - -/** - * @brief Clear the interrupt flag. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @param flag: Specifies the interrupt flag. - * This parameter can be one of the @ref trng_flag_t. - * @retval None - */ -void ald_trng_clear_flag_status(trng_handle_t *hperh, trng_flag_t flag) -{ - assert_param(IS_TRNG_FLAG(flag)); - WRITE_REG(hperh->perh->IFCR, flag); - - return; -} - -/** - * @brief Reset the TRNG peripheral. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @retval None - */ -void trng_reset(trng_handle_t *hperh) -{ - TRNG->CR = 0; - TRNG->SEED = 0; - TRNG->CFGR = 0x1FF0707; - TRNG->IER = 0; - TRNG->IFCR = 0xFFFFFFFF; - - hperh->state = TRNG_STATE_READY; - __UNLOCK(hperh); - return; -} - -/** - * @brief This function handles TRNG interrupt request. - * @param hperh: Pointer to a trng_handle_t structure that contains - * the configuration information for the specified TRNG module. - * @retval None - */ -void ald_trng_irq_handler(trng_handle_t *hperh) -{ - if (ald_trng_get_flag_status(hperh, TRNG_IF_SERR) == SET) { - hperh->state = TRNG_STATE_ERROR; - ald_trng_clear_flag_status(hperh, TRNG_IF_SERR); - if (hperh->err_cplt_cbk) - hperh->err_cplt_cbk(hperh); - return; - } - - if (ald_trng_get_flag_status(hperh, TRNG_IF_DAVLD) == SET) { - hperh->data = hperh->perh->DR; - hperh->state = TRNG_STATE_READY; - ald_trng_clear_flag_status(hperh, TRNG_IF_DAVLD); - if (hperh->trng_cplt_cbk) - hperh->trng_cplt_cbk(hperh); - } - - if (ald_trng_get_flag_status(hperh, TRNG_IF_START) == SET) { - hperh->state = TRNG_STATE_BUSY; - ald_trng_clear_flag_status(hperh, TRNG_IF_START); - if (hperh->init_cplt_cbk) - hperh->init_cplt_cbk(hperh); - } -} - -/** - * @} - */ -/** - * @} - */ -#endif /* ALD_TRNG */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_tsense.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_tsense.c deleted file mode 100644 index 5fcd8311f1..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_tsense.c +++ /dev/null @@ -1,253 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_tsense.c - * @brief TSENSE module driver. - * - * @version V1.0 - * @date 15 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include "ald_tsense.h" -#include "ald_bkpc.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup TSENSE TSENSE - * @brief TSENSE module driver - * @{ - */ -#ifdef ALD_TSENSE - - -/** @defgroup TSENSE_Private_Variables TSENSE Private Variables - * @{ - */ -tsense_cbk __tsense_cbk; -/** - * @} - */ - -/** @defgroup TSENSE_Public_Functions TSENSE Public Functions - * @{ - */ - -/** @addtogroup TSENSE_Public_Functions_Group1 Initialization functions - * @brief Initialization functions - * - * @verbatim - ============================================================================== - ##### Initialization functions ##### - ============================================================================== - [..] This section provides functions allowing to initialize the TSENSE: - (+) This parameters can be configured: - (++) Update Cycle - (++) Output Mode - (++) Perscaler - (+) Select TSENSE source clock(default LOSC) - - @endverbatim - * @{ - */ - -/** - * @brief Initializes the TSENSE according to the specified - * @retval None - */ -void ald_tsense_init(void) -{ - uint16_t tempt, temptinv; - uint32_t tscic, tscicinv; - - TSENSE_UNLOCK(); - TSENSE->CR = 0; - - MODIFY_REG(TSENSE->CR, TSENSE_CR_CTN_MSK, 0x1 << TSENSE_CR_CTN_POS); - MODIFY_REG(TSENSE->CR, TSENSE_CR_TSU_MSK, 0x4 << TSENSE_CR_TSU_POSS); - MODIFY_REG(TSENSE->CR, TSENSE_CR_TOM_MSK, 0x3 << TSENSE_CR_TOM_POSS); - MODIFY_REG(TSENSE->PSR, TSENSE_PSR_PRS_MSK, 0x1 << TSENSE_PSR_PRS_POSS); - - TSENSE->HTGR = 0x88F18; - TSENSE->LTGR = 0x85C39; - tempt = *(volatile uint16_t *)0x40348; - temptinv = *(volatile uint16_t *)0x4034A; - tscic = *(volatile uint32_t *)0x40350; - tscicinv = *(volatile uint32_t *)0x40358; - - if ((tempt == (uint16_t)(~temptinv)) && (tscic == (~tscicinv))) { - TSENSE->TBDR = tempt; - TSENSE->TCALBDR = (tscic & 0x1FFFFFF) >> 6; - } - else { - TSENSE->TBDR = 0x1E00; - TSENSE->TCALBDR = 0x1FE70; - } - - TSENSE_LOCK(); - return; -} - -/** - * @brief Configure the TSENSE source. - * @param sel: TSENSE source type. - * @retval None - */ -void ald_tsense_source_select(tsense_source_sel_t sel) -{ - assert_param(IS_TSENSE_SOURCE_SEL(sel)); - - BKPC_UNLOCK(); - MODIFY_REG(BKPC->PCCR, BKPC_PCCR_TSENSECS_MSK, sel << BKPC_PCCR_TSENSECS_POSS); - - if (sel == TSENSE_SOURCE_LOSC) { - SET_BIT(BKPC->CR, BKPC_CR_LOSCEN_MSK); - } - else if (sel == TSENSE_SOURCE_LRC) { - SET_BIT(BKPC->CR, BKPC_CR_LRCEN_MSK); - } - else { - ; /* do nothing */ - } - - BKPC_LOCK(); - return; -} -/** - * @} - */ - -/** @addtogroup TSENSE_Public_Functions_Group2 Peripheral Control functions - * @brief Peripheral Control functions - * - * @verbatim - ============================================================================== - ##### Peripheral Control functions ##### - ============================================================================== - [..] This section provides functions allowing to: - (+) ald_tsense_get_value() API can get the current temperature. - (+) ald_tsense_get_value_by_it() API can get the current temperature by interrupt. - (+) ald_tsense_irq_handler() API can handle the interrupt request. - - @endverbatim - * @{ - */ - -/** - * @brief Get the current temperature - * @param tsense: The value of current temperature. - * @retval ALD status: - * @arg @ref OK The value is valid - * @arg @ref ERROR The value is invalid - */ -ald_status_t ald_tsense_get_value(uint16_t *tsense) -{ - uint32_t tmp = 0; - - TSENSE_UNLOCK(); - SET_BIT(TSENSE->IFCR, TSENSE_IFCR_TSENSE_MSK); - SET_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - - while ((!(READ_BIT(TSENSE->IF, TSENSE_IF_TSENSE_MSK))) && (tmp++ < 1000000)); - - if (tmp >= 1000000) { - TSENSE_UNLOCK(); - CLEAR_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - return TIMEOUT; - } - - TSENSE_UNLOCK(); - SET_BIT(TSENSE->IFCR, TSENSE_IFCR_TSENSE_MSK); - TSENSE_LOCK(); - - if (READ_BIT(TSENSE->DR, TSENSE_DR_ERR_MSK)) { - TSENSE_UNLOCK(); - CLEAR_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - return ERROR; - } - - *tsense = READ_BITS(TSENSE->DR, TSENSE_DR_DATA_MSK, TSENSE_DR_DATA_POSS); - - TSENSE_UNLOCK(); - CLEAR_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - - return OK; -} - -/** - * @brief Get the current temperature by interrupt - * @param cbk: The callback function - * @retval None - */ -void ald_tsense_get_value_by_it(tsense_cbk cbk) -{ - __tsense_cbk = cbk; - - TSENSE_UNLOCK(); - SET_BIT(TSENSE->IFCR, TSENSE_IFCR_TSENSE_MSK); - SET_BIT(TSENSE->IE, TSENSE_IE_TSENSE_MSK); - SET_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - - return; -} - -/** - * @brief This function handles TSENSE interrupt request. - * @retval None - */ -void ald_tsense_irq_handler(void) -{ - TSENSE_UNLOCK(); - SET_BIT(TSENSE->IFCR, TSENSE_IFCR_TSENSE_MSK); - TSENSE_LOCK(); - - if (__tsense_cbk == NULL) { - TSENSE_UNLOCK(); - CLEAR_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - return; - } - - if (READ_BIT(TSENSE->DR, TSENSE_DR_ERR_MSK)) { - TSENSE_UNLOCK(); - CLEAR_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - __tsense_cbk(0, ERROR); - return; - } - - __tsense_cbk(READ_BITS(TSENSE->DR, TSENSE_DR_DATA_MSK, TSENSE_DR_DATA_POSS), OK); - - TSENSE_UNLOCK(); - SET_BIT(TSENSE->IFCR, TSENSE_IFCR_TSENSE_MSK); - CLEAR_BIT(TSENSE->CR, TSENSE_CR_EN_MSK); - TSENSE_LOCK(); - return; -} -/** - * @} - */ -/** - * @} - */ -#endif /* ALD_TSENSE */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_uart.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_uart.c deleted file mode 100644 index ee4bd1bbd2..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_uart.c +++ /dev/null @@ -1,1178 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_uart.c - * @brief UART module driver. - * This file provides firmware functions to manage the following - * functionalities of the Universal Asynchronous Receiver Transmitter (UART) peripheral: - * + Initialization and Configuration functions - * + IO operation functions - * + Peripheral Control functions - * + Peripheral State and Errors functions - * - * @version V1.0 - * @date 21 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - The UART driver can be used as follows: - - (#) Declare a uart_handle_t handle structure. - - (#) Initialize the UART low level resources: - (##) Enable the UARTx interface clock. - (##) UART pins configuration: - (+++) Enable the clock for the UART GPIOs. - (+++) Configure the UART pins (TX as alternate function pull-up, RX as alternate function Input). - (##) NVIC configuration if you need to use interrupt process (ald_uart_send_by_it() - and ald_uart_recv_by_it() APIs): - (+++) Configure the uart interrupt priority. - (+++) Enable the NVIC UART IRQ handle. - (##) DMA Configuration if you need to use DMA process (ald_uart_send_by_dma() - and ald_uart_recv_by_dma() APIs): - (+++) Select the DMA Tx/Rx channel. - (+++) Associate the initialized DMA handle to the UART DMA Tx/Rx handle. - - (#) Program the Baud Rate, Word Length, Stop Bit, Parity, Hardware - flow control and Mode(Receiver/Transmitter) in the hperh Init structure. - - (#) Initialize the UART registers by calling the ald_uart_init() API. - - [..] - Three operation modes are available within this driver: - - *** Polling mode IO operation *** - ================================= - [..] - (+) Send an amount of data in blocking mode using ald_uart_send() - (+) Receive an amount of data in blocking mode using ald_uart_recv() - - *** Interrupt mode IO operation *** - =================================== - [..] - (+) Send an amount of data in non blocking mode using ald_uart_send_by_it() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode using ald_uart_recv_by_it() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - - *** DMA mode IO operation *** - ============================== - [..] - (+) Send an amount of data in non blocking mode (DMA) using ald_uart_send_by_dma() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode (DMA) using ald_uart_recv_by_dma() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - (+) Pause the DMA Transfer using ald_uart_dma_pause() - (+) Resume the DMA Transfer using ald_uart_dma_resume() - (+) Stop the DMA Transfer using ald_uart_dma_stop() - - @endverbatim - ****************************************************************************** - */ - -#include "ald_uart.h" -#include "ald_cmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup UART UART - * @brief UART module driver - * @{ - */ -#ifdef ALD_UART - -/** @defgroup UART_Private_Functions UART Private Functions - * @brief UART Private functions - * @{ - */ -#ifdef ALD_DMA -/** - * @brief DMA uart transmit process complete callback. - * @param arg: Pointer to a uart_handle_t structure. - * @retval None - */ -static void uart_dma_send_cplt(void *arg) -{ - uart_handle_t *hperh = (uart_handle_t *)arg; - - if (hperh->state == UART_STATE_BUSY_TX) - ald_uart_dma_req_config(hperh, DISABLE); - - hperh->tx_count = 0; - ald_uart_interrupt_config(hperh, UART_IT_TC, ENABLE); - return; -} - -/** - * @brief DMA uart receive process complete callback. - * @param arg: Pointer to a uart_handle_t structure. - * @retval None - */ -static void uart_dma_recv_cplt(void *arg) -{ - uart_handle_t *hperh = (uart_handle_t *)arg; - - if (hperh->state == UART_STATE_BUSY_RX) - ald_uart_dma_req_config(hperh, DISABLE); - - hperh->rx_count = 0; - CLEAR_BIT(hperh->state, UART_STATE_RX_MASK); - - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); - - return; -} - -/** - * @brief DMA uart communication error callback. - * @param arg: Pointer to a uart_handle_t structure. - * @retval None - */ -static void uart_dma_error(void *arg) -{ - uart_handle_t *hperh = (uart_handle_t *)arg; - - hperh->rx_count = 0; - hperh->tx_count = 0; - hperh->state = UART_STATE_READY; - hperh->err_code |= UART_ERROR_DMA; - ald_uart_dma_req_config(hperh, DISABLE); - - if (hperh->error_cbk) - hperh->error_cbk(hperh); - - return; -} -#endif - -/** - * @brief This function handles uart Communication Timeout. - * @param hperh: Pointer to a uart_handle_t structure. - * @param flag: specifies the uart flag to check. - * @param status: The new Flag status (SET or RESET). - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t uart_wait_flag(uart_handle_t *hperh, uart_status_t flag, flag_status_t status, uint32_t timeout) -{ - uint32_t tick; - - if (timeout == 0) - return ERROR; - - tick = ald_get_tick(); - - /* Waiting for flag */ - while ((ald_uart_get_status(hperh, flag)) != status) { - if (((ald_get_tick()) - tick) > timeout) - return TIMEOUT; - } - - return OK; -} - -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a uart_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __uart_send_by_it(uart_handle_t *hperh) -{ - if ((hperh->state & UART_STATE_TX_MASK) == 0x0) - return BUSY; - - WRITE_REG(hperh->perh->TBR, (uint8_t)(*hperh->tx_buf++ & 0x00FF)); - - if (--hperh->tx_count == 0) { - ald_uart_clear_flag_status(hperh, UART_IF_TC); - ald_uart_interrupt_config(hperh, UART_IT_TXS, DISABLE); - ald_uart_interrupt_config(hperh, UART_IT_TC, ENABLE); - } - - return OK; -} - -/** - * @brief Wraps up transmission in non blocking mode. - * @param hperh: pointer to a uart_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __uart_end_send_by_it(uart_handle_t *hperh) -{ - if (!(READ_BIT(hperh->perh->SR, UART_SR_TEM_MSK))) - return OK; - - ald_uart_interrupt_config(hperh, UART_IT_TC, DISABLE); - CLEAR_BIT(hperh->state, UART_STATE_TX_MASK); - if (hperh->tx_cplt_cbk) - hperh->tx_cplt_cbk(hperh); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode - * @param hperh: Pointer to a uart_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __uart_recv_by_it(uart_handle_t *hperh) -{ - if ((hperh->state & UART_STATE_RX_MASK) == 0x0) - return BUSY; - - *hperh->rx_buf++ = (uint8_t)(hperh->perh->RBR & 0xFF); - - if (--hperh->rx_count == 0) { - ald_uart_interrupt_config(hperh, UART_IT_RXRD, DISABLE); - CLEAR_BIT(hperh->state, UART_STATE_RX_MASK); - - if (hperh->rx_cplt_cbk) - hperh->rx_cplt_cbk(hperh); - } - - return OK; -} -/** - * @} - */ - -/** @defgroup UART_Public_Functions UART Public Functions - * @{ - */ - -/** @defgroup UART_Public_Functions_Group1 Initialization and Configuration functions - * @brief Initialization and Configuration functions - * - * @verbatim -=============================================================================== - ##### Initialization and Configuration functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to initialize the UARTx - and configure UARTx param. - (+) For the UARTx only these parameters can be configured: - (++) Baud Rate - (++) Word Length - (++) Stop Bit - (++) Parity - (++) Hardware flow control - (+) For RS485 mode, user also need configure some parameters by - ald_uart_rs485_config(): - (++) Enable/disable normal point mode - (++) Enable/disable auto-direction - (++) Enable/disable address detection invert - (++) Enable/disable address for compare - - @endverbatim - * @{ - */ - -/** - * @brief Reset UART peripheral - * @param hperh: Pointer to a uart_handle_t structure that contains - * the configuration information for the specified uart module. - * @retval None - */ -void ald_uart_reset(uart_handle_t *hperh) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - WRITE_REG(hperh->perh->BRR, 0x0); - WRITE_REG(hperh->perh->LCR, 0x0); - WRITE_REG(hperh->perh->MCR, 0x0); - WRITE_REG(hperh->perh->CR, 0x0); - WRITE_REG(hperh->perh->RTOR, 0x0); - WRITE_REG(hperh->perh->FCR, 0x0); - WRITE_REG(hperh->perh->IDR, 0xFFF); - - hperh->err_code = UART_ERROR_NONE; - hperh->state = UART_STATE_RESET; - - __UNLOCK(hperh); - return; -} - -/** - * @brief Initializes the UARTx according to the specified - * parameters in the uart_handle_t. - * @param hperh: Pointer to a uart_handle_t structure that contains - * the configuration information for the specified UART module. - * @retval None - */ -void ald_uart_init(uart_handle_t *hperh) -{ - uint32_t tmp; - - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_BAUDRATE(hperh->init.baud)); - assert_param(IS_UART_WORD_LENGTH(hperh->init.word_length)); - assert_param(IS_UART_STOPBITS(hperh->init.stop_bits)); - assert_param(IS_UART_PARITY(hperh->init.parity)); - assert_param(IS_UART_MODE(hperh->init.mode)); - assert_param(IS_UART_HARDWARE_FLOW_CONTROL(hperh->init.fctl)); - - ald_uart_reset(hperh); - - tmp = READ_REG(hperh->perh->LCR); - MODIFY_REG(tmp, UART_LCR_DLS_MSK, hperh->init.word_length << UART_LCR_DLS_POSS); - MODIFY_REG(tmp, UART_LCR_STOP_MSK, hperh->init.stop_bits << UART_LCR_STOP_POS); - MODIFY_REG(tmp, UART_LCR_PEN_MSK, (hperh->init.parity == UART_PARITY_NONE ? 0 : 1) << UART_LCR_PEN_POS); - MODIFY_REG(tmp, UART_LCR_PS_MSK, (hperh->init.parity == UART_PARITY_EVEN ? 1 : 0) << UART_LCR_PS_POS); - WRITE_REG(hperh->perh->LCR, tmp); - MODIFY_REG(hperh->perh->MCR, UART_MCR_AFCEN_MSK, hperh->init.fctl << UART_MCR_AFCEN_POS); - SET_BIT(hperh->perh->LCR, UART_LCR_BRWEN_MSK); - WRITE_REG(hperh->perh->BRR, ald_cmu_get_pclk1_clock() / hperh->init.baud); - CLEAR_BIT(hperh->perh->LCR, UART_LCR_BRWEN_MSK); - SET_BIT(hperh->perh->FCR, UART_FCR_FIFOEN_MSK); - SET_BIT(hperh->perh->FCR, UART_FCR_RFRST_MSK); - SET_BIT(hperh->perh->FCR, UART_FCR_TFRST_MSK); - MODIFY_REG(hperh->perh->FCR, UART_FCR_RXTL_MSK, 0 << UART_FCR_RXTL_POSS); - MODIFY_REG(hperh->perh->FCR, UART_FCR_TXTL_MSK, 0 << UART_FCR_TXTL_POSS); - SET_BIT(hperh->perh->LCR, UART_LCR_RXEN_MSK); - - if (hperh->init.mode == UART_MODE_LIN) - SET_BIT(hperh->perh->MCR, UART_MCR_LINEN_MSK); - else if (hperh->init.mode == UART_MODE_IrDA) - SET_BIT(hperh->perh->MCR, UART_MCR_IREN_MSK); - else if (hperh->init.mode == UART_MODE_RS485) - SET_BIT(hperh->perh->MCR, UART_MCR_AADEN_MSK); - else if (hperh->init.mode == UART_MODE_HDSEL) - SET_BIT(hperh->perh->MCR, UART_MCR_HDSEL_MSK); - else - ;/* do nothing */ - - if (hperh->init.fctl) - SET_BIT(hperh->perh->MCR, UART_MCR_RTSCTRL_MSK); - if (hperh->init.mode == UART_MODE_IrDA) - SET_BIT(hperh->perh->LCR, UART_LCR_RXINV_MSK); - - hperh->state = UART_STATE_READY; - hperh->err_code = UART_ERROR_NONE; - return; -} - -/** - * @brief Configure the RS485 mode according to the specified - * parameters in the uart_rs485_config_t. - * @param hperh: Pointer to a uart_handle_t structure that contains - * the configuration information for the specified UART module. - * @param config: Specifies the RS485 parameters. - * @retval None - */ -void ald_uart_rs485_config(uart_handle_t *hperh, uart_rs485_config_t *config) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_FUNC_STATE(config->normal)); - assert_param(IS_FUNC_STATE(config->dir)); - assert_param(IS_FUNC_STATE(config->invert)); - - MODIFY_REG(hperh->perh->MCR, UART_MCR_AADNOR_MSK, config->normal << UART_MCR_AADNOR_POS); - MODIFY_REG(hperh->perh->MCR, UART_MCR_AADDIR_MSK, config->dir << UART_MCR_AADDIR_POS); - MODIFY_REG(hperh->perh->MCR, UART_MCR_AADINV_MSK, config->invert << UART_MCR_AADINV_POS); - MODIFY_REG(hperh->perh->CR, UART_CR_ADDR_MSK, config->addr << UART_CR_ADDR_POSS); - - return; -} -/** - * @} - */ - -/** @defgroup UART_Public_Functions_Group2 IO operation functions - * @brief UART Transmit and Receive functions - * @verbatim - ============================================================================== - # IO operation functions # - ============================================================================== - [..] - This subsection provides a set of functions allowing to manage the UART data transfers. - - (#) There are two modes of transfer: - (++) Blocking mode: The communication is performed in polling mode. - The Status of all data processing is returned by the same function - after finishing transfer. - (++) Non blocking mode: The communication is performed using Interrupts - or DMA, these APIs return the Status. - The end of the data processing will be indicated through the - dedicated UART IRQ when using Interrupt mode or the DMA IRQ when - using DMA mode. - The hperh->tx_cplt_cbk(), hperh->rx_cplt_cbk() user callbacks - will be executed respectively at the end of the transmit or receive process. - The hperh->error_cbk() user callback will be executed when - a communication error is detected. - - (#) Blocking mode APIs are: - (++) ald_uart_send() - (++) ald_uart_recv() - - (#) Non Blocking mode APIs with Interrupt are: - (++) ald_uart_send_by_it() - (++) ald_uart_recv_by_it() - (++) ald_uart_irq_handler() - - (#) Non Blocking mode functions with DMA are: - (++) ald_uart_send_by_dma() - (++) ald_uart_recv_by_dma() - (++) ald_uart_dma_pause() - (++) ald_uart_dma_resume() - (++) ald_uart_dma_stop() - - (#) A set of transfer complete callbacks are provided in non blocking mode: - (++) hperh->tx_cplt_cbk() - (++) hperh->rx_cplt_cbk() - (++) hperh->error_cbk() - - @endverbatim - * @{ - */ - -/** - * @brief Sends an amount of data in blocking mode. - * @param hperh: Pointer to a uart_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_send(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - hperh->err_code = UART_ERROR_NONE; - SET_BIT(hperh->state, UART_STATE_TX_MASK); - - hperh->tx_size = size; - hperh->tx_count = size; - - while (hperh->tx_count-- > 0) { - if (uart_wait_flag(hperh, UART_STATUS_TBEM, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = UART_STATE_READY; - return TIMEOUT; - } - - WRITE_REG(hperh->perh->TBR, (*buf++ & 0xFF)); - } - - if (uart_wait_flag(hperh, UART_STATUS_TEM, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = UART_STATE_READY; - return TIMEOUT; - } - - CLEAR_BIT(hperh->state, UART_STATE_TX_MASK); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Receives an amount of data in blocking mode. - * @param hperh: Pointer to a uart_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_recv(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->err_code = UART_ERROR_NONE; - SET_BIT(hperh->state, UART_STATE_RX_MASK); - - hperh->rx_size = size; - hperh->rx_count = size; - - while (hperh->rx_count-- > 0) { - if (uart_wait_flag(hperh, UART_STATUS_DR, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = UART_STATE_READY; - return TIMEOUT; - } - - *buf++ = (uint8_t)(hperh->perh->RBR & 0xFF); - } - - CLEAR_BIT(hperh->state, UART_STATE_RX_MASK); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a uart_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_send_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = UART_ERROR_NONE; - SET_BIT(hperh->state, UART_STATE_TX_MASK); - __UNLOCK(hperh); - - if (((ald_uart_get_status(hperh, UART_STATUS_TBEM)) == SET) - && ((ald_uart_get_flag_status(hperh, UART_IF_TXS)) == RESET)) { - WRITE_REG(hperh->perh->TBR, (*hperh->tx_buf++ & 0xFF)); - --hperh->tx_count; - } - - if (hperh->tx_count == 0) { - ald_uart_interrupt_config(hperh, UART_IT_TC, ENABLE); - return OK; - } - - ald_uart_interrupt_config(hperh, UART_IT_TXS, ENABLE); - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode - * @param hperh: Pointer to a uart_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_recv_by_it(uart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = UART_ERROR_NONE; - SET_BIT(hperh->state, UART_STATE_RX_MASK); - __UNLOCK(hperh); - - ald_uart_interrupt_config(hperh, UART_IT_RXRD, ENABLE); - return OK; -} -#ifdef ALD_DMA -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a uart_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as UART transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_send_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = UART_ERROR_NONE; - SET_BIT(hperh->state, UART_STATE_TX_MASK); - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - hperh->hdmatx.cplt_cbk = uart_dma_send_cplt; - hperh->hdmatx.cplt_arg = (void *)hperh; - hperh->hdmatx.err_cbk = uart_dma_error; - hperh->hdmatx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->TBR; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_UART_TXEMPTY; - hperh->hdmatx.config.burst = ENABLE; - hperh->hdmatx.config.channel = channel; - - if (hperh->init.mode == UART_MODE_RS485) { - hperh->hdmatx.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - if (hperh->perh == UART0) - hperh->hdmatx.config.msel = DMA_MSEL_UART0; - else if (hperh->perh == UART1) - hperh->hdmatx.config.msel = DMA_MSEL_UART1; - else if (hperh->perh == UART2) - hperh->hdmatx.config.msel = DMA_MSEL_UART2; - else if (hperh->perh == UART3) - hperh->hdmatx.config.msel = DMA_MSEL_UART3; - else - ; /* do nothing */ - - ald_dma_config_basic(&hperh->hdmatx); - - __UNLOCK(hperh); - ald_uart_clear_flag_status(hperh, UART_IF_TC); - ald_uart_dma_req_config(hperh, ENABLE); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode. - * @param hperh: Pointer to a uart_handle_t structure. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param channel: DMA channel as UART receive - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_recv_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->err_code = UART_ERROR_NONE; - SET_BIT(hperh->state, UART_STATE_RX_MASK); - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - hperh->hdmarx.cplt_cbk = uart_dma_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = uart_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->RBR; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_UART_RNR; - hperh->hdmarx.config.burst = ENABLE; - hperh->hdmarx.config.channel = channel; - - if (hperh->init.mode == UART_MODE_RS485) { - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - if (hperh->perh == UART0) - hperh->hdmarx.config.msel = DMA_MSEL_UART0; - else if (hperh->perh == UART1) - hperh->hdmarx.config.msel = DMA_MSEL_UART1; - else if (hperh->perh == UART2) - hperh->hdmarx.config.msel = DMA_MSEL_UART2; - else if (hperh->perh == UART3) - hperh->hdmarx.config.msel = DMA_MSEL_UART3; - else - ; - - ald_dma_config_basic(&hperh->hdmarx); - __UNLOCK(hperh); - ald_uart_dma_req_config(hperh, ENABLE); - - return OK; -} - -/** - * @brief Pauses the DMA Transfer. - * @param hperh: Pointer to a uart_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_dma_pause(uart_handle_t *hperh) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - ald_uart_dma_req_config(hperh, DISABLE); - return OK; -} - -/** - * @brief Resumes the DMA Transfer. - * @param hperh: Pointer to a uart_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_dma_resume(uart_handle_t *hperh) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - ald_uart_dma_req_config(hperh, ENABLE); - return OK; -} - -/** - * @brief Stops the DMA Transfer. - * @param hperh: Pointer to a uart_handle_t structure. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_uart_dma_stop(uart_handle_t *hperh) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - ald_uart_dma_req_config(hperh, DISABLE); - hperh->state = UART_STATE_READY; - return OK; -} -#endif - -/** - * @brief This function handles UART interrupt request. - * @param hperh: Pointer to a uart_handle_t structure. - * @retval None - */ -void ald_uart_irq_handler(uart_handle_t *hperh) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - /* Handle parity error */ - if ((ald_uart_get_status(hperh, UART_STATUS_PE)) != RESET) - hperh->err_code |= UART_ERROR_PE; - - /* Handle frame error */ - if ((ald_uart_get_status(hperh, UART_STATUS_FE)) != RESET) - hperh->err_code |= UART_ERROR_FE; - - /* Handle overflow error */ - if ((ald_uart_get_status(hperh, UART_STATUS_OE)) != RESET) - hperh->err_code |= UART_ERROR_ORE; - - /* Receive */ - if ((ald_uart_get_mask_flag_status(hperh, UART_IF_RXRD)) != RESET) { - __uart_recv_by_it(hperh); - ald_uart_clear_flag_status(hperh, UART_IF_RXRD); - } - - /* Transmit */ - if ((ald_uart_get_mask_flag_status(hperh, UART_IF_TXS)) != RESET) { - __uart_send_by_it(hperh); - ald_uart_clear_flag_status(hperh, UART_IF_TXS); - } - - /* End Transmit */ - if ((ald_uart_get_mask_flag_status(hperh, UART_IF_TC)) != RESET) { - __uart_end_send_by_it(hperh); - ald_uart_clear_flag_status(hperh, UART_IF_TC); - } - - /* Handle error state */ - if (hperh->err_code != UART_ERROR_NONE) { - hperh->state = UART_STATE_READY; - - if (hperh->error_cbk) - hperh->error_cbk(hperh); - } -} -/** - * @} - */ - -/** @defgroup UART_Public_Functions_Group3 Peripheral Control functions - * @brief UART control functions - * - * @verbatim - ============================================================================== - ##### Peripheral Control functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to control the UART: - (+) ald_uart_interrupt_config() API can be helpful to configure UART interrupt source. - (+) ald_uart_dma_req_config() API can be helpful to configure UART DMA request. - (+) ald_uart_tx_fifo_config() API can be helpful to configure UART TX FIFO paramters. - (+) ald_uart_rx_fifo_config() API can be helpful to configure UART RX FIFO paramters. - (+) ald_uart_lin_send_break() API can send a frame of break in LIN mode. - (+) ald_uart_lin_detect_break_len_config() API can be helpful to configure the length of break frame. - (+) ald_uart_auto_baud_config() API can be helpful to configure detection data mode. - (+) ald_uart_get_it_status() API can get the status of interrupt source. - (+) ald_uart_get_status() API can get the status of UART_SR register. - (+) ald_uart_get_flag_status() API can get the status of UART flag. - (+) ald_uart_get_mask_flag_status() API can get status os flag and interrupt source. - (+) ald_uart_clear_flag_status() API can clear UART flag. - - @endverbatim - * @{ - */ - -/** - * @brief Enable/disable the specified UART interrupts. - * @param hperh: Pointer to a uart_handle_t structure. - * @param it: Specifies the UART interrupt sources to be enabled or disabled. - * This parameter can be one of the @ref uart_it_t. - * @param state: New state of the specified UART interrupts. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_uart_interrupt_config(uart_handle_t *hperh, uart_it_t it, type_func_t state) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_IT(it)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - WRITE_REG(hperh->perh->IER, it); - else - WRITE_REG(hperh->perh->IDR, it); - - return; -} - -/** - * @brief Configure UART DMA request. - * @param hperh: Pointer to a uart_handle_t structure. - * @param state: New state of the specified DMA request. - * This parameter can be: - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_uart_dma_req_config(uart_handle_t *hperh, type_func_t state) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_FUNC_STATE(state)); - - if (state == ENABLE) - SET_BIT(hperh->perh->MCR, UART_MCR_DMAEN_MSK); - else - CLEAR_BIT(hperh->perh->MCR, UART_MCR_DMAEN_MSK); - - return; -} - -/** - * @brief Configure transmit fifo parameters. - * @param hperh: Pointer to a uart_handle_t structure. - * @param config: Transmit fifo trigger level. - * @retval None - */ -void ald_uart_tx_fifo_config(uart_handle_t *hperh, uart_txfifo_t config) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_TXFIFO_TYPE(config)); - - SET_BIT(hperh->perh->FCR, UART_FCR_TFRST_MSK); - MODIFY_REG(hperh->perh->FCR, UART_FCR_TXTL_MSK, config << UART_FCR_TXTL_POSS); - SET_BIT(hperh->perh->FCR, UART_FCR_FIFOEN_MSK); - - return; -} - -/** - * @brief Configure receive fifo parameters. - * @param hperh: Pointer to a uart_handle_t structure. - * @param config: Receive fifo trigger level. - * @retval None - */ -void ald_uart_rx_fifo_config(uart_handle_t *hperh, uart_rxfifo_t config) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_RXFIFO_TYPE(config)); - - SET_BIT(hperh->perh->FCR, UART_FCR_RFRST_MSK); - MODIFY_REG(hperh->perh->FCR, UART_FCR_RXTL_MSK, config << UART_FCR_RXTL_POSS); - SET_BIT(hperh->perh->FCR, UART_FCR_FIFOEN_MSK); - - return; -} - -/** - * @brief request to send a frame of break. - * @param hperh: Pointer to a uart_handle_t structure. - * @retval None - */ -void ald_uart_lin_send_break(uart_handle_t *hperh) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - SET_BIT(hperh->perh->MCR, UART_MCR_BKREQ_MSK); - return; -} - -/** - * @brief Configure the length of break frame to be detect. - * @param hperh: Pointer to a uart_handle_t structure. - * @param len: Length of break frame. - * @arg LIN_BREAK_LEN_10B - * @arg LIN_BREAK_LEN_11B - * @retval None - */ -void ald_uart_lin_detect_break_len_config(uart_handle_t *hperh, uart_lin_break_len_t len) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_LIN_BREAK_LEN(len)); - - MODIFY_REG(hperh->perh->MCR, UART_MCR_LINBDL_MSK, len << UART_MCR_LINBDL_POS); - return; -} - -/** - * @brief Configure the mode of auto-baud-rate detect. - * @param hperh: Pointer to a uart_handle_t structure. - * @param mode: The mode of auto-baud-rate detect. - * @arg UART_ABRMOD_1_TO_0 - * @arg UART_ABRMOD_1 - * @arg UART_ABRMOD_0_TO_1 - * @retval None - */ -void ald_uart_auto_baud_config(uart_handle_t *hperh, uart_auto_baud_mode_t mode) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_AUTO_BAUD_MODE(mode)); - - MODIFY_REG(hperh->perh->MCR, UART_MCR_ABRMOD_MSK, mode << UART_MCR_ABRMOD_POSS); - return; -} - -/** - * @brief Send address in RS485 mode. - * @param hperh: Pointer to a uart_handle_t structure that contains - * the configuration information for the specified UART module. - * @param addr: the address of RS485 device. - * @param timeout: Timeout duration - * @retval The ALD status. - */ -ald_status_t ald_uart_rs485_send_addr(uart_handle_t *hperh, uint16_t addr, uint32_t timeout) -{ - assert_param(IS_UART_ALL(hperh->perh)); - - if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_RX)) - return BUSY; - - SET_BIT(hperh->state, UART_STATE_TX_MASK); - - if (uart_wait_flag(hperh, UART_STATUS_TBEM, SET, timeout) != OK) { - hperh->state = UART_STATE_READY; - return TIMEOUT; - } - - WRITE_REG(hperh->perh->TBR, (addr | 0x100)); - - if (uart_wait_flag(hperh, UART_STATUS_TEM, SET, timeout) != OK) { - hperh->state = UART_STATE_READY; - return TIMEOUT; - } - - CLEAR_BIT(hperh->state, UART_STATE_TX_MASK); - - return OK; -} - -/** - * @brief Get the status of UART interrupt source. - * @param hperh: Pointer to a uart_handle_t structure. - * @param it: Specifies the UART interrupt source. - * This parameter can be one of the @ref uart_it_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -it_status_t ald_uart_get_it_status(uart_handle_t *hperh, uart_it_t it) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_IT(it)); - - if (READ_BIT(hperh->perh->IVS, it)) - return SET; - - return RESET; -} - -/** - * @brief Get the status of UART_SR register. - * @param hperh: Pointer to a uart_handle_t structure. - * @param status: Specifies the UART status type. - * This parameter can be one of the @ref uart_status_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_uart_get_status(uart_handle_t *hperh, uart_status_t status) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_STATUS(status)); - - if (READ_BIT(hperh->perh->SR, status)) - return SET; - - return RESET; -} - - -/** - * @brief Get the status of UART interrupt flag. - * @param hperh: Pointer to a uart_handle_t structure. - * @param flag: Specifies the UART interrupt flag. - * This parameter can be one of the @ref uart_flag_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_uart_get_flag_status(uart_handle_t *hperh, uart_flag_t flag) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_IF(flag)); - - if (READ_BIT(hperh->perh->RIF, flag)) - return SET; - - return RESET; -} - -/** - * @brief Get the status of interrupt flag and interupt source. - * @param hperh: Pointer to a uart_handle_t structure. - * @param flag: Specifies the UART interrupt flag. - * This parameter can be one of the @ref uart_flag_t. - * @retval Status: - * - 0: RESET - * - 1: SET - */ -flag_status_t ald_uart_get_mask_flag_status(uart_handle_t *hperh, uart_flag_t flag) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_IF(flag)); - - if (READ_BIT(hperh->perh->IFM, flag)) - return SET; - - return RESET; -} - -/** - * @brief Clear the UART interrupt flag. - * @param hperh: Pointer to a uart_handle_t structure. - * @param flag: Specifies the UART interrupt flag. - * This parameter can be one of the @ref uart_flag_t. - * @retval None - */ -void ald_uart_clear_flag_status(uart_handle_t *hperh, uart_flag_t flag) -{ - assert_param(IS_UART_ALL(hperh->perh)); - assert_param(IS_UART_IF(flag)); - - WRITE_REG(hperh->perh->ICR, flag); - return; -} -/** - * @} - */ - -/** @defgroup UART_Public_Functions_Group4 Peripheral State and Errors functions - * @brief UART State and Errors functions - * -@verbatim - ============================================================================== - ##### Peripheral State and Errors functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to return the State of - UART communication process, return Peripheral Errors occurred during communication - process - (+) ald_uart_get_state() API can be helpful to check in run-time the state of the UART peripheral. - (+) ald_uart_get_error() check in run-time errors that could be occurred during communication. - -@endverbatim - * @{ - */ - -/** - * @brief Returns the UART state. - * @param hperh: Pointer to a uart_handle_t structure. - * @retval ALD state - */ -uart_state_t ald_uart_get_state(uart_handle_t *hperh) -{ - return hperh->state; -} - -/** - * @brief Return the UART error code - * @param hperh: Pointer to a uart_handle_t structure. - * @retval UART Error Code - */ -uint32_t ald_uart_get_error(uart_handle_t *hperh) -{ - return hperh->err_code; -} - -/** - * @} - */ - -/** - * @} - */ -#endif /* ALD_UART */ - -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_usart.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_usart.c deleted file mode 100644 index 1e9ed5c501..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_usart.c +++ /dev/null @@ -1,2326 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_usart.c - * @brief USART module driver. - * This file provides firmware functions to manage the following - * functionalities of the Universal Synchronous Asynchronous Receiver Transmitter (USART) peripheral: - * + Initialization functions - * + IO operation functions - * + Peripheral Control functions - * + Peripheral State and Errors functions - * - * @version V1.0 - * @date 25 Apr 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - * @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - The USART ALD driver can be used as follows: - - (#) Declare a usart_handle_t handle structure. - - (#) Initialize the USART handle: - (##) Enable the USARTx interface clock. - (##) USART pins configuration: - (+++) Enable the clock for the USART GPIOs. - (+++) Configure the USART pins (TX as alternate function pull-up, RX as alternate function Input). - (##) NVIC configuration if you need to use interrupt process (ald_usart_send_by_it() - and ald_usart_recv_by_it() APIs): - (+++) Configure the USARTx interrupt priority. - (+++) Enable the NVIC USART IRQ handle. - (##) DMA Configuration if you need to use DMA process (ald_usart_send_by_dma() - and ald_usart_recv_by_dma() APIs): - (+++) Declare a DMA handle structure for the Tx/Rx channel. - (+++) Enable the DMAx interface clock. - (+++) Configure the declared DMA handle structure with the required - Tx/Rx parameters. - (+++) Configure the DMA Tx/Rx channel. - (+++) Associate the initialized DMA handle to the USART DMA Tx/Rx handle. - - (#) Program the baud rate, word length, stop bit, parity, hardware - flow control and mode(Receiver/Transmitter) in the hperh Init structure. - - (#) For the USART asynchronous mode, initialize the USART registers by calling - the ald_usart_init() API. - - (#) For the USART Half duplex mode, initialize the USART registers by calling - the ald_usart_half_duplex_init() API. - - (#) For the LIN mode, initialize the USART registers by calling the usart_lin_init() API. - - (#) For the Multi-Processor mode, initialize the USART registers by calling - the ald_usart_multi_processor_init() API. - - [..] - (@) The specific USART interrupts (Transmission complete interrupt, - RXNE interrupt and Error Interrupts) will be managed using the function - ald_usart_interrupt_config inside the transmit and receive process. - - [..] - Three operation modes are available within this driver : - - *** Polling mode IO operation *** - ================================= - [..] Asynchronous: - (+) Send an amount of data in blocking mode using ald_usart_send() - (+) Receive an amount of data in blocking mode using ald_usart_recv() - - [..] Synchronous: - (+) Send an amount of data in blocking mode using ald_usart_send_sync() - (+) Receive an amount of data in blocking mode using ald_usart_recv_sync() - - *** Interrupt mode IO operation *** - =================================== - [..] Asynchronous: - (+) Send an amount of data in non blocking mode using ald_usart_send_by_it() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode using USART_recv_by_it() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - [..] Synchronous: - (+) Send an amount of data in non blocking mode using ald_usart_send_by_it_sync() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode using USART_recv_by_it_sync() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - - *** DMA mode IO operation *** - ============================== - [..] Asynchronous: - (+) Send an amount of data in non blocking mode (DMA) using ald_usart_send_by_dma() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode (DMA) using ald_usart_recv_by_dma() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk()() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - [..] Synchronous: - (+) Send an amount of data in non blocking mode (DMA) using ald_usart_send_by_dma_sync() - (+) At transmission end of transfer hperh->tx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->tx_cplt_cbk() - (+) Receive an amount of data in non blocking mode (DMA) using ald_usart_recv_by_dma_sync() - (+) At reception end of transfer hperh->rx_cplt_cbk() is executed and user can - add his own code by customization of function pointer hperh->rx_cplt_cbk() - (+) In case of transfer Error, hperh->error_cbk()() function is executed and user can - add his own code by customization of function pointer hperh->error_cbk() - [..] Utilities: - (+) Pause the DMA Transfer using ald_usart_dma_pause() - (+) Resume the DMA Transfer using ald_usart_dma_resume() - (+) Stop the DMA Transfer using ald_usart_dma_stop() - - *** USART ALD driver macros list *** - ============================================= - [..] - Below the list of most used macros in USART ALD driver. - - (+) USART_ENABLE: Enable the USART peripheral - (+) USART_DISABLE: Disable the USART peripheral - (+) USART_RESET_HANDLE_STATE : Reset USART handle - (+) USART_CLEAR_PEFLAG : Clear PE flag - (+) USART_CLEAR_FEFLAG: Clear FE flag - (+) USART_CLEAR_NEFLAG: Clear NE flag - (+) USART_CLEAR_OREFLAG: Clear voerrun flag - (+) USART_CLEAR_IDLEFLAG : Clear IDLE flag - (+) USART_HWCONTROL_CTS_ENABLE: Enable CTS flow control - (+) USART_HWCONTROL_CTS_DISABLE: Disable CTS flow control - (+) USART_HWCONTROL_RTS_ENABLE: Enable RTS flow control - (+) USART_HWCONTROL_RTS_DISABLE: Disable RTS flow control - - [..] - (@) You can refer to the USART Library header file for more useful macros - - @endverbatim - ****************************************************************************** - */ - -#include "ald_usart.h" -#include "ald_cmu.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup USART USART - * @brief USART module driver - * @{ - */ -#ifdef ALD_USART - -/** @defgroup USART_Private_Variables USART Private Variables - * @{ - */ -uint8_t __frame_mode = 0; -/** - * @} - */ - -/** @addtogroup USART_Private_Functions USART Private Functions - * @{ - */ -static void usart_set_config (usart_handle_t *hperh); -static ald_status_t __usart_send_by_it(usart_handle_t *hperh); -static ald_status_t __usart_end_send_by_it(usart_handle_t *hperh); -static ald_status_t __usart_recv_by_it(usart_handle_t *hperh); -static ald_status_t __usart_recv_frame_cplt(usart_handle_t *hperh); -static ald_status_t __usart_recv_by_it_sync(usart_handle_t *hperh); -static ald_status_t __usart_send_recv_by_it_sync(usart_handle_t *hperh); -#ifdef ALD_DMA -static void usart_dma_send_cplt(void *arg); -static void usart_dma_recv_cplt(void *arg); -static void usart_dma_error(void *arg); -#endif -static ald_status_t usart_wait_flag(usart_handle_t *hperh, usart_flag_t flag, flag_status_t status, uint32_t timeout); -/** - * @} - */ - -/** @defgroup USART_Public_Functions USART Public Functions - * @{ - */ - -/** @defgroup USART_Public_Functions_Group1 Initialization functions - * @brief Initialization and Configuration functions - * - * @verbatim -=============================================================================== - ##### Initialization and Configuration functions ##### - =============================================================================== - [..] - This subsection provides a set of functions allowing to initialize the USARTx or the USARTy - in asynchronous or synchronous mode. - (+) For the asynchronous mode only these parameters can be configured: - (++) Baud rate - (++) Word length - (++) Stop bit - (++) Parity - (++) Hardware flow control - (++) Receiver/transmitter modes - [..] - The ald_usart_init(), ald_usart_half_duplex_init(), usart_lin_init(), ald_usart_multi_processor_init() - and ald_usart_clock_init() APIs follow respectively the USART asynchronous, USART Half duplex, - LIN, Multi-Processor and synchronous configuration procedures. - - @endverbatim - * @{ - */ - -/* - Additionnal remark: If the parity is enabled, then the MSB bit of the data written - in the data register is transmitted but is changed by the parity bit. - Depending on the frame length defined by the M bit (8-bits or 9-bits), - the possible USART frame formats are as listed in the following table: - +-------------------------------------------------------------+ - | M bit | PCE bit | USART frame | - |---------------------|---------------------------------------| - | 0 | 0 | | SB | 8 bit data | STB | | - |---------|-----------|---------------------------------------| - | 0 | 1 | | SB | 7 bit data | PB | STB | | - |---------|-----------|---------------------------------------| - | 1 | 0 | | SB | 9 bit data | STB | | - |---------|-----------|---------------------------------------| - | 1 | 1 | | SB | 8 bit data | PB | STB | | - +-------------------------------------------------------------+ -*/ - - -/** - * @brief Reset the USART peripheral. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval None - */ -void ald_usart_reset(usart_handle_t *hperh) -{ - assert_param(IS_USART(hperh->perh)); - - hperh->state = USART_STATE_BUSY; - USART_DISABLE(hperh); - - WRITE_REG(hperh->perh->CON0, 0x0); - WRITE_REG(hperh->perh->CON1, 0x0); - WRITE_REG(hperh->perh->CON2, 0x0); - - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_RESET; - - __UNLOCK(hperh); - return; -} - -/** - * @brief Initializes the USART mode according to the specified parameters in - * the usart_init_t and create the associated handle. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_init(usart_handle_t *hperh) -{ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_HARDWARE_FLOW_CONTROL(hperh->init.fctl)); - assert_param(IS_USART_WORD_LENGTH(hperh->init.word_length)); - - ald_usart_reset(hperh); - hperh->state = USART_STATE_BUSY; - USART_DISABLE(hperh); - usart_set_config(hperh); - - /* In asynchronous mode, the following bits must be kept cleared: - * - LINEN and CLKEN bits in the USART_CR2 register, - * - SCEN, HDSEL and IREN bits in the USART_CR3 register. - */ - CLEAR_BIT(hperh->perh->CON1, USART_CON1_SCKEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_SMARTEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_HDPSEL_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_IREN_MSK); - - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_READY; - USART_ENABLE(hperh); - - return OK; -} - -/** - * @brief Initializes the half-duplex mode according to the specified - * parameters in the usart_init_t and create the associated handle. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_half_duplex_init(usart_handle_t *hperh) -{ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_WORD_LENGTH(hperh->init.word_length)); - - ald_usart_reset(hperh); - hperh->state = USART_STATE_BUSY; - USART_DISABLE(hperh); - usart_set_config(hperh); - - /* In half-duplex mode, the following bits must be kept cleared: - * - LINEN and CLKEN bits in the USART_CR2 register, - * - SCEN and IREN bits in the USART_CR3 register.*/ - CLEAR_BIT(hperh->perh->CON1, USART_CON1_SCKEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_SMARTEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_IREN_MSK); - SET_BIT(hperh->perh->CON2, USART_CON2_HDPSEL_MSK); - - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_READY; - USART_ENABLE(hperh); - - return OK; -} - -/** - * @brief Initializes the Multi-Processor mode according to the specified - * parameters in the usart_init_t and create the associated handle. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param addr: USART node address - * @param wakeup: specifies the USART wakeup method. - * This parameter can be one of the following values: - * @arg USART_WAKEUP_IDLE: Wakeup by an idle line detection - * @arg USART_WAKEUP_ADDR: Wakeup by an address mark - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_multi_processor_init(usart_handle_t *hperh, uint8_t addr, usart_wakeup_t wakeup) -{ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_WAKEUP(wakeup)); - assert_param(IS_USART_ADDRESS(addr)); - assert_param(IS_USART_WORD_LENGTH(hperh->init.word_length)); - - ald_usart_reset(hperh); - hperh->state = USART_STATE_BUSY; - USART_DISABLE(hperh); - usart_set_config(hperh); - - /* In Multi-Processor mode, the following bits must be kept cleared: - * - LINEN and CLKEN bits in the USART_CR2 register, - * - SCEN, HDSEL and IREN bits in the USART_CR3 register */ - CLEAR_BIT(hperh->perh->CON1, USART_CON1_SCKEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_SMARTEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_HDPSEL_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_IREN_MSK); - MODIFY_REG(hperh->perh->CON1, USART_CON1_ADDR_MSK, addr << USART_CON1_ADDR_POSS); - MODIFY_REG(hperh->perh->CON0, USART_CON0_WKMOD_MSK, wakeup << USART_CON0_WKMOD_POS); - - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_READY; - USART_ENABLE(hperh); - - return OK; -} - -/** - * @brief Initializes the synchronization mode according to the specified - * parameters in the usart_init_t and usart_clock_init_t. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param init: USART Clock Init Structure. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_clock_init(usart_handle_t *hperh, usart_clock_init_t *init) -{ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_WORD_LENGTH(hperh->init.word_length)); - - ald_usart_reset(hperh); - hperh->state = USART_STATE_BUSY; - USART_DISABLE(hperh); - usart_set_config(hperh); - - /* In Multi-Processor mode, the following bits must be kept cleared: - * - LINEN and CLKEN bits in the USART_CR2 register, - * - SCEN, HDSEL and IREN bits in the USART_CR3 register */ - CLEAR_BIT(hperh->perh->CON2, USART_CON2_SMARTEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_HDPSEL_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_IREN_MSK); - MODIFY_REG(hperh->perh->CON1, USART_CON1_SCKEN_MSK, init->clk << USART_CON1_SCKEN_POS); - MODIFY_REG(hperh->perh->CON1, USART_CON1_SCKPOL_MSK, init->polarity << USART_CON1_SCKPOL_POS); - MODIFY_REG(hperh->perh->CON1, USART_CON1_SCKPHA_MSK, init->phase << USART_CON1_SCKPHA_POS); - MODIFY_REG(hperh->perh->CON1, USART_CON1_LBCP_MSK, init->last_bit << USART_CON1_LBCP_POS); - - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_READY; - USART_ENABLE(hperh); - - return OK; -} - -/** - * @} - */ - -/** @defgroup USART_Public_Functions_Group2 IO operation functions - * @brief USART Transmit and Receive functions - * @{ - */ - -/** @defgroup USART_Public_Functions_Group2_1 Asynchronization IO operation functions - * @brief Asynchronization IO operation functions - * - * @verbatim - ============================================================================== - ##### IO operation functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to manage the USART asynchronous - and Half duplex data transfers. - - (#) There are two modes of transfer: - (++) Blocking mode: The communication is performed in polling mode. - The Status of all data processing is returned by the same function - after finishing transfer. - (++) Non blocking mode: The communication is performed using Interrupts - or DMA, these APIs return the Status. - The end of the data processing will be indicated through the - dedicated USART IRQ when using Interrupt mode or the DMA IRQ when - using DMA mode. - The hperh->tx_cplt_cbk(), hperh->rx_cplt_cbk() user callbacks - will be executed respectively at the end of the transmit or receive process. - The hperh->error_cbk() user callback will be executed when - a communication error is detected. - - (#) Blocking mode APIs are: - (++) ald_usart_send() - (++) ald_usart_recv() - - (#) Non Blocking mode APIs with Interrupt are: - (++) ald_usart_send_by_it() - (++) ald_usart_recv_by_it() - (++) urart_irq_handle() - - (#) Non Blocking mode functions with DMA are: - (++) ald_usart_send_by_dma() - (++) ald_usart_recv_by_dma() - (++) ald_usart_dma_pause() - (++) ald_usart_dma_resume() - (++) ald_usart_dma_stop() - - (#) A set of Transfer Complete Callbacks are provided in non blocking mode: - (++) hperh->tx_cplt_cbk() - (++) hperh->rx_cplt_cbk() - (++) hperh->error_cbk() - - [..] - (@) In the Half duplex communication, it is forbidden to run the transmit - and receive process in parallel, the USART state USART_STATE_BUSY_TX_RX - can't be useful. - - @endverbatim - * @{ - */ - -/** - * @brief Sends an amount of data in blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if ((hperh->state != USART_STATE_READY) && (hperh->state != USART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - hperh->err_code = USART_ERROR_NONE; - SET_BIT(hperh->state, USART_STATE_TX_MASK); - - hperh->tx_size = size; - hperh->tx_count = size; - - while (hperh->tx_count-- > 0) { - if (usart_wait_flag(hperh, USART_FLAG_TXE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - if (hperh->init.parity == USART_PARITY_NONE) { - WRITE_REG(hperh->perh->DATA, (*(uint16_t *)buf & (uint16_t)0x01FF)); - buf += 2; - } - else { - WRITE_REG(hperh->perh->DATA, *buf++); - } - } - else { - WRITE_REG(hperh->perh->DATA, *buf++); - } - } - - if (usart_wait_flag(hperh, USART_FLAG_TC, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - CLEAR_BIT(hperh->state, USART_STATE_TX_MASK); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Receives an amount of data in blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_recv(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if ((hperh->state != USART_STATE_READY) && (hperh->state != USART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - hperh->err_code = USART_ERROR_NONE; - SET_BIT(hperh->state, USART_STATE_RX_MASK); - - hperh->rx_size = size; - hperh->rx_count = size; - - while (hperh->rx_count-- > 0) { - if (usart_wait_flag(hperh, USART_FLAG_RXNE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - if (hperh->init.parity == USART_PARITY_NONE) { - *(uint16_t *)buf = (uint16_t)(hperh->perh->DATA & 0x1FF); - buf += 2; - } - else { - *buf = (uint8_t)(hperh->perh->DATA & 0xFF); - buf += 1; - } - } - else { - if (hperh->init.parity == USART_PARITY_NONE) - *buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - else - *buf++ = (uint8_t)(hperh->perh->DATA & 0x7F); - } - } - - CLEAR_BIT(hperh->state, USART_STATE_RX_MASK); - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send_by_it(usart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if ((hperh->state != USART_STATE_READY) && (hperh->state != USART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_TX_MASK); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = USART_ERROR_NONE; - - __UNLOCK(hperh); - ald_usart_interrupt_config(hperh, USART_IT_TXE, ENABLE); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_recv_by_it(usart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if ((hperh->state != USART_STATE_READY) && (hperh->state != USART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_RX_MASK); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = USART_ERROR_NONE; - - __UNLOCK(hperh); - ald_usart_interrupt_config(hperh, USART_IT_PE, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_RXNE, ENABLE); - - return OK; -} - -/** - * @brief Receives an frame in interrupt mode - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Maximum amount of data to be received - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_recv_frame_by_it(usart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if ((hperh->state != USART_STATE_READY) && (hperh->state != USART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_RX_MASK); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = USART_ERROR_NONE; - - __UNLOCK(hperh); - ald_usart_interrupt_config(hperh, USART_IT_PE, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_RXNE, ENABLE); - __frame_mode = 1; - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as USART transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send_by_dma(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if ((hperh->state != USART_STATE_READY) && (hperh->state != USART_STATE_BUSY_RX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_TX_MASK); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = USART_ERROR_NONE; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - /* Configure callback function */ - hperh->hdmatx.cplt_cbk = usart_dma_send_cplt; - hperh->hdmatx.cplt_arg = (void *)hperh; - hperh->hdmatx.err_cbk = usart_dma_error; - hperh->hdmatx.err_arg = (void *)hperh; - - /* Configure USART DMA transmit */ - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_USART_TXEMPTY; - hperh->hdmatx.config.channel = channel; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) - && (hperh->init.parity == USART_PARITY_NONE)) { - hperh->hdmatx.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmatx); - - __UNLOCK(hperh); - ald_usart_clear_flag_status(hperh, USART_FLAG_TC); - SET_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param channel: DMA channel as USART receive - * @note When the USART parity is enabled (PCE = 1), the received data contain - * the parity bit (MSB position) - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_recv_by_dma(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if ((hperh->state != USART_STATE_READY) && (hperh->state != USART_STATE_BUSY_TX)) - return BUSY; - - if ((buf == NULL ) || (size == 0)) - return ERROR; - - __LOCK(hperh); - SET_BIT(hperh->state, USART_STATE_RX_MASK); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->err_code = USART_ERROR_NONE; - - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - /* Configure callback function */ - hperh->hdmarx.cplt_cbk = usart_dma_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = usart_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - /* Configure DMA Receive */ - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_USART_RNR; - hperh->hdmarx.config.channel = channel; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) - && (hperh->init.parity == USART_PARITY_NONE)) { - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmarx); - - __UNLOCK(hperh); - SET_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - - return OK; -} -#endif -/** - * @} - */ - -/** @defgroup USART_Public_Functions_Group2_2 Synchronization IO operation functions - * @brief Synchronization IO operation functions - * - * @verbatim - ============================================================================== - ##### IO operation functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to manage the USART synchronous - data transfers. - - [..] - The USART supports master mode only: it cannot receive or send data related to an input - clock (SCLK is always an output). - - (#) There are two modes of transfer: - (++) Blocking mode: The communication is performed in polling mode. - The Status of all data processing is returned by the same function - after finishing transfer. - (++) No-Blocking mode: The communication is performed using Interrupts - or DMA, These API's return the Status. - The end of the data processing will be indicated through the - dedicated USART IRQ when using Interrupt mode or the DMA IRQ when - using DMA mode. - The hperh->tx_cplt_cbk(), hperh->rx_cplt_cbk() and hperh->tx_rx_cplt_cbk() - user callbacks will be executed respectively at the end of the transmit - or Receive process. The hperh->error_cbk() user callback will be - executed when a communication error is detected - - (#) Blocking mode APIs are : - (++) ald_usart_send_sync() in simplex mode - (++) ald_usart_recv_sync() in full duplex receive only - (++) ald_usart_send_recv_sync() in full duplex mode - - (#) Non Blocking mode APIs with Interrupt are : - (++) ald_usart_send_by_it_sync()in simplex mode - (++) ald_usart_recv_by_it_sync() in full duplex receive only - (++) ald_usart_send_recv_by_it_sync() in full duplex mode - (++) ald_usart_irq_handler() - - (#) Non Blocking mode functions with DMA are : - (++) ald_usart_send_by_dma_sync()in simplex mode - (++) ald_usart_recv_by_dma_sync() in full duplex receive only - (++) usart_send_recv_by_dma_symc() in full duplex mode - (++) ald_usart_dma_pause() - (++) ald_usart_dma_resume() - (++) ald_usart_dma_stop() - - (#) A set of Transfer Complete Callbacks are provided in non Blocking mode: - (++) hperh->tx_cplt_cbk() - (++) hperh->rx_cplt_cbk() - (++) hperh->tx_rx_cplt_cbk() - (++) hperh->error_cbk() - - @endverbatim - * @{ - */ - -/** - * @brief Simplex Send an amount of data in blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_TX; - - while (hperh->tx_count-- > 0) { - if (usart_wait_flag(hperh, USART_FLAG_TXE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) && (hperh->init.parity == USART_PARITY_NONE)) { - WRITE_REG(hperh->perh->DATA, (*(uint16_t *)buf & 0x1FF)); - buf += 2; - } - else { - WRITE_REG(hperh->perh->DATA, *buf++); - } - } - - if (usart_wait_flag(hperh, USART_FLAG_TC, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - hperh->state = USART_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Full-Duplex Receive an amount of data in blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_recv_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_RX; - - while (hperh->rx_count-- > 0) { - if (usart_wait_flag(hperh, USART_FLAG_TXE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - WRITE_REG(hperh->perh->DATA, (DUMMY_DATA & 0x1FF)); - - if (usart_wait_flag(hperh, USART_FLAG_RXNE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.parity == USART_PARITY_NONE) { - *(uint16_t *)buf = (uint16_t)(hperh->perh->DATA & 0x1FF); - buf += 2; - } - else { - *buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - } - } - else { - WRITE_REG(hperh->perh->DATA, (DUMMY_DATA & 0xFF)); - - if (usart_wait_flag(hperh, USART_FLAG_RXNE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.parity == USART_PARITY_NONE) - *buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - else - *buf++ = (uint8_t)(hperh->perh->DATA & 0x7F); - } - } - - hperh->state = USART_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Full-Duplex Send receive an amount of data in full-duplex mode (blocking mode). - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param tx_buf: Pointer to data transmitted buffer - * @param rx_buf: Pointer to data received buffer - * @param size: Amount of data to be sent - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send_recv_sync(usart_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size, uint32_t timeout) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((tx_buf == NULL) || (rx_buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_size = size; - hperh->rx_count = size; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_RX; - - while (hperh->tx_count-- > 0) { - --hperh->rx_count; - - if (usart_wait_flag(hperh, USART_FLAG_TXE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - if (hperh->init.parity == USART_PARITY_NONE) { - WRITE_REG(hperh->perh->DATA, (*(uint16_t *)tx_buf & 0x1FF)); - tx_buf += 2; - } - else { - WRITE_REG(hperh->perh->DATA, *tx_buf++); - } - - if (usart_wait_flag(hperh, USART_FLAG_RXNE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.parity == USART_PARITY_NONE) { - *(uint16_t *)rx_buf = (uint16_t)(hperh->perh->DATA & 0x1FF); - rx_buf += 2; - } - else { - *rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - } - } - else { - WRITE_REG(hperh->perh->DATA, *tx_buf++); - - if (usart_wait_flag(hperh, USART_FLAG_RXNE, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = USART_STATE_READY; - return TIMEOUT; - } - - if (hperh->init.parity == USART_PARITY_NONE) - *rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - else - *rx_buf++ = (uint8_t)(hperh->perh->DATA & 0x7F); - } - } - - hperh->state = USART_STATE_READY; - __UNLOCK(hperh); - - return OK; -} - -/** - * @brief Simplex Send an amount of data in non-blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @retval Status, see @ref ald_status_t. - * @note The USART errors are not managed to avoid the overrun error. - */ -ald_status_t ald_usart_send_by_it_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_TX; - - /* The USART Error Interrupts: (Frame error, Noise error, Overrun error) - * are not managed by the USART transmit process to avoid the overrun interrupt - * when the USART mode is configured for transmit and receive "USART_MODE_TX_RX" - * to benefit for the frame error and noise interrupts the USART mode should be - * configured only for transmit "USART_MODE_TX" - * The __ALD_USART_ENABLE_IT(hperh, USART_IT_ERR) can be used to enable the Frame error, - * Noise error interrupt - */ - - __UNLOCK(hperh); - ald_usart_interrupt_config(hperh, USART_IT_TXE, ENABLE); - - return OK; -} - -/** - * @brief Simplex Receive an amount of data in non-blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_recv_by_it_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_RX; - - __UNLOCK(hperh); - ald_usart_interrupt_config(hperh, USART_IT_RXNE, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_PE, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, ENABLE); - - WRITE_REG(hperh->perh->DATA, (DUMMY_DATA & (uint16_t)0x01FF)); - return OK; -} - -/** - * @brief Full-Duplex Send receive an amount of data in full-duplex mode (non-blocking). - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param tx_buf: Pointer to data transmitted buffer - * @param rx_buf: Pointer to data received buffer - * @param size: Amount of data to be received - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send_recv_by_it_sync(usart_handle_t *hperh, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t size) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((tx_buf == NULL) || (rx_buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_buf = rx_buf; - hperh->rx_size = size; - hperh->rx_count = size; - hperh->tx_buf = tx_buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_TX_RX; - - __UNLOCK(hperh); - ald_usart_interrupt_config(hperh, USART_IT_RXNE, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_PE, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, ENABLE); - ald_usart_interrupt_config(hperh, USART_IT_TXE, ENABLE); - - return OK; -} - -#ifdef ALD_DMA -/** - * @brief Simplex Send an amount of data in non-blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be sent - * @param channel: DMA channel as USART transmit - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send_by_dma_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t channel) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->tx_count = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_TX; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - - /* Configure callback function */ - hperh->hdmatx.cplt_cbk = usart_dma_send_cplt; - hperh->hdmatx.cplt_arg = (void *)hperh; - hperh->hdmatx.err_cbk = usart_dma_error; - hperh->hdmatx.err_arg = (void *)hperh; - - /* Configure DMA transmit */ - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_USART_TXEMPTY; - hperh->hdmatx.config.channel = channel; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) - && (hperh->init.parity == USART_PARITY_NONE)) { - hperh->hdmatx.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmatx); - - __UNLOCK(hperh); - ald_usart_clear_flag_status(hperh, USART_FLAG_TC); - SET_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - - return OK; -} - -/** - * @brief Full-Duplex Receive an amount of data in non-blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param buf: Pointer to data buffer - * @param size: Amount of data to be received - * @param tx_channel: DMA channel as USART transmit - * @param rx_channel: DMA channel as USART receive - * @retval Status, see @ref ald_status_t. - * @note The USART DMA transmit channel must be configured in order to generate the clock for the slave. - * @note When the USART parity is enabled (PCE = 1) the data received contain the parity bit. - */ -ald_status_t ald_usart_recv_by_dma_sync(usart_handle_t *hperh, uint8_t *buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_buf = buf; - hperh->rx_size = size; - hperh->tx_buf = buf; - hperh->tx_size = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_RX; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - /* Configure DMA callback function */ - hperh->hdmarx.cplt_cbk = usart_dma_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmarx.err_cbk = usart_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - /* Configure DMA receive*/ - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_USART_RNR; - hperh->hdmarx.config.channel = rx_channel; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) - && (hperh->init.parity == USART_PARITY_NONE)) { - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmarx); - - /* Enable the USART transmit DMA channel: the transmit channel is used in order - * to generate in the non-blocking mode the clock to the slave device, - * this mode isn't a simplex receive mode but a full-duplex receive one - */ - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_USART_TXEMPTY; - hperh->hdmatx.config.channel = tx_channel; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) - && (hperh->init.parity == USART_PARITY_NONE)) { - hperh->hdmatx.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmatx); - - USART_CLEAR_OREFLAG(hperh); - __UNLOCK(hperh); - SET_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - SET_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - - return OK; -} - -/** - * @brief Full-Duplex Transmit Receive an amount of data in non-blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param tx_buf: Pointer to data transmitted buffer - * @param rx_buf: Pointer to data received buffer - * @param size: Amount of data to be received - * @param tx_channel: DMA channel as USART transmit - * @param rx_channel: DMA channel as USART receive - * @note When the USART parity is enabled (PCE = 1) the data received contain the parity bit. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_send_recv_by_dma_sync(usart_handle_t *hperh, uint8_t *tx_buf, - uint8_t *rx_buf, uint16_t size, uint8_t tx_channel, uint8_t rx_channel) -{ - if (hperh->state != USART_STATE_READY) - return BUSY; - - if ((tx_buf == NULL) || (rx_buf == NULL) || (size == 0)) - return ERROR; - - __LOCK(hperh); - - hperh->rx_buf = rx_buf; - hperh->rx_size = size; - hperh->tx_buf = tx_buf; - hperh->tx_size = size; - hperh->err_code = USART_ERROR_NONE; - hperh->state = USART_STATE_BUSY_TX_RX; - - if (hperh->hdmatx.perh == NULL) - hperh->hdmatx.perh = DMA0; - if (hperh->hdmarx.perh == NULL) - hperh->hdmarx.perh = DMA0; - - /* Configure DMA callback function */ - hperh->hdmarx.cplt_cbk = usart_dma_recv_cplt; - hperh->hdmarx.cplt_arg = (void *)hperh; - hperh->hdmatx.cplt_cbk = usart_dma_send_cplt; - hperh->hdmatx.cplt_arg = (void *)hperh; - hperh->hdmatx.err_cbk = usart_dma_error; - hperh->hdmatx.err_arg = (void *)hperh; - hperh->hdmarx.err_cbk = usart_dma_error; - hperh->hdmarx.err_arg = (void *)hperh; - - /* Configure DMA receive */ - ald_dma_config_struct(&hperh->hdmarx.config); - hperh->hdmarx.config.src = (void *)&hperh->perh->DATA; - hperh->hdmarx.config.dst = (void *)rx_buf; - hperh->hdmarx.config.size = size; - hperh->hdmarx.config.src_inc = DMA_DATA_INC_NONE; - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_BYTE; - hperh->hdmarx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmarx.config.msigsel = DMA_MSIGSEL_USART_RNR; - hperh->hdmarx.config.channel = rx_channel; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) - && (hperh->init.parity == USART_PARITY_NONE)) { - hperh->hdmarx.config.dst_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmarx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmarx); - - /* Configure DMA transmit*/ - ald_dma_config_struct(&hperh->hdmatx.config); - hperh->hdmatx.config.src = (void *)tx_buf; - hperh->hdmatx.config.dst = (void *)&hperh->perh->DATA; - hperh->hdmatx.config.size = size; - hperh->hdmatx.config.src_inc = DMA_DATA_INC_BYTE; - hperh->hdmatx.config.dst_inc = DMA_DATA_INC_NONE; - hperh->hdmatx.config.msel = hperh->perh == USART0 ? DMA_MSEL_USART0 : DMA_MSEL_USART1; - hperh->hdmatx.config.msigsel = DMA_MSIGSEL_USART_TXEMPTY; - hperh->hdmatx.config.channel = tx_channel; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) - && (hperh->init.parity == USART_PARITY_NONE)) { - hperh->hdmatx.config.src_inc = DMA_DATA_INC_HALFWORD; - hperh->hdmatx.config.data_width = DMA_DATA_SIZE_HALFWORD; - } - - ald_dma_config_basic(&hperh->hdmatx); - - ald_usart_clear_flag_status(hperh, USART_FLAG_TC); - USART_CLEAR_OREFLAG(hperh); - __UNLOCK(hperh); - SET_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - SET_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - - return OK; -} -#endif -/** - * @} - */ - -/** @defgroup USART_Public_Functions_Group2_3 Utilities functions - * @brief Utilities functions - * @{ - */ -#ifdef ALD_DMA -/** - * @brief Pauses the DMA Transfer. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_dma_pause(usart_handle_t *hperh) -{ - __LOCK(hperh); - - if (hperh->state == USART_STATE_BUSY_TX) { - CLEAR_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - } - else if (hperh->state == USART_STATE_BUSY_RX) { - CLEAR_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - } - else if (hperh->state == USART_STATE_BUSY_TX_RX) { - CLEAR_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - } - else { - __UNLOCK(hperh); - return ERROR; - } - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Resumes the DMA Transfer. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_dma_resume(usart_handle_t *hperh) -{ - __LOCK(hperh); - - if (hperh->state == USART_STATE_BUSY_TX) { - SET_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - } - else if (hperh->state == USART_STATE_BUSY_RX) { - USART_CLEAR_OREFLAG(hperh); - SET_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - } - else if (hperh->state == USART_STATE_BUSY_TX_RX) { - USART_CLEAR_OREFLAG(hperh); - SET_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - SET_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - } - else { - __UNLOCK(hperh); - return ERROR; - } - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Stops the DMA Transfer. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_dma_stop(usart_handle_t *hperh) -{ - CLEAR_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - - hperh->state = USART_STATE_READY; - return OK; -} -#endif -/** - * @brief This function handles USART interrupt request. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval None - */ -void ald_usart_irq_handler(usart_handle_t *hperh) -{ - uint32_t flag; - uint32_t source; - - /* Handle parity error */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_PE); - source = ald_usart_get_it_status(hperh, USART_IT_PE); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= USART_ERROR_PE; - - /* Handle frame error */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_FE); - source = ald_usart_get_it_status(hperh, USART_IT_ERR); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= USART_ERROR_FE; - - /* Handle noise error */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_NE); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= USART_ERROR_NE; - - /* Handle overrun error */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_ORE); - if ((flag != RESET) && (source != RESET)) - hperh->err_code |= USART_ERROR_ORE; - - /* Handle idle error */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_IDLE); - source = ald_usart_get_it_status(hperh, USART_IT_IDLE); - if ((flag != RESET) && (source != RESET)) - __usart_recv_frame_cplt(hperh); - - /* Handle asynchronous */ - if (READ_BIT(hperh->perh->CON1, USART_CON1_SCKEN_MSK) == 0) { - /* Receiver */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_RXNE); - source = ald_usart_get_it_status(hperh, USART_IT_RXNE); - if ((flag != RESET) && (source != RESET)) - __usart_recv_by_it(hperh); - - /* Transmitter */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_TXE); - source = ald_usart_get_it_status(hperh, USART_IT_TXE); - if ((flag != RESET) && (source != RESET)) - __usart_send_by_it(hperh); - } - else { /* Handle synchronous */ - /* Receiver */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_RXNE); - source = ald_usart_get_it_status(hperh, USART_IT_RXNE); - if ((flag != RESET) && (source != RESET)) { - if (hperh->state == USART_STATE_BUSY_RX) - __usart_recv_by_it_sync(hperh); - else - __usart_send_recv_by_it_sync(hperh); - } - - /* Transmitter */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_TXE); - source = ald_usart_get_it_status(hperh, USART_IT_TXE); - if ((flag != RESET) && (source != RESET)) { - if (hperh->state == USART_STATE_BUSY_TX) - __usart_send_by_it(hperh); - else - __usart_send_recv_by_it_sync(hperh); - } - } - - /* Handle transmitter end */ - flag = ald_usart_get_flag_status(hperh, USART_FLAG_TC); - source = ald_usart_get_it_status(hperh, USART_IT_TC); - if ((flag != RESET) && (source != RESET)) - __usart_end_send_by_it(hperh); - - /* Handle error */ - if (hperh->err_code != USART_ERROR_NONE) { - USART_CLEAR_PEFLAG(hperh); - hperh->state = USART_STATE_READY; - - if (hperh->error_cbk != NULL) - hperh->error_cbk(hperh); - } -} - -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup USART_Public_Functions_Group3 Peripheral Control functions - * @brief USART control functions - * - * @verbatim - ============================================================================== - ##### Peripheral Control functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to control the USART: - (+) usart_lin_send_break() API can be helpful to transmit the break character. - (+) ald_usart_multi_processor_enter_mute_mode() API can be helpful to enter the USART in mute mode. - (+) ald_usart_multi_processor_exit_mute_mode() API can be helpful to exit the USART mute mode by software. - (+) ald_usart_half_duplex_enable_send() API to enable the USART transmitter and disables the USART receiver in Half Duplex mode - (+) ald_usart_half_duplex_enable_recv() API to enable the USART receiver and disables the USART transmitter in Half Duplex mode - (+) ald_usart_interrupt_config() API to Enables/Disables the specified USART interrupts - (+) ald_usart_get_flag_status() API to get USART flag status - (+) ald_usart_clear_flag_status() API to clear USART flag status - (+) ald_usart_get_it_status() API to Checks whether the specified USART interrupt has occurred or not - - @endverbatim - * @{ - */ - -/** - * @brief Enters the USART in mute mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_multi_processor_enter_mute_mode(usart_handle_t *hperh) -{ - assert_param(IS_USART(hperh->perh)); - - __LOCK(hperh); - - hperh->state = USART_STATE_BUSY; - SET_BIT(hperh->perh->CON0, USART_CON0_RXWK_MSK); - hperh->state = USART_STATE_READY; - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Exits the USART mute mode: wake up software. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_multi_processor_exit_mute_mode(usart_handle_t *hperh) -{ - assert_param(IS_USART(hperh->perh)); - - __LOCK(hperh); - - hperh->state = USART_STATE_BUSY; - CLEAR_BIT(hperh->perh->CON0, USART_CON0_RXWK_MSK); - hperh->state = USART_STATE_READY; - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Enables the USART transmitter and disables the USART receiver. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_half_duplex_enable_send(usart_handle_t *hperh) -{ - __LOCK(hperh); - - hperh->state = USART_STATE_BUSY; - SET_BIT(hperh->perh->CON0, USART_CON0_RXEN_MSK); - SET_BIT(hperh->perh->CON0, USART_CON0_TXEN_MSK); - hperh->state = USART_STATE_READY; - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Enables the USART receiver and disables the USART transmitter. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_usart_half_duplex_enable_recv(usart_handle_t *hperh) -{ - __LOCK(hperh); - - hperh->state = USART_STATE_BUSY; - SET_BIT(hperh->perh->CON0, USART_CON0_RXEN_MSK); - SET_BIT(hperh->perh->CON0, USART_CON0_TXEN_MSK); - hperh->state = USART_STATE_READY; - - __UNLOCK(hperh); - return OK; -} - -/** - * @brief Enables or disables the USART's DMA request. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param req: specifies the DMA request. - * @arg USART_dma_req_tx: USART DMA transmit request - * @arg USART_dma_req_rx: USART DMA receive request - * @param state: New state of the DMA Request sources. - * @arg ENABLE - * @arg DISABLE - * @return: None - */ -void ald_usart_dma_req_config(usart_handle_t *hperh, usart_dma_req_t req, type_func_t state) -{ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_DMAREQ(req)); - assert_param(IS_FUNC_STATE(state)); - - if (state != DISABLE) - SET_BIT(hperh->perh->CON2, req); - else - CLEAR_BIT(hperh->perh->CON2, req); - - return; -} - -/** - * @brief Enables or disables the specified USART interrupts. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param it: Specifies the USART interrupt sources to be enabled or disabled. - * This parameter can be one of the following values: - * @arg USART_IT_CTS: CTS change interrupt - * @arg USART_IT_LBD: LIN Break detection interrupt - * @arg USART_IT_TXE: Transmit Data Register empty interrupt - * @arg USART_IT_TC: Transmission complete interrupt - * @arg USART_IT_RXNE: Receive Data register not empty interrupt - * @arg USART_IT_IDLE: Idle line detection interrupt - * @arg USART_IT_PE: Parity Error interrupt - * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) - * @param state: New status - * - ENABLE - * - DISABLE - * @retval None - */ -void ald_usart_interrupt_config(usart_handle_t *hperh, usart_it_t it, type_func_t state) -{ - uint8_t idx; - - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_CONFIG_IT(it)); - assert_param(IS_FUNC_STATE(state)); - - idx = (it >> 16) & 0x7; - it &= 0xFFFF; - - if (state) { - if (idx == 1) - SET_BIT(hperh->perh->CON0, it); - else if (idx == 2) - SET_BIT(hperh->perh->CON1, it); - else if (idx == 4) - SET_BIT(hperh->perh->CON2, it); - else - ; - } - else { - if (idx == 1) - CLEAR_BIT(hperh->perh->CON0, it); - else if (idx == 2) - CLEAR_BIT(hperh->perh->CON1, it); - else if (idx == 4) - CLEAR_BIT(hperh->perh->CON2, it); - else - ; - } - - return; -} - -/** @brief Check whether the specified USART flag is set or not. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param flag: specifies the flag to check. - * This parameter can be one of the @ref usart_flag_t. - * @retval Status - * - SET - * - RESET - */ -flag_status_t ald_usart_get_flag_status(usart_handle_t *hperh, usart_flag_t flag) -{ - flag_status_t status = RESET; - - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_FLAG(flag)); - - if (READ_BIT(hperh->perh->STAT, flag)) - status = SET; - - return status; -} - -/** @brief Clear the specified USART pending flags. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param flag: specifies the flag to check. - * This parameter can be any combination of the following values: - * @arg USART_FLAG_TC: Transmission Complete flag. - * @arg USART_FLAG_RXNE: Receive data register not empty flag. - * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun - * error) and IDLE (Idle line detected) flags are cleared by software - * sequence: a read operation to USART_SR register followed by a read - * operation to USART_DR register. - * @note RXNE flag can be also cleared by a read to the USART_DR register. - * @note TC flag can be also cleared by software sequence: a read operation to - * USART_SR register followed by a write operation to USART_DR register. - * @note TXE flag is cleared only by a write to the USART_DR register. - * @retval None - */ -void ald_usart_clear_flag_status(usart_handle_t *hperh, usart_flag_t flag) -{ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_CLEAR_FLAG(flag)); - - CLEAR_BIT(hperh->perh->STAT, flag); -} - -/** - * @brief Checks whether the specified USART interrupt has occurred or not. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param it: Specifies the USART interrupt source to check. - * This parameter can be one of the following values: - * @arg USART_IT_CTS: CTS change interrupt - * @arg USART_IT_LBD: LIN Break detection interrupt - * @arg USART_IT_TXE: Tansmit Data Register empty interrupt - * @arg USART_IT_TC: Transmission complete interrupt - * @arg USART_IT_RXNE: Receive Data register not empty interrupt - * @arg USART_IT_IDLE: Idle line detection interrupt - * @arg USART_IT_ORE: OverRun Error interrupt - * @arg USART_IT_NE: Noise Error interrupt - * @arg USART_IT_FE: Framing Error interrupt - * @arg USART_IT_PE: Parity Error interrupt - * @retval Status - * - SET - * - RESET - */ -it_status_t ald_usart_get_it_status(usart_handle_t *hperh, usart_it_t it) -{ - uint8_t idx; - it_status_t status = RESET; - - /* Check the parameters */ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_GET_IT(it)); - - idx = (it >> 16) & 0x7; - it &= 0xFFFF; - - if (idx == 0) { - if (READ_BIT(hperh->perh->STAT, it)) - status = SET; - } - else if (idx == 1) { - if (READ_BIT(hperh->perh->CON0, it)) - status = SET; - } - else if (idx == 2) { - if (READ_BIT(hperh->perh->CON1, it)) - status = SET; - } - else if (idx == 4) { - if (READ_BIT(hperh->perh->CON2, it)) - status = SET; - } - else { - /* do nothing */ - } - - return status; -} - -/** - * @} - */ - -/** @defgroup USART_Public_Functions_Group4 Peripheral State and Errors functions - * @brief USART State and Errors functions - * -@verbatim - ============================================================================== - ##### Peripheral State and Errors functions ##### - ============================================================================== - [..] - This subsection provides a set of functions allowing to return the State of - USART communication process, return Peripheral Errors occurred during communication - process - (+) ald_usart_get_state() API can be helpful to check in run-time the state of the USART peripheral. - (+) ald_usart_get_error() check in run-time errors that could be occurred during communication. - -@endverbatim - * @{ - */ - -/** - * @brief Returns the USART state. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval USART state - */ -usart_state_t ald_usart_get_state(usart_handle_t *hperh) -{ - return hperh->state; -} - -/** - * @brief Return the USART error code - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART. - * @retval USART Error Code - */ -uint32_t ald_usart_get_error(usart_handle_t *hperh) -{ - return hperh->err_code; -} - -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup USART_Private_Functions USART Private Functions - * @brief USART Private functions - * @{ - */ -#ifdef ALD_DMA -/** - * @brief DMA USART transmit process complete callback. - * @param arg: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval None - */ -static void usart_dma_send_cplt(void *arg) -{ - usart_handle_t *hperh = (usart_handle_t *)arg; - - hperh->tx_count = 0; - CLEAR_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - ald_usart_interrupt_config(hperh, USART_IT_TC, ENABLE); -} - -/** - * @brief DMA USART receive process complete callback. - * @param arg: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval None - */ -static void usart_dma_recv_cplt(void *arg) -{ - usart_handle_t *hperh = (usart_handle_t *)arg; - - hperh->rx_count = 0; - CLEAR_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - CLEAR_BIT(hperh->state, USART_STATE_RX_MASK); - - if (hperh->rx_cplt_cbk != NULL) - hperh->rx_cplt_cbk(hperh); -} - -/** - * @brief DMA USART communication error callback. - * @param arg: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval None - */ -static void usart_dma_error(void *arg) -{ - usart_handle_t *hperh = (usart_handle_t *)arg; - - hperh->rx_count = 0; - hperh->tx_count = 0; - hperh->state = USART_STATE_READY; - hperh->err_code |= USART_ERROR_DMA; - - CLEAR_BIT(hperh->perh->CON2, USART_CON2_TXDMAEN_MSK); - CLEAR_BIT(hperh->perh->CON2, USART_CON2_RXDMAEN_MSK); - - if (hperh->error_cbk != NULL) - hperh->error_cbk(hperh); -} -#endif -/** - * @brief This function handles USART Communication Timeout. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @param flag: specifies the USART flag to check. - * @param status: The new Flag status (SET or RESET). - * @param timeout: Timeout duration - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t usart_wait_flag(usart_handle_t *hperh, usart_flag_t flag, flag_status_t status, uint32_t timeout) -{ - uint32_t tick; - - if (timeout == 0) - return OK; - - tick = ald_get_tick(); - - while ((ald_usart_get_flag_status(hperh, flag)) != status) { - if (((ald_get_tick()) - tick) > timeout) { - ald_usart_interrupt_config(hperh, USART_IT_TXE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_RXNE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_PE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, DISABLE); - - return TIMEOUT; - } - } - - return OK; -} - -/** - * @brief Sends an amount of data in non blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __usart_send_by_it(usart_handle_t *hperh) -{ - if ((hperh->state != USART_STATE_BUSY_TX) && (hperh->state != USART_STATE_BUSY_TX_RX)) - return BUSY; - - if ((hperh->init.word_length == USART_WORD_LENGTH_9B) && (hperh->init.parity == USART_PARITY_NONE)) { - WRITE_REG(hperh->perh->DATA, (uint16_t)(*(uint16_t *)hperh->tx_buf & (uint16_t)0x01FF)); - hperh->tx_buf += 2; - } - else { - WRITE_REG(hperh->perh->DATA, *hperh->tx_buf++); - } - - if (--hperh->tx_count == 0) { - ald_usart_interrupt_config(hperh, USART_IT_TXE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_TC, ENABLE); - } - - return OK; -} - - -/** - * @brief Wraps up transmission in non blocking mode. - * @param hperh: pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __usart_end_send_by_it(usart_handle_t *hperh) -{ - ald_usart_interrupt_config(hperh, USART_IT_TC, DISABLE); - CLEAR_BIT(hperh->state, USART_STATE_TX_MASK); - - if (hperh->tx_cplt_cbk != NULL) - hperh->tx_cplt_cbk(hperh); - - return OK; -} - -/** - * @brief Receives an amount of data in non blocking mode - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __usart_recv_by_it(usart_handle_t *hperh) -{ - if ((hperh->state != USART_STATE_BUSY_RX) && (hperh->state != USART_STATE_BUSY_TX_RX)) - return BUSY; - - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - if (hperh->init.parity == USART_PARITY_NONE) { - *(uint16_t *)hperh->rx_buf = (uint16_t)(hperh->perh->DATA & (uint16_t)0x01FF); - hperh->rx_buf += 2; - } - else { - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - } - } - else { - if (hperh->init.parity == USART_PARITY_NONE) - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - else - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0x7F); - } - - if (__frame_mode && ((ald_usart_get_it_status(hperh, USART_IT_IDLE)) == RESET)) - ald_usart_interrupt_config(hperh, USART_IT_IDLE, ENABLE); - - if (--hperh->rx_count == 0) { - ald_usart_interrupt_config(hperh, USART_IT_RXNE, DISABLE); - CLEAR_BIT(hperh->state, USART_STATE_RX_MASK); - __frame_mode = 0; - - if (hperh->state == USART_STATE_READY) { - ald_usart_interrupt_config(hperh, USART_IT_PE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, DISABLE); - } - - if (hperh->rx_cplt_cbk != NULL) - hperh->rx_cplt_cbk(hperh); - } - - return OK; -} - -/** - * @brief Receives an frame complete in non blocking mode - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __usart_recv_frame_cplt(usart_handle_t *hperh) -{ - if ((hperh->state != USART_STATE_BUSY_RX) && (hperh->state != USART_STATE_BUSY_TX_RX)) - return BUSY; - - ald_usart_interrupt_config(hperh, USART_IT_IDLE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_RXNE, DISABLE); - CLEAR_BIT(hperh->state, USART_STATE_RX_MASK); - - __frame_mode = 0; - hperh->rx_size -= hperh->rx_count; - - if (hperh->state == USART_STATE_READY) { - ald_usart_interrupt_config(hperh, USART_IT_PE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, DISABLE); - } - - if (hperh->rx_cplt_cbk != NULL) - hperh->rx_cplt_cbk(hperh); - - return OK; -} - - - -/** - * @brief Simplex Receive an amount of data in non-blocking mode. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __usart_recv_by_it_sync(usart_handle_t *hperh) -{ - if (hperh->state != USART_STATE_BUSY_RX) - return BUSY; - - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - - if (hperh->init.parity == USART_PARITY_NONE) { - *(uint16_t *)hperh->rx_buf = (uint16_t)(hperh->perh->DATA & 0x1FF); - hperh->rx_buf += 2; - } - else { - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - } - - if (--hperh->rx_count != 0x00) - WRITE_REG(hperh->perh->DATA, (DUMMY_DATA & 0x1FF)); - } - else { - if (hperh->init.parity == USART_PARITY_NONE) - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - else - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0x7F); - - if (--hperh->rx_count != 0x00) - hperh->perh->DATA = (DUMMY_DATA & 0xFF); - } - - if (hperh->rx_count == 0) { - ald_usart_interrupt_config(hperh, USART_IT_RXNE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_PE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, DISABLE); - hperh->state = USART_STATE_READY; - - if (hperh->rx_cplt_cbk != NULL) - hperh->rx_cplt_cbk(hperh); - } - - return OK; -} - -/** - * @brief Full-Duplex Send receive an amount of data in full-duplex mode (non-blocking). - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval Status, see @ref ald_status_t. - */ -static ald_status_t __usart_send_recv_by_it_sync(usart_handle_t *hperh) -{ - if (hperh->state != USART_STATE_BUSY_TX_RX) - return BUSY; - - if (hperh->tx_count != 0) { - if (ald_usart_get_flag_status(hperh, USART_FLAG_TXE) != RESET) { - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - if (hperh->init.parity == USART_PARITY_NONE) { - WRITE_REG(hperh->perh->DATA, (uint16_t)(*(uint16_t *)hperh->tx_buf & 0x1FF)); - hperh->tx_buf += 2; - } - else { - WRITE_REG(hperh->perh->DATA, *hperh->tx_buf++); - } - } - else { - WRITE_REG(hperh->perh->DATA, *hperh->tx_buf++); - } - - if (--hperh->tx_count == 0) - ald_usart_interrupt_config(hperh, USART_IT_TXE, DISABLE); - } - } - - if (hperh->rx_count != 0) { - if (ald_usart_get_flag_status(hperh, USART_FLAG_RXNE) != RESET) { - if (hperh->init.word_length == USART_WORD_LENGTH_9B) { - if (hperh->init.parity == USART_PARITY_NONE) { - *(uint16_t *)hperh->rx_buf = (uint16_t)(hperh->perh->DATA & 0x1FF); - hperh->rx_buf += 2; - } - else { - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - } - } - else { - if (hperh->init.parity == USART_PARITY_NONE) - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0xFF); - else - *hperh->rx_buf++ = (uint8_t)(hperh->perh->DATA & 0x7F); - } - - --hperh->rx_count; - } - } - - if (hperh->rx_count == 0) { - ald_usart_interrupt_config(hperh, USART_IT_RXNE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_PE, DISABLE); - ald_usart_interrupt_config(hperh, USART_IT_ERR, DISABLE); - - hperh->state = USART_STATE_READY; - - if (hperh->tx_rx_cplt_cbk != NULL) - hperh->tx_rx_cplt_cbk(hperh); - } - - return OK; -} - -/** - * @brief Configures the USART peripheral. - * @param hperh: Pointer to a usart_handle_t structure that contains - * the configuration information for the specified USART module. - * @retval None - */ -static void usart_set_config (usart_handle_t *hperh) -{ - uint32_t tmp; - uint32_t integer; - uint32_t fractional; - - /* Check the parameters */ - assert_param(IS_USART(hperh->perh)); - assert_param(IS_USART_BAUDRATE(hperh->init.baud)); - assert_param(IS_USART_WORD_LENGTH(hperh->init.word_length)); - assert_param(IS_USART_STOPBITS(hperh->init.stop_bits)); - assert_param(IS_USART_PARITY(hperh->init.parity)); - assert_param(IS_USART_MODE(hperh->init.mode)); - assert_param(IS_USART_HARDWARE_FLOW_CONTROL(hperh->init.fctl)); - - MODIFY_REG(hperh->perh->CON1, USART_CON1_STPLEN_MSK, hperh->init.stop_bits << USART_CON1_STPLEN_POSS); - tmp = READ_REG(hperh->perh->CON0); - MODIFY_REG(tmp, USART_CON0_DLEN_MSK, hperh->init.word_length << USART_CON0_DLEN_POS); - - if (hperh->init.parity == USART_PARITY_NONE) - CLEAR_BIT(tmp, USART_CON0_PEN_MSK); - else - SET_BIT(tmp, USART_CON0_PEN_MSK); - - if (hperh->init.parity == USART_PARITY_ODD) - SET_BIT(tmp, USART_CON0_PSEL_MSK); - else - CLEAR_BIT(tmp, USART_CON0_PSEL_MSK); - - WRITE_REG(hperh->perh->CON0, tmp); - MODIFY_REG(hperh->perh->CON2, USART_CON2_RTSEN_MSK, (hperh->init.fctl & 0x1) << USART_CON2_RTSEN_POS); - MODIFY_REG(hperh->perh->CON2, USART_CON2_CTSEN_MSK, ((hperh->init.fctl >> 1) & 0x1) << USART_CON2_CTSEN_POS); - MODIFY_REG(hperh->perh->CON0, USART_CON0_RXEN_MSK, (hperh->init.mode & 0x1) << USART_CON0_RXEN_POS); - MODIFY_REG(hperh->perh->CON0, USART_CON0_TXEN_MSK, ((hperh->init.mode >> 1) & 0x1) << USART_CON0_TXEN_POS); - - /* Determine the integer part */ - integer = ((25 * ald_cmu_get_pclk1_clock()) / (4 * (hperh->init.baud))); - tmp = (integer / 100) << 4; - - /* Determine the fractional part */ - fractional = integer - (100 * (tmp >> 4)); - tmp |= ((((fractional * 16) + 50) / 100) & ((uint8_t)0x0F)); - WRITE_REG(hperh->perh->BAUDCON, (uint16_t)tmp); - - return; -} -/** - * @} - */ -#endif /* ALD_USART */ -/** - * @} - */ -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_wdt.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_wdt.c deleted file mode 100644 index d19a0397ab..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/ald_wdt.c +++ /dev/null @@ -1,214 +0,0 @@ -/** - ********************************************************************************* - * - * @file ald_wdt.c - * @brief WDT module driver. - * - * @version V1.0 - * @date 18 Dec 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ -#include "ald_conf.h" -#include "ald_wdt.h" - - -/** @addtogroup ES32FXXX_ALD - * @{ - */ - -/** @defgroup WDT WDT - * @brief WDT module driver - * @{ - */ -#ifdef ALD_WDT - - -/** @defgroup WWDT_Public_Functions WWDT Public Functions - * @brief Init and configure WWDT function - * @{ - */ -/** - * @brief Initializes the WWDT according to the specified parameters. - * @param load: Specifies the free-running downcounter value. - * @param win: specifics the no dog windows, - * the parameter can be one of the following values: - * @arg @ref WWDT_WIN_25 No dog window size: 25% - * @arg @ref WWDT_WIN_50 No dog window size: 50% - * @arg @ref WWDT_WIN_75 No dog window size: 75% - * @arg @ref WWDT_WIN_00 No dog window size: 0% - * @param interrupt: Enable or disable interrupt. - * @retval None - */ -void ald_wwdt_init(uint32_t load, wwdt_win_t win, type_func_t interrupt) -{ - assert_param(IS_WWDT_WIN_TYPE(win)); - assert_param(IS_FUNC_STATE(interrupt)); - - WWDT_UNLOCK(); - WRITE_REG(WWDT->LOAD, load); - MODIFY_REG(WWDT->CON, WWDT_CON_WWDTWIN_MSK, win << WWDT_CON_WWDTWIN_POSS); - SET_BIT(WWDT->CON, WWDT_CON_CLKS_MSK); - SET_BIT(WWDT->CON, WWDT_CON_RSTEN_MSK); - MODIFY_REG(WWDT->CON, WWDT_CON_IE_MSK, interrupt << WWDT_CON_IE_POS); - WWDT_LOCK(); - - return; -} - -/** - * @brief Start the WWDT - * @retval None - */ -void ald_wwdt_start(void) -{ - WWDT_UNLOCK(); - SET_BIT(WWDT->CON, WWDT_CON_EN_MSK); - WWDT_LOCK(); - - return; -} - -/** - * @brief Get the free-running downcounter value - * @retval Value - */ -uint32_t ald_wwdt_get_value(void) -{ - return WWDT->VALUE; -} - -/** - * @brief Get interrupt state - * @retval Value - */ -it_status_t ald_wwdt_get_flag_status(void) -{ - if (READ_BIT(WWDT->RIS, WWDT_RIS_WWDTIF_MSK)) - return SET; - - return RESET; -} - -/** - * @brief Clear interrupt state - * @retval None - */ -void ald_wwdt_clear_flag_status(void) -{ - WRITE_REG(WWDT->INTCLR, 1); - return; -} - -/** - * @brief Refreshes the WWDT - * @retval None - */ -void ald_wwdt_feed_dog(void) -{ - WWDT_UNLOCK(); - WRITE_REG(WWDT->INTCLR, 0x1); - WWDT_LOCK(); - - return; -} -/** - * @} - */ - -/** @defgroup IWDT_Public_Functions IWDT Public Functions - * @brief Init and configure IWDT function - * @{ - */ -/** - * @brief Initializes the IWDG according to the specified parameters. - * @param load: Specifies the free-running downcounter value. - * @param interrupt: Enable or disable interrupt. - * @retval None - */ -void ald_iwdt_init(uint32_t load, type_func_t interrupt) -{ - assert_param(IS_FUNC_STATE(interrupt)); - - IWDT_UNLOCK(); - WRITE_REG(IWDT->LOAD, load); - SET_BIT(IWDT->CON, IWDT_CON_CLKS_MSK); - SET_BIT(IWDT->CON, IWDT_CON_RSTEN_MSK); - MODIFY_REG(IWDT->CON, IWDT_CON_IE_MSK, interrupt << IWDT_CON_IE_POS); - IWDT_LOCK(); - - return; -} - -/** - * @brief Start the IWDT - * @retval None - */ -void ald_iwdt_start(void) -{ - IWDT_UNLOCK(); - SET_BIT(IWDT->CON, IWDT_CON_EN_MSK); - IWDT_LOCK(); - - return; -} - -/** - * @brief Get the free-running downcounter value - * @retval Value - */ -uint32_t ald_iwdt_get_value(void) -{ - return IWDT->VALUE; -} - -/** - * @brief Get interrupt state - * @retval Value - */ -it_status_t ald_iwdt_get_flag_status(void) -{ - if (READ_BIT(IWDT->RIS, IWDT_RIS_WDTIF_MSK)) - return SET; - - return RESET; -} - -/** - * @brief Clear interrupt state - * @retval None - */ -void ald_iwdt_clear_flag_status(void) -{ - WRITE_REG(IWDT->INTCLR, 1); - return; -} - -/** - * @brief Refreshes the WWDT - * @retval None - */ -void ald_iwdt_feed_dog(void) -{ - IWDT_UNLOCK(); - WRITE_REG(IWDT->INTCLR, 1); - IWDT_LOCK(); - - return; -} -/** - * @} - */ - -#endif /* ALD_WDT */ -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/utils.c b/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/utils.c deleted file mode 100644 index e406c53afc..0000000000 --- a/bsp/essemi/es32f0334/libraries/ES32F033x_ALD_StdPeriph_Driver/Source/utils.c +++ /dev/null @@ -1,440 +0,0 @@ -/** - ********************************************************************************* - * - * @file utils.c - * @brief This file contains the Utilities functions/types for the driver. - * - * @version V1.0 - * @date 07 Nov 2017 - * @author AE Team - * @note - * - * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. - * - ********************************************************************************* - */ - -#include -#include "utils.h" -#include "ald_dma.h" -#include "ald_cmu.h" - - -/** @defgroup ES32FXXX_ALD EASTSOFT ES32F0xx ALD - * @brief Shanghai Eastsoft Microelectronics Cortex-M Chip Abstraction Layer Driver(ALD) - * @{ - */ - -/** @defgroup UTILS Utils - * @brief Utils module driver - * @{ - */ - -/** @defgroup ALD_Private_Constants Private Constants - * @brief ALD Private Constants - * @{ - */ - -/** - * @brief ALD version number - */ -#define __ALD_VERSION_MAIN (0x01) /**< [31:24] main version */ -#define __ALD_VERSION_SUB1 (0x00) /**< [23:16] sub1 version */ -#define __ALD_VERSION_SUB2 (0x00) /**< [15:8] sub2 version */ -#define __ALD_VERSION_RC (0x00) /**< [7:0] release candidate */ -#define __ALD_VERSION ((__ALD_VERSION_MAIN << 24) | \ - (__ALD_VERSION_SUB1 << 16) | \ - (__ALD_VERSION_SUB2 << 8 ) | \ - (__ALD_VERSION_RC)) -/** - * @} - */ - -/** @defgroup ALD_Private_Variables Private Variables - * @{ - */ -/** @brief lib_tick: Increase by one millisecond - */ -static __IO uint32_t lib_tick; -uint32_t __systick_interval = SYSTICK_INTERVAL_1MS; -/** - * @} - */ - - -/** @defgroup ALD_Public_Functions Public Functions - * @{ - */ - -/** @defgroup ALD_Public_Functions_Group1 Initialization Function - * @brief Initialization functions - * - * @verbatim - =============================================================================== - ##### Initialization functions ##### - =============================================================================== - [..] This section provides functions allowing to: - (+) Initializes interface, the NVIC allocation and initial clock - configuration. It initializes the source of time base also when timeout - is needed and the backup domain when enabled. - (+) Configure The time base source to have 1ms time base with a dedicated - Tick interrupt priority. - (++) Systick timer is used by default as source of time base, but user - can eventually implement his proper time base source (a general purpose - timer for example or other time source), keeping in mind that Time base - duration should be kept 1ms. - (++) Time base configuration function (ald_tick_init()) is called automatically - at the beginning of the program after reset by ald_cmu_init() or at - any time when clock is configured. - (++) Source of time base is configured to generate interrupts at regular - time intervals. Care must be taken if ald_delay_ms() is called from a - peripheral ISR process, the Tick interrupt line must have higher priority - (numerically lower) than the peripheral interrupt. Otherwise the caller - ISR process will be blocked. - (++) functions affecting time base configurations are declared as __weak - to make override possible in case of other implementations in user file. - (+) Configure the interval of Systick interrupt. - - @endverbatim - * @{ - */ - -/** - * @brief This function Configures time base source, NVIC and DMA. - * @note This function is called at the beginning of program after reset and before - * the clock configuration. - * @note The time base configuration is based on MSI clock when exiting from Reset. - * Once done, time base tick start incrementing. - * In the default implementation, Systick is used as source of time base. - * The tick variable is incremented each 1ms in its ISR. - * @retval None - */ -void ald_cmu_init(void) -{ - ald_cmu_clock_config_default(); - ald_tick_init(TICK_INT_PRIORITY); -#ifdef ALD_DMA - ald_dma_init(DMA0); -#endif - return; -} - -/** - * @brief This function configures the source of the time base. - * The time source is configured to have 1ms time base with a dedicated - * Tick interrupt priority. - * @note In the default implementation, SysTick timer is the source of time base. - * It is used to generate interrupts at regular time intervals. - * Care must be taken if ald_delay_ms() is called from a peripheral ISR process, - * The SysTick interrupt must have higher priority (numerically lower) - * than the peripheral interrupt. Otherwise the caller ISR process will be blocked. - * The function is declared as __weak to be overwritten in case of other - * implementation in user file. - * @param prio: Tick interrupt priority. - * @retval None - */ -__weak void ald_tick_init(uint32_t prio) -{ - /* Configure the SysTick IRQ */ - SysTick_Config(ald_cmu_get_sys_clock() / SYSTICK_INTERVAL_1MS); - - if (prio != 3) - NVIC_SetPriority(SysTick_IRQn, prio); - - return; -} - -/** - * @brief Selects the interval of systick interrupt. - * @param value: The value of interval: - * @arg @ref SYSTICK_INTERVAL_1MS 1 millisecond - * @arg @ref SYSTICK_INTERVAL_10MS 10 milliseconds - * @arg @ref SYSTICK_INTERVAL_100MS 100 milliseconds - * @arg @ref SYSTICK_INTERVAL_1000MS 1 second - * @retval None - */ -void ald_systick_interval_select(systick_interval_t value) -{ - assert_param(IS_SYSTICK_INTERVAL(value)); - - SysTick_Config(ald_cmu_get_sys_clock() / value); - __systick_interval = value; - - if (TICK_INT_PRIORITY != 3) - NVIC_SetPriority(SysTick_IRQn, TICK_INT_PRIORITY); - - return; -} -/** - * @} - */ - -/** @defgroup ALD_Public_Functions_Group2 Control functions - * @brief Control functions - * - * @verbatim - =============================================================================== - ##### Control functions ##### - =============================================================================== - [..] This section provides functions allowing to: - (+) Provide a tick value in millisecond - (+) Provide a blocking delay in millisecond - (+) Suspend the time base source interrupt - (+) Resume the time base source interrupt - (+) Get the ALD version - (+) Waiting for flag - (+) Configure the interrupt - (+) Provide system tick value - (+) Get CPU ID - (+) Get UID - (+) Get CHIPID - - @endverbatim - * @{ - */ - -/** - * @brief This function is called to increment a global variable "lib_tick" - * used as application time base. - * @note In the default implementation, this variable is incremented each 1ms - * in Systick ISR. - * @note This function is declared as __weak to be overwritten in case of other - * implementations in user file. - * @retval None - */ -__weak void ald_inc_tick_weak(void) -{ - ++lib_tick; -} - -/** - * @brief This function invoked by Systick ISR. - * @note This function is declared as __weak to be overwritten in case of - * other implementations in user file. - * @retval None - */ -__weak void ald_systick_irq_cbk(void) -{ - /* do nothing */ - return; -} - -/** - * @brief This function invoked by Systick ISR each 1ms. - * @retval None - */ -__isr__ void ald_inc_tick(void) -{ - ald_inc_tick_weak(); - ald_systick_irq_cbk(); - - return; -} - -/** - * @brief Provides a tick value in millisecond. - * @note This function is declared as __weak to be overwritten in case of other - * implementations in user file. - * @retval tick value - */ -__weak uint32_t ald_get_tick(void) -{ - return lib_tick; -} - -/** - * @brief This function provides accurate delay (in milliseconds) based - * on variable incremented. - * @note In the default implementation, SysTick timer is the source of time base. - * It is used to generate interrupts at regular time intervals where lib_tick - * is incremented. - * @note This function is declared as __weak to be overwritten in case of other - * implementations in user file. - * @param delay: specifies the delay time length, in milliseconds. - * @retval None - */ -__weak void ald_delay_ms(__IO uint32_t delay) -{ - uint32_t tick, __delay; - - switch (__systick_interval) { - case SYSTICK_INTERVAL_1MS: - __delay = delay; - break; - - case SYSTICK_INTERVAL_10MS: - __delay = delay / 10; - break; - - case SYSTICK_INTERVAL_100MS: - __delay = delay / 100; - break; - - case SYSTICK_INTERVAL_1000MS: - __delay = delay / 1000; - break; - - default: - __delay = delay; - break; - } - - tick = ald_get_tick(); - __delay = __delay == 0 ? 1 : __delay; - - while ((ald_get_tick() - tick) < __delay) - ; -} - -/** - * @brief Suspend Tick increment. - * @note In the default implementation, SysTick timer is the source of time base. - * It is used to generate interrupts at regular time intervals. - * Once ald_suspend_tick() is called, the the SysTick interrupt - * will be disabled and so Tick increment is suspended. - * @note This function is declared as __weak to be overwritten - * in case of other implementations in user file. - * @retval None - */ -__weak void ald_suspend_tick(void) -{ - CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); -} - -/** - * @brief Resume Tick increment. - * @note In the default implementation, SysTick timer is the source of - * time base. It is used to generate interrupts at regular time - * intervals. Once ald_resume_tick() is called, the the SysTick - * interrupt will be enabled and so Tick increment is resumed. - * @note This function is declared as __weak to be overwritten - * in case of other implementations in user file. - * @retval None - */ -__weak void ald_resume_tick(void) -{ - SET_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); -} - -/** - * @brief This method returns the ALD revision - * @retval version: 0xXYZR (8bits for each decimal, R for RC) - */ -uint32_t ald_get_ald_version(void) -{ - return __ALD_VERSION; -} - -/** - * @brief Waiting the specified bit in the register change to SET/RESET. - * @param reg: The register address. - * @param bit: The specified bit. - * @param status: The status for waiting. - * @param timeout: Timeout duration. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_wait_flag(uint32_t *reg, uint32_t bit, flag_status_t status, uint32_t timeout) -{ - uint32_t tick = ald_get_tick(); - - assert_param(timeout > 0); - - if (status == SET) { - while (!(IS_BIT_SET(*reg, bit))) { - if (((ald_get_tick()) - tick) > timeout) - return TIMEOUT; - } - } - else { - while ((IS_BIT_SET(*reg, bit))) { - if (((ald_get_tick()) - tick) > timeout) - return TIMEOUT; - } - } - - return OK; -} - -/** - * @brief Configure interrupt. - * @param irq: Interrunpt type. - * @param prio: preempt priority(0-3). - * @param status: Status. - * @arg ENABLE - * @arg DISABLE - * @retval None - */ -void ald_mcu_irq_config(IRQn_Type irq, uint8_t prio, type_func_t status) -{ - assert_param(IS_FUNC_STATE(status)); - assert_param(IS_PRIO(prio)); - - if (status == ENABLE) { - NVIC_SetPriority(irq, prio); - NVIC_EnableIRQ(irq); - } - else { - NVIC_DisableIRQ(irq); - } - - return; -} - -/** - * @brief Get the system tick. - * @retval The value of current tick. - */ -uint32_t ald_mcu_get_tick(void) -{ - uint32_t load = SysTick->LOAD; - uint32_t val = SysTick->VAL; - - return (load - val); -} - -/** - * @brief Get the CPU ID. - * @retval CPU ID. - */ -uint32_t ald_mcu_get_cpu_id(void) -{ - return SCB->CPUID; -} - -/** - * @brief Get the UID. - * @param buf: Pointer to UID, len: 12Bytes(96-bits) - * @retval None - */ -void ald_mcu_get_uid(uint8_t *buf) -{ - memcpy(&buf[0], (void *)MCU_UID0_ADDR, 4); - memcpy(&buf[4], (void *)MCU_UID1_ADDR, 4); - memcpy(&buf[8], (void *)MCU_UID2_ADDR, 4); - - return; -} - -/** - * @brief Get the CHIPID - * @retval CHPID - */ -uint32_t ald_mcu_get_chipid(void) -{ - return (uint32_t)*(uint32_t *)MCU_CHIPID_ADDR; -} -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ diff --git a/bsp/essemi/es32f0334/libraries/SConscript b/bsp/essemi/es32f0334/libraries/SConscript deleted file mode 100644 index 7a04540b4e..0000000000 --- a/bsp/essemi/es32f0334/libraries/SConscript +++ /dev/null @@ -1,27 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() - -# The set of source files associated with this SConscript file. -src = [] - -src += Glob('ES32F033x_ALD_StdPeriph_Driver/Source/*.c') - -#add for startup script -if rtconfig.CROSS_TOOL == 'gcc': - src = src + ['CMSIS/Device/EastSoft/es32f033x/Startup/gcc/startup_es32f033x.s'] -elif rtconfig.CROSS_TOOL == 'keil': - src = src + ['CMSIS/Device/EastSoft/es32f033x/Startup/keil/startup_es32f033x.s'] -elif rtconfig.CROSS_TOOL == 'iar': - src = src + ['CMSIS/Device/EastSoft/es32f033x/Startup/iar/startup_es32f033x.s'] - -path = [cwd + '/CMSIS/Device/EastSoft/es32f033x/Include', - cwd + '/CMSIS/Include', - cwd + '/ES32F033x_ALD_StdPeriph_Driver/Include'] - -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, CPPDEFINES = ['ES32F033x']) - -Return('group') diff --git a/bsp/essemi/es32f0334/project.uvoptx b/bsp/essemi/es32f0334/project.uvoptx deleted file mode 100644 index 1282ebe195..0000000000 --- a/bsp/essemi/es32f0334/project.uvoptx +++ /dev/null @@ -1,1138 +0,0 @@ - - - - 1.0 - -
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj; *.o - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - 0 - - - - 0 - 0 - - - - rt-thread - 0x4 - ARM-ADS - - 12000000 - - 1 - 1 - 0 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 1 - 0 - 1 - - 255 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 3 - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - 0 - CMSIS_AGDI - -X"Any" -UAny -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0ES32F033x.FLM -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM) - - - 0 - JL2CM3 - -U12345678 -O78 -S4 -ZTIFSpeedSel2000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0ES32F033x.FLM -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM) - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F033x -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM)) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - 0 - 0 - 0 - - - - - - - - - - - - - Applications - 1 - 0 - 0 - 0 - - 1 - 1 - 1 - 0 - 0 - 0 - applications\main.c - main.c - 0 - 0 - - - - - cpu - 0 - 0 - 0 - 0 - - 2 - 2 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\backtrace.c - backtrace.c - 0 - 0 - - - 2 - 3 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\div0.c - div0.c - 0 - 0 - - - 2 - 4 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\showmem.c - showmem.c - 0 - 0 - - - 2 - 5 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\cortex-m0\cpuport.c - cpuport.c - 0 - 0 - - - 2 - 6 - 2 - 0 - 0 - 0 - ..\..\..\libcpu\arm\cortex-m0\context_rvds.S - context_rvds.S - 0 - 0 - - - - - DeviceDrivers - 0 - 0 - 0 - 0 - - 3 - 7 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\hwtimer\hwtimer.c - hwtimer.c - 0 - 0 - - - 3 - 8 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\i2c\i2c_core.c - i2c_core.c - 0 - 0 - - - 3 - 9 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\i2c\i2c_dev.c - i2c_dev.c - 0 - 0 - - - 3 - 10 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\i2c\i2c-bit-ops.c - i2c-bit-ops.c - 0 - 0 - - - 3 - 11 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\misc\pin.c - pin.c - 0 - 0 - - - 3 - 12 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\misc\adc.c - adc.c - 0 - 0 - - - 3 - 13 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\misc\rt_drv_pwm.c - rt_drv_pwm.c - 0 - 0 - - - 3 - 14 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\pm\pm.c - pm.c - 0 - 0 - - - 3 - 15 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\rtc\rtc.c - rtc.c - 0 - 0 - - - 3 - 16 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\serial\serial.c - serial.c - 0 - 0 - - - 3 - 17 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\spi\spi_core.c - spi_core.c - 0 - 0 - - - 3 - 18 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\spi\spi_dev.c - spi_dev.c - 0 - 0 - - - 3 - 19 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\completion.c - completion.c - 0 - 0 - - - 3 - 20 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\dataqueue.c - dataqueue.c - 0 - 0 - - - 3 - 21 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\pipe.c - pipe.c - 0 - 0 - - - 3 - 22 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\ringblk_buf.c - ringblk_buf.c - 0 - 0 - - - 3 - 23 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\ringbuffer.c - ringbuffer.c - 0 - 0 - - - 3 - 24 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\waitqueue.c - waitqueue.c - 0 - 0 - - - 3 - 25 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\workqueue.c - workqueue.c - 0 - 0 - - - - - Drivers - 0 - 0 - 0 - 0 - - 4 - 26 - 1 - 0 - 0 - 0 - drivers\board.c - board.c - 0 - 0 - - - 4 - 27 - 1 - 0 - 0 - 0 - drivers\drv_gpio.c - drv_gpio.c - 0 - 0 - - - 4 - 28 - 1 - 0 - 0 - 0 - drivers\drv_uart.c - drv_uart.c - 0 - 0 - - - - - finsh - 0 - 0 - 0 - 0 - - 5 - 29 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\shell.c - shell.c - 0 - 0 - - - 5 - 30 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\cmd.c - cmd.c - 0 - 0 - - - 5 - 31 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\msh.c - msh.c - 0 - 0 - - - - - Kernel - 0 - 0 - 0 - 0 - - 6 - 32 - 1 - 0 - 0 - 0 - ..\..\..\src\clock.c - clock.c - 0 - 0 - - - 6 - 33 - 1 - 0 - 0 - 0 - ..\..\..\src\components.c - components.c - 0 - 0 - - - 6 - 34 - 1 - 0 - 0 - 0 - ..\..\..\src\device.c - device.c - 0 - 0 - - - 6 - 35 - 1 - 0 - 0 - 0 - ..\..\..\src\idle.c - idle.c - 0 - 0 - - - 6 - 36 - 1 - 0 - 0 - 0 - ..\..\..\src\ipc.c - ipc.c - 0 - 0 - - - 6 - 37 - 1 - 0 - 0 - 0 - ..\..\..\src\irq.c - irq.c - 0 - 0 - - - 6 - 38 - 1 - 0 - 0 - 0 - ..\..\..\src\kservice.c - kservice.c - 0 - 0 - - - 6 - 39 - 1 - 0 - 0 - 0 - ..\..\..\src\mem.c - mem.c - 0 - 0 - - - 6 - 40 - 1 - 0 - 0 - 0 - ..\..\..\src\mempool.c - mempool.c - 0 - 0 - - - 6 - 41 - 1 - 0 - 0 - 0 - ..\..\..\src\object.c - object.c - 0 - 0 - - - 6 - 42 - 1 - 0 - 0 - 0 - ..\..\..\src\scheduler.c - scheduler.c - 0 - 0 - - - 6 - 43 - 1 - 0 - 0 - 0 - ..\..\..\src\signal.c - signal.c - 0 - 0 - - - 6 - 44 - 1 - 0 - 0 - 0 - ..\..\..\src\thread.c - thread.c - 0 - 0 - - - 6 - 45 - 1 - 0 - 0 - 0 - ..\..\..\src\timer.c - timer.c - 0 - 0 - - - - - Libraries - 0 - 0 - 0 - 0 - - 7 - 46 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_acmp.c - ald_acmp.c - 0 - 0 - - - 7 - 47 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_adc.c - ald_adc.c - 0 - 0 - - - 7 - 48 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_bkpc.c - ald_bkpc.c - 0 - 0 - - - 7 - 49 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_calc.c - ald_calc.c - 0 - 0 - - - 7 - 50 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_cmu.c - ald_cmu.c - 0 - 0 - - - 7 - 51 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_crc.c - ald_crc.c - 0 - 0 - - - 7 - 52 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_crypt.c - ald_crypt.c - 0 - 0 - - - 7 - 53 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_dma.c - ald_dma.c - 0 - 0 - - - 7 - 54 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_flash.c - ald_flash.c - 0 - 0 - - - 7 - 55 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_flash_ext.c - ald_flash_ext.c - 0 - 0 - - - 7 - 56 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_gpio.c - ald_gpio.c - 0 - 0 - - - 7 - 57 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_i2c.c - ald_i2c.c - 0 - 0 - - - 7 - 58 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_iap.c - ald_iap.c - 0 - 0 - - - 7 - 59 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lcd.c - ald_lcd.c - 0 - 0 - - - 7 - 60 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lptim.c - ald_lptim.c - 0 - 0 - - - 7 - 61 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lpuart.c - ald_lpuart.c - 0 - 0 - - - 7 - 62 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_pis.c - ald_pis.c - 0 - 0 - - - 7 - 63 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_pmu.c - ald_pmu.c - 0 - 0 - - - 7 - 64 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_rmu.c - ald_rmu.c - 0 - 0 - - - 7 - 65 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_rtc.c - ald_rtc.c - 0 - 0 - - - 7 - 66 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_smartcard.c - ald_smartcard.c - 0 - 0 - - - 7 - 67 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_spi.c - ald_spi.c - 0 - 0 - - - 7 - 68 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_timer.c - ald_timer.c - 0 - 0 - - - 7 - 69 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_trng.c - ald_trng.c - 0 - 0 - - - 7 - 70 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_tsense.c - ald_tsense.c - 0 - 0 - - - 7 - 71 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_uart.c - ald_uart.c - 0 - 0 - - - 7 - 72 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_usart.c - ald_usart.c - 0 - 0 - - - 7 - 73 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_wdt.c - ald_wdt.c - 0 - 0 - - - 7 - 74 - 1 - 0 - 0 - 0 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\utils.c - utils.c - 0 - 0 - - - 7 - 75 - 2 - 0 - 0 - 0 - libraries\CMSIS\Device\EastSoft\es32f033x\Startup\keil\startup_es32f033x.s - startup_es32f033x.s - 0 - 0 - - - -
diff --git a/bsp/essemi/es32f0334/project.uvprojx b/bsp/essemi/es32f0334/project.uvprojx deleted file mode 100644 index 6e1b30253a..0000000000 --- a/bsp/essemi/es32f0334/project.uvprojx +++ /dev/null @@ -1,871 +0,0 @@ - - - - 2.1 - -
### uVision Project, (C) Keil Software
- - - - rt-thread - 0x4 - ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC - 0 - - - ES32F0334LT - Eastsoft - Eastsoft.ES32_DFP.7.2350 - http://www.essemi.com - IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F033x -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM)) - 0 - $$Device:ES32F0334LT$Device\Include\es32f033x.h - - - - - - - - - - $$Device:ES32F0334LT$SVD\es32f0xx.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\ - rtthread - 1 - 0 - 0 - 1 - 1 - .\build\keil\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - - 0 - 0 - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -MPU - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - -MPU - TARMCM1.DLL - -pCM0 - - - - 1 - 0 - 0 - 0 - 16 - - - - - 1 - 0 - 0 - 1 - 1 - 4096 - - 1 - BIN\UL2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M0" - - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 0 - 3 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x8000 - - - 1 - 0x0 - 0x40000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x40000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x8000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - - ES32F033x - - applications;.;drivers;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m0;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;..\..\..\components\drivers\include;..\..\..\components\drivers\include;drivers;..\..\..\components\finsh;.;..\..\..\include;libraries\CMSIS\Device\EastSoft\es32f033x\Include;libraries\CMSIS\Include;libraries\ES32F033x_ALD_StdPeriph_Driver\Include - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x08000000 - 0x20000000 - - - - - - - - - - - - - Applications - - - main.c - 1 - applications\main.c - - - - - cpu - - - backtrace.c - 1 - ..\..\..\libcpu\arm\common\backtrace.c - - - div0.c - 1 - ..\..\..\libcpu\arm\common\div0.c - - - showmem.c - 1 - ..\..\..\libcpu\arm\common\showmem.c - - - cpuport.c - 1 - ..\..\..\libcpu\arm\cortex-m0\cpuport.c - - - context_rvds.S - 2 - ..\..\..\libcpu\arm\cortex-m0\context_rvds.S - - - - - DeviceDrivers - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 0 - - - - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 0 - 2 - 2 - 2 - 2 - 2 - 0 - 0 - 2 - 2 - 2 - 2 - 2 - - - - - - - - - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - - - - - - - - - - - - hwtimer.c - 1 - ..\..\..\components\drivers\hwtimer\hwtimer.c - - - i2c_core.c - 1 - ..\..\..\components\drivers\i2c\i2c_core.c - - - i2c_dev.c - 1 - ..\..\..\components\drivers\i2c\i2c_dev.c - - - i2c-bit-ops.c - 1 - ..\..\..\components\drivers\i2c\i2c-bit-ops.c - - - pin.c - 1 - ..\..\..\components\drivers\misc\pin.c - - - adc.c - 1 - ..\..\..\components\drivers\misc\adc.c - - - rt_drv_pwm.c - 1 - ..\..\..\components\drivers\misc\rt_drv_pwm.c - - - pm.c - 1 - ..\..\..\components\drivers\pm\pm.c - - - rtc.c - 1 - ..\..\..\components\drivers\rtc\rtc.c - - - serial.c - 1 - ..\..\..\components\drivers\serial\serial.c - - - spi_core.c - 1 - ..\..\..\components\drivers\spi\spi_core.c - - - spi_dev.c - 1 - ..\..\..\components\drivers\spi\spi_dev.c - - - completion.c - 1 - ..\..\..\components\drivers\src\completion.c - - - dataqueue.c - 1 - ..\..\..\components\drivers\src\dataqueue.c - - - pipe.c - 1 - ..\..\..\components\drivers\src\pipe.c - - - ringblk_buf.c - 1 - ..\..\..\components\drivers\src\ringblk_buf.c - - - ringbuffer.c - 1 - ..\..\..\components\drivers\src\ringbuffer.c - - - waitqueue.c - 1 - ..\..\..\components\drivers\src\waitqueue.c - - - workqueue.c - 1 - ..\..\..\components\drivers\src\workqueue.c - - - - - Drivers - - - board.c - 1 - drivers\board.c - - - drv_gpio.c - 1 - drivers\drv_gpio.c - - - drv_uart.c - 1 - drivers\drv_uart.c - - - - - finsh - - - shell.c - 1 - ..\..\..\components\finsh\shell.c - - - cmd.c - 1 - ..\..\..\components\finsh\cmd.c - - - msh.c - 1 - ..\..\..\components\finsh\msh.c - - - - - Kernel - - - clock.c - 1 - ..\..\..\src\clock.c - - - components.c - 1 - ..\..\..\src\components.c - - - device.c - 1 - ..\..\..\src\device.c - - - idle.c - 1 - ..\..\..\src\idle.c - - - ipc.c - 1 - ..\..\..\src\ipc.c - - - irq.c - 1 - ..\..\..\src\irq.c - - - kservice.c - 1 - ..\..\..\src\kservice.c - - - mem.c - 1 - ..\..\..\src\mem.c - - - mempool.c - 1 - ..\..\..\src\mempool.c - - - object.c - 1 - ..\..\..\src\object.c - - - scheduler.c - 1 - ..\..\..\src\scheduler.c - - - signal.c - 1 - ..\..\..\src\signal.c - - - thread.c - 1 - ..\..\..\src\thread.c - - - timer.c - 1 - ..\..\..\src\timer.c - - - - - Libraries - - - ald_acmp.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_acmp.c - - - ald_adc.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_adc.c - - - ald_bkpc.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_bkpc.c - - - ald_calc.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_calc.c - - - ald_cmu.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_cmu.c - - - ald_crc.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_crc.c - - - ald_crypt.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_crypt.c - - - ald_dma.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_dma.c - - - ald_flash.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_flash.c - - - ald_flash_ext.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_flash_ext.c - - - ald_gpio.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_gpio.c - - - ald_i2c.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_i2c.c - - - ald_iap.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_iap.c - - - ald_lcd.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lcd.c - - - ald_lptim.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lptim.c - - - ald_lpuart.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lpuart.c - - - ald_pis.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_pis.c - - - ald_pmu.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_pmu.c - - - ald_rmu.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_rmu.c - - - ald_rtc.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_rtc.c - - - ald_smartcard.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_smartcard.c - - - ald_spi.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_spi.c - - - ald_timer.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_timer.c - - - ald_trng.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_trng.c - - - ald_tsense.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_tsense.c - - - ald_uart.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_uart.c - - - ald_usart.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_usart.c - - - ald_wdt.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_wdt.c - - - utils.c - 1 - libraries\ES32F033x_ALD_StdPeriph_Driver\Source\utils.c - - - startup_es32f033x.s - 2 - libraries\CMSIS\Device\EastSoft\es32f033x\Startup\keil\startup_es32f033x.s - - - - - - - - - - - - - -
diff --git a/bsp/essemi/es32f0334/rtconfig.h b/bsp/essemi/es32f0334/rtconfig.h deleted file mode 100644 index 7354c8d7d8..0000000000 --- a/bsp/essemi/es32f0334/rtconfig.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef RT_CONFIG_H__ -#define RT_CONFIG_H__ - -/* Automatically generated file; DO NOT EDIT. */ -/* RT-Thread 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 100 -#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_DEBUG -#define RT_DEBUG_COLOR - -/* 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 - -/* RT-Thread Components */ - -#define RT_USING_COMPONENTS_INIT -#define RT_USING_USER_MAIN -#define RT_MAIN_THREAD_STACK_SIZE 2048 -#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 4096 -#define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT -#define FINSH_USING_MSH_ONLY -#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_HWTIMER -#define RT_USING_I2C -#define RT_USING_I2C_BITOPS -#define RT_USING_PIN -#define RT_USING_ADC -#define RT_USING_PWM -#define RT_USING_PM -#define RT_USING_RTC -#define RT_USING_SPI - -/* 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 */ - - -/* peripheral libraries and drivers */ - - -/* miscellaneous packages */ - - -/* samples: kernel and components samples */ - - -/* Hardware Drivers Config */ - -/* On-chip Peripheral Drivers */ - -#define BSP_USING_GPIO - -/* UART Drivers */ - -#define BSP_USING_UART1 - -/* SPI Drivers */ - - -/* I2C Drivers */ - - -/* PWM Drivers */ - - -/* HWtimer Drivers */ - - -/* RTC Drivers */ - - -/* PM Drivers */ - - -/* ADC Drivers */ - - -/* Onboard Peripheral Drivers */ - - -/* Offboard Peripheral Drivers */ - -/* Peripheral Drivers test example */ - -#define SOC_ES32F0334LT - -#endif diff --git a/bsp/essemi/es32f0334/rtconfig.py b/bsp/essemi/es32f0334/rtconfig.py deleted file mode 100644 index eb371bf3a7..0000000000 --- a/bsp/essemi/es32f0334/rtconfig.py +++ /dev/null @@ -1,135 +0,0 @@ -import os -import sys - -# toolchains options -CROSS_TOOL = 'keil' - -if os.getenv('RTT_CC'): - CROSS_TOOL = os.getenv('RTT_CC') - -# device options -ARCH = 'arm' -CPU = 'cortex-m0' - -# cross_tool provides the cross compiler -# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR -if CROSS_TOOL == 'gcc': # not support gcc yet - PLATFORM = 'gcc' - EXEC_PATH = 'C:/GCC' - -elif CROSS_TOOL == 'keil': - PLATFORM = 'armcc' - EXEC_PATH = 'C:/Keil' - -elif CROSS_TOOL == 'iar': # not support iar yet - PLATFORM = 'iar' - EXEC_PATH = 'C:/IAR' - -if os.getenv('RTT_EXEC_PATH'): - EXEC_PATH = os.getenv('RTT_EXEC_PATH') - -BUILD = 'debug' -#BUILD = 'release' - -if PLATFORM == 'gcc': - # toolchains - PREFIX = 'arm-none-eabi-' - CC = PREFIX + 'gcc' - CXX = PREFIX + 'g++' - AS = PREFIX + 'gcc' - AR = PREFIX + 'ar' - LINK = PREFIX + 'gcc' - TARGET_EXT = 'elf' - SIZE = PREFIX + 'size' - OBJDUMP = PREFIX + 'objdump' - OBJCPY = PREFIX + 'objcopy' - DEVICE = ' -mcpu=' + CPU + ' -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE - AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb' - LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T drivers/linker_scripts/link.lds' - - CPATH = '' - LPATH = '' - - if BUILD == 'debug': - CFLAGS += ' -O0 -gdwarf-2 -g' - AFLAGS += ' -gdwarf-2' - else: - CFLAGS += ' -O2' - - POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + OBJCPY + ' -O ihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n' -elif PLATFORM == 'armcc': - # toolchains - CC = 'armcc' - AS = 'armasm' - AR = 'armar' - LINK = 'armlink' - TARGET_EXT = 'axf' - - DEVICE = ' --device DARMSTM' - CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' - AFLAGS = DEVICE + ' --apcs=interwork ' - LFLAGS = DEVICE + ' --scatter "drivers/linker_scripts/link.sct" --info sizes --info totals --info unused --info veneers --list rtthread.map --strict' - - CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include' - LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/ARMCC/lib' - - CFLAGS += ' -D__MICROLIB ' - AFLAGS += ' --pd "__MICROLIB SETA 1" ' - LFLAGS += ' --library_type=microlib ' - EXEC_PATH += '/ARM/ARMCC/bin' - - 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 = '-Dewarm' - - 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 += ' --silent' - - AFLAGS = DEVICE - AFLAGS += ' -s+' - AFLAGS += ' -w+' - AFLAGS += ' -r' - AFLAGS += ' --cpu Cortex-M0' - AFLAGS += ' --fpu None' - AFLAGS += ' -S' - - LFLAGS = ' --config "drivers\linker_scripts\link.icf"' - LFLAGS += ' --redirect _Printf=_PrintfTiny' - LFLAGS += ' --redirect _Scanf=_ScanfSmall' - if BUILD == 'debug': - CFLAGS += ' --debug' - CFLAGS += ' -On' - else: - CFLAGS += ' -Oh' - - LFLAGS += ' --entry __iar_program_start' - EXEC_PATH = EXEC_PATH + '/arm/bin/' - POST_ACTION = '' diff --git a/bsp/essemi/es32f0334/template.uvoptx b/bsp/essemi/es32f0334/template.uvoptx deleted file mode 100644 index 1b420d4999..0000000000 --- a/bsp/essemi/es32f0334/template.uvoptx +++ /dev/null @@ -1,182 +0,0 @@ - - - - 1.0 - -
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj; *.o - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - 0 - - - - 0 - 0 - - - - rt-thread - 0x4 - ARM-ADS - - 12000000 - - 1 - 1 - 0 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 0 - 0 - 1 - - 255 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 3 - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - 0 - CMSIS_AGDI - -X"Any" -UAny -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0ES32F033x.FLM -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM) - - - 0 - JL2CM3 - -U12345678 -O78 -S4 -ZTIFSpeedSel2000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0ES32F033x.FLM -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM) - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F033x -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM)) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - 0 - 0 - 0 - - - - - - - - - - - -
diff --git a/bsp/essemi/es32f0334/template.uvprojx b/bsp/essemi/es32f0334/template.uvprojx deleted file mode 100644 index 37ac22a68d..0000000000 --- a/bsp/essemi/es32f0334/template.uvprojx +++ /dev/null @@ -1,389 +0,0 @@ - - - - 2.1 - -
### uVision Project, (C) Keil Software
- - - - rt-thread - 0x4 - ARM-ADS - 0 - - - ES32F0334LT - Eastsoft - Eastsoft.ES32_DFP.7.2350 - http://www.essemi.com - IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F033x -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM)) - 0 - $$Device:ES32F0334LT$Device\Include\es32f033x.h - - - - - - - - - - $$Device:ES32F0334LT$SVD\es32f0xx.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\ - rtthread - 1 - 0 - 0 - 1 - 1 - .\build\keil\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - - 0 - 0 - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -MPU - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - -MPU - TARMCM1.DLL - -pCM0 - - - - 1 - 0 - 0 - 0 - 16 - - - - - 1 - 0 - 0 - 1 - 1 - 4096 - - 1 - BIN\UL2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M0" - - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 0 - 3 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x8000 - - - 1 - 0x0 - 0x40000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x40000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x8000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x08000000 - 0x20000000 - - - - - - - - - - - - - - - - - - - -
diff --git a/bsp/essemi/es32f0654/applications/main.c b/bsp/essemi/es32f0654/applications/main.c index fd331eb8d9..10d69b22b0 100644 --- a/bsp/essemi/es32f0654/applications/main.c +++ b/bsp/essemi/es32f0654/applications/main.c @@ -10,8 +10,9 @@ #include #include +#include "drv_gpio.h" -#define LED_PIN 39 +#define LED_PIN GET_PIN( C , 8 ) int main(void) { diff --git a/bsp/essemi/es32f0654/drivers/board.c b/bsp/essemi/es32f0654/drivers/board.c index 7411168324..1719d06e20 100644 --- a/bsp/essemi/es32f0654/drivers/board.c +++ b/bsp/essemi/es32f0654/drivers/board.c @@ -127,6 +127,8 @@ void SysTick_Configuration(void) { /* ticks = sysclk / RT_TICK_PER_SECOND */ SysTick_Config(ald_cmu_get_sys_clock() / RT_TICK_PER_SECOND); + + __systick_interval = 1; } /** diff --git a/bsp/essemi/es32f0654/drivers/bsp_driver_example/i2c_sample.c b/bsp/essemi/es32f0654/drivers/bsp_driver_example/i2c_sample.c index c8a666609d..92a96b2e85 100644 --- a/bsp/essemi/es32f0654/drivers/bsp_driver_example/i2c_sample.c +++ b/bsp/essemi/es32f0654/drivers/bsp_driver_example/i2c_sample.c @@ -64,8 +64,6 @@ static void i2c_io_sample(int argc, char *argv[]) temp_msg.flags = RT_I2C_RD; /* I2C读 */ s_stat = rt_i2c_transfer(i2c_bus,&temp_msg,num_msg); /* 传输消息 */ - rt_thread_mdelay(400); - if( s_stat == num_msg ) { rt_kprintf("receive successful. \n receive messege : %s \n:",buffer); @@ -87,8 +85,6 @@ static void i2c_io_sample(int argc, char *argv[]) temp_msg.flags = RT_I2C_WR; /* I2C写 */ s_stat = rt_i2c_transfer(i2c_bus,&temp_msg,num_msg); /* 传输一条 */ - rt_thread_mdelay(400); - if( s_stat == num_msg ) { rt_kprintf(" send successful \n messege : %s \n:",buffer); diff --git a/bsp/essemi/es32f0654/drivers/bsp_driver_example/led_blink_sample.c b/bsp/essemi/es32f0654/drivers/bsp_driver_example/led_blink_sample.c index 42c956a060..fb5a98a279 100644 --- a/bsp/essemi/es32f0654/drivers/bsp_driver_example/led_blink_sample.c +++ b/bsp/essemi/es32f0654/drivers/bsp_driver_example/led_blink_sample.c @@ -19,9 +19,10 @@ #include #include #include +#include "drv_gpio.h" /* PIN脚编号,查看驱动文件drv_gpio.c确定 */ -#define LED_PIN_NUM 40 /*PB9*/ +#define LED_PIN_NUM GET_PIN(B,9) /*PB9*/ static int pin_num; static void led_entry(void *parameter) diff --git a/bsp/essemi/es32f0654/drivers/bsp_driver_example/pin_beep_sample.c b/bsp/essemi/es32f0654/drivers/bsp_driver_example/pin_beep_sample.c index 29dfbe1b2f..03e6b14ba1 100644 --- a/bsp/essemi/es32f0654/drivers/bsp_driver_example/pin_beep_sample.c +++ b/bsp/essemi/es32f0654/drivers/bsp_driver_example/pin_beep_sample.c @@ -16,16 +16,17 @@ #include #include +#include "drv_gpio.h" /* 引脚编号,通过查看驱动文件drv_gpio.c确定 */ #ifndef BEEP_PIN_NUM - #define BEEP_PIN_NUM 40 /* PB9 */ + #define BEEP_PIN_NUM GET_PIN(B,9) /* PB9 */ #endif #ifndef KEY0_PIN_NUM - #define KEY0_PIN_NUM 18 /* PF0 */ + #define KEY0_PIN_NUM GET_PIN(F,0) /* PF0 */ #endif #ifndef KEY1_PIN_NUM - #define KEY1_PIN_NUM 19 /* PF1 */ + #define KEY1_PIN_NUM GET_PIN(F,1) /* PF1 */ #endif void beep_on(void *args) diff --git a/bsp/essemi/es32f0654/drivers/bsp_driver_example/pm_sample.c b/bsp/essemi/es32f0654/drivers/bsp_driver_example/pm_sample.c index 78358e421c..d960bdd139 100644 --- a/bsp/essemi/es32f0654/drivers/bsp_driver_example/pm_sample.c +++ b/bsp/essemi/es32f0654/drivers/bsp_driver_example/pm_sample.c @@ -30,11 +30,12 @@ #include #include +#include "drv_gpio.h" #ifdef RT_USING_PM #define PM_NAME "pm" /* 设备名称 */ -#define WAKE_UP_PIN 19 /* 唤醒源 */ +#define WAKE_UP_PIN GET_PIN(F,0) /* 唤醒源 */ #define SLEEP_TIMES 12 /* 进入睡眠次数,轮流进入不同的睡眠模式,包括无睡眠模式 */ diff --git a/bsp/essemi/es32f0654/drivers/bsp_driver_example/pwm_led_sample.c b/bsp/essemi/es32f0654/drivers/bsp_driver_example/pwm_led_sample.c index 23ecfd227e..c2a0ed8fee 100644 --- a/bsp/essemi/es32f0654/drivers/bsp_driver_example/pwm_led_sample.c +++ b/bsp/essemi/es32f0654/drivers/bsp_driver_example/pwm_led_sample.c @@ -16,13 +16,13 @@ #include #include - +#include "drv_gpio.h" #ifdef RT_USING_PWM -#define LED_PIN_NUM 16 /* LED PIN脚编号,查看驱动文件drv_gpio.c确定 */ +#define LED_PIN_NUM GET_PIN(A,2) /* LED PIN脚编号,查看驱动文件drv_gpio.c确定 */ #define PWM_DEV_NAME "pwm1" /* PWM设备名称 */ -#define PWM_DEV_CHANNEL 1 /* PA8 PWM通道 */ +#define PWM_DEV_CHANNEL 1 /* PWM通道 */ struct rt_device_pwm *pwm_dev; /* PWM设备句柄 */ diff --git a/bsp/essemi/es32f0654/drivers/bsp_driver_example/uart_sample.c b/bsp/essemi/es32f0654/drivers/bsp_driver_example/uart_sample.c index cb750efe6e..efd893de21 100644 --- a/bsp/essemi/es32f0654/drivers/bsp_driver_example/uart_sample.c +++ b/bsp/essemi/es32f0654/drivers/bsp_driver_example/uart_sample.c @@ -12,16 +12,28 @@ * 例程导出了 uart_sample 命令到控制终端 * 命令调用格式:uart_sample uart2 * 命令解释:命令第二个参数是要使用的串口设备名称,为空则使用默认的串口设备 - * 程序功能:通过串口输出字符串"hello RT-Thread!",然后错位输出输入的字符 + * 程序功能:通过串口输出字符串"hello RT-Thread!",然后根据例子类型,处理输入数据,然后输出 */ #include -#define SAMPLE_UART_NAME "uart2" /* 串口设备名称 */ +/* UART_SAMPLE_TYPE = 1,错位输出 + = 2 接收到固定格式之后输出 +*/ +#define UART_SAMPLE_TYPE 1 + +#if (UART_SAMPLE_TYPE == 2) + +#define SAMPLE_UART_RXBUF_SIZE 256 /* 接收缓存大小 */ +#define SAMPLE_UART_END_SRTING "\r\n" /* 结尾固定格式 */ + +#endif + +#define SAMPLE_UART_NAME "uart0" /* 串口设备名称 */ /* 用于接收消息的信号量 */ static struct rt_semaphore rx_sem; -static rt_device_t serial; +static rt_device_t serial; /* 接收数据回调函数 */ static rt_err_t uart_input(rt_device_t dev, rt_size_t size) @@ -33,7 +45,8 @@ static rt_err_t uart_input(rt_device_t dev, rt_size_t size) } static void serial_thread_entry(void *parameter) -{ +{ +#if (UART_SAMPLE_TYPE == 1) char ch; while (1) @@ -48,6 +61,42 @@ static void serial_thread_entry(void *parameter) ch = ch + 1; rt_device_write(serial, 0, &ch, 1); } +#endif + +#if (UART_SAMPLE_TYPE == 2) + char rx_buf[SAMPLE_UART_RXBUF_SIZE],*end = SAMPLE_UART_END_SRTING; /*rx_buf[]:接收缓存,可修改大小 end[]:固定的结束格式(可修改,不可包含'\0')*/ + uint32_t rx_index = 0; /*接收数据的索引 */ + uint32_t end_len = rt_strlen(end); /*固定的结束格式的长度*/ + + while(1) + { + + /* 从串口读取一个字节的数据,没有读取到则等待接收信号量 */ + while (rt_device_read(serial, -1, (rx_buf + rx_index), 1) != 1) + { + /* 阻塞等待接收信号量,等到信号量后再次读取数据 */ + rt_sem_take(&rx_sem, RT_WAITING_FOREVER); + } + + rx_index++; + if(rx_index >= SAMPLE_UART_RXBUF_SIZE) + { + rt_kprintf("rx_buf over!\r\n"); /*范围越界*/ + } + + /*判断是否固定的结尾格式*/ + if((rx_index >= end_len)&&\ + ((rt_strncmp(end,(rx_buf + rx_index - end_len),end_len)) == 0)) + { + rt_device_write(serial, 0, rx_buf, rx_index); + rx_index = 0; + } + + } + + +#endif + } static int uart_sample(int argc, char *argv[]) diff --git a/bsp/essemi/es32f0654/drivers/drv_can.c b/bsp/essemi/es32f0654/drivers/drv_can.c index 7c73acd0cf..cf2d9d66d1 100644 --- a/bsp/essemi/es32f0654/drivers/drv_can.c +++ b/bsp/essemi/es32f0654/drivers/drv_can.c @@ -418,14 +418,14 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t } /* clear TIR */ h_can->perh->TxMailBox[box_num].TXID &= CAN_TXID0_TXMREQ_MSK; - /* Set up the Id */ + /* Set up the Id */ if (RT_CAN_STDID == pmsg->ide) - { - h_can->perh->TxMailBox[box_num].TXID |= (txheader.std << CAN_TXID0_STDID_POSS) | txheader.rtr; + { + h_can->perh->TxMailBox[box_num].TXID |= (txheader.std << CAN_TXID0_STDID_POSS) | (txheader.rtr << CAN_TXID0_RTR_POS); } else { - h_can->perh->TxMailBox[box_num].TXID |= (txheader.ext << CAN_TXID0_EXID_POSS) | txheader.type | txheader.rtr; + h_can->perh->TxMailBox[box_num].TXID |= (txheader.ext << CAN_TXID0_EXID_POSS) | (txheader.type << CAN_TXID0_IDE_POS) | (txheader.rtr << CAN_TXID0_RTR_POS); } /* Set up the DLC */ h_can->perh->TxMailBox[box_num].TXFCON = pmsg->len & 0x0FU; diff --git a/bsp/essemi/es32f0654/drivers/drv_gpio.c b/bsp/essemi/es32f0654/drivers/drv_gpio.c index 00050866e5..994b26ad94 100644 --- a/bsp/essemi/es32f0654/drivers/drv_gpio.c +++ b/bsp/essemi/es32f0654/drivers/drv_gpio.c @@ -314,12 +314,18 @@ void es32f0_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) rt_inline const struct pin_irq_map *get_pin_irq_map(rt_uint16_t gpio_pin) { - rt_int32_t mapindex = gpio_pin & 0x00FF; - if (mapindex < 0 || mapindex >= ITEM_NUM(pin_irq_map)) + uint8_t map_index = 0U; + + while(gpio_pin >> (++map_index)) + { + } + map_index--; + + if (map_index >= ITEM_NUM(pin_irq_map)) { return RT_NULL; } - return &pin_irq_map[mapindex]; + return &pin_irq_map[map_index]; }; rt_err_t es32f0_pin_attach_irq(struct rt_device *device, rt_int32_t pin, diff --git a/bsp/essemi/es32f0654/drivers/drv_gpio.h b/bsp/essemi/es32f0654/drivers/drv_gpio.h index b0b68714d3..21f564f937 100644 --- a/bsp/essemi/es32f0654/drivers/drv_gpio.h +++ b/bsp/essemi/es32f0654/drivers/drv_gpio.h @@ -26,6 +26,8 @@ #include "es_conf_info_gpio.h" +#define GET_PIN(port,pin) (ES_PIN_GPIO_##port##_##pin) + int rt_hw_pin_init(void); #endif diff --git a/bsp/essemi/es32f0654/drivers/drv_i2c.c b/bsp/essemi/es32f0654/drivers/drv_i2c.c index 1109b7f641..911f316687 100644 --- a/bsp/essemi/es32f0654/drivers/drv_i2c.c +++ b/bsp/essemi/es32f0654/drivers/drv_i2c.c @@ -81,9 +81,9 @@ static void _i2c_init(void) #ifdef BSP_USING_I2C1 -#if defined(ES_I2C1_SDA_GPIO_FUNC)&&defined(ES_I2C1_SDA_GPIO_PORT)&&defined(ES_I2C1_SDA_GPIO_PIN) - gpio_instruct.func = ES_I2C1_SDA_GPIO_FUNC; - ald_gpio_init(ES_I2C1_SDA_GPIO_PORT, ES_I2C1_SDA_GPIO_PIN, &gpio_instruct); +#if defined(ES_I2C1_SCL_GPIO_FUNC)&&defined(ES_I2C1_SCL_GPIO_PORT)&&defined(ES_I2C1_SCL_GPIO_PIN) + gpio_instruct.func = ES_I2C1_SCL_GPIO_FUNC; + ald_gpio_init(ES_I2C1_SCL_GPIO_PORT, ES_I2C1_SCL_GPIO_PIN, &gpio_instruct); #endif #if defined(ES_I2C1_SDA_GPIO_FUNC)&&defined(ES_I2C1_SDA_GPIO_PORT)&&defined(ES_I2C1_SDA_GPIO_PIN) diff --git a/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/gcc/startup_es32f065x.s b/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/gcc/startup_es32f065x.s new file mode 100644 index 0000000000..9f27a3d852 --- /dev/null +++ b/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/gcc/startup_es32f065x.s @@ -0,0 +1,299 @@ +/** + ****************************************************************************** + * @file startup_es32f065x.s + * @author AE Team + * @brief ES32F065x devices vector table for GCC toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M0 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + * @note + * Change Logs: + * Date Author Notes + * 10 Dec 2018 AE Team The first version + * + * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. 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. + ********************************************************************************** + */ + + .syntax unified + .arch armv6-m + .cpu cortex-m0 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + ldr r0, =_estack + mov sp, r0 /* set stack pointer */ + +/* Copy the data segment initializers from flash to SRAM */ + ldr r0, =_sdata + ldr r1, =_edata + ldr r2, =_sidata + movs r3, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r4, [r2, r3] + str r4, [r0, r3] + adds r3, r3, #4 + +LoopCopyDataInit: + adds r4, r0, r3 + cmp r4, r1 + bcc CopyDataInit + +/* Zero fill the bss segment. */ + ldr r2, =_sbss + ldr r4, =_ebss + movs r3, #0 + b LoopFillZerobss + +FillZerobss: + str r3, [r2] + adds r2, r2, #4 + +LoopFillZerobss: + cmp r2, r4 + bcc FillZerobss + + bl __libc_init_array + + bl main + +LoopForever: + b LoopForever + + +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex M0. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack /* 0, load top of stack */ + .word Reset_Handler /* 1, reset handler */ + .word NMI_Handler /* 2, nmi handler */ + .word HardFault_Handler /* 3, hard fault handler */ + .word 0 /* 4, Reserved */ + .word 0 /* 5, Reserved */ + .word 0 /* 6, Reserved */ + .word 0 /* 7, Reserved */ + .word 0 /* 8, Reserved */ + .word 0 /* 9, Reserved */ + .word 0 /* 10, Reserved */ + .word SVC_Handler /* 11, svcall handler */ + .word DebugMon_Handler /* 12, Debug Monitor Handler */ + .word 0 /* 13, Reserved */ + .word PendSV_Handler /* 14, pendsv handler */ + .word SysTick_Handler /* 15, systick handler */ + .word WWDG_IWDG_Handler /* 16, irq0 WWDG_IWDG handler */ + .word LVD_Handler /* 17, irq1 LVD handler */ + .word RTC_TSENSE_Handler /* 18, irq2 RTC handler */ + .word CRYPT_TRNG_Handler /* 19, irq3 CRYPT handler */ + .word CMU_Handler /* 20, irq4 CMU handler */ + .word EXTI0_3_Handler /* 21, irq5 EXTI0_3 handler */ + .word EXTI4_7_Handler /* 22, irq6 EXTI4_7 handler */ + .word EXTI8_11_Handler /* 23, irq7 EXTI8_11 handler */ + .word EXTI12_15_Handler /* 24, irq8 EXTI12_15 handler */ + .word DMA_Handler /* 25, irq9 DMA handler */ + .word CAN0_Handler /* 26, irq10 CAN0_CRYPT_TRNG handler */ + .word LPTIM0_SPI2_Handler /* 27, irq11 LPTIM0_SPI2 handler */ + .word ADC_ACMP_Handler /* 28, irq12 ADC_ACMP handler */ + .word AD16C4T0_BRK_UP_TRIG_COM_Handler /* 29, irq13 AD16C4T0_BRK_UP_TRIG_COM handler */ + .word AD16C4T0_CC_Handler /* 30, irq14 AD16C4T0_CC handler */ + .word BS16T0_Handler /* 31, irq15 BS16T0 handler */ + .word 0 /* 32, irq16 Reserved */ + .word GP16C2T0_Handler /* 33, irq17 GP16C2T0 handler */ + .word GP16C2T1_Handler /* 34, irq18 GP16C2T1 handler */ + .word BS16T1_UART2_Handler /* 35, irq19 BS16T1_UART2 handler */ + .word BS16T2_UART3_Handler /* 36, irq20 BS16T2_UART3 handler */ + .word GP16C4T0_LCD_Handler /* 37, irq21 GP16C4T0_LCD handler */ + .word BS16T3_DAC0_Handler /* 38, irq22 BS16T3_DAC0 handler */ + .word I2C0_Handler /* 39, irq23 I2C0 handler */ + .word I2C1_Handler /* 40, irq24 I2C1 handler */ + .word SPI0_Handler /* 41, irq25 SPI0 handler */ + .word SPI1_Handler /* 42, irq26 SPI1 handler */ + .word UART0_Handler /* 43, irq27 UART0 handler */ + .word UART1_Handler /* 44, irq28 UART1 handler */ + .word USART0_Handler /* 45, irq29 USART0 handler */ + .word USART1_Handler /* 46 irq30 USART1 handler */ + .word LPUART0_Handler /* 47, irq31 LPUART0 handler */ + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IWDG_Handler + .thumb_set WWDG_IWDG_Handler,Default_Handler + + .weak LVD_Handler + .thumb_set LVD_Handler,Default_Handler + + .weak RTC_TSENSE_Handler + .thumb_set RTC_TSENSE_Handler,Default_Handler + + .weak CRYPT_TRNG_Handler + .thumb_set CRYPT_TRNG_Handler,Default_Handler + + .weak CMU_Handler + .thumb_set CMU_Handler,Default_Handler + + .weak EXTI0_3_Handler + .thumb_set EXTI0_3_Handler,Default_Handler + + .weak EXTI4_7_Handler + .thumb_set EXTI4_7_Handler,Default_Handler + + .weak EXTI8_11_Handler + .thumb_set EXTI8_11_Handler,Default_Handler + + .weak EXTI12_15_Handler + .thumb_set EXTI12_15_Handler,Default_Handler + + .weak DMA_Handler + .thumb_set DMA_Handler,Default_Handler + + .weak CAN0_Handler + .thumb_set CAN0_Handler,Default_Handler + + .weak LPTIM0_SPI2_Handler + .thumb_set LPTIM0_SPI2_Handler,Default_Handler + + .weak ADC_ACMP_Handler + .thumb_set ADC_ACMP_Handler,Default_Handler + + .weak AD16C4T0_BRK_UP_TRIG_COM_Handler + .thumb_set AD16C4T0_BRK_UP_TRIG_COM_Handler,Default_Handler + + .weak AD16C4T0_CC_Handler + .thumb_set AD16C4T0_CC_Handler,Default_Handler + + .weak BS16T0_Handler + .thumb_set BS16T0_Handler,Default_Handler + + .weak GP16C2T0_Handler + .thumb_set GP16C2T0_Handler,Default_Handler + + .weak GP16C2T1_Handler + .thumb_set GP16C2T1_Handler,Default_Handler + + .weak BS16T1_UART2_Handler + .thumb_set BS16T1_UART2_Handler,Default_Handler + + .weak BS16T2_UART3_Handler + .thumb_set BS16T2_UART3_Handler,Default_Handler + + .weak GP16C4T0_LCD_Handler + .thumb_set GP16C4T0_LCD_Handler,Default_Handler + + .weak BS16T3_DAC0_Handler + .thumb_set BS16T3_DAC0_Handler,Default_Handler + + .weak I2C0_Handler + .thumb_set I2C0_Handler,Default_Handler + + .weak I2C1_Handler + .thumb_set I2C1_Handler,Default_Handler + + .weak SPI0_Handler + .thumb_set SPI0_Handler,Default_Handler + + .weak SPI1_Handler + .thumb_set SPI1_Handler,Default_Handler + + .weak UART0_Handler + .thumb_set UART0_Handler,Default_Handler + + .weak UART1_Handler + .thumb_set UART1_Handler,Default_Handler + + .weak USART0_Handler + .thumb_set USART0_Handler,Default_Handler + + .weak USART1_Handler + .thumb_set USART1_Handler,Default_Handler + + .weak LPUART0_Handler + .thumb_set LPUART0_Handler,Default_Handler + \ No newline at end of file diff --git a/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/iar/startup_es32f065x.s b/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/iar/startup_es32f065x.s index 265c345fb1..054b37dc64 100644 --- a/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/iar/startup_es32f065x.s +++ b/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/iar/startup_es32f065x.s @@ -3,8 +3,27 @@ ; description: es32f065x Device Startup File ; author : AE Team ; data : 10 Dec 2018 +; note +; Change Logs: +; Date Author Notes +; 10 Dec 2018 AE Team The first version +; ; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. 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. +;********************************************************************************* MODULE ?cstartup @@ -35,7 +54,7 @@ __vector_table DCD SysTick_Handler ;15, systick handler DCD WWDG_IWDG_Handler ;16, irq0 WWDG_IWDG handler DCD LVD_Handler ;17, irq1 LVD handler - DCD RTC_TEMP_Handler ;18, irq2 RTC handler + DCD RTC_TSENSE_Handler ;18, irq2 RTC handler DCD CRYPT_TRNG_Handler ;19, irq3 CRYPT handler DCD CMU_Handler ;20, irq4 CMU handler DCD EXTI0_3_Handler ;21, irq5 EXTI0_3 handler @@ -118,10 +137,10 @@ WWDG_IWDG_Handler LVD_Handler B LVD_Handler - PUBWEAK RTC_TEMP_Handler + PUBWEAK RTC_TSENSE_Handler SECTION .text:CODE:NOROOT:REORDER(1) -RTC_TEMP_Handler - B RTC_TEMP_Handler +RTC_TSENSE_Handler + B RTC_TSENSE_Handler PUBWEAK CRYPT_TRNG_Handler SECTION .text:CODE:NOROOT:REORDER(1) diff --git a/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/keil/startup_es32f065x.s b/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/keil/startup_es32f065x.s index dab56328c5..233ad8aab6 100644 --- a/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/keil/startup_es32f065x.s +++ b/bsp/essemi/es32f0654/libraries/CMSIS/Device/EastSoft/ES32F065x/Startup/keil/startup_es32f065x.s @@ -3,8 +3,27 @@ ; description: es32f065x Device Startup File ; author : AE Team ; data : 29 Aug 2017 +; note +; Change Logs: +; Date Author Notes +; 29 Aug 2017 AE Team The first version +; ; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. 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. +;********************************************************************************* ;Stack Configuration------------------------------------------------------------ Stack_Size EQU 0x00000400 diff --git a/bsp/essemi/es32f369x/applications/main.c b/bsp/essemi/es32f369x/applications/main.c index c8068e94d6..ed064d6f0a 100644 --- a/bsp/essemi/es32f369x/applications/main.c +++ b/bsp/essemi/es32f369x/applications/main.c @@ -10,13 +10,14 @@ #include #include +#include "drv_gpio.h" -#define LED_PIN 18 +#define LED_PIN GET_PIN( F , 0 ) int main(void) { int count = 1; - /* set PF00 pin mode to output */ + /* set pin mode to output */ rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT); while (count++) diff --git a/bsp/essemi/es32f369x/drivers/board.c b/bsp/essemi/es32f369x/drivers/board.c index ea42df63dc..ae52cbf5dc 100644 --- a/bsp/essemi/es32f369x/drivers/board.c +++ b/bsp/essemi/es32f369x/drivers/board.c @@ -129,6 +129,8 @@ void SysTick_Configuration(void) { /* ticks = sysclk / RT_TICK_PER_SECOND */ SysTick_Config(ald_cmu_get_sys_clock() / RT_TICK_PER_SECOND); + + __systick_interval = 1; } /** diff --git a/bsp/essemi/es32f369x/drivers/bsp_driver_example/i2c_sample.c b/bsp/essemi/es32f369x/drivers/bsp_driver_example/i2c_sample.c index c8a666609d..92a96b2e85 100644 --- a/bsp/essemi/es32f369x/drivers/bsp_driver_example/i2c_sample.c +++ b/bsp/essemi/es32f369x/drivers/bsp_driver_example/i2c_sample.c @@ -64,8 +64,6 @@ static void i2c_io_sample(int argc, char *argv[]) temp_msg.flags = RT_I2C_RD; /* I2C读 */ s_stat = rt_i2c_transfer(i2c_bus,&temp_msg,num_msg); /* 传输消息 */ - rt_thread_mdelay(400); - if( s_stat == num_msg ) { rt_kprintf("receive successful. \n receive messege : %s \n:",buffer); @@ -87,8 +85,6 @@ static void i2c_io_sample(int argc, char *argv[]) temp_msg.flags = RT_I2C_WR; /* I2C写 */ s_stat = rt_i2c_transfer(i2c_bus,&temp_msg,num_msg); /* 传输一条 */ - rt_thread_mdelay(400); - if( s_stat == num_msg ) { rt_kprintf(" send successful \n messege : %s \n:",buffer); diff --git a/bsp/essemi/es32f369x/drivers/bsp_driver_example/led_blink_sample.c b/bsp/essemi/es32f369x/drivers/bsp_driver_example/led_blink_sample.c index f1c9901ad0..6d75105695 100644 --- a/bsp/essemi/es32f369x/drivers/bsp_driver_example/led_blink_sample.c +++ b/bsp/essemi/es32f369x/drivers/bsp_driver_example/led_blink_sample.c @@ -18,10 +18,11 @@ #include #include -#include +#include +#include "drv_gpio.h" /* PIN脚编号,查看驱动文件drv_gpio.c确定 */ -#define LED_PIN_NUM 19 /*PF1*/ +#define LED_PIN_NUM GET_PIN( F , 1 ) static int pin_num; static void led_entry(void *parameter) diff --git a/bsp/essemi/es32f369x/drivers/bsp_driver_example/pin_beep_sample.c b/bsp/essemi/es32f369x/drivers/bsp_driver_example/pin_beep_sample.c index 58a7bf1891..9cf9ef81e8 100644 --- a/bsp/essemi/es32f369x/drivers/bsp_driver_example/pin_beep_sample.c +++ b/bsp/essemi/es32f369x/drivers/bsp_driver_example/pin_beep_sample.c @@ -15,17 +15,18 @@ */ #include -#include +#include +#include "drv_gpio.h" /* 引脚编号,通过查看驱动文件drv_gpio.c确定 */ #ifndef BEEP_PIN_NUM - #define BEEP_PIN_NUM 19 /* PF1 */ + #define BEEP_PIN_NUM GET_PIN( F , 1 ) #endif #ifndef KEY0_PIN_NUM - #define KEY0_PIN_NUM 52 /* PC11 */ + #define KEY0_PIN_NUM GET_PIN( C , 11 ) #endif #ifndef KEY1_PIN_NUM - #define KEY1_PIN_NUM 53 /* PC12 */ + #define KEY1_PIN_NUM GET_PIN( C , 12 ) #endif void beep_on(void *args) diff --git a/bsp/essemi/es32f369x/drivers/bsp_driver_example/pm_sample.c b/bsp/essemi/es32f369x/drivers/bsp_driver_example/pm_sample.c index 731dca4115..fb4b78d731 100644 --- a/bsp/essemi/es32f369x/drivers/bsp_driver_example/pm_sample.c +++ b/bsp/essemi/es32f369x/drivers/bsp_driver_example/pm_sample.c @@ -30,15 +30,14 @@ #include #include -#include "drv_pm.h" -#include "ald_gpio.h" - +#include "drv_pm.h" +#include "drv_gpio.h" #ifdef RT_USING_PM -#define PM_NAME "pm" /* 设备名称 */ -#define WAKE_UP_PIN 51 /* 唤醒源 */ -#define SLEEP_TIMES 12 /* 进入睡眠次数,轮流进入不同的睡眠模式,包括无睡眠模式 */ +#define PM_NAME "pm" /* 设备名称 */ +#define WAKE_UP_PIN GET_PIN( C , 10 ) /* 唤醒源 */ +#define SLEEP_TIMES 12 /* 进入睡眠次数,轮流进入不同的睡眠模式,包括无睡眠模式 */ /*部分芯片进入深度睡眠后,部分外设的部分寄存器可能会丢失*/ #define SAVE_REG UART0 diff --git a/bsp/essemi/es32f369x/drivers/bsp_driver_example/pwm_led_sample.c b/bsp/essemi/es32f369x/drivers/bsp_driver_example/pwm_led_sample.c index 8d12b74e15..51cedd49eb 100644 --- a/bsp/essemi/es32f369x/drivers/bsp_driver_example/pwm_led_sample.c +++ b/bsp/essemi/es32f369x/drivers/bsp_driver_example/pwm_led_sample.c @@ -16,13 +16,13 @@ #include #include - +#include "drv_gpio.h" #ifdef RT_USING_PWM -#define LED_PIN_NUM 37 /* PF1 LED PIN脚编号,查看驱动文件drv_gpio.c确定 */ -#define PWM_DEV_NAME "pwm1" /* PWM设备名称 */ -#define PWM_DEV_CHANNEL 1 /* PWM通道 */ +#define LED_PIN_NUM GET_PIN( C , 6 ) /* LED PIN脚编号,查看驱动文件drv_gpio.c确定 */ +#define PWM_DEV_NAME "pwm1" /* PWM设备名称 */ +#define PWM_DEV_CHANNEL 1 /* PWM通道 */ struct rt_device_pwm *pwm_dev; /* PWM设备句柄 */ diff --git a/bsp/essemi/es32f369x/drivers/bsp_driver_example/uart_sample.c b/bsp/essemi/es32f369x/drivers/bsp_driver_example/uart_sample.c index e059df32bb..2094a6576e 100644 --- a/bsp/essemi/es32f369x/drivers/bsp_driver_example/uart_sample.c +++ b/bsp/essemi/es32f369x/drivers/bsp_driver_example/uart_sample.c @@ -12,16 +12,28 @@ * 例程导出了 uart_sample 命令到控制终端 * 命令调用格式:uart_sample uart2 * 命令解释:命令第二个参数是要使用的串口设备名称,为空则使用默认的串口设备 - * 程序功能:通过串口输出字符串"hello RT-Thread!",然后错位输出输入的字符 + * 程序功能:通过串口输出字符串"hello RT-Thread!",然后根据例子类型,处理输入数据,然后输出 */ #include -#define SAMPLE_UART_NAME "uart0" /* 串口设备名称 */ +/* UART_SAMPLE_TYPE = 1,错位输出 + = 2 接收到固定格式之后输出 +*/ +#define UART_SAMPLE_TYPE 1 + +#if (UART_SAMPLE_TYPE == 2) + +#define SAMPLE_UART_RXBUF_SIZE 256 /* 接收缓存大小 */ +#define SAMPLE_UART_END_SRTING "\r\n" /* 结尾固定格式 */ + +#endif + +#define SAMPLE_UART_NAME "uart1" /* 串口设备名称 */ /* 用于接收消息的信号量 */ static struct rt_semaphore rx_sem; -static rt_device_t serial; +static rt_device_t serial; /* 接收数据回调函数 */ static rt_err_t uart_input(rt_device_t dev, rt_size_t size) @@ -33,7 +45,8 @@ static rt_err_t uart_input(rt_device_t dev, rt_size_t size) } static void serial_thread_entry(void *parameter) -{ +{ +#if (UART_SAMPLE_TYPE == 1) char ch; while (1) @@ -48,6 +61,42 @@ static void serial_thread_entry(void *parameter) ch = ch + 1; rt_device_write(serial, 0, &ch, 1); } +#endif + +#if (UART_SAMPLE_TYPE == 2) + char rx_buf[SAMPLE_UART_RXBUF_SIZE],*end = SAMPLE_UART_END_SRTING; /*rx_buf[]:接收缓存,可修改大小 end[]:固定的结束格式(可修改,不可包含'\0')*/ + uint32_t rx_index = 0; /*接收数据的索引 */ + uint32_t end_len = rt_strlen(end); /*固定的结束格式的长度*/ + + while(1) + { + + /* 从串口读取一个字节的数据,没有读取到则等待接收信号量 */ + while (rt_device_read(serial, -1, (rx_buf + rx_index), 1) != 1) + { + /* 阻塞等待接收信号量,等到信号量后再次读取数据 */ + rt_sem_take(&rx_sem, RT_WAITING_FOREVER); + } + + rx_index++; + if(rx_index >= SAMPLE_UART_RXBUF_SIZE) + { + rt_kprintf("rx_buf over!\r\n"); /*范围越界*/ + } + + /*判断是否固定的结尾格式*/ + if((rx_index >= end_len)&&\ + ((rt_strncmp(end,(rx_buf + rx_index - end_len),end_len)) == 0)) + { + rt_device_write(serial, 0, rx_buf, rx_index); + rx_index = 0; + } + + } + + +#endif + } static int uart_sample(int argc, char *argv[]) diff --git a/bsp/essemi/es32f369x/drivers/drv_adc.c b/bsp/essemi/es32f369x/drivers/drv_adc.c index 716fddcfa4..91bf56ef38 100644 --- a/bsp/essemi/es32f369x/drivers/drv_adc.c +++ b/bsp/essemi/es32f369x/drivers/drv_adc.c @@ -68,8 +68,8 @@ static adc_channel_t es32f3_adc_get_channel(rt_uint32_t channel) gpio_initstruct.mode = GPIO_MODE_INPUT; gpio_initstruct.pupd = GPIO_FLOATING; gpio_initstruct.odos = GPIO_OPEN_DRAIN; - gpio_initstruct.podrv = GPIO_OUT_DRIVE_1; - gpio_initstruct.nodrv = GPIO_OUT_DRIVE_1; + gpio_initstruct.podrv = GPIO_OUT_DRIVE_6; + gpio_initstruct.nodrv = GPIO_OUT_DRIVE_6; gpio_initstruct.flt = GPIO_FILTER_DISABLE; gpio_initstruct.type = GPIO_TYPE_CMOS; gpio_initstruct.func = GPIO_FUNC_0; diff --git a/bsp/essemi/es32f369x/drivers/drv_can.c b/bsp/essemi/es32f369x/drivers/drv_can.c index 6e7456b9b6..48c462c5f1 100644 --- a/bsp/essemi/es32f369x/drivers/drv_can.c +++ b/bsp/essemi/es32f369x/drivers/drv_can.c @@ -413,14 +413,14 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t /* clear TIR */ h_can->perh->TxMailBox[box_num].TXID &= CAN_TXID0_TXMREQ_MSK; - /* Set up the Id */ + /* Set up the Id */ if (RT_CAN_STDID == pmsg->ide) - { - h_can->perh->TxMailBox[box_num].TXID |= (txheader.std << CAN_TXID0_STDID_POSS) | txheader.rtr; + { + h_can->perh->TxMailBox[box_num].TXID |= (txheader.std << CAN_TXID0_STDID_POSS) | (txheader.rtr << CAN_TXID0_RTR_POS); } else { - h_can->perh->TxMailBox[box_num].TXID |= (txheader.ext << CAN_TXID0_EXID_POSS) | txheader.type | txheader.rtr; + h_can->perh->TxMailBox[box_num].TXID |= (txheader.ext << CAN_TXID0_EXID_POSS) | (txheader.type << CAN_TXID0_IDE_POS) | (txheader.rtr << CAN_TXID0_RTR_POS); } /* Set up the DLC */ h_can->perh->TxMailBox[box_num].TXFCON = pmsg->len & 0x0FU; diff --git a/bsp/essemi/es32f369x/drivers/drv_gpio.c b/bsp/essemi/es32f369x/drivers/drv_gpio.c index 8ce6ab7aa8..24621e117a 100644 --- a/bsp/essemi/es32f369x/drivers/drv_gpio.c +++ b/bsp/essemi/es32f369x/drivers/drv_gpio.c @@ -274,8 +274,8 @@ void es32f3_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) /* Configure GPIO_InitStructure */ gpio_initstruct.mode = GPIO_MODE_OUTPUT; gpio_initstruct.func = GPIO_FUNC_1; - gpio_initstruct.podrv = GPIO_OUT_DRIVE_1; - gpio_initstruct.nodrv = GPIO_OUT_DRIVE_0_1; + gpio_initstruct.podrv = GPIO_OUT_DRIVE_6; + gpio_initstruct.nodrv = GPIO_OUT_DRIVE_6; gpio_initstruct.type = GPIO_TYPE_CMOS; gpio_initstruct.odos = GPIO_PUSH_PULL; gpio_initstruct.flt = GPIO_FILTER_DISABLE; @@ -316,12 +316,18 @@ void es32f3_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) rt_inline const struct pin_irq_map *get_pin_irq_map(rt_uint16_t gpio_pin) { - rt_int32_t mapindex = gpio_pin & 0x00FF; - if (mapindex < 0 || mapindex >= ITEM_NUM(pin_irq_map)) + uint8_t map_index = 0U; + + while(gpio_pin >> (++map_index)) + { + } + map_index--; + + if (map_index >= ITEM_NUM(pin_irq_map)) { return RT_NULL; } - return &pin_irq_map[mapindex]; + return &pin_irq_map[map_index]; }; rt_err_t es32f3_pin_attach_irq(struct rt_device *device, rt_int32_t pin, @@ -442,8 +448,8 @@ rt_err_t es32f3_pin_irq_enable(struct rt_device *device, rt_base_t pin, /* Configure GPIO_InitStructure */ gpio_initstruct.mode = GPIO_MODE_INPUT; gpio_initstruct.odos = GPIO_PUSH_PULL; - gpio_initstruct.podrv = GPIO_OUT_DRIVE_1; - gpio_initstruct.nodrv = GPIO_OUT_DRIVE_1; + gpio_initstruct.podrv = GPIO_OUT_DRIVE_6; + gpio_initstruct.nodrv = GPIO_OUT_DRIVE_6; gpio_initstruct.func = GPIO_FUNC_1; gpio_initstruct.flt = GPIO_FILTER_DISABLE; switch (pin_irq_hdr_tab[irqindex].mode) diff --git a/bsp/essemi/es32f369x/drivers/drv_gpio.h b/bsp/essemi/es32f369x/drivers/drv_gpio.h index 8489e625d5..efb5f27f7e 100644 --- a/bsp/essemi/es32f369x/drivers/drv_gpio.h +++ b/bsp/essemi/es32f369x/drivers/drv_gpio.h @@ -25,6 +25,8 @@ #define DRV_GPIO_H__ #include "es_conf_info_gpio.h" + +#define GET_PIN(port,pin) (ES_PIN_GPIO_##port##_##pin) int rt_hw_pin_init(void); diff --git a/bsp/essemi/es32f369x/drivers/drv_i2c.c b/bsp/essemi/es32f369x/drivers/drv_i2c.c index c398d5ab45..01d4404606 100644 --- a/bsp/essemi/es32f369x/drivers/drv_i2c.c +++ b/bsp/essemi/es32f369x/drivers/drv_i2c.c @@ -49,8 +49,8 @@ static void _i2c_init(void) gpio_instruct.mode = GPIO_MODE_OUTPUT; gpio_instruct.odos = GPIO_OPEN_DRAIN; gpio_instruct.pupd = GPIO_PUSH_UP; - gpio_instruct.podrv = GPIO_OUT_DRIVE_1; - gpio_instruct.nodrv = GPIO_OUT_DRIVE_0_1; + gpio_instruct.podrv = GPIO_OUT_DRIVE_6; + gpio_instruct.nodrv = GPIO_OUT_DRIVE_6; gpio_instruct.flt = GPIO_FILTER_DISABLE; gpio_instruct.type = GPIO_TYPE_CMOS; @@ -83,9 +83,9 @@ static void _i2c_init(void) #ifdef BSP_USING_I2C1 -#if defined(ES_I2C1_SDA_GPIO_FUNC)&&defined(ES_I2C1_SDA_GPIO_PORT)&&defined(ES_I2C1_SDA_GPIO_PIN) - gpio_instruct.func = ES_I2C1_SDA_GPIO_FUNC; - ald_gpio_init(ES_I2C1_SDA_GPIO_PORT, ES_I2C1_SDA_GPIO_PIN, &gpio_instruct); +#if defined(ES_I2C1_SCL_GPIO_FUNC)&&defined(ES_I2C1_SCL_GPIO_PORT)&&defined(ES_I2C1_SCL_GPIO_PIN) + gpio_instruct.func = ES_I2C1_SCL_GPIO_FUNC; + ald_gpio_init(ES_I2C1_SCL_GPIO_PORT, ES_I2C1_SCL_GPIO_PIN, &gpio_instruct); #endif #if defined(ES_I2C1_SDA_GPIO_FUNC)&&defined(ES_I2C1_SDA_GPIO_PORT)&&defined(ES_I2C1_SDA_GPIO_PIN) diff --git a/bsp/essemi/es32f369x/drivers/drv_spi.c b/bsp/essemi/es32f369x/drivers/drv_spi.c index aae178f78e..f777645a56 100644 --- a/bsp/essemi/es32f369x/drivers/drv_spi.c +++ b/bsp/essemi/es32f369x/drivers/drv_spi.c @@ -283,8 +283,8 @@ int rt_hw_spi_init(void) gpio_instruct.pupd = GPIO_PUSH_UP_DOWN; gpio_instruct.odos = GPIO_PUSH_PULL; - gpio_instruct.podrv = GPIO_OUT_DRIVE_1; - gpio_instruct.nodrv = GPIO_OUT_DRIVE_1; + gpio_instruct.podrv = GPIO_OUT_DRIVE_6; + gpio_instruct.nodrv = GPIO_OUT_DRIVE_6; gpio_instruct.type = GPIO_TYPE_TTL; gpio_instruct.flt = GPIO_FILTER_DISABLE; diff --git a/bsp/essemi/es32f369x/drivers/drv_uart.c b/bsp/essemi/es32f369x/drivers/drv_uart.c index 5ca5085c54..f964f6f82d 100644 --- a/bsp/essemi/es32f369x/drivers/drv_uart.c +++ b/bsp/essemi/es32f369x/drivers/drv_uart.c @@ -198,8 +198,8 @@ static rt_err_t es32f3x_configure(struct rt_serial_device *serial, struct serial gpio_initstructure.mode = GPIO_MODE_OUTPUT; gpio_initstructure.odos = GPIO_PUSH_PULL; gpio_initstructure.pupd = GPIO_PUSH_UP; - gpio_initstructure.podrv = GPIO_OUT_DRIVE_1; - gpio_initstructure.nodrv = GPIO_OUT_DRIVE_1; + gpio_initstructure.podrv = GPIO_OUT_DRIVE_6; + gpio_initstructure.nodrv = GPIO_OUT_DRIVE_6; gpio_initstructure.flt = GPIO_FILTER_DISABLE; gpio_initstructure.type = GPIO_TYPE_TTL; diff --git a/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/gcc/startup_es32f36xx.S b/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/gcc/startup_es32f36xx.S index 4e34d42c1d..68d648f157 100644 --- a/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/gcc/startup_es32f36xx.S +++ b/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/gcc/startup_es32f36xx.S @@ -11,7 +11,27 @@ * calls main()). * After Reset the Cortex-M3 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. - ****************************************************************************** + * @note + * Change Logs: + * Date Author Notes + * 23 Jan 2019 AE Team The first version + * + * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. 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. + ********************************************************************************** */ .syntax unified @@ -41,6 +61,48 @@ defined in linker script */ Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ + + ldr r0, =0x55AA6996 + ldr r1, =0x40080000 + str r0, [r1] + + ldr r0, =0x5A962814 + ldr r1, =0x40080100 + str r0, [r1] + ldr r0, =0xE7CB69A5 + str r0, [r1] + + ldr r0, =0x40083C00 + ldr r1, [r0] + ldr r2, =0xffff + and r1, r2 + ldr r2, =0x55AA0000 + orr r1, r2 + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + + mov r0, r0 + mov r0, r0 + + ldr r0, =0x123456 + ldr r1, =0x40080100 + str r0, [r1] + + ldr r0, =0x40080404 + ldr r1, =0x4000000 + str r1, [r0] + + ldr r0, =0x123456 + ldr r1, =0x40080000 + str r0, [r1] /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata @@ -72,11 +134,13 @@ FillZerobss: LoopFillZerobss: cmp r2, r4 bcc FillZerobss + + bl sys_config + bl adc_config -/*bl __libc_init_array + bl __libc_init_array - bl main */ - bl entry + bl main LoopForever: b LoopForever diff --git a/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/iar/startup_es32f36xx.s b/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/iar/startup_es32f36xx.s index 5e43634bd9..8cbaf6eb0e 100644 --- a/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/iar/startup_es32f36xx.s +++ b/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/iar/startup_es32f36xx.s @@ -3,8 +3,27 @@ ; description: es32f36xx Device Startup File ; author : AE Team ; data : 04 Jul 2019 +; note +; Change Logs: +; Date Author Notes +; 04 Jul 2019 AE Team The first version +; ; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. 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. +;********************************************************************************* MODULE ?cstartup @@ -12,6 +31,8 @@ SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) + EXTERN sys_config + EXTERN adc_config EXTERN __iar_program_start PUBLIC __vector_table @@ -116,8 +137,56 @@ __vector_table PUBWEAK RESET_Handler SECTION .text:CODE:NOROOT:REORDER(2) RESET_Handler - LDR R0, =__iar_program_start - BX R0 + ldr r0, =0x55AA6996 + ldr r1, =0x40080000 + str r0, [r1] + + ldr r0, =0x5A962814 + ldr r1, =0x40080100 + str r0, [r1] + ldr r0, =0xE7CB69A5 + str r0, [r1] + + ldr r0, =0x40083C00 + ldr r1, [r0] + ldr r2, =0xffff + and r1, r2, r1 + ldr r2, =0x55AA0000 + orr r1, r2, r1 + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + + mov r0, r0 + mov r0, r0 + + ldr r0, =0x123456 + ldr r1, =0x40080100 + str r0, [r1] + + ldr r0, =0x40080404 + ldr r1, =0x4000000 + str r1, [r0] + + ldr r0, =0x123456 + ldr r1, =0x40080000 + str r0, [r1] + + LDR R0, =sys_config + BLX R0 + + LDR R0, =adc_config + BLX R0 + + LDR R0, =__iar_program_start + BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:NOROOT:REORDER(1) diff --git a/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/keil/startup_es32f36xx.s b/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/keil/startup_es32f36xx.s index c8aaf3ed69..8e2c55e5e3 100644 --- a/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/keil/startup_es32f36xx.s +++ b/bsp/essemi/es32f369x/libraries/CMSIS/Device/EastSoft/ES32F36xx/Startup/keil/startup_es32f36xx.s @@ -3,22 +3,27 @@ ; description: es32f36xx Device Startup File ; author : AE Team ; data : 23 Jan 2019 +; note +; Change Logs: +; Date Author Notes +; 23 Jan 2019 AE Team The first version +; ; Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. 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. -;******************************************************************************* +;********************************************************************************* ;Stack Configuration------------------------------------------------------------ Stack_Size EQU 0x00000800 @@ -137,6 +142,57 @@ __Vectors DCD __initial_sp ;0, load top of stack ;Reset Handler---------------------------------------------- RESET_Handler PROC EXPORT RESET_Handler [WEAK] + + ldr r0, =0x55AA6996 + ldr r1, =0x40080000 + str r0, [r1] + + ldr r0, =0x5A962814 + ldr r1, =0x40080100 + str r0, [r1] + ldr r0, =0xE7CB69A5 + str r0, [r1] + + ldr r0, =0x40083C00 + ldr r1, [r0] + ldr r2, =0xffff + and r1, r2 + ldr r2, =0x55AA0000 + orr r1, r2 + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + str r1, [r0] + + mov r0, r0 + mov r0, r0 + + ldr r0, =0x123456 + ldr r1, =0x40080100 + str r0, [r1] + + ldr r0, =0x40080404 + ldr r1, =0x4000000 + str r1, [r0] + + ldr r0, =0x123456 + ldr r1, =0x40080000 + str r0, [r1] + + IMPORT sys_config + LDR R0, =sys_config + BLX R0 + + IMPORT adc_config + LDR R0, =adc_config + BLX R0 + IMPORT __main LDR R0, =__main BX R0 diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_gpio.h b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_gpio.h index 517330ce32..07d98a1342 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_gpio.h +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_gpio.h @@ -50,23 +50,63 @@ * @defgroup GPIO_Public_Macros GPIO Public Macros * @{ */ -#define GPIO_PIN_0 (1U << 0) -#define GPIO_PIN_1 (1U << 1) -#define GPIO_PIN_2 (1U << 2) -#define GPIO_PIN_3 (1U << 3) -#define GPIO_PIN_4 (1U << 4) -#define GPIO_PIN_5 (1U << 5) -#define GPIO_PIN_6 (1U << 6) -#define GPIO_PIN_7 (1U << 7) -#define GPIO_PIN_8 (1U << 8) -#define GPIO_PIN_9 (1U << 9) -#define GPIO_PIN_10 (1U << 10) -#define GPIO_PIN_11 (1U << 11) -#define GPIO_PIN_12 (1U << 12) -#define GPIO_PIN_13 (1U << 13) -#define GPIO_PIN_14 (1U << 14) -#define GPIO_PIN_15 (1U << 15) -#define GPIO_PIN_ALL (0xFFFF) +#define GPIO_PIN_0 (0x1U) +#define GPIO_PIN_1 (0x2U) +#define GPIO_PIN_2 (0x4U) +#define GPIO_PIN_3 (0x8U) +#define GPIO_PIN_4 (0x10U) +#define GPIO_PIN_5 (0x20U) +#define GPIO_PIN_6 (0x40U) +#define GPIO_PIN_7 (0x80U) +#define GPIO_PIN_8 (0x100U) +#define GPIO_PIN_9 (0x200U) +#define GPIO_PIN_10 (0x400U) +#define GPIO_PIN_11 (0x800U) +#define GPIO_PIN_12 (0x1000U) +#define GPIO_PIN_13 (0x2000U) +#define GPIO_PIN_14 (0x4000U) +#define GPIO_PIN_15 (0x8000U) +#define GPIO_PIN_ALL (0xFFFF) + +/* Toggle IO */ +#define ALD_GPIOA_TOGGLE_PIN(x) (GPIOA->BIR = (x)) +#define ALD_GPIOB_TOGGLE_PIN(x) (GPIOB->BIR = (x)) +#define ALD_GPIOC_TOGGLE_PIN(x) (GPIOC->BIR = (x)) +#define ALD_GPIOD_TOGGLE_PIN(x) (GPIOD->BIR = (x)) +#define ALD_GPIOE_TOGGLE_PIN(x) (GPIOE->BIR = (x)) +#define ALD_GPIOF_TOGGLE_PIN(x) (GPIOF->BIR = (x)) +#define ALD_GPIOG_TOGGLE_PIN(x) (GPIOG->BIR = (x)) +#define ALD_GPIOH_TOGGLE_PIN(x) (GPIOH->BIR = (x)) + +/* Read IO level */ +#define ALD_GPIOA_READ_PIN(x) ((GPIOA->DIN & (x)) ? 1 : 0) +#define ALD_GPIOB_READ_PIN(x) ((GPIOB->DIN & (x)) ? 1 : 0) +#define ALD_GPIOC_READ_PIN(x) ((GPIOC->DIN & (x)) ? 1 : 0) +#define ALD_GPIOD_READ_PIN(x) ((GPIOD->DIN & (x)) ? 1 : 0) +#define ALD_GPIOE_READ_PIN(x) ((GPIOE->DIN & (x)) ? 1 : 0) +#define ALD_GPIOF_READ_PIN(x) ((GPIOF->DIN & (x)) ? 1 : 0) +#define ALD_GPIOG_READ_PIN(x) ((GPIOG->DIN & (x)) ? 1 : 0) +#define ALD_GPIOH_READ_PIN(x) ((GPIOH->DIN & (x)) ? 1 : 0) + +/* Set IO as high */ +#define ALD_GPIOA_SET_PIN(x) (GPIOA->BSRR = (x)) +#define ALD_GPIOB_SET_PIN(x) (GPIOB->BSRR = (x)) +#define ALD_GPIOC_SET_PIN(x) (GPIOC->BSRR = (x)) +#define ALD_GPIOD_SET_PIN(x) (GPIOD->BSRR = (x)) +#define ALD_GPIOE_SET_PIN(x) (GPIOE->BSRR = (x)) +#define ALD_GPIOF_SET_PIN(x) (GPIOF->BSRR = (x)) +#define ALD_GPIOG_SET_PIN(x) (GPIOG->BSRR = (x)) +#define ALD_GPIOH_SET_PIN(x) (GPIOH->BSRR = (x)) + +/* Set IO as low */ +#define ALD_GPIOA_RESET_PIN(x) (GPIOA->BSRR = ((x) << 16)) +#define ALD_GPIOB_RESET_PIN(x) (GPIOB->BSRR = ((x) << 16)) +#define ALD_GPIOC_RESET_PIN(x) (GPIOC->BSRR = ((x) << 16)) +#define ALD_GPIOD_RESET_PIN(x) (GPIOD->BSRR = ((x) << 16)) +#define ALD_GPIOE_RESET_PIN(x) (GPIOE->BSRR = ((x) << 16)) +#define ALD_GPIOF_RESET_PIN(x) (GPIOF->BSRR = ((x) << 16)) +#define ALD_GPIOG_RESET_PIN(x) (GPIOG->BSRR = ((x) << 16)) +#define ALD_GPIOH_RESET_PIN(x) (GPIOH->BSRR = ((x) << 16)) /** * @} */ diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_i2c.h b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_i2c.h index c520c3d41a..fb81f4d70b 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_i2c.h +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_i2c.h @@ -320,7 +320,7 @@ typedef struct i2c_handle_s { #define I2C_GET_IT_SOURCE(x, y) ((((x)->perh->IFM & (y)) == (y)) ? SET : RESET) #define I2C_GET_FLAG(x, y) ((((x)->perh->STAT) & ((y) & I2C_FLAG_MASK)) != RESET) #define I2C_MASTER_GET_DIR(x) (READ_BIT(((x)->perh->CON2), I2C_CON2_RD_WRN_MSK)) -#define I2C_SLAVE_GET_DIR(x) (READ_BIT(hperh->perh->STAT, I2C_STAT_DIR_MSK)) +#define I2C_SLAVE_GET_DIR(x) (READ_BIT(((x)->perh->STAT), I2C_STAT_DIR_MSK)) #define I2C_ENABLE(x) (SET_BIT((x)->perh->CON1, I2C_CON1_PE_MSK)) #define I2C_DISABLE(x) (CLEAR_BIT((x)->perh->CON1, I2C_CON1_PE_MSK)) /** diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_timer.h b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_timer.h index dcbc884368..ca3fe84d32 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_timer.h +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_timer.h @@ -841,18 +841,15 @@ do { \ ((y) == TIMER_CHANNEL_3) || \ ((y) == TIMER_CHANNEL_4)))) -#define IS_TIMER_CCXN_INSTANCE(x, y) ((((x) == NULL) || \ - ((x) == NULL)) && \ +#define IS_TIMER_CCXN_INSTANCE(x, y) ((((x) == NULL)) && \ (((y) == TIMER_CHANNEL_1) || \ ((y) == TIMER_CHANNEL_2) || \ ((y) == TIMER_CHANNEL_3) || \ ((y) == TIMER_CHANNEL_4))) -#define IS_TIMER_REPETITION_COUNTER_INSTANCE(x) (((x) == NULL) || \ - ((x) == NULL)) +#define IS_TIMER_REPETITION_COUNTER_INSTANCE(x) (((x) == NULL)) -#define IS_TIMER_BREAK_INSTANCE(x) (((x) == NULL) || \ - ((x) == NULL)) +#define IS_TIMER_BREAK_INSTANCE(x) (((x) == NULL)) #define IS_TIMER_CLOCK_DIVISION_INSTANCE(x) IS_TIMER_CC2_INSTANCE(x) @@ -1050,7 +1047,7 @@ void ald_timer_pwm_start(timer_handle_t *hperh, timer_channel_t ch); void ald_timer_pwm_stop(timer_handle_t *hperh, timer_channel_t ch); void ald_timer_pwm_start_by_it(timer_handle_t *hperh, timer_channel_t ch); void ald_timer_pwm_stop_by_it(timer_handle_t *hperh, timer_channel_t ch); -void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint16_t freq); +void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint32_t freq); void ald_timer_pwm_set_duty(timer_handle_t *hperh, timer_channel_t ch, uint16_t duty); void ald_timer_pwm_set_input(timer_handle_t *hperh, timer_channel_t ch); #ifdef ALD_DMA diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_uart.h b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_uart.h index 56c1b5b94d..b5870ead77 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_uart.h +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/ald_uart.h @@ -213,16 +213,6 @@ typedef struct { uint8_t addr; /**< Address for compare */ } uart_rs485_config_t; -/** - * @brief Smart_card clock division - */ -typedef enum { - SCARD_CLOCK_DIV1 = 0x0U, /**< No prescaler is used */ - SCARD_CLOCK_DIV2 = 0x1U, /** Clock is divided by 2 */ - SCARD_CLOCK_DIV4 = 0x2U, /** Clock is divided by 4 */ - SCARD_CLOCK_DIV6 = 0x3U, /** Clock is divided by 6 */ -} scard_clk_div_t; - /** * @brief Smart_card Rx/Tx handle retry time */ @@ -244,7 +234,7 @@ typedef struct { uint8_t block_len; /**< Specifies the data block length.*/ uint8_t pt; /**< Specifies the protect time*/ scard_retry_t retry; /**< Specifies retry time.*/ - scard_clk_div_t clk_div; /**< Specifies the clock division.*/ + uint8_t clk_div; /**< Specifies the clock division.*/ type_func_t clk_out; /**< Specifies the clock out */ } uart_scard_config_t; @@ -458,10 +448,7 @@ typedef enum { ((x) == UART_IF_TFTH) || \ ((x) == UART_IF_TFEMPTY) || \ ((x) == UART_IF_TFOVER)) -#define IS_UART_SCARD_CLK(x) (((x) == SCARD_CLOCK_DIV1) || \ - ((x) == SCARD_CLOCK_DIV2) || \ - ((x) == SCARD_CLOCK_DIV4) || \ - ((x) == SCARD_CLOCK_DIV6)) +#define IS_UART_SCARD_CLK(x) (((x) <= 0x1F)) #define IS_UART_BAUDRATE(x) (((x) > 0) && ((x) < 0x44AA21)) #define IS_UART_DATA(x) ((x) <= 0x1FF) diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/utils.h b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/utils.h index b5589ce07a..e3b7242801 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/utils.h +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Include/utils.h @@ -130,7 +130,7 @@ do { \ */ #define MCU_UID0_ADDR 0x000803E0U #define MCU_UID1_ADDR 0x000803E8U -#define MCU_UID2_ADDR 0x000803F0U +#define MCU_UID2_ADDR 0x000803ECU #define MCU_CHIPID_ADDR 0x000803F8U #define DWT_CR *(uint32_t *)0xE0001000U #define DWT_CYCCNT *(volatile uint32_t *)0xE0001004U @@ -170,6 +170,7 @@ void ald_systick_interval_select(systick_interval_t value); /* Peripheral Control functions */ void ald_inc_tick(void); void ald_systick_irq_cbk(void); +void ald_delay_us(__IO uint32_t delay); void ald_delay_ms(__IO uint32_t delay); uint32_t ald_get_tick(void); void ald_suspend_tick(void); diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_adc.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_adc.c index 6870742cc0..ebe1ff999e 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_adc.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_adc.c @@ -133,19 +133,30 @@ ald_status_t ald_adc_init(adc_handle_t *hperh) MODIFY_REG(hperh->perh->CON1, ADC_CON1_CM_MSK, hperh->init.cont << ADC_CON1_CM_POS); MODIFY_REG(hperh->perh->CON0, ADC_CON0_SCANEN_MSK, hperh->init.scan << ADC_CON0_SCANEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_GAINCALEN_MSK, DISABLE << ADC_CCR_GAINCALEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_OFFCALEN_MSK, DISABLE << ADC_CCR_OFFCALEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_DIFFEN_MSK, DISABLE << ADC_CCR_DIFFEN_POS); + + ADC0->CCR = 0; + MODIFY_REG(ADC0->CCR, ADC_CCR_GAINCALEN_MSK, DISABLE << ADC_CCR_GAINCALEN_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_OFFCALEN_MSK, DISABLE << ADC_CCR_OFFCALEN_POS); /* if the ADC clock less than 1MHz,PWRMOD should be disable*/ - MODIFY_REG(hperh->perh->CCR, ADC_CCR_PWRMODSEL_MSK, DISABLE << ADC_CCR_PWRMODSEL_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRBUFEN_MSK, ENABLE << ADC_CCR_VRBUFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VCMBUFEN_MSK, ENABLE << ADC_CCR_VCMBUFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VREFEN_MSK, ENABLE << ADC_CCR_VREFEN_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_IREFEN_MSK, ENABLE << ADC_CCR_IREFEN_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_PWRMODSEL_MSK, DISABLE << ADC_CCR_PWRMODSEL_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_VRBUFEN_MSK, ENABLE << ADC_CCR_VRBUFEN_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_VCMBUFEN_MSK, ENABLE << ADC_CCR_VCMBUFEN_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_VREFEN_MSK, ENABLE << ADC_CCR_VREFEN_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_IREFEN_MSK, ENABLE << ADC_CCR_IREFEN_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_VRNSEL_MSK, hperh->init.n_ref << ADC_CCR_VRNSEL_POS); + MODIFY_REG(ADC0->CCR, ADC_CCR_VRPSEL_MSK, hperh->init.p_ref << ADC_CCR_VRPSEL_POSS); + + if (hperh->perh == ADC1) + ADC1->CCR = ADC0->CCR; + + MODIFY_REG(hperh->perh->CCR, ADC_CCR_DIFFEN_MSK, DISABLE << ADC_CCR_DIFFEN_POS); MODIFY_REG(hperh->perh->CCR, ADC_CCR_CKDIV_MSK, hperh->init.div << ADC_CCR_CKDIV_POSS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRNSEL_MSK, hperh->init.n_ref << ADC_CCR_VRNSEL_POS); - MODIFY_REG(hperh->perh->CCR, ADC_CCR_VRPSEL_MSK, hperh->init.p_ref << ADC_CCR_VRPSEL_POSS); - MODIFY_REG(hperh->perh->CON1, ADC_CON1_NCHESEL_MSK, hperh->init.nche_sel << ADC_CON1_NCHESEL_POS); + /* Enable adc calibration */ + SET_BIT(ADC0->CCR, ADC_CCR_TRMEN_MSK); + SET_BIT(ADC1->CCR, ADC_CCR_TRMEN_MSK); + + +MODIFY_REG(hperh->perh->CON1, ADC_CON1_NCHESEL_MSK, hperh->init.nche_sel << ADC_CON1_NCHESEL_POS); ald_adc_interrupt_config(hperh, ADC_IT_OVR, ENABLE); ADC_ENABLE(hperh); @@ -429,113 +440,6 @@ static void adc_dma_timer_trigger_cplt(void *arg) return; } -/** - * @brief Config Timer trigger adc function - * @param config: Pointer to a adc_timer_config_t structure that - * contains the configuration information for the specified function. - * @retval Status, see @ref ald_status_t. - */ -ald_status_t ald_adc_timer_trigger_adc_by_dma(adc_timer_config_t *config) -{ - config->h_pis.perh = PIS; - config->h_pis.init.producer_clk = PIS_CLK_PCLK1; - config->h_pis.init.producer_edge = PIS_EDGE_NONE; - config->h_pis.init.consumer_clk = PIS_CLK_PCLK2; - - #if defined(ES32F36xx) - if (config->p_timer == AD16C4T0) - config->h_pis.init.producer_src = PIS_TIMER0_UPDATA; - else if (config->p_timer == AD16C4T1) - config->h_pis.init.producer_src = PIS_TIMER1_UPDATA; - else if (config->p_timer == GP32C4T0) - config->h_pis.init.producer_src = PIS_TIMER2_UPDATA; - else if (config->p_timer == GP32C4T1) - config->h_pis.init.producer_src = PIS_TIMER3_UPDATA; - else - return ERROR; - #elif defined(ES32F39xx) || defined(ES32F336x) - if (config->p_timer == GP16C4T0) - config->h_pis.init.producer_src = PIS_TIMER0_UPDATA; - else if (config->p_timer == GP16C4T1) - config->h_pis.init.producer_src = PIS_TIMER1_UPDATA; - else if (config->p_timer == GP32C4T0) - config->h_pis.init.producer_src = PIS_TIMER2_UPDATA; - else if (config->p_timer == GP32C4T1) - config->h_pis.init.producer_src = PIS_TIMER3_UPDATA; - else - return ERROR; - #endif - - if (config->p_adc == ADC0) - config->h_pis.init.consumer_trig = PIS_CH6_ADC0_NORMAL; - else - return ERROR; - - ald_pis_create(&config->h_pis); - - /* Initialize TIMER0 */ - config->h_timer.perh = config->p_timer; - config->h_timer.init.prescaler = 0; - config->h_timer.init.mode = TIMER_CNT_MODE_UP; - config->h_timer.init.period = ((ald_cmu_get_pclk1_clock() / 1000000) * config->time); - config->h_timer.init.clk_div = TIMER_CLOCK_DIV1; - config->h_timer.init.re_cnt = 0; - ald_timer_base_init(&config->h_timer); - - config->h_adc.perh = config->p_adc; - config->h_adc.init.align = ADC_DATAALIGN_RIGHT; - config->h_adc.init.scan = DISABLE; - config->h_adc.init.cont = DISABLE; - config->h_adc.init.nch_nr = ADC_NCH_NR_1; - config->h_adc.init.disc = ADC_ALL_DISABLE; - config->h_adc.init.disc_nr = ADC_DISC_NR_1; - config->h_adc.init.data_bit = ADC_CONV_BIT_12; - config->h_adc.init.div = ADC_CKDIV_128; - config->h_adc.init.nche_sel = ADC_NCHESEL_MODE_ONE; - config->h_adc.init.n_ref = config->n_ref; - config->h_adc.init.p_ref = config->p_ref; - config->h_adc.normal_cplt_cbk = config->cplt_cbk; - config->h_adc.insert_cplt_cbk = NULL; - config->h_adc.wdg_cbk = NULL; - config->h_adc.error_cbk = NULL; - config->h_adc.ovr_cbk = NULL; - ald_adc_init(&config->h_adc); - - - - config->h_adc.perh->CON1 |= 0x10000000; - config->config.ch = config->adc_ch; - config->config.idx = ADC_NCH_IDX_1; - config->config.samp = ADC_SAMPLETIME_4; - ald_adc_normal_channel_config(&config->h_adc, &config->config); - - config->h_dma.cplt_cbk = adc_dma_timer_trigger_cplt; - config->h_dma.cplt_arg = config; - config->h_dma.err_cbk = adc_dma_error; - config->h_dma.err_arg = &config->h_adc; - - ald_dma_config_struct(&config->h_dma.config); - config->h_dma.perh = DMA0; - config->h_dma.config.src = (void *)&config->h_adc.perh->NCHDR; - config->h_dma.config.dst = (void *)config->buf; - config->h_dma.config.size = config->size; - config->h_dma.config.data_width = DMA_DATA_SIZE_HALFWORD; - config->h_dma.config.src_inc = DMA_DATA_INC_NONE; - config->h_dma.config.dst_inc = DMA_DATA_INC_HALFWORD; - config->h_dma.config.msel = config->p_adc == ADC0 ? DMA_MSEL_ADC0 : DMA_MSEL_ADC1; - config->h_dma.config.msigsel = DMA_MSIGSEL_ADC; - config->h_dma.config.burst = ENABLE; - config->h_dma.config.channel = config->dma_ch; - ald_dma_config_basic(&config->h_dma); - - SET_BIT(config->h_adc.perh->CON1, ADC_CON1_DMA_MSK); - ADC_ENABLE(&config->h_adc); - ald_timer_base_start(&config->h_timer); - - return OK; -} - - /** * @brief Config timer trigger adc insert channel conversion. * @param config: Pointer to a adc_timer_config_t structure that @@ -607,13 +511,121 @@ ald_status_t ald_adc_timer_trigger_insert(adc_timer_config_t *config) config->h_adc.error_cbk = NULL; config->h_adc.ovr_cbk = NULL; ald_adc_init(&config->h_adc); + + config->h_adc.perh->CON1 |= 0x00100000; /* rising edge trigger insert channel convert */ + config->i_config.ch = config->adc_ch; + config->i_config.idx = ADC_ICH_IDX_1; + config->i_config.samp = ADC_SAMPLETIME_4; + config->i_config.nr = ADC_ICH_NR_1; + config->i_config.auto_m = DISABLE; + ald_adc_insert_channel_config(&config->h_adc, &config->i_config); + + ADC_ENABLE(&config->h_adc); + ald_timer_base_start(&config->h_timer); + + return OK; +} - config->h_adc.perh->CON1 |= 0x00100000; /* rising edge trigger insert channel convert */ - config->i_config.ch = config->adc_ch; - config->i_config.idx = ADC_ICH_IDX_1; - config->i_config.samp = ADC_SAMPLETIME_4; - config->i_config.auto_m = DISABLE; - ald_adc_insert_channel_config(&config->h_adc, &config->i_config); + + +/** + * @brief Config Timer trigger adc function + * @param config: Pointer to a adc_timer_config_t structure that + * contains the configuration information for the specified function. + * @retval Status, see @ref ald_status_t. + */ +ald_status_t ald_adc_timer_trigger_adc_by_dma(adc_timer_config_t *config) +{ + config->h_pis.perh = PIS; + config->h_pis.init.producer_clk = PIS_CLK_PCLK1; + config->h_pis.init.producer_edge = PIS_EDGE_NONE; + config->h_pis.init.consumer_clk = PIS_CLK_PCLK2; + + #if defined(ES32F36xx) + if (config->p_timer == AD16C4T0) + config->h_pis.init.producer_src = PIS_TIMER0_UPDATA; + else if (config->p_timer == AD16C4T1) + config->h_pis.init.producer_src = PIS_TIMER1_UPDATA; + else if (config->p_timer == GP32C4T0) + config->h_pis.init.producer_src = PIS_TIMER2_UPDATA; + else if (config->p_timer == GP32C4T1) + config->h_pis.init.producer_src = PIS_TIMER3_UPDATA; + else + return ERROR; + #elif defined(ES32F39xx) || defined(ES32F336x) + if (config->p_timer == GP16C4T0) + config->h_pis.init.producer_src = PIS_TIMER0_UPDATA; + else if (config->p_timer == GP16C4T1) + config->h_pis.init.producer_src = PIS_TIMER1_UPDATA; + else if (config->p_timer == GP32C4T0) + config->h_pis.init.producer_src = PIS_TIMER2_UPDATA; + else if (config->p_timer == GP32C4T1) + config->h_pis.init.producer_src = PIS_TIMER3_UPDATA; + else + return ERROR; + #endif + + if (config->p_adc == ADC0) + config->h_pis.init.consumer_trig = PIS_CH6_ADC0_NORMAL; + else + return ERROR; + + ald_pis_create(&config->h_pis); + + /* Initialize TIMER */ + config->h_timer.perh = config->p_timer; + config->h_timer.init.prescaler = 0; + config->h_timer.init.mode = TIMER_CNT_MODE_UP; + config->h_timer.init.period = ((ald_cmu_get_pclk1_clock() / 1000000) * config->time); + config->h_timer.init.clk_div = TIMER_CLOCK_DIV1; + config->h_timer.init.re_cnt = 0; + ald_timer_base_init(&config->h_timer); + + config->h_adc.perh = config->p_adc; + config->h_adc.init.align = ADC_DATAALIGN_RIGHT; + config->h_adc.init.scan = DISABLE; + config->h_adc.init.cont = DISABLE; + config->h_adc.init.nch_nr = ADC_NCH_NR_1; + config->h_adc.init.disc = ADC_ALL_DISABLE; + config->h_adc.init.disc_nr = ADC_DISC_NR_1; + config->h_adc.init.data_bit = ADC_CONV_BIT_12; + config->h_adc.init.div = ADC_CKDIV_128; + config->h_adc.init.nche_sel = ADC_NCHESEL_MODE_ONE; + config->h_adc.init.n_ref = config->n_ref; + config->h_adc.init.p_ref = config->p_ref; + config->h_adc.normal_cplt_cbk = config->cplt_cbk; + config->h_adc.insert_cplt_cbk = NULL; + config->h_adc.wdg_cbk = NULL; + config->h_adc.error_cbk = NULL; + config->h_adc.ovr_cbk = NULL; + ald_adc_init(&config->h_adc); + + config->h_adc.perh->CON1 |= 0x10000000; + config->config.ch = config->adc_ch; + config->config.idx = ADC_NCH_IDX_1; + config->config.samp = ADC_SAMPLETIME_4; + ald_adc_normal_channel_config(&config->h_adc, &config->config); + + config->h_dma.cplt_cbk = adc_dma_timer_trigger_cplt; + config->h_dma.cplt_arg = config; + config->h_dma.err_cbk = adc_dma_error; + config->h_dma.err_arg = &config->h_adc; + + ald_dma_config_struct(&config->h_dma.config); + config->h_dma.perh = DMA0; + config->h_dma.config.src = (void *)&config->h_adc.perh->NCHDR; + config->h_dma.config.dst = (void *)config->buf; + config->h_dma.config.size = config->size; + config->h_dma.config.data_width = DMA_DATA_SIZE_HALFWORD; + config->h_dma.config.src_inc = DMA_DATA_INC_NONE; + config->h_dma.config.dst_inc = DMA_DATA_INC_HALFWORD; + config->h_dma.config.msel = config->p_adc == ADC0 ? DMA_MSEL_ADC0 : DMA_MSEL_ADC1; + config->h_dma.config.msigsel = DMA_MSIGSEL_ADC; + config->h_dma.config.burst = ENABLE; + config->h_dma.config.channel = config->dma_ch; + ald_dma_config_basic(&config->h_dma); + + SET_BIT(config->h_adc.perh->CON1, ADC_CON1_DMA_MSK); ADC_ENABLE(&config->h_adc); ald_timer_base_start(&config->h_timer); diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_can.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_can.c index ec9ec28260..fb97024cd1 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_can.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_can.c @@ -99,6 +99,7 @@ static void can_rx_fifo_release(can_handle_t *hperh, can_rx_fifo_t num); static ald_status_t __can_send_by_it(can_handle_t *hperh, uint8_t err); static ald_status_t __can_recv_by_it(can_handle_t *hperh, can_rx_fifo_t num); +static int __can_rx_check(can_handle_t *hperh, can_rx_fifo_t num); /** * @} */ @@ -138,7 +139,7 @@ ald_status_t ald_can_init(can_handle_t *hperh) assert_param(IS_FUNC_STATE(hperh->init.ttcm)); assert_param(IS_FUNC_STATE(hperh->init.abom)); assert_param(IS_FUNC_STATE(hperh->init.awk)); - assert_param(IS_FUNC_STATE(hperh->init.abom)); + assert_param(IS_FUNC_STATE(hperh->init.artx)); assert_param(IS_FUNC_STATE(hperh->init.rfom)); assert_param(IS_FUNC_STATE(hperh->init.txmp)); assert_param(IS_CAN_MODE(hperh->init.mode)); @@ -442,6 +443,9 @@ ald_status_t ald_can_recv(can_handle_t *hperh, can_rx_fifo_t num, can_rx_msg_t * } } + if (__can_rx_check(hperh, num)) + return ERROR; + stid = READ_BITS(hperh->perh->RxFIFO[num].RXFID, CAN_RXF0ID_STDID_MSK, CAN_RXF0ID_STDID_POSS); exid = READ_BITS(hperh->perh->RxFIFO[num].RXFID, CAN_RXF0ID_EXID_MSK, CAN_RXF0ID_EXID_POSS); msg->type = (can_id_type_t)READ_BITS(hperh->perh->RxFIFO[num].RXFID, CAN_RXF0ID_IDE_MSK, CAN_RXF0ID_IDE_POS); diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_cmu.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_cmu.c index 8beb08de5b..670546d515 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_cmu.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_cmu.c @@ -290,12 +290,11 @@ ald_status_t ald_cmu_clock_config_default(void) return ERROR; } - WRITE_REG(CMU->CFGR, 0x0); - CLEAR_BIT(CMU->CFGR, CMU_CFGR_HRCFST_MSK); /* Select 24Mhz */ + WRITE_REG(CMU->CFGR, 0x4000000); /* Select 24MHz */ tmp = READ_REG(CMU->CLKENR); - /* Enable HRC/LRC/LOSC */ - SET_BIT(tmp, CMU_CLKENR_HRCEN_MSK | CMU_CLKENR_LRCEN_MSK | CMU_CLKENR_LOSCEN_MSK); + /* Enable HRC/LRC */ + SET_BIT(tmp, CMU_CLKENR_HRCEN_MSK | CMU_CLKENR_LRCEN_MSK); WRITE_REG(CMU->CLKENR, tmp); /* Reset LRC */ for (cnt = 0; cnt < 10000; ++cnt); diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_dma.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_dma.c index eae14f80c3..a12c72b371 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_dma.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_dma.c @@ -186,19 +186,20 @@ void ald_dma_irq_handler(void) uint32_t i, reg = DMA0->IFLAG; for (i = 0; i < DMA_CH_COUNT; ++i) { - if (READ_BIT(reg, (1 << i))) { + if (READ_BIT(reg, (1U << i))) { + DMA0->ICFR = (1U << i); + DMA0->CHENCLR = (1U << i); + if (dma0_cbk[i].cplt_cbk != NULL) dma0_cbk[i].cplt_cbk(dma0_cbk[i].cplt_arg); - - ald_dma_clear_flag_status(DMA0, i); } } if (READ_BIT(reg, (1U << DMA_ERR))) { - ald_dma_clear_flag_status(DMA0, DMA_ERR); + DMA0->ICFR = (1U << DMA_ERR); for (i = 0; i < DMA_CH_COUNT; ++i) { - if (((DMA0->CHENSET >> i) & 0x1) && (dma0_cbk[i].err_cbk != NULL)) + if (dma0_cbk[i].err_cbk != NULL) dma0_cbk[i].err_cbk(dma0_cbk[i].err_arg); } } diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_gpio.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_gpio.c index 255c569463..8285401f26 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_gpio.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_gpio.c @@ -415,9 +415,9 @@ void ald_gpio_write_pin(GPIO_TypeDef *GPIOx, uint16_t pin, uint8_t val) assert_param(IS_GPIO_PIN(pin)); if ((val & (0x01)) == 0x00) - CLEAR_BIT(GPIOx->DOUT, pin); + GPIOx->BSRR = pin << 16U; else - SET_BIT(GPIOx->DOUT, pin); + GPIOx->BSRR = pin; return; } diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_nand.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_nand.c index cc178feb7f..6008dcde08 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_nand.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_nand.c @@ -305,7 +305,9 @@ ald_status_t ald_nand_read_page_8b(nand_handle_t *hperh, nand_address_t *addr, u *(__IO uint8_t *)((uint32_t)(deviceaddr | CMD_AREA)) = ((uint8_t)0x00); } - /* Get Data into Buffer */ + ald_delay_us(25); /*ʱ25us,nand flash ֲеֵ*/ + + /* Get Data into Buffer */ for (; index < size; index++) { *(uint8_t *)buf++ = *(uint8_t *)deviceaddr; } diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_timer.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_timer.c index 7860499237..49c6be5d1c 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_timer.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_timer.c @@ -737,7 +737,7 @@ void ald_timer_pwm_stop_by_dma(timer_handle_t *hperh, timer_channel_t ch) * @param freq: PWM freq to set * @retval None */ -void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint16_t freq) +void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint32_t freq) { uint32_t _arr; @@ -758,12 +758,12 @@ void ald_timer_pwm_set_freq(timer_handle_t *hperh, uint16_t freq) * @arg TIMER_CHANNEL_2: TIMER Channel 2 selected * @arg TIMER_CHANNEL_3: TIMER Channel 3 selected * @arg TIMER_CHANNEL_4: TIMER Channel 4 selected - * @param duty: PWM duty to set + * @param duty: PWM duty to set [0, 100] * @retval None */ void ald_timer_pwm_set_duty(timer_handle_t *hperh, timer_channel_t ch, uint16_t duty) { - uint32_t tmp = (hperh->init.period + 1) * duty / 100 - 1; + uint32_t tmp = (hperh->init.period + 1) * duty / 100; if (ch == TIMER_CHANNEL_1) WRITE_REG(hperh->perh->CCVAL1, tmp); diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_uart.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_uart.c index 84c96348c6..44327be3f7 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_uart.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/ald_uart.c @@ -144,12 +144,29 @@ static void uart_dma_send_cplt(void *arg) */ static void uart_dma_recv_cplt(void *arg) { + uint32_t stat = 0; + uart_handle_t *hperh = (uart_handle_t *)arg; hperh->tx_count = hperh->tx_size; ald_uart_dma_req_config(hperh, UART_DMA_REQ_RX, DISABLE); hperh->rx_count = 0; CLEAR_BIT(hperh->state, UART_STATE_RX_MASK); + stat = hperh->perh->STAT; + + /* Handle parity error */ + if ((READ_BIT(stat, UART_STATUS_PERR)) != RESET) + hperh->err_code |= UART_ERROR_PE; + + /* Handle frame error */ + if ((READ_BIT(stat, UART_STATUS_FERR)) != RESET) + hperh->err_code |= UART_ERROR_FE; + + /* Handle rx overflow error */ + if ((READ_BIT(stat, UART_STATUS_RFOERR)) != RESET) { + hperh->err_code |= UART_ERROR_ORE; + UART_FIFO_RX_RESET(hperh); + } if (hperh->rx_cplt_cbk) hperh->rx_cplt_cbk(hperh); @@ -552,12 +569,16 @@ ald_status_t ald_uart_send(uart_handle_t *hperh, uint8_t *buf, uint16_t size, ui */ ald_status_t ald_uart_recv(uart_handle_t *hperh, uint8_t *buf, uint16_t size, uint32_t timeout) { + uint32_t stat = 0; + uint32_t err = 0; + uint32_t tick = 0; + assert_param(IS_UART_ALL(hperh->perh)); if ((hperh->state != UART_STATE_READY) && (hperh->state != UART_STATE_BUSY_TX)) return BUSY; - if ((buf == NULL) || (size == 0)) + if ((buf == NULL) || (size == 0) || (timeout == 0)) return ERROR; __LOCK(hperh); @@ -568,15 +589,47 @@ ald_status_t ald_uart_recv(uart_handle_t *hperh, uint8_t *buf, uint16_t size, ui hperh->rx_count = 0; SET_BIT(hperh->perh->FCON, UART_FCON_RFRST_MSK); - while (size-- > 0) { - if (uart_wait_flag(hperh, UART_STATUS_RFTH, SET, timeout) != OK) { - __UNLOCK(hperh); - hperh->state = UART_STATE_READY; - return TIMEOUT; - } + err = (UART_STATUS_PERR | UART_STATUS_FERR | UART_STATUS_RFOERR); - *buf++ = (uint8_t)(hperh->perh->RXBUF & 0xFF); - hperh->rx_count++; + while (size-- > 0) { + tick = ald_get_tick(); + + /* Waiting for flag */ + while (1) { + stat = hperh->perh->STAT; + if (READ_BIT(stat, UART_STATUS_RFTH) != RESET) + break; + + if (((ald_get_tick()) - tick) > timeout) { + __UNLOCK(hperh); + hperh->state = UART_STATE_READY; + return TIMEOUT; + } + } + if ((stat & err) == RESET) { + *buf++ = (uint8_t)(hperh->perh->RXBUF & 0xFF); + hperh->rx_count++; + } + else { + /* Handle parity error */ + if ((READ_BIT(stat, UART_STATUS_PERR)) != RESET) + hperh->err_code |= UART_ERROR_PE; + + /* Handle frame error */ + if ((READ_BIT(stat, UART_STATUS_FERR)) != RESET) + hperh->err_code |= UART_ERROR_FE; + + /* Handle rx overflow error */ + if ((READ_BIT(stat, UART_STATUS_RFOERR)) != RESET) { + hperh->err_code |= UART_ERROR_ORE; + UART_FIFO_RX_RESET(hperh); + } + + CLEAR_BIT(hperh->state, UART_STATE_RX_MASK); + __UNLOCK(hperh); + + return ERROR; + } } CLEAR_BIT(hperh->state, UART_STATE_RX_MASK); @@ -898,7 +951,7 @@ ald_status_t ald_uart_recv_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t s hperh->hdmarx.config.msigsel = DMA_MSIGSEL_UART_RNR; } - hperh->hdmatx.config.burst = ENABLE; + hperh->hdmarx.config.burst = ENABLE; hperh->hdmarx.config.channel = channel; if (hperh->init.mode == UART_MODE_RS485) { @@ -915,9 +968,9 @@ ald_status_t ald_uart_recv_by_dma(uart_handle_t *hperh, uint8_t *buf, uint16_t s else if (hperh->perh == UART3) hperh->hdmarx.config.msel = DMA_MSEL_UART3; else if (hperh->perh == UART4) - hperh->hdmatx.config.msel = DMA_MSEL_UART4; + hperh->hdmarx.config.msel = DMA_MSEL_UART4; else if (hperh->perh == UART5) - hperh->hdmatx.config.msel = DMA_MSEL_UART5; + hperh->hdmarx.config.msel = DMA_MSEL_UART5; else ; @@ -980,27 +1033,35 @@ ald_status_t ald_uart_dma_stop(uart_handle_t *hperh) */ void ald_uart_irq_handler(uart_handle_t *hperh) { + uint32_t stat = 0; + assert_param(IS_UART_ALL(hperh->perh)); + stat = hperh->perh->STAT; + /* Handle parity error */ - if (((ald_uart_get_status(hperh, UART_STATUS_PERR)) != RESET) && \ + if (((READ_BIT(stat, UART_STATUS_PERR)) != RESET) && \ (ald_uart_get_state(hperh)) == UART_STATE_RX_MASK) hperh->err_code |= UART_ERROR_PE; /* Handle frame error */ - if (((ald_uart_get_status(hperh, UART_STATUS_FERR)) != RESET) && \ + if (((READ_BIT(stat, UART_STATUS_FERR)) != RESET) && \ (ald_uart_get_state(hperh)) == UART_STATE_RX_MASK) hperh->err_code |= UART_ERROR_FE; /* Handle rx overflow error */ - if (((ald_uart_get_status(hperh, UART_STATUS_RFOERR)) != RESET) && \ - (ald_uart_get_state(hperh)) == UART_STATE_RX_MASK) + if (((READ_BIT(stat, UART_STATUS_RFOERR)) != RESET) && \ + (ald_uart_get_state(hperh)) == UART_STATE_RX_MASK) { hperh->err_code |= UART_ERROR_ORE; + UART_FIFO_RX_RESET(hperh); + } /* Handle tx overflow error */ - if (((ald_uart_get_status(hperh, UART_STATUS_TFOERR)) != RESET) && \ - (ald_uart_get_state(hperh)) == UART_STATE_TX_MASK) + if (((READ_BIT(stat, UART_STATUS_TFOERR)) != RESET) && \ + (ald_uart_get_state(hperh)) == UART_STATE_TX_MASK) { hperh->err_code |= UART_ERROR_ORE; + UART_FIFO_TX_RESET(hperh); + } /* Receive */ if ((ald_uart_get_mask_flag_status(hperh, UART_IF_RFTH)) != RESET) { diff --git a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/utils.c b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/utils.c index d2c5bfecb6..d57bc6e25b 100644 --- a/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/utils.c +++ b/bsp/essemi/es32f369x/libraries/ES32F36xx_ALD_StdPeriph_Driver/Source/utils.c @@ -4,10 +4,14 @@ * @file utils.c * @brief This file contains the Utilities functions/types for the driver. * - * @version V1.0 - * @date 07 Nov 2019 + * @version V1.1 + * @date 13 Apr 2021 * @author AE Team * @note + * Change Logs: + * Date Author Notes + * 07 Nov 2019 AE Team The first version + * 13 Apr 2021 AE Team Add API: sys_config() * * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. * @@ -31,7 +35,8 @@ #include #include "utils.h" #include "ald_dma.h" -#include "ald_cmu.h" +#include "ald_cmu.h" +#include "ald_iap.h" /** @defgroup ES32FXXX_ALD EASTSOFT ES32F3xx ALD @@ -152,9 +157,9 @@ void ald_cmu_init(void) __weak void ald_tick_init(uint32_t prio) { /* Configure the SysTick IRQ */ - NVIC_SetPriority(SysTick_IRQn, prio); SysTick_Config(ald_cmu_get_sys_clock() / SYSTICK_INTERVAL_1MS); - + NVIC_SetPriority(SysTick_IRQn, prio); + return; } @@ -246,6 +251,31 @@ __weak uint32_t ald_get_tick(void) { return lib_tick; } + +/** + * @brief This function provides accurate delay (in milliseconds) based + * on variable incremented. + * @note In the default implementation, SysTick timer is the source of time base. + * It is used to generate interrupts at regular time intervals where lib_tick + * is incremented. + * @note This function is declared as __weak to be overwritten in case of other + * implementations in user file. + * @param delay: specifies the delay time length, in microseconds(us). + * @retval None + */ +__weak void ald_delay_us(__IO uint32_t delay) +{ + uint32_t start, now, delta, reload, us_tick; + start = SysTick->VAL; + reload = SysTick->LOAD; + us_tick = ald_cmu_get_sys_clock() / 1000000UL; + do + { + now = SysTick->VAL; + delta = (start > now) ? (start - now) : (reload + start - now); + } + while (delta < (us_tick * delay)); +} /** * @brief This function provides accurate delay (in milliseconds) based @@ -467,6 +497,205 @@ uint32_t ald_mcu_get_chipid(void) { return (uint32_t)*(uint32_t *)MCU_CHIPID_ADDR; } + +/** + * @brief Bypass bootroom and set VR1_Ref 0xA + * @retval None + */ +void sys_config(void) +{ + uint32_t i = 0, tmp = 0; + uint8_t err = 0, flag = 0; + uint32_t inf014 = 0, inf0154 = 0; + uint8_t cnt = 4; + + uint32_t *inf0_addr = (uint32_t *)0x20003C00; + /* read bootroom cfg register */ + inf014 = *((uint32_t *)(0x80000 + 56)); + /* read VR1_VREF register */ + inf0154 = *((uint32_t *)(0x80000 + 616)); + + if (inf0154 == 0xFFFFFFFF) + while(1); + + /* if bypass bootroom */ + if ((0xFFFFFFFF != inf014)) { + /* change cfg_boot value = 0xffff */ + inf014 = 0xFFFFFFFF; + flag = 0x1; + } + + /* change CFG_VR1_VREF value, FLASH ref 0xA */ + tmp = (inf0154 >> 8) & 0xF; + if (0xA != tmp) { + inf0154 &= ~(0xF << 8); + inf0154 |= (0xA << 8); + inf0154 = (inf0154 & (0x0000FFFF)) | ((~(inf0154 & 0xFFFF)) << 16); + flag = 0x1; + } + + /* if flag reset, return */ + if (0x0 == flag) + return; + + /* 0x80000, 256words,INFO0 value */ + for (i = 0; i < 256; i++) + inf0_addr[i] = *((uint32_t *)(0x80000 + i * 4)); + + /* refresh value */ + inf0_addr[14] = inf014; + inf0_addr[154] = inf0154; + + while(--cnt) { + err = 0; + /* unlock */ + *((volatile uint32_t *)(0x40080000)) = 0x55AA6996; + *((volatile uint32_t *)(0x40080100)) = 0x5A962814; + *((volatile uint32_t *)(0x40080100)) = 0xE7CB69A5; + + /* erase */ + if (ald_iap_erase_page(0x80000) == OK) { + /* program 256*4bytes, info0 */ + if (ald_iap_program_words(0x80000, (uint8_t *)inf0_addr, 1024, 0) == OK) { + /* check */ + for (i = 0; i < 256; i++) { + if (inf0_addr[i] != *((uint32_t *)(0x80000 + i * 4))) { + err = 1; + break;; + } + } + if (err == 0) { + /* lock */ + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080000)) = 0x123456; + return; + } + } + else { + err = 1; + } + } + else { + err = 1; + } + } + + if (err) { + ald_iap_erase_page(0x80000); + /* lock */ + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080000)) = 0x123456; + while(1); + } +} + +/** + * @brief ADC adjust parameter config + * @retval None + */ +void adc_config(void) +{ + uint32_t inf0176 = 0, inf0178 = 0; + uint32_t inf0250 = 0, inf0251 = 0; + uint32_t inf0242 = 0, i = 0; + uint8_t flag = 0, err = 0; + uint8_t cnt = 4; + /* ram store inf0 1k buffer, 15k ~ 16k */ + uint32_t *inf0_addr = (uint32_t *)0x20003C00; + + /* Read ADC_GE */ + inf0242 = *((uint32_t *)(0x80000 + 968)); + + if (0xF5230ADC == inf0242) return; + + /* read Lot ID */ + inf0250 = *((uint32_t *)(0x80000 + 1000)); + inf0251 = *((uint32_t *)(0x80000 + 1004)); + inf0251 = (inf0251 & 0xFFFF0000) >> 16; + + /* read CFG_ADC0DA/CFG_ADC1DA */ + inf0176 = *((uint32_t *)(0x80000 + 704)); + inf0178 = *((uint32_t *)(0x80000 + 712)); + + switch(inf0250) { + case 0x45465537: + if ((inf0251 == 0x3034) || (inf0251 == 0x3035)) + flag = 1; + break; + case 0x45503931: + if ((inf0251 == 0x3732) || (inf0251 == 0x3734)) + flag = 1; + break; + case 0x45503935: + if ((inf0251 == 0x3837) || (inf0251 == 0x3839)) + flag = 1; + break; + default: + break; + } + + if (!flag) return; + + inf0176 ^= (0x1 << 15); + inf0176 = (inf0176 & 0x0000FFFF) | ((~(inf0176 & 0xFFFF)) << 16); + + inf0178 ^= (0x1 << 15); + inf0178 = (inf0178 & 0x0000FFFF) | ((~(inf0178 & 0xFFFF)) << 16); + + /* 0x80000, 256words,INFO0 value */ + for (i = 0; i < 256; i++) + inf0_addr[i] = *((uint32_t *)(0x80000 + i * 4)); + + inf0_addr[176] = inf0176; + inf0_addr[178] = inf0178; + inf0_addr[242] = 0xF5230ADC; + + while(--cnt) { + err = 0; + /* unlock */ + *((volatile uint32_t *)(0x40080000)) = 0x55AA6996; + *((volatile uint32_t *)(0x40080100)) = 0x5A962814; + *((volatile uint32_t *)(0x40080100)) = 0xE7CB69A5; + + /* erase */ + if (ald_iap_erase_page(0x80000) == OK) { + /* program 256*4bytes, info0 */ + if (ald_iap_program_words(0x80000, (uint8_t *)inf0_addr, 1024, 0) == OK) { + /* check */ + for (i = 0; i < 256; i++) { + if (inf0_addr[i] != *((uint32_t *)(0x80000 + i * 4))) { + err = 1; + break;; + } + } + if (err == 0) { + /* lock */ + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080000)) = 0x123456; + return; + } + } + else { + err = 1; + } + } + else { + err = 1; + } + } + + if (err) { + ald_iap_erase_page(0x80000); + /* lock */ + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080100)) = 0x123456; + *((volatile uint32_t *)(0x40080000)) = 0x123456; + while(1); + } +} /** * @} */ diff --git a/bsp/essemi/es8p508x/.config b/bsp/essemi/es8p508x/.config deleted file mode 100644 index ff8ee21d05..0000000000 --- a/bsp/essemi/es8p508x/.config +++ /dev/null @@ -1,405 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# RT-Thread 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=100 -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 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_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="uart5" -CONFIG_RT_VER_NUM=0x40002 -# CONFIG_RT_USING_CPU_FFS is not set -# 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=2048 -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=2048 -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=y -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_PIN=y -# CONFIG_RT_USING_ADC 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 - -# -# RT-Thread online packages -# - -# -# IoT - internet of things -# -# CONFIG_PKG_USING_PAHOMQTT 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_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_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 - -# -# 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_IOTHUB is not set -# CONFIG_PKG_USING_JIOT-C-SDK 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_ONNX_PARSER is not set -# CONFIG_PKG_USING_ONNX_BACKEND 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 - -# -# security packages -# -# CONFIG_PKG_USING_MBEDTLS is not set -# CONFIG_PKG_USING_libsodium is not set -# CONFIG_PKG_USING_TINYCRYPT 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 - -# -# 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_RDB is not set -# CONFIG_PKG_USING_QRCODE is not set -# CONFIG_PKG_USING_ULOG_EASYFLASH 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_NR_MICRO_SHELL is not set - -# -# system packages -# -# CONFIG_PKG_USING_GUIENGINE is not set -# CONFIG_PKG_USING_CAIRO is not set -# CONFIG_PKG_USING_PIXMAN is not set -# CONFIG_PKG_USING_LWEXT4 is not set -# CONFIG_PKG_USING_PARTITION is not set -# CONFIG_PKG_USING_FAL 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_THREAD_POOL is not set -# CONFIG_PKG_USING_ROBOTS 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_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_WM_LIBRARIES is not set -# CONFIG_PKG_USING_KENDRYTE_SDK is not set -# CONFIG_PKG_USING_INFRARED is not set -# CONFIG_PKG_USING_ROSSERIAL 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_LCD_DRIVERS is not set -# CONFIG_PKG_USING_MAX17048 is not set -# CONFIG_PKG_USING_RPLIDAR 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_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_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_NNOM is not set -# CONFIG_PKG_USING_LIBANN is not set -# CONFIG_PKG_USING_ELAPACK is not set -# CONFIG_PKG_USING_ARMv7M_DWT is not set -# CONFIG_PKG_USING_VT100 is not set -# CONFIG_PKG_USING_ULAPACK is not set -# CONFIG_PKG_USING_UKAL is not set -CONFIG_SOC_ES8P508x=y - -# -# Hardware Drivers Config -# - -# -# On-chip Peripheral Drivers -# -CONFIG_BSP_USING_GPIO=y - -# -# UART Drivers -# -# CONFIG_BSP_USING_UART0 is not set -# CONFIG_BSP_USING_UART1 is not set -# CONFIG_BSP_USING_UART2 is not set -# CONFIG_BSP_USING_UART3 is not set -# CONFIG_BSP_USING_UART4 is not set -CONFIG_BSP_USING_UART5=y - -# -# Onboard Peripheral Drivers -# - -# -# Offboard Peripheral Drivers -# diff --git a/bsp/essemi/es8p508x/Kconfig b/bsp/essemi/es8p508x/Kconfig deleted file mode 100644 index 57778bdbef..0000000000 --- a/bsp/essemi/es8p508x/Kconfig +++ /dev/null @@ -1,27 +0,0 @@ -mainmenu "RT-Thread 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" - -config SOC_ES8P508x - bool - select RT_USING_COMPONENTS_INIT - select RT_USING_USER_MAIN - default y - -source "drivers/Kconfig" diff --git a/bsp/essemi/es8p508x/README.md b/bsp/essemi/es8p508x/README.md deleted file mode 100644 index 68c95b3ede..0000000000 --- a/bsp/essemi/es8p508x/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# HRSDK-GDB-ES8P508 开发板 BSP 说明 -标签: EastSoft、国产MCU、Cortex-M0、ES8P5088FLLQ - -## 1. 简介 - -本文档为上海东软载波微电子开发团队为 HRSDK-GDB-ES8P508 开发板提供的 BSP (板级支持包) 说明。 -通过阅读本文档,开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。 - -### 1.1 开发板介绍 - -主要内容如下: -HRSDK-GDB-ES8P508x 是东软载波微电子官方推出的一款基于 ARM Cortex-M0 内核的开发板,最高主频为 48MHz,可满足基础功能测试及高端功能扩展等开发需求。 - -开发板外观如下图所示: - -HRSDK-GDB-ES8P508x-V1.0 - -![ES8P508](figures/HRSDK-GDB-ES8P508x-V1.0.jpg) - -该开发板常用 **板载资源** 如下: - -- MCU:ES8P5088FLLQ,主频 48MHz,24KB SRAM,128KB FLASH,45 GPIOs -- 常用外设 - - LED:1个,(PA14) - - 按键:1个(MRSTN) -- 常用接口:GPIO、UART、SPI、I2C -- 调试接口,ESLinkⅡ(EastSoft 官方推出的开发工具,有标准版和mini版两种版本,均自带 CDC 串口功能) SWD 下载 - -外设支持: - -本 BSP 目前对外设的支持情况如下: - -| **片上外设** | **支持情况** | **备注** | -| :---------------- | :----------: | :-----------------------------------| -| GPIO | 支持 | 45 GPIOs | -| UART | 支持 | UART0/1/2/3/4/5 | - - -更多详细信息请咨询[上海东软载波微电子技术支持](http://www.essemi.com/) - -## 2. 快速上手 - -本 BSP 为开发者提供 MDK4 工程。下面以 MDK4 开发环境为例,介绍如何将系统运行起来。 - -### 硬件连接 - -使用 ESLinkⅡ (自带 CDC 串口)或 Jlink 等调试工具连接开发板到 PC,拨动开关选择使用调试工具供电或使用外部电源供电。若使用 Jlink 等调试工具,还需要将 UART5_TX(PB13)、UART5_RX(PB12)、GND 接到串口工具上。 - -使用ESlinkⅡ(mini)连接开发板如下图所示: - -ESLinkⅡ(mini) + HRSDK-GDB-ES8P508-V1.0 - -![ESLinkII](figures/ESLinkII-mini.jpg) - -### 编译下载 - -双击 project.uvprojx 文件,打开 MDK4 工程,工程默认配置使用 JLink 下载程序,在通过 JLink 连接开发板的基础上,点击下载按钮即可下载程序到开发板,如果使用 ESLinkⅡ,则选择 "CMSIS-DAP Debugger",连接正常后即可编译并下载程序到开发板。 - -### 运行结果 - -下载程序成功之后,系统会自动运行,观察串口输出的信息,同时开发板LED闪烁。 - -```bash - \ | / -- RT - Thread Operating System - / | \ 4.0.2 build Jul 12 2019 - 2006 - 2019 Copyright by rt-thread team -msh /> -``` -## 3. 进阶使用 - -此 BSP 默认只开启了 GPIO 和 uart5 的功能,如果需使用 SPI 等更多高级功能,需要利用 ENV 工具对 BSP 进行配置,步骤如下: - -1. 在 bsp 下打开 env 工具。 - -2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 - -3. 输入`pkgs --update`命令更新软件包。 - -4. 输入`scons --target=MDK4` 命令重新生成工程。 - -更多 Env 工具的详细介绍请参考 [RT-Thread 文档中心](https://www.rt-thread.org/document/site/) - -## 4. 联系人信息 - -- [wangyongquan](https://github.com/wangyq2018) - -## 5. 参考 - -- [ EastSoft 官网](http://www.essemi.com) - diff --git a/bsp/essemi/es8p508x/SConscript b/bsp/essemi/es8p508x/SConscript deleted file mode 100644 index 11d722608a..0000000000 --- a/bsp/essemi/es8p508x/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# RT-Thread SConscript bridge -import os -from building import * - -objs = [] -cwd = GetCurrentDir() -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/essemi/es8p508x/SConstruct b/bsp/essemi/es8p508x/SConstruct deleted file mode 100644 index 164265293d..0000000000 --- a/bsp/essemi/es8p508x/SConstruct +++ /dev/null @@ -1,39 +0,0 @@ -import os -import sys -import rtconfig - -if os.getenv('RTT_ROOT'): - RTT_ROOT = os.getenv('RTT_ROOT') -else: - RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..') - -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 = 'rtthread.' + rtconfig.TARGET_EXT - -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 -objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) - -# make a building -DoBuilding(TARGET, objs) diff --git a/bsp/essemi/es8p508x/applications/SConscript b/bsp/essemi/es8p508x/applications/SConscript deleted file mode 100644 index 51b0290a69..0000000000 --- a/bsp/essemi/es8p508x/applications/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -from building import * - -cwd = GetCurrentDir() -src = Glob('*.c') - -CPPPATH = [cwd] -group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') diff --git a/bsp/essemi/es8p508x/applications/main.c b/bsp/essemi/es8p508x/applications/main.c deleted file mode 100644 index 6494a970b5..0000000000 --- a/bsp/essemi/es8p508x/applications/main.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-07-12 wangyq the first version - */ - -#include -#include -#include - -#define LED_PIN 29 - -int main(void) -{ - int count = 1; - - /* set PA14 pin mode to output */ - rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT); - - while (count++) - { - rt_pin_write(LED_PIN, PIN_HIGH); - rt_thread_mdelay(500); - rt_pin_write(LED_PIN, PIN_LOW); - rt_thread_mdelay(500); - } - - return RT_EOK; -} - diff --git a/bsp/essemi/es8p508x/drivers/Kconfig b/bsp/essemi/es8p508x/drivers/Kconfig deleted file mode 100644 index 98a7d173b3..0000000000 --- a/bsp/essemi/es8p508x/drivers/Kconfig +++ /dev/null @@ -1,51 +0,0 @@ -menu "Hardware Drivers Config" - - menu "On-chip Peripheral Drivers" - config BSP_USING_GPIO - bool "Enable GPIO" - select RT_USING_PIN - default y - - menu "UART Drivers" - config BSP_USING_UART0 - bool "Enable UART0 PB00/PB01(R/T)" - select RT_USING_SERIAL - default n - - config BSP_USING_UART1 - bool "Enable UART1 PA18/PA17(R/T)" - select RT_USING_SERIAL - default n - - config BSP_USING_UART2 - bool "Enable UART2 PA04/PA05(R/T)" - select RT_USING_SERIAL - default n - - config BSP_USING_UART3 - bool "Enable UART3 PA30/PA29(R/T)" - select RT_USING_SERIAL - default n - - config BSP_USING_UART4 - bool "Enable UART4 PB10/PB11(R/T)" - select RT_USING_SERIAL - default n - - config BSP_USING_UART5 - bool "Enable UART5 PB12/PB13(R/T)" - select RT_USING_SERIAL - default y - endmenu - - endmenu - - menu "Onboard Peripheral Drivers" - - endmenu - - menu "Offboard Peripheral Drivers" - - endmenu - -endmenu diff --git a/bsp/essemi/es8p508x/drivers/SConscript b/bsp/essemi/es8p508x/drivers/SConscript deleted file mode 100644 index f2b341e073..0000000000 --- a/bsp/essemi/es8p508x/drivers/SConscript +++ /dev/null @@ -1,21 +0,0 @@ -from building import * - -cwd = GetCurrentDir() - -# add the general drivers. -src = Split(''' -board.c -''') - -# add gpio code -if GetDepend('RT_USING_PIN'): - src += ['drv_gpio.c'] - -# add serial driver code -if GetDepend('BSP_USING_UART0') or GetDepend('BSP_USING_UART1') or GetDepend('BSP_USING_UART2') or GetDepend('BSP_USING_UART3') or GetDepend('BSP_USING_UART4') or GetDepend('BSP_USING_UART5'): - src += ['drv_uart.c'] - -CPPPATH = [cwd] -group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') diff --git a/bsp/essemi/es8p508x/drivers/board.c b/bsp/essemi/es8p508x/drivers/board.c deleted file mode 100644 index b013fa327c..0000000000 --- a/bsp/essemi/es8p508x/drivers/board.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-07-11 wangyq the first version - */ - -#include -#include -#include "board.h" -#include "drv_uart.h" -#include "drv_gpio.h" -#include -#include - -/** - * @addtogroup es8p - */ - -/*@{*/ - -/******************************************************************************* -* Function Name : NVIC_Configuration -* Description : Configures Vector Table base location. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void NVIC_Configuration(void) -{ -} - -/******************************************************************************* - * Function Name : SystemClock_Configuration - * Description : Configures the System Clock. - * Input : None - * Output : None - * Return : None - *******************************************************************************/ -void SystemClock_Config(void) -{ - /* system clock 48MHz */ - PLLClock_Config(ENABLE, SCU_PLL_HRC, SCU_PLL_48M, ENABLE); -} - -/******************************************************************************* - * Function Name : SysTick_Configuration - * Description : Configures the SysTick for OS tick. - * Input : None - * Output : None - * Return : None - *******************************************************************************/ -void SysTick_Configuration(void) -{ - /* ticks = SYS_CLK / RT_TICK_PER_SECOND */ - SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); -} - -/** - * This is the timer interrupt service routine. - * - */ -void systick_irq_cbk(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - rt_tick_increase(); - - /* leave interrupt */ - rt_interrupt_leave(); -} - -/*@}*/ -/** - * This function will initial es8p board. - */ -void rt_hw_board_init(void) -{ - /* NVIC Configuration */ - NVIC_Configuration(); - - /*System Clock Configuration */ - SystemClock_Config(); - - /* 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 -} - -/** - * This function will delay for some us. - * - * @param us the delay time of us - */ -void rt_hw_us_delay(rt_uint32_t us) -{ - unsigned int 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/essemi/es8p508x/drivers/board.h b/bsp/essemi/es8p508x/drivers/board.h deleted file mode 100644 index 0dcfdd432f..0000000000 --- a/bsp/essemi/es8p508x/drivers/board.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-07-11 wangyq the first version - */ - -// <<< Use Configuration Wizard in Context Menu >>> -#ifndef __BOARD_H__ -#define __BOARD_H__ - -#include - -#define ES8P_SRAM_SIZE 0x6000 -#define ES8P_SRAM_END (0x20000000 + ES8P_SRAM_SIZE) - -#if defined(__CC_ARM) || defined(__CLANG_ARM) - extern int Image$$RW_IRAM1$$ZI$$Limit; - #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) -#elif __ICCARM__ - #pragma section="HEAP" - #define HEAP_BEGIN (__segment_end("HEAP")) -#else - extern int __bss_end; - #define HEAP_BEGIN ((void *)&__bss_end) -#endif - -#define HEAP_END ES8P_SRAM_END - -void rt_hw_board_init(void); - -#endif diff --git a/bsp/essemi/es8p508x/drivers/drv_gpio.c b/bsp/essemi/es8p508x/drivers/drv_gpio.c deleted file mode 100644 index 9dfc09ef8e..0000000000 --- a/bsp/essemi/es8p508x/drivers/drv_gpio.c +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-07-11 wangyq the first version - */ - -#include -#include -#include "board.h" -#include "drv_gpio.h" -#include -#include - -#ifdef RT_USING_PIN - -#define __ES8P_PIN(index, gpio, gpio_index) {index, GPIO##gpio, GPIO_Pin_##gpio_index} -#define __ES8P_PIN_DEFAULT {-1, GPIOA, GPIO_Pin_0} - -/* es8p GPIO driver */ -struct pin_index -{ - int index; - GPIO_TYPE gpio; - GPIO_TYPE_PIN pin; -}; - -static const struct pin_index pins[] = -{ - __ES8P_PIN_DEFAULT, - __ES8P_PIN(1, B, 0), - __ES8P_PIN(2, B, 1), - __ES8P_PIN(3, B, 2), - __ES8P_PIN(4, B, 3), - __ES8P_PIN(5, B, 4), - __ES8P_PIN(6, B, 5), - __ES8P_PIN(7, B, 6), - __ES8P_PIN(8, B, 7), - __ES8P_PIN(9, B, 8), - __ES8P_PIN(10, B, 9), - __ES8P_PIN(11, B, 10), - __ES8P_PIN(12, B, 11), - __ES8P_PIN(13, B, 12), - __ES8P_PIN(14, B, 13), - __ES8P_PIN(15, A, 0), - __ES8P_PIN(16, A, 1), - __ES8P_PIN(17, A, 2), - __ES8P_PIN(18, A, 3), - __ES8P_PIN(19, A, 4), - __ES8P_PIN(20, A, 5), - __ES8P_PIN(21, A, 6), - __ES8P_PIN(22, A, 7), - __ES8P_PIN(23, A, 8), - __ES8P_PIN(24, A, 9), - __ES8P_PIN(25, A, 10), - __ES8P_PIN(26, A, 11), - __ES8P_PIN(27, A, 12), - __ES8P_PIN(28, A, 13), - __ES8P_PIN(29, A, 14), - __ES8P_PIN(30, A, 15), - __ES8P_PIN(31, A, 16), - __ES8P_PIN_DEFAULT, - __ES8P_PIN_DEFAULT, - __ES8P_PIN(34, A, 17), - __ES8P_PIN(35, A, 18), - __ES8P_PIN_DEFAULT, - __ES8P_PIN(37, A, 20), - __ES8P_PIN(38, A, 21), - __ES8P_PIN(39, A, 22), - __ES8P_PIN(40, A, 23), - __ES8P_PIN(41, A, 24), - __ES8P_PIN(42, A, 25), - __ES8P_PIN(43, A, 26), - __ES8P_PIN(44, A, 27), - __ES8P_PIN(45, A, 28), - __ES8P_PIN(46, A, 29), - __ES8P_PIN(47, A, 30), - __ES8P_PIN(48, A, 31), -}; - -struct irq_map -{ - PINT_TYPE pinno; - IRQn_Type irqno; -}; -static const struct irq_map irq_map[] = -{ - {PINT0, PINT0_IRQn}, - {PINT1, PINT1_IRQn}, - {PINT2, PINT2_IRQn}, - {PINT3, PINT3_IRQn}, - {PINT4, PINT4_IRQn}, - {PINT5, PINT5_IRQn}, - {PINT6, PINT6_IRQn}, - {PINT7, PINT7_IRQn}, -}; - -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}, -}; - -#define ITEM_NUM(items) sizeof(items) / sizeof(items[0]) -const struct pin_index *get_pin(uint8_t pin) -{ - const struct pin_index *index; - if (pin < ITEM_NUM(pins)) - { - index = &pins[pin]; - if (index->index == -1) - index = RT_NULL; - } - else - { - index = RT_NULL; - } - return index; -}; - -void es8p_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value) -{ - const struct pin_index *index; - index = get_pin(pin); - if (index == RT_NULL) - { - return; - } - - if (value == 0) - { - if (index->gpio == GPIOA) - GPIOA_ResetBit(index->pin); - else if (index->gpio == GPIOB) - GPIOB_ResetBit(index->pin); - } - else - { - if (index->gpio == GPIOA) - GPIOA_SetBit(index->pin); - else if (index->gpio == GPIOB) - GPIOB_SetBit(index->pin); - } -} - -int es8p_pin_read(rt_device_t dev, rt_base_t pin) -{ - int value; - const struct pin_index *index; - value = PIN_LOW; - index = get_pin(pin); - if (index == RT_NULL) - { - return value; - } - value = GPIO_ReadBit(index->gpio, index->pin); - return value; -} - -void es8p_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) -{ - const struct pin_index *index; - GPIO_InitStruType gpio_initstruct; - index = get_pin(pin); - if (index == RT_NULL) - { - return; - } - - /* Configure GPIO_InitStructure */ - gpio_initstruct.GPIO_Signal = GPIO_Pin_Signal_Digital; - gpio_initstruct.GPIO_Func = GPIO_Func_0; - gpio_initstruct.GPIO_OD = GPIO_ODE_Output_Disable; - gpio_initstruct.GPIO_PUEN = GPIO_PUE_Input_Disable; - gpio_initstruct.GPIO_PDEN = GPIO_PDE_Input_Disable; - gpio_initstruct.GPIO_DS = GPIO_DS_Output_Normal; - - if (mode == PIN_MODE_OUTPUT) - { - /* output setting */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - } - else if (mode == PIN_MODE_INPUT) - { - /* input setting: not pull. */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - } - else if (mode == PIN_MODE_INPUT_PULLUP) - { - /* input setting: pull up. */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - gpio_initstruct.GPIO_PUEN = GPIO_PUE_Input_Enable; - } - else if (mode == PIN_MODE_INPUT_PULLDOWN) - { - /* input setting: pull down. */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - gpio_initstruct.GPIO_PDEN = GPIO_PDE_Input_Enable; - } - else if (mode == PIN_MODE_OUTPUT_OD) - { - /* output setting: od. */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - gpio_initstruct.GPIO_OD = GPIO_ODE_Output_Enable; - } - GPIO_Init(index->gpio, index->pin, &gpio_initstruct); -} - -rt_inline const struct irq_map *get_pin_irq_map(rt_uint16_t gpio_pin) -{ - rt_int32_t mapindex = gpio_pin & 0x00FF; - if (mapindex < 0 || mapindex >= 32) - { - return RT_NULL; - } - return &irq_map[mapindex % 8]; -}; - -rt_err_t es8p_pin_attach_irq(struct rt_device *device, rt_int32_t pin, - rt_uint32_t mode, void (*hdr)(void *args), void *args) -{ - const struct pin_index *index; - rt_base_t level; - rt_int32_t irqindex; - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - - irqindex = index->pin % 8; - 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; -} - -rt_err_t es8p_pin_detach_irq(struct rt_device *device, rt_int32_t pin) -{ - const struct pin_index *index; - rt_base_t level; - rt_int32_t irqindex = -1; - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - irqindex = index->pin % 8; - 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; -} - -rt_err_t es8p_pin_irq_enable(struct rt_device *device, rt_base_t pin, - rt_uint32_t enabled) -{ - const struct pin_index *index; - const struct irq_map *irqmap; - rt_base_t level; - rt_int32_t irqindex = -1; - /* Configure GPIO_InitStructure */ - GPIO_InitStruType gpio_initstruct; - - index = get_pin(pin); - if (index == RT_NULL) - { - return RT_ENOSYS; - } - if (enabled == PIN_IRQ_ENABLE) - { - irqindex = pin % 8; - level = rt_hw_interrupt_disable(); - if (pin_irq_hdr_tab[irqindex].pin == -1) - { - rt_hw_interrupt_enable(level); - return RT_ENOSYS; - } - irqmap = &irq_map[irqindex]; - - /* Configure GPIO_InitStructure */ - gpio_initstruct.GPIO_Signal = GPIO_Pin_Signal_Digital; - gpio_initstruct.GPIO_Func = GPIO_Func_0; - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - gpio_initstruct.GPIO_OD = GPIO_ODE_Output_Disable; - gpio_initstruct.GPIO_DS = GPIO_DS_Output_Normal; - - switch (pin_irq_hdr_tab[irqindex].mode) - { - case PIN_IRQ_MODE_RISING: - gpio_initstruct.GPIO_PUEN = GPIO_PUE_Input_Disable; - gpio_initstruct.GPIO_PDEN = GPIO_PDE_Input_Enable; - if (index->gpio == GPIOA) - PINT_Config(irqmap->pinno, (PINT_TYPE_SEL)(pin >> 3), PINT_Trig_Rise); - else - PINT_Config(irqmap->pinno, (PINT_TYPE_SEL)((pin >> 3) + 4), PINT_Trig_Rise); - break; - - case PIN_IRQ_MODE_FALLING: - gpio_initstruct.GPIO_PUEN = GPIO_PUE_Input_Enable; - gpio_initstruct.GPIO_PDEN = GPIO_PDE_Input_Disable; - if (index->gpio == GPIOA) - PINT_Config(irqmap->pinno, (PINT_TYPE_SEL)(pin >> 3), PINT_Trig_Fall); - else - PINT_Config(irqmap->pinno, (PINT_TYPE_SEL)((pin >> 3) + 4), PINT_Trig_Fall); - break; - - case PIN_IRQ_MODE_RISING_FALLING: - gpio_initstruct.GPIO_PUEN = GPIO_PUE_Input_Disable; - gpio_initstruct.GPIO_PDEN = GPIO_PDE_Input_Disable; - if (index->gpio == GPIOA) - PINT_Config(irqmap->pinno, (PINT_TYPE_SEL)(pin >> 3), PINT_Trig_Change); - else - PINT_Config(irqmap->pinno, (PINT_TYPE_SEL)((pin >> 3) + 4), PINT_Trig_Change); - break; - - default: - break; - } - GPIO_Init(index->gpio, index->pin, &gpio_initstruct); - NVIC_EnableIRQ(irqmap->irqno); - rt_hw_interrupt_enable(level); - } - else if (enabled == PIN_IRQ_DISABLE) - { - irqmap = get_pin_irq_map(index->pin); - if (irqmap == RT_NULL) - { - return RT_ENOSYS; - } - NVIC_DisableIRQ(irqmap->irqno); - } - else - { - return RT_ENOSYS; - } - return RT_EOK; -} - -const static struct rt_pin_ops _es8p_pin_ops = -{ - es8p_pin_mode, - es8p_pin_write, - es8p_pin_read, - es8p_pin_attach_irq, - es8p_pin_detach_irq, - es8p_pin_irq_enable, - RT_NULL, -}; - -int rt_hw_pin_init(void) -{ - int result; - SCU_GPIOCLK_Enable(); - result = rt_device_pin_register("pin", &_es8p_pin_ops, RT_NULL); - return result; -} -INIT_BOARD_EXPORT(rt_hw_pin_init); - -rt_inline void pin_irq_hdr(PINT_TYPE_IT GPIO_Pin) -{ - uint16_t irqno; - /* pin no. convert to dec no. */ - for (irqno = 0; irqno < 16; irqno++) - { - if ((0x01 << irqno) == GPIO_Pin) - { - break; - } - } - if (pin_irq_hdr_tab[irqno].hdr) - { - pin_irq_hdr_tab[irqno].hdr(pin_irq_hdr_tab[irqno].args); - } -} - -rt_inline void GPIO_EXTI_Callback(PINT_TYPE_IT GPIO_Pin) -{ - if (PINT_GetIFStatus(GPIO_Pin) != RESET) - { - PINT_ClearITPendingBit(GPIO_Pin); - pin_irq_hdr(GPIO_Pin); - } -} - -void PINT0_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT0); - rt_interrupt_leave(); -} - -void PINT1_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT1); - rt_interrupt_leave(); -} - -void PINT2_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT2); - rt_interrupt_leave(); -} - -void PINT3_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT3); - rt_interrupt_leave(); -} - -void PINT4_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT4); - rt_interrupt_leave(); -} - -void PINT5_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT5); - rt_interrupt_leave(); -} - -void PINT6_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT6); - rt_interrupt_leave(); -} - -void PINT7_IRQHandler(void) -{ - rt_interrupt_enter(); - GPIO_EXTI_Callback(PINT_IT_PINT7); - rt_interrupt_leave(); -} - -#endif diff --git a/bsp/essemi/es8p508x/drivers/drv_gpio.h b/bsp/essemi/es8p508x/drivers/drv_gpio.h deleted file mode 100644 index 28a5987f20..0000000000 --- a/bsp/essemi/es8p508x/drivers/drv_gpio.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-07-11 wangyq the first version - */ - -#ifndef DRV_GPIO_H__ -#define DRV_GPIO_H__ - -int rt_hw_pin_init(void); - -#endif diff --git a/bsp/essemi/es8p508x/drivers/drv_uart.c b/bsp/essemi/es8p508x/drivers/drv_uart.c deleted file mode 100644 index 3fb1410a48..0000000000 --- a/bsp/essemi/es8p508x/drivers/drv_uart.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-07-12 wangyq the first version - */ - -#include -#include -#include -#include "board.h" -#include "drv_uart.h" -#include -#include - -#ifdef RT_USING_SERIAL - -/* es8p uart driver */ -struct es8p_uart -{ - UART_TypeDef *huart; - IRQn_Type irq; -}; - -static rt_err_t es8px_configure(struct rt_serial_device *serial, struct serial_configure *cfg) -{ - GPIO_InitStruType gpio_initstruct; - UART_InitStruType uart_initstruct; - struct es8p_uart *uart; - RT_ASSERT(serial != RT_NULL); - RT_ASSERT(cfg != RT_NULL); - uart = (struct es8p_uart *)serial->parent.user_data; - - gpio_initstruct.GPIO_Signal = GPIO_Pin_Signal_Digital; - gpio_initstruct.GPIO_OD = GPIO_ODE_Output_Disable; - gpio_initstruct.GPIO_PUEN = GPIO_PUE_Input_Enable; - gpio_initstruct.GPIO_PDEN = GPIO_PDE_Input_Disable; - gpio_initstruct.GPIO_DS = GPIO_DS_Output_Normal; - -#ifdef BSP_USING_UART0 - gpio_initstruct.GPIO_Func = GPIO_Func_2; - /* Initialize rx pin */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - GPIO_Init(GPIOB, GPIO_Pin_0, &gpio_initstruct); - /* Initialize tx pin ,the same as rx pin except mode */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - GPIO_Init(GPIOB, GPIO_Pin_1, &gpio_initstruct); -#endif - -#ifdef BSP_USING_UART1 - gpio_initstruct.GPIO_Func = GPIO_Func_1; - /* Initialize rx pin */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - GPIO_Init(GPIOA, GPIO_Pin_18, &gpio_initstruct); - /* Initialize tx pin ,the same as rx pin except mode */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - GPIO_Init(GPIOA, GPIO_Pin_17, &gpio_initstruct); -#endif - -#ifdef BSP_USING_UART2 - gpio_initstruct.GPIO_Func = GPIO_Func_2; - /* Initialize rx pin */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - GPIO_Init(GPIOA, GPIO_Pin_4, &gpio_initstruct); - /* Initialize tx pin ,the same as rx pin except mode */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - GPIO_Init(GPIOA, GPIO_Pin_5, &gpio_initstruct); -#endif - -#ifdef BSP_USING_UART3 - gpio_initstruct.GPIO_Func = GPIO_Func_2; - /* Initialize rx pin */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - GPIO_Init(GPIOA, GPIO_Pin_30, &gpio_initstruct); - /* Initialize tx pin ,the same as rx pin except mode */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - GPIO_Init(GPIOA, GPIO_Pin_29, &gpio_initstruct); -#endif - -#ifdef BSP_USING_UART4 - gpio_initstruct.GPIO_Func = GPIO_Func_1; - /* Initialize rx pin */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - GPIO_Init(GPIOB, GPIO_Pin_10, &gpio_initstruct); - /* Initialize tx pin ,the same as rx pin except mode */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - GPIO_Init(GPIOB, GPIO_Pin_11, &gpio_initstruct); -#endif - -#ifdef BSP_USING_UART5 - gpio_initstruct.GPIO_Func = GPIO_Func_1; - /* Initialize rx pin */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_In; - GPIO_Init(GPIOB, GPIO_Pin_12, &gpio_initstruct); - /* Initialize tx pin ,the same as rx pin except mode */ - gpio_initstruct.GPIO_Direction = GPIO_Dir_Out; - GPIO_Init(GPIOB, GPIO_Pin_13, &gpio_initstruct); -#endif - - uart_initstruct.UART_ClockSet = UART_Clock_1; - uart_initstruct.UART_BaudRate = cfg->baud_rate; - uart_initstruct.UART_RxPolar = UART_Polar_Normal; - uart_initstruct.UART_TxPolar = UART_Polar_Normal; - - if (cfg->data_bits == DATA_BITS_7) - { - uart_initstruct.UART_RxMode = UART_DataMode_7; - uart_initstruct.UART_TxMode = UART_DataMode_7; - - if (cfg->parity == PARITY_EVEN) - { - uart_initstruct.UART_RxMode = UART_DataMode_7Even; - uart_initstruct.UART_TxMode = UART_DataMode_7Even; - } - else if (cfg->parity == PARITY_ODD) - { - uart_initstruct.UART_RxMode = UART_DataMode_7Odd; - uart_initstruct.UART_TxMode = UART_DataMode_7Odd; - } - } - else if (cfg->data_bits == DATA_BITS_8) - { - uart_initstruct.UART_RxMode = UART_DataMode_8; - uart_initstruct.UART_TxMode = UART_DataMode_8; - - if (cfg->parity == PARITY_EVEN) - { - uart_initstruct.UART_RxMode = UART_DataMode_8Even; - uart_initstruct.UART_TxMode = UART_DataMode_8Even; - } - else if (cfg->parity == PARITY_ODD) - { - uart_initstruct.UART_RxMode = UART_DataMode_8Odd; - uart_initstruct.UART_TxMode = UART_DataMode_8Odd; - } - } - else if (cfg->data_bits == DATA_BITS_9) - { - uart_initstruct.UART_RxMode = UART_DataMode_9; - uart_initstruct.UART_TxMode = UART_DataMode_9; - } - - if (cfg->bit_order == BIT_ORDER_MSB) - { - return RT_EINVAL; - } - - if (cfg->invert == NRZ_INVERTED) - { - uart_initstruct.UART_RxPolar = UART_Polar_Opposite; - uart_initstruct.UART_TxPolar = UART_Polar_Opposite; - } - - /* config uart function */ - UART_Init(uart->huart, &uart_initstruct); - /* enable rx and tx */ - uart->huart->CON.RXEN = 1; - uart->huart->CON.TXEN = 1; - - NVIC_SetPriority(uart->irq, 1); - - return RT_EOK; -} - -static rt_err_t es8px_control(struct rt_serial_device *serial, int cmd, void *arg) -{ - struct es8p_uart *uart; - RT_ASSERT(serial != RT_NULL); - - uart = (struct es8p_uart *)serial->parent.user_data; - - switch (cmd) - { - case RT_DEVICE_CTRL_CLR_INT: - /* disable rx irq */ - NVIC_DisableIRQ(uart->irq); - /* disable interrupt */ - UART_ITConfig(uart->huart, UART_IT_RB, DISABLE); - break; - - case RT_DEVICE_CTRL_SET_INT: - /* enable rx irq */ - NVIC_EnableIRQ(uart->irq); - /* enable interrupt */ - UART_ITConfig(uart->huart, UART_IT_RB, ENABLE); - break; - } - - return RT_EOK; -} - -static int es8px_putc(struct rt_serial_device *serial, char c) -{ - struct es8p_uart *uart; - RT_ASSERT(serial != RT_NULL); - uart = (struct es8p_uart *)serial->parent.user_data; - - while (UART_GetFlagStatus(uart->huart, UART_FLAG_TB) == RESET) ; - UART_SendByte(uart->huart, c); - - return 1; -} - -static int es8px_getc(struct rt_serial_device *serial) -{ - int ch = -1; - struct es8p_uart *uart; - - RT_ASSERT(serial != RT_NULL); - uart = (struct es8p_uart *)serial->parent.user_data; - - if (UART_GetFlagStatus(uart->huart, UART_FLAG_RB)) - { - ch = UART_RecByte(uart->huart); - } - - return ch; -} - -static const struct rt_uart_ops es8px_uart_ops = -{ - es8px_configure, - es8px_control, - es8px_putc, - es8px_getc, -}; - -#ifdef BSP_USING_UART0 -/* UART0 device driver structure */ -struct es8p_uart uart0 = -{ - UART0, - UART0_IRQn -}; - -struct rt_serial_device serial0; - -void UART0_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART0->IF.RBIF) - { - rt_hw_serial_isr(&serial0, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART0 */ - -#ifdef BSP_USING_UART1 -/* UART1 device driver structure */ -struct es8p_uart uart1 = -{ - UART1, - UART1_IRQn -}; - -struct rt_serial_device serial1; - -void UART1_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART1->IF.RBIF) - { - rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART1 */ - -#ifdef BSP_USING_UART2 -/* UART1 device driver structure */ -struct es8p_uart uart2 = -{ - UART2, - UART2_IRQn -}; - -struct rt_serial_device serial2; - -void UART2_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART2->IF.RBIF) - { - rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART2 */ - -#ifdef BSP_USING_UART3 -/* UART3 device driver structure */ -struct es8p_uart uart3 = -{ - UART3, - UART3_IRQn -}; - -struct rt_serial_device serial3; - -void UART3_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART3->IF.RBIF) - { - rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART3 */ - -#ifdef BSP_USING_UART4 -/* UART4 device driver structure */ -struct es8p_uart uart4 = -{ - UART4, - UART4_IRQn -}; - -struct rt_serial_device serial4; - -void UART4_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART4->IF.RBIF) - { - rt_hw_serial_isr(&serial4, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART4 */ - -#ifdef BSP_USING_UART5 -/* UART5 device driver structure */ -struct es8p_uart uart5 = -{ - UART5, - UART5_IRQn -}; - -struct rt_serial_device serial5; - -void UART5_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - if (UART5->IF.RBIF) - { - rt_hw_serial_isr(&serial5, RT_SERIAL_EVENT_RX_IND); - } - /* leave interrupt */ - rt_interrupt_leave(); -} -#endif /* BSP_USING_UART5 */ - -int rt_hw_uart_init(void) -{ - struct es8p_uart *uart; - struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; - -#ifdef BSP_USING_UART0 - uart = &uart0; - serial0.ops = &es8px_uart_ops; - serial0.config = config; - - /* register UART0 device */ - rt_hw_serial_register(&serial0, "uart0", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); -#endif /* BSP_USING_UART0 */ - -#ifdef BSP_USING_UART1 - uart = &uart1; - serial1.ops = &es8px_uart_ops; - serial1.config = config; - - /* register UART1 device */ - rt_hw_serial_register(&serial1, "uart1", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); -#endif /* BSP_USING_UART1 */ - -#ifdef BSP_USING_UART2 - uart = &uart2; - serial2.ops = &es8px_uart_ops; - serial2.config = config; - - /* register UART2 device */ - rt_hw_serial_register(&serial2, "uart2", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); -#endif /* BSP_USING_UART2 */ - -#ifdef BSP_USING_UART3 - uart = &uart3; - serial3.ops = &es8px_uart_ops; - serial3.config = config; - - /* register UART3 device */ - rt_hw_serial_register(&serial3, "uart3", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); -#endif /* BSP_USING_UART3 */ - -#ifdef BSP_USING_UART4 - uart = &uart4; - serial4.ops = &es8px_uart_ops; - serial4.config = config; - - /* register UART4 device */ - rt_hw_serial_register(&serial4, "uart4", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); -#endif /* BSP_USING_UART4 */ - -#ifdef BSP_USING_UART5 - uart = &uart5; - serial5.ops = &es8px_uart_ops; - serial5.config = config; - - /* register UART5 device */ - rt_hw_serial_register(&serial5, "uart5", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); -#endif /* BSP_USING_UART5 */ - - return 0; -} -INIT_BOARD_EXPORT(rt_hw_uart_init); - -#endif diff --git a/bsp/essemi/es8p508x/drivers/drv_uart.h b/bsp/essemi/es8p508x/drivers/drv_uart.h deleted file mode 100644 index 77abf1cfd4..0000000000 --- a/bsp/essemi/es8p508x/drivers/drv_uart.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-07-12 wangyq the first version - */ - -#ifndef DRV_UART_H__ -#define DRV_UART_H__ - -int rt_hw_uart_init(void); - -#endif diff --git a/bsp/essemi/es8p508x/drivers/linker_scripts/link.sct b/bsp/essemi/es8p508x/drivers/linker_scripts/link.sct deleted file mode 100644 index 47ab250a8b..0000000000 --- a/bsp/essemi/es8p508x/drivers/linker_scripts/link.sct +++ /dev/null @@ -1,15 +0,0 @@ -; ************************************************************* -; *** Scatter-Loading Description File generated by uVision *** -; ************************************************************* - -LR_IROM1 0x00000000 0x00020000 { ; load region size_region - ER_IROM1 0x00000000 0x00020000 { ; load address = execution address - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) - } - RW_IRAM1 0x20000000 0x00006000 { ; RW data - .ANY (+RW +ZI) - } -} - diff --git a/bsp/essemi/es8p508x/figures/ESLinkII-mini.jpg b/bsp/essemi/es8p508x/figures/ESLinkII-mini.jpg deleted file mode 100644 index 7dfc7aa1ae..0000000000 Binary files a/bsp/essemi/es8p508x/figures/ESLinkII-mini.jpg and /dev/null differ diff --git a/bsp/essemi/es8p508x/figures/HRSDK-GDB-ES8P508x-V1.0.jpg b/bsp/essemi/es8p508x/figures/HRSDK-GDB-ES8P508x-V1.0.jpg deleted file mode 100644 index a31b7c0704..0000000000 Binary files a/bsp/essemi/es8p508x/figures/HRSDK-GDB-ES8P508x-V1.0.jpg and /dev/null differ diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/ES8P508x.h b/bsp/essemi/es8p508x/libraries/CMSIS/ES8P508x.h deleted file mode 100644 index e6eab20bc4..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/ES8P508x.h +++ /dev/null @@ -1,3117 +0,0 @@ -/******************************************************************* -* *file : ES8P508x.h -* *description: ES8P508x Device Head File -* *author : Eastsoft MCU Software Team -* *version : V0.01 -* *data : 7/11/2017 -* -* *Copyright (C) 2017 Shanghai Eastsoft Microelectronics Co., Ltd. -*******************************************************************/ -#ifndef __ES8P508x_H__ -#define __ES8P508x_H__ - -#define __I volatile const /* defines 'read only' permissions */ -#define __O volatile /* defines 'write only' permissions */ -#define __IO volatile /* defines 'read / write' permissions */ - -#define __CM0_REV 0 /* Core Revision r0p0 */ -#define __NVIC_PRIO_BITS 2 /* ES8P508x uses 2 Bits for the Priority Levels */ -#define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */ - -typedef enum IRQn -{ - /****** Cortex-M0 Processor Exceptions Numbers ******************************************************/ - RST_IRQn = -15, - NonMaskableInt_IRQn = -14, - HardFault_IRQn = -13, - SVC_IRQn = -5, - PendSV_IRQn = -2, - SysTick_IRQn = -1, - PINT0_IRQn = 0, - PINT1_IRQn = 1, - PINT2_IRQn = 2, - PINT3_IRQn = 3, - PINT4_IRQn = 4, - PINT5_IRQn = 5, - PINT6_IRQn = 6, - PINT7_IRQn = 7, - T16N0_IRQn = 8, - T16N1_IRQn = 9, - T16N2_IRQn = 10, - T16N3_IRQn = 11, - T32N0_IRQn = 12, - Reserved0_IRQn = 13, - IWDT_IRQn = 14, - WWDT_IRQn = 15, - CCM_IRQn = 16, - PLK_IRQn = 17, - LVD_IRQn = 18, - KINT_IRQn = 19, - RTC_IRQn = 20, - ADC_IRQn = 21, - Reserved1_IRQn = 22, - AES_IRQn = 23, - UART0_IRQn = 24, - UART1_IRQn = 25, - UART2_IRQn = 26, - UART3_IRQn = 27, - UART4_IRQn = 28, - UART5_IRQn = 29, - SPI0_IRQn = 30, - I2C0_IRQn = 31, -} IRQn_Type; - - -#include "core_cm0.h" -#include - - -/******************************************************************************/ -/* 设备特殊寄存器结构定䷿ */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联县 */ -#pragma anon_unions - -typedef union -{ - struct - { - uint32_t PROT: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} SCU_PROT_Typedef; - -typedef union -{ - struct - { - uint32_t NMIEN: 1; - uint32_t NMICS: 5; - uint32_t RESERVED0: 26; - }; - uint32_t Word; -} SCU_NMICON_Typedef; - -typedef union -{ - struct - { - uint32_t PORF: 1; - uint32_t PORRCF: 1; - uint32_t PORRSTF: 1; - uint32_t BORF: 1; - uint32_t WWDTRSTF: 1; - uint32_t IWDTRSTF: 1; - uint32_t MRSTF: 1; - uint32_t SOFT_RSTF: 1; - uint32_t POR_LOST: 1; - uint32_t CFG_RST: 1; - uint32_t LOCKUP_RST: 1; - uint32_t RESERVED0: 21; - }; - uint32_t Word; -} SCU_PWRC_Typedef; - -typedef union -{ - struct - { - uint32_t FLAG0: 1; - uint32_t FLAG1: 1; - uint32_t FLAG2: 1; - uint32_t FLAG3: 1; - uint32_t FLAG4: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} SCU_FAULTFLAG_Typedef; - -typedef union -{ - struct - { - uint32_t WAKEUPTIME: 12; - uint32_t MOSC_EN: 1; - uint32_t CLKFLT_EN: 1; - uint32_t FLASHPW_PD: 1; - uint32_t RESERVED0: 1; - uint32_t LDOLP_VOSEL: 3; - uint32_t LDOHP_SOFT: 1; - uint32_t RESERVED1: 12; - }; - uint32_t Word; -} SCU_WAKEUPTIME_Typedef; - -typedef union -{ - struct - { - uint32_t PINST: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} SCU_MRSTN_SOFT_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0HT: 1; - uint32_t T16N1HT: 1; - uint32_t T16N2HT: 1; - uint32_t T16N3HT: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0HT: 1; - uint32_t RESERVED1: 7; - uint32_t IWDTHT: 1; - uint32_t WWDTHT: 1; - uint32_t RESERVED2: 14; - }; - uint32_t Word; -} SCU_DBGHALT_Typedef; - -typedef union -{ - struct - { - uint32_t ACCT: 4; - uint32_t HS: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} SCU_FLASHWAIT_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 1; - uint32_t BORV: 4; - uint32_t BORFLT: 3; - uint32_t RESERVED1: 24; - }; - uint32_t Word; -} SCU_SOFTCFG_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t FLTEN: 1; - uint32_t RESERVED0: 2; - uint32_t VS: 4; - uint32_t IF: 1; - uint32_t IE: 1; - uint32_t IFS: 3; - uint32_t RESERVED1: 2; - uint32_t LVDO: 1; - uint32_t RESERVED2: 16; - }; - uint32_t Word; -} SCU_LVDCON_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RESERVED0: 3; - uint32_t IE: 1; - uint32_t IFS: 3; - uint32_t IF: 1; - uint32_t RESERVED1: 7; - uint32_t FLAG: 1; - uint32_t RESERVED2: 15; - }; - uint32_t Word; -} SCU_CCM_Typedef; - -typedef union -{ - struct - { - uint32_t IE: 1; - uint32_t RESERVED0: 3; - uint32_t LK_IFS: 3; - uint32_t RESERVED1: 1; - uint32_t IF: 1; - uint32_t RESERVED2: 7; - uint32_t LK_FLAG: 1; - uint32_t RESERVED3: 15; - }; - uint32_t Word; -} SCU_PLLLKCON_Typedef; - -typedef union -{ - struct - { - uint32_t CLK_SEL: 2; - uint32_t XTAL_LP: 1; - uint32_t RESERVED0: 5; - uint32_t PLL_MUX: 1; - uint32_t RESERVED1: 3; - uint32_t SYSCLK_DIV: 3; - uint32_t RESERVED2: 1; - uint32_t CLKFLT_BY: 8; - uint32_t CLKOUT0_SEL: 2; - uint32_t CLKOUT1_SEL: 2; - uint32_t RESERVED3: 4; - }; - uint32_t Word; -} SCU_SCLKEN0_Typedef; - -typedef union -{ - struct - { - uint32_t XTAL_EN: 1; - uint32_t HRC_EN: 1; - uint32_t RESERVED0: 6; - uint32_t PLL_REF_SEL: 3; - uint32_t PLL_48M_SEL: 1; - uint32_t PLL_EN: 1; - uint32_t PLL_BYLOCK: 1; - uint32_t RESERVED1: 2; - uint32_t XTAL_RDY: 1; - uint32_t HRC_RDY: 1; - uint32_t PLL_RDY: 1; - uint32_t RESERVED2: 13; - }; - uint32_t Word; -} SCU_SCLKEN1_Typedef; - -typedef union -{ - struct - { - uint32_t SCU_EN: 1; - uint32_t GPIO_EN: 1; - uint32_t IAP_EN: 1; - uint32_t CRC_EN: 1; - uint32_t ADC_EN: 1; - uint32_t RTC_EN: 1; - uint32_t RESERVED0: 1; - uint32_t IWDT_EN: 1; - uint32_t WWDT_EN: 1; - uint32_t AES_EN: 1; - uint32_t RESERVED1: 22; - }; - uint32_t Word; -} SCU_PCLKEN0_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0_EN: 1; - uint32_t T16N1_EN: 1; - uint32_t T16N2_EN: 1; - uint32_t T16N3_EN: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0_EN: 1; - uint32_t RESERVED1: 7; - uint32_t UART0_EN: 1; - uint32_t UART1_EN: 1; - uint32_t UART2_EN: 1; - uint32_t UART3_EN: 1; - uint32_t UART4_EN: 1; - uint32_t UART5_EN: 1; - uint32_t RESERVED2: 2; - uint32_t SPI0_EN: 1; - uint32_t RESERVED3: 3; - uint32_t I2C0_EN: 1; - uint32_t RESERVED4: 3; - }; - uint32_t Word; -} SCU_PCLKEN1_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 1; - uint32_t GPIO_RST: 1; - uint32_t IAP_RST: 1; - uint32_t CRC_RST: 1; - uint32_t ADC_RST: 1; - uint32_t RTC_RST: 1; - uint32_t RESERVED1: 1; - uint32_t IWDT_RST: 1; - uint32_t WWDT_RST: 1; - uint32_t AES_RST: 1; - uint32_t RESERVED2: 22; - }; - uint32_t Word; -} SCU_PRSTEN0_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0_RST: 1; - uint32_t T16N1_RST: 1; - uint32_t T16N2_RST: 1; - uint32_t T16N3_RST: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0_RST: 1; - uint32_t RESERVED1: 7; - uint32_t UART0_RST: 1; - uint32_t UART1_RST: 1; - uint32_t UART2_RST: 1; - uint32_t UART3_RST: 1; - uint32_t UART4_RST: 1; - uint32_t UART5_RST: 1; - uint32_t RESERVED2: 2; - uint32_t SPI0_RST: 1; - uint32_t RESERVED3: 3; - uint32_t I2C0_RST: 1; - uint32_t RESERVED4: 3; - }; - uint32_t Word; -} SCU_PRSTEN1_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0EN: 1; - uint32_t T16N1EN: 1; - uint32_t T16N2EN: 1; - uint32_t T16N3EN: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0EN: 1; - uint32_t RESERVED1: 23; - }; - uint32_t Word; -} SCU_TIMEREN_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0DIS: 1; - uint32_t T16N1DIS: 1; - uint32_t T16N2DIS: 1; - uint32_t T16N3DIS: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0DIS: 1; - uint32_t RESERVED1: 23; - }; - uint32_t Word; -} SCU_TIMERDIS_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} SCU_TBLREMAPEN_Typedef; - -typedef union -{ - struct - { - uint32_t TBLOFF: 32; - }; - uint32_t Word; -} SCU_TBLOFF_Typedef; - -typedef struct -{ - __IO SCU_PROT_Typedef PROT; - __IO SCU_NMICON_Typedef NMICON; - __IO SCU_PWRC_Typedef PWRC; - __IO SCU_FAULTFLAG_Typedef FAULTFLAG; - __IO SCU_WAKEUPTIME_Typedef WAKEUPTIME; - __IO SCU_MRSTN_SOFT_Typedef MRSTN_SOFT; - __IO SCU_DBGHALT_Typedef DBGHALT; - uint32_t RESERVED0 ; - __IO SCU_FLASHWAIT_Typedef FLASHWAIT; - __IO SCU_SOFTCFG_Typedef SOFTCFG; - __IO SCU_LVDCON_Typedef LVDCON; - __IO SCU_CCM_Typedef CCM; - __IO SCU_PLLLKCON_Typedef PLLLKCON; - uint32_t RESERVED1[3] ; - __IO SCU_SCLKEN0_Typedef SCLKEN0; - __IO SCU_SCLKEN1_Typedef SCLKEN1; - __IO SCU_PCLKEN0_Typedef PCLKEN0; - __IO SCU_PCLKEN1_Typedef PCLKEN1; - __IO SCU_PRSTEN0_Typedef PRSTEN0; - __IO SCU_PRSTEN1_Typedef PRSTEN1; - __O SCU_TIMEREN_Typedef TIMEREN; - __IO SCU_TIMERDIS_Typedef TIMERDIS; - __IO SCU_TBLREMAPEN_Typedef TBLREMAPEN; - __IO SCU_TBLOFF_Typedef TBLOFF; -} SCU_TypeDef; - -typedef union -{ - struct - { - uint32_t UL: 32; - }; - uint32_t Word; -} CRC_UL_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t HS: 1; - uint32_t DS: 1; - uint32_t REQ: 1; - uint32_t ACK: 1; - uint32_t RESERVED0: 2; - uint32_t MOD: 2; - uint32_t BYTE: 2; - uint32_t REFIN: 1; - uint32_t REFOUT: 1; - uint32_t XOROUT: 1; - uint32_t RESERVED1: 17; - }; - uint32_t Word; -} CRC_CON_Typedef; - -typedef union -{ - struct - { - uint32_t TRIG: 32; - }; - uint32_t Word; -} CRC_TRIG_Typedef; - -typedef union -{ - struct - { - uint32_t ADDR: 17; - uint32_t RESERVED0: 3; - uint32_t IFREN: 1; - uint32_t RESERVED1: 11; - }; - uint32_t Word; -} CRC_ADDR_Typedef; - -typedef union -{ - struct - { - uint32_t CRC_SIZE: 15; - uint32_t RESERVED0: 17; - }; - uint32_t Word; -} CRC_SIZE_Typedef; - -typedef union -{ - struct - { - uint32_t DI: 32; - }; - uint32_t Word; -} CRC_DI_Typedef; - -typedef union -{ - struct - { - uint32_t DO: 32; - }; - uint32_t Word; -} CRC_DO_Typedef; - -typedef union -{ - struct - { - uint32_t BUSY: 1; - uint32_t RSTF: 1; - uint32_t EMPTY_ERR: 1; - uint32_t RESERVED0: 29; - }; - uint32_t Word; -} CRC_STA_Typedef; - -typedef union -{ - struct - { - uint32_t FADR: 15; - uint32_t RESERVED0: 5; - uint32_t IFREN: 1; - uint32_t RESERVED1: 11; - }; - uint32_t Word; -} CRC_FA_Typedef; - -typedef struct -{ - __IO CRC_UL_Typedef UL; - __IO CRC_CON_Typedef CON; - __IO CRC_TRIG_Typedef TRIG; - __IO CRC_ADDR_Typedef ADDR; - __IO CRC_SIZE_Typedef SIZE; - __IO CRC_DI_Typedef DI; - __I CRC_DO_Typedef DO; - __IO CRC_STA_Typedef STA; - __I CRC_FA_Typedef FA; -} CRC_TypeDef; - -typedef union -{ - struct - { - uint32_t PORT_0: 1; - uint32_t PORT_1: 1; - uint32_t PORT_2: 1; - uint32_t PORT_3: 1; - uint32_t PORT_4: 1; - uint32_t PORT_5: 1; - uint32_t PORT_6: 1; - uint32_t PORT_7: 1; - uint32_t PORT_8: 1; - uint32_t PORT_9: 1; - uint32_t PORT_10: 1; - uint32_t PORT_11: 1; - uint32_t PORT_12: 1; - uint32_t PORT_13: 1; - uint32_t PORT_14: 1; - uint32_t PORT_15: 1; - uint32_t PORT_16: 1; - uint32_t PORT_17: 1; - uint32_t PORT_18: 1; - uint32_t PORT_19: 1; - uint32_t PORT_20: 1; - uint32_t PORT_21: 1; - uint32_t PORT_22: 1; - uint32_t PORT_23: 1; - uint32_t PORT_24: 1; - uint32_t PORT_25: 1; - uint32_t PORT_26: 1; - uint32_t PORT_27: 1; - uint32_t PORT_28: 1; - uint32_t PORT_29: 1; - uint32_t PORT_30: 1; - uint32_t PORT_31: 1; - }; - uint32_t Word; -} GPIO_PAPORT_Typedef; - -typedef union -{ - struct - { - uint32_t DATA_0: 1; - uint32_t DATA_1: 1; - uint32_t DATA_2: 1; - uint32_t DATA_3: 1; - uint32_t DATA_4: 1; - uint32_t DATA_5: 1; - uint32_t DATA_6: 1; - uint32_t DATA_7: 1; - uint32_t DATA_8: 1; - uint32_t DATA_9: 1; - uint32_t DATA_10: 1; - uint32_t DATA_11: 1; - uint32_t DATA_12: 1; - uint32_t DATA_13: 1; - uint32_t DATA_14: 1; - uint32_t DATA_15: 1; - uint32_t DATA_16: 1; - uint32_t DATA_17: 1; - uint32_t DATA_18: 1; - uint32_t DATA_19: 1; - uint32_t DATA_20: 1; - uint32_t DATA_21: 1; - uint32_t DATA_22: 1; - uint32_t DATA_23: 1; - uint32_t DATA_24: 1; - uint32_t DATA_25: 1; - uint32_t DATA_26: 1; - uint32_t DATA_27: 1; - uint32_t DATA_28: 1; - uint32_t DATA_29: 1; - uint32_t DATA_30: 1; - uint32_t DATA_31: 1; - }; - uint32_t Word; -} GPIO_PADATA_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADATABSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADATABCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADATABRR_Typedef; - -typedef union -{ - struct - { - uint32_t DIR_0: 1; - uint32_t DIR_1: 1; - uint32_t DIR_2: 1; - uint32_t DIR_3: 1; - uint32_t DIR_4: 1; - uint32_t DIR_5: 1; - uint32_t DIR_6: 1; - uint32_t DIR_7: 1; - uint32_t DIR_8: 1; - uint32_t DIR_9: 1; - uint32_t DIR_10: 1; - uint32_t DIR_11: 1; - uint32_t DIR_12: 1; - uint32_t DIR_13: 1; - uint32_t DIR_14: 1; - uint32_t DIR_15: 1; - uint32_t DIR_16: 1; - uint32_t DIR_17: 1; - uint32_t DIR_18: 1; - uint32_t DIR_19: 1; - uint32_t DIR_20: 1; - uint32_t DIR_21: 1; - uint32_t DIR_22: 1; - uint32_t DIR_23: 1; - uint32_t DIR_24: 1; - uint32_t DIR_25: 1; - uint32_t DIR_26: 1; - uint32_t DIR_27: 1; - uint32_t DIR_28: 1; - uint32_t DIR_29: 1; - uint32_t DIR_30: 1; - uint32_t DIR_31: 1; - }; - uint32_t Word; -} GPIO_PADIR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADIRBSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADIRBCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADIRBRR_Typedef; - -typedef union -{ - struct - { - uint32_t PA0: 2; - uint32_t RESERVED0: 2; - uint32_t PA1: 2; - uint32_t RESERVED1: 2; - uint32_t PA2: 2; - uint32_t RESERVED2: 2; - uint32_t PA3: 2; - uint32_t RESERVED3: 2; - uint32_t PA4: 2; - uint32_t RESERVED4: 2; - uint32_t PA5: 2; - uint32_t RESERVED5: 2; - uint32_t PA6: 2; - uint32_t RESERVED6: 2; - uint32_t PA7: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC0_Typedef; - -typedef union -{ - struct - { - uint32_t PA8: 2; - uint32_t RESERVED0: 2; - uint32_t PA9: 2; - uint32_t RESERVED1: 2; - uint32_t PA10: 2; - uint32_t RESERVED2: 2; - uint32_t PA11: 2; - uint32_t RESERVED3: 2; - uint32_t PA12: 2; - uint32_t RESERVED4: 2; - uint32_t PA13: 2; - uint32_t RESERVED5: 2; - uint32_t PA14: 2; - uint32_t RESERVED6: 2; - uint32_t PA15: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC1_Typedef; - -typedef union -{ - struct - { - uint32_t PA16: 2; - uint32_t RESERVED0: 2; - uint32_t PA17: 2; - uint32_t RESERVED1: 2; - uint32_t PA18: 2; - uint32_t RESERVED2: 2; - uint32_t PA19: 2; - uint32_t RESERVED3: 2; - uint32_t PA20: 2; - uint32_t RESERVED4: 2; - uint32_t PA21: 2; - uint32_t RESERVED5: 2; - uint32_t PA22: 2; - uint32_t RESERVED6: 2; - uint32_t PA23: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC2_Typedef; - -typedef union -{ - struct - { - uint32_t PA24: 2; - uint32_t RESERVED0: 2; - uint32_t PA25: 2; - uint32_t RESERVED1: 2; - uint32_t PA26: 2; - uint32_t RESERVED2: 2; - uint32_t PA27: 2; - uint32_t RESERVED3: 2; - uint32_t PA28: 2; - uint32_t RESERVED4: 2; - uint32_t PA29: 2; - uint32_t RESERVED5: 2; - uint32_t PA30: 2; - uint32_t RESERVED6: 2; - uint32_t PA31: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC3_Typedef; - -typedef union -{ - struct - { - uint32_t INEB_0: 1; - uint32_t INEB_1: 1; - uint32_t INEB_2: 1; - uint32_t INEB_3: 1; - uint32_t INEB_4: 1; - uint32_t INEB_5: 1; - uint32_t INEB_6: 1; - uint32_t INEB_7: 1; - uint32_t INEB_8: 1; - uint32_t INEB_9: 1; - uint32_t INEB_10: 1; - uint32_t INEB_11: 1; - uint32_t INEB_12: 1; - uint32_t INEB_13: 1; - uint32_t INEB_14: 1; - uint32_t INEB_15: 1; - uint32_t INEB_16: 1; - uint32_t INEB_17: 1; - uint32_t INEB_18: 1; - uint32_t INEB_19: 1; - uint32_t INEB_20: 1; - uint32_t INEB_21: 1; - uint32_t INEB_22: 1; - uint32_t INEB_23: 1; - uint32_t INEB_24: 1; - uint32_t INEB_25: 1; - uint32_t INEB_26: 1; - uint32_t INEB_27: 1; - uint32_t INEB_28: 1; - uint32_t INEB_29: 1; - uint32_t INEB_30: 1; - uint32_t INEB_31: 1; - }; - uint32_t Word; -} GPIO_PAINEB_Typedef; - -typedef union -{ - struct - { - uint32_t ODE_0: 1; - uint32_t ODE_1: 1; - uint32_t ODE_2: 1; - uint32_t ODE_3: 1; - uint32_t ODE_4: 1; - uint32_t ODE_5: 1; - uint32_t ODE_6: 1; - uint32_t ODE_7: 1; - uint32_t ODE_8: 1; - uint32_t ODE_9: 1; - uint32_t ODE_10: 1; - uint32_t ODE_11: 1; - uint32_t ODE_12: 1; - uint32_t ODE_13: 1; - uint32_t ODE_14: 1; - uint32_t ODE_15: 1; - uint32_t ODE_16: 1; - uint32_t ODE_17: 1; - uint32_t ODE_18: 1; - uint32_t ODE_19: 1; - uint32_t ODE_20: 1; - uint32_t ODE_21: 1; - uint32_t ODE_22: 1; - uint32_t ODE_23: 1; - uint32_t ODE_24: 1; - uint32_t ODE_25: 1; - uint32_t ODE_26: 1; - uint32_t ODE_27: 1; - uint32_t ODE_28: 1; - uint32_t ODE_29: 1; - uint32_t ODE_30: 1; - uint32_t ODE_31: 1; - }; - uint32_t Word; -} GPIO_PAODE_Typedef; - -typedef union -{ - struct - { - uint32_t PUE_0: 1; - uint32_t PUE_1: 1; - uint32_t PUE_2: 1; - uint32_t PUE_3: 1; - uint32_t PUE_4: 1; - uint32_t PUE_5: 1; - uint32_t PUE_6: 1; - uint32_t PUE_7: 1; - uint32_t PUE_8: 1; - uint32_t PUE_9: 1; - uint32_t PUE_10: 1; - uint32_t PUE_11: 1; - uint32_t PUE_12: 1; - uint32_t PUE_13: 1; - uint32_t PUE_14: 1; - uint32_t PUE_15: 1; - uint32_t PUE_16: 1; - uint32_t PUE_17: 1; - uint32_t PUE_18: 1; - uint32_t PUE_19: 1; - uint32_t PUE_20: 1; - uint32_t PUE_21: 1; - uint32_t PUE_22: 1; - uint32_t PUE_23: 1; - uint32_t PUE_24: 1; - uint32_t PUE_25: 1; - uint32_t PUE_26: 1; - uint32_t PUE_27: 1; - uint32_t PUE_28: 1; - uint32_t PUE_29: 1; - uint32_t PUE_30: 1; - uint32_t PUE_31: 1; - }; - uint32_t Word; -} GPIO_PAPUE_Typedef; - -typedef union -{ - struct - { - uint32_t PDE_0: 1; - uint32_t PDE_1: 1; - uint32_t PDE_2: 1; - uint32_t PDE_3: 1; - uint32_t PDE_4: 1; - uint32_t PDE_5: 1; - uint32_t PDE_6: 1; - uint32_t PDE_7: 1; - uint32_t PDE_8: 1; - uint32_t PDE_9: 1; - uint32_t PDE_10: 1; - uint32_t PDE_11: 1; - uint32_t PDE_12: 1; - uint32_t PDE_13: 1; - uint32_t PDE_14: 1; - uint32_t PDE_15: 1; - uint32_t PDE_16: 1; - uint32_t PDE_17: 1; - uint32_t PDE_18: 1; - uint32_t PDE_19: 1; - uint32_t PDE_20: 1; - uint32_t PDE_21: 1; - uint32_t PDE_22: 1; - uint32_t PDE_23: 1; - uint32_t PDE_24: 1; - uint32_t PDE_25: 1; - uint32_t PDE_26: 1; - uint32_t PDE_27: 1; - uint32_t PDE_28: 1; - uint32_t PDE_29: 1; - uint32_t PDE_30: 1; - uint32_t PDE_31: 1; - }; - uint32_t Word; -} GPIO_PAPDE_Typedef; - -typedef union -{ - struct - { - uint32_t DS_0: 1; - uint32_t DS_1: 1; - uint32_t DS_2: 1; - uint32_t DS_3: 1; - uint32_t DS_4: 1; - uint32_t DS_5: 1; - uint32_t DS_6: 1; - uint32_t DS_7: 1; - uint32_t DS_8: 1; - uint32_t DS_9: 1; - uint32_t DS_10: 1; - uint32_t DS_11: 1; - uint32_t DS_12: 1; - uint32_t DS_13: 1; - uint32_t DS_14: 1; - uint32_t DS_15: 1; - uint32_t DS_16: 1; - uint32_t DS_17: 1; - uint32_t DS_18: 1; - uint32_t DS_19: 1; - uint32_t DS_20: 1; - uint32_t DS_21: 1; - uint32_t DS_22: 1; - uint32_t DS_23: 1; - uint32_t DS_24: 1; - uint32_t DS_25: 1; - uint32_t DS_26: 1; - uint32_t DS_27: 1; - uint32_t DS_28: 1; - uint32_t DS_29: 1; - uint32_t DS_30: 1; - uint32_t DS_31: 1; - }; - uint32_t Word; -} GPIO_PADS_Typedef; - -typedef union -{ - struct - { - uint32_t PORT_0: 1; - uint32_t PORT_1: 1; - uint32_t PORT_2: 1; - uint32_t PORT_3: 1; - uint32_t PORT_4: 1; - uint32_t PORT_5: 1; - uint32_t PORT_6: 1; - uint32_t PORT_7: 1; - uint32_t PORT_8: 1; - uint32_t PORT_9: 1; - uint32_t PORT_10: 1; - uint32_t PORT_11: 1; - uint32_t PORT_12: 1; - uint32_t PORT_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBPORT_Typedef; - -typedef union -{ - struct - { - uint32_t DATA_0: 1; - uint32_t DATA_1: 1; - uint32_t DATA_2: 1; - uint32_t DATA_3: 1; - uint32_t DATA_4: 1; - uint32_t DATA_5: 1; - uint32_t DATA_6: 1; - uint32_t DATA_7: 1; - uint32_t DATA_8: 1; - uint32_t DATA_9: 1; - uint32_t DATA_10: 1; - uint32_t DATA_11: 1; - uint32_t DATA_12: 1; - uint32_t DATA_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBDATA_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDATABSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDATABCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDATABRR_Typedef; - -typedef union -{ - struct - { - uint32_t DIR_0: 1; - uint32_t DIR_1: 1; - uint32_t DIR_2: 1; - uint32_t DIR_3: 1; - uint32_t DIR_4: 1; - uint32_t DIR_5: 1; - uint32_t DIR_6: 1; - uint32_t DIR_7: 1; - uint32_t DIR_8: 1; - uint32_t DIR_9: 1; - uint32_t DIR_10: 1; - uint32_t DIR_11: 1; - uint32_t DIR_12: 1; - uint32_t DIR_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBDIR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDIRBSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDIRBCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDIRBRR_Typedef; - -typedef union -{ - struct - { - uint32_t PB0: 2; - uint32_t RESERVED0: 2; - uint32_t PB1: 2; - uint32_t RESERVED1: 2; - uint32_t PB2: 2; - uint32_t RESERVED2: 2; - uint32_t PB3: 2; - uint32_t RESERVED3: 2; - uint32_t PB4: 2; - uint32_t RESERVED4: 2; - uint32_t PB5: 2; - uint32_t RESERVED5: 2; - uint32_t PB6: 2; - uint32_t RESERVED6: 2; - uint32_t PB7: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PBFUNC0_Typedef; - -typedef union -{ - struct - { - uint32_t PB8: 2; - uint32_t RESERVED0: 2; - uint32_t PB9: 2; - uint32_t RESERVED1: 2; - uint32_t PB10: 2; - uint32_t RESERVED2: 2; - uint32_t PB11: 2; - uint32_t RESERVED3: 2; - uint32_t PB12: 2; - uint32_t RESERVED4: 2; - uint32_t PB13: 2; - uint32_t RESERVED5: 10; - }; - uint32_t Word; -} GPIO_PBFUNC1_Typedef; - -typedef union -{ - struct - { - uint32_t INEB_0: 1; - uint32_t INEB_1: 1; - uint32_t INEB_2: 1; - uint32_t INEB_3: 1; - uint32_t INEB_4: 1; - uint32_t INEB_5: 1; - uint32_t INEB_6: 1; - uint32_t INEB_7: 1; - uint32_t INEB_8: 1; - uint32_t INEB_9: 1; - uint32_t INEB_10: 1; - uint32_t INEB_11: 1; - uint32_t INEB_12: 1; - uint32_t INEB_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBINEB_Typedef; - -typedef union -{ - struct - { - uint32_t ODE_0: 1; - uint32_t ODE_1: 1; - uint32_t ODE_2: 1; - uint32_t ODE_3: 1; - uint32_t ODE_4: 1; - uint32_t ODE_5: 1; - uint32_t ODE_6: 1; - uint32_t ODE_7: 1; - uint32_t ODE_8: 1; - uint32_t ODE_9: 1; - uint32_t ODE_10: 1; - uint32_t ODE_11: 1; - uint32_t ODE_12: 1; - uint32_t ODE_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBODE_Typedef; - -typedef union -{ - struct - { - uint32_t PUEN_0: 1; - uint32_t PUEN_1: 1; - uint32_t PUEN_2: 1; - uint32_t PUEN_3: 1; - uint32_t PUEN_4: 1; - uint32_t PUEN_5: 1; - uint32_t PUEN_6: 1; - uint32_t PUEN_7: 1; - uint32_t PUEN_8: 1; - uint32_t PUEN_9: 1; - uint32_t PUEN_10: 1; - uint32_t PUEN_11: 1; - uint32_t PUEN_12: 1; - uint32_t PUEN_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBPUE_Typedef; - -typedef union -{ - struct - { - uint32_t PDEN_0: 1; - uint32_t PDEN_1: 1; - uint32_t PDEN_2: 1; - uint32_t PDEN_3: 1; - uint32_t PDEN_4: 1; - uint32_t PDEN_5: 1; - uint32_t PDEN_6: 1; - uint32_t PDEN_7: 1; - uint32_t PDEN_8: 1; - uint32_t PDEN_9: 1; - uint32_t PDEN_10: 1; - uint32_t PDEN_11: 1; - uint32_t PDEN_12: 1; - uint32_t PDEN_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBPDE_Typedef; - -typedef union -{ - struct - { - uint32_t DS_0: 1; - uint32_t DS_1: 1; - uint32_t DS_2: 1; - uint32_t DS_3: 1; - uint32_t DS_4: 1; - uint32_t DS_5: 1; - uint32_t DS_6: 1; - uint32_t DS_7: 1; - uint32_t DS_8: 1; - uint32_t DS_9: 1; - uint32_t DS_10: 1; - uint32_t DS_11: 1; - uint32_t DS_12: 1; - uint32_t DS_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBDS_Typedef; - -typedef union -{ - struct - { - uint32_t PINTIE: 8; - uint32_t PMASK: 8; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} GPIO_PINTIE_Typedef; - -typedef union -{ - struct - { - uint32_t PINTIF_0: 1; - uint32_t PINTIF_1: 1; - uint32_t PINTIF_2: 1; - uint32_t PINTIF_3: 1; - uint32_t PINTIF_4: 1; - uint32_t PINTIF_5: 1; - uint32_t PINTIF_6: 1; - uint32_t PINTIF_7: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} GPIO_PINTIF_Typedef; - -typedef union -{ - struct - { - uint32_t PINT0SEL: 3; - uint32_t RESERVED0: 1; - uint32_t PINT1SEL: 3; - uint32_t RESERVED1: 1; - uint32_t PINT2SEL: 3; - uint32_t RESERVED2: 1; - uint32_t PINT3SEL: 3; - uint32_t RESERVED3: 1; - uint32_t PINT4SEL: 3; - uint32_t RESERVED4: 1; - uint32_t PINT5SEL: 3; - uint32_t RESERVED5: 1; - uint32_t PINT6SEL: 3; - uint32_t RESERVED6: 1; - uint32_t PINT7SEL: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_PINTSEL_Typedef; - -typedef union -{ - struct - { - uint32_t PINT0CFG: 3; - uint32_t RESERVED0: 1; - uint32_t PINT1CFG: 3; - uint32_t RESERVED1: 1; - uint32_t PINT2CFG: 3; - uint32_t RESERVED2: 1; - uint32_t PINT3CFG: 3; - uint32_t RESERVED3: 1; - uint32_t PINT4CFG: 3; - uint32_t RESERVED4: 1; - uint32_t PINT5CFG: 3; - uint32_t RESERVED5: 1; - uint32_t PINT6CFG: 3; - uint32_t RESERVED6: 1; - uint32_t PINT7CFG: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_PINTCFG_Typedef; - -typedef union -{ - struct - { - uint32_t KINTIE: 8; - uint32_t KMASK: 8; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} GPIO_KINTIE_Typedef; - -typedef union -{ - struct - { - uint32_t KINTIF_0: 1; - uint32_t KINTIF_1: 1; - uint32_t KINTIF_2: 1; - uint32_t KINTIF_3: 1; - uint32_t KINTIF_4: 1; - uint32_t KINTIF_5: 1; - uint32_t KINTIF_6: 1; - uint32_t KINTIF_7: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} GPIO_KINTIF_Typedef; - -typedef union -{ - struct - { - uint32_t KINT0SEL: 3; - uint32_t RESERVED0: 1; - uint32_t KINT1SEL: 3; - uint32_t RESERVED1: 1; - uint32_t KINT2SEL: 3; - uint32_t RESERVED2: 1; - uint32_t KINT3SEL: 3; - uint32_t RESERVED3: 1; - uint32_t KINT4SEL: 3; - uint32_t RESERVED4: 1; - uint32_t KINT5SEL: 3; - uint32_t RESERVED5: 1; - uint32_t KINT6SEL: 3; - uint32_t RESERVED6: 1; - uint32_t KINT7SEL: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_KINTSEL_Typedef; - -typedef union -{ - struct - { - uint32_t KINT0CFG: 3; - uint32_t RESERVED0: 1; - uint32_t KINT1CFG: 3; - uint32_t RESERVED1: 1; - uint32_t KINT2CFG: 3; - uint32_t RESERVED2: 1; - uint32_t KINT3CFG: 3; - uint32_t RESERVED3: 1; - uint32_t KINT4CFG: 3; - uint32_t RESERVED4: 1; - uint32_t KINT5CFG: 3; - uint32_t RESERVED5: 1; - uint32_t KINT6CFG: 3; - uint32_t RESERVED6: 1; - uint32_t KINT7CFG: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_KINTCFG_Typedef; - -typedef union -{ - struct - { - uint32_t FLT_S_0: 1; - uint32_t FLT_S_1: 1; - uint32_t FLT_S_2: 1; - uint32_t FLT_S_3: 1; - uint32_t FLT_S_4: 1; - uint32_t FLT_S_5: 1; - uint32_t FLT_S_6: 1; - uint32_t FLT_S_7: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} GPIO_IOINTFLTS_Typedef; - -typedef union -{ - struct - { - uint32_t FLT0_SEL: 4; - uint32_t FLT1_SEL: 4; - uint32_t FLT2_SEL: 4; - uint32_t FLT3_SEL: 4; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} GPIO_TMRFLTSEL_Typedef; - -typedef union -{ - struct - { - uint32_t TX0PS: 2; - uint32_t RESERVED0: 2; - uint32_t TX0PLV: 1; - uint32_t TX0_S: 2; - uint32_t RESERVED1: 1; - uint32_t TX1PS: 2; - uint32_t RESERVED2: 2; - uint32_t TX1PLV: 1; - uint32_t TX1_S: 2; - uint32_t RESERVED3: 1; - uint32_t TX2PS: 2; - uint32_t RESERVED4: 2; - uint32_t TX2PLV: 1; - uint32_t TX2_S: 2; - uint32_t RESERVED5: 1; - uint32_t TX3PS: 2; - uint32_t RESERVED6: 2; - uint32_t TX3PLV: 1; - uint32_t TX3_S: 2; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_TXPWM_Typedef; - -typedef union -{ - struct - { - uint32_t BUZEN: 1; - uint32_t RESERVED0: 7; - uint32_t BUZ_LOAD: 20; - uint32_t RESERVED1: 4; - }; - uint32_t Word; -} GPIO_BUZC_Typedef; - -typedef struct -{ - __I GPIO_PAPORT_Typedef PAPORT; - uint32_t RESERVED0[3] ; - __IO GPIO_PADATA_Typedef PADATA; - __O GPIO_PADATABSR_Typedef PADATABSR; - __O GPIO_PADATABCR_Typedef PADATABCR; - __O GPIO_PADATABRR_Typedef PADATABRR; - __IO GPIO_PADIR_Typedef PADIR; - __O GPIO_PADIRBSR_Typedef PADIRBSR; - __O GPIO_PADIRBCR_Typedef PADIRBCR; - __O GPIO_PADIRBRR_Typedef PADIRBRR; - __IO GPIO_PAFUNC0_Typedef PAFUNC0; - __IO GPIO_PAFUNC1_Typedef PAFUNC1; - __IO GPIO_PAFUNC2_Typedef PAFUNC2; - __IO GPIO_PAFUNC3_Typedef PAFUNC3; - __IO GPIO_PAINEB_Typedef PAINEB; - __IO GPIO_PAODE_Typedef PAODE; - __IO GPIO_PAPUE_Typedef PAPUE; - __IO GPIO_PAPDE_Typedef PAPDE; - __IO GPIO_PADS_Typedef PADS; - uint32_t RESERVED1[11] ; - __I GPIO_PBPORT_Typedef PBPORT; - uint32_t RESERVED2[3] ; - __IO GPIO_PBDATA_Typedef PBDATA; - __O GPIO_PBDATABSR_Typedef PBDATABSR; - __O GPIO_PBDATABCR_Typedef PBDATABCR; - __O GPIO_PBDATABRR_Typedef PBDATABRR; - __IO GPIO_PBDIR_Typedef PBDIR; - __O GPIO_PBDIRBSR_Typedef PBDIRBSR; - __O GPIO_PBDIRBCR_Typedef PBDIRBCR; - __O GPIO_PBDIRBRR_Typedef PBDIRBRR; - __IO GPIO_PBFUNC0_Typedef PBFUNC0; - __IO GPIO_PBFUNC1_Typedef PBFUNC1; - uint32_t RESERVED3[2] ; - __IO GPIO_PBINEB_Typedef PBINEB; - __IO GPIO_PBODE_Typedef PBODE; - __IO GPIO_PBPUE_Typedef PBPUE; - __IO GPIO_PBPDE_Typedef PBPDE; - __IO GPIO_PBDS_Typedef PBDS; - uint32_t RESERVED4[139] ; - __IO GPIO_PINTIE_Typedef PINTIE; - __IO GPIO_PINTIF_Typedef PINTIF; - __IO GPIO_PINTSEL_Typedef PINTSEL; - __IO GPIO_PINTCFG_Typedef PINTCFG; - __IO GPIO_KINTIE_Typedef KINTIE; - __IO GPIO_KINTIF_Typedef KINTIF; - __IO GPIO_KINTSEL_Typedef KINTSEL; - __IO GPIO_KINTCFG_Typedef KINTCFG; - uint32_t RESERVED5[4] ; - __IO GPIO_IOINTFLTS_Typedef IOINTFLTS; - uint32_t RESERVED6[3] ; - __IO GPIO_TMRFLTSEL_Typedef TMRFLTSEL; - uint32_t RESERVED7[15] ; - __IO GPIO_TXPWM_Typedef TXPWM; - uint32_t RESERVED8[3] ; - __IO GPIO_BUZC_Typedef BUZC; -} GPIO_TypeDef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t RESERVED0: 2; - uint32_t FLASH_REQ: 1; - uint32_t FLASH_ACK: 1; - uint32_t RESERVED1: 1; - uint32_t FLASH_FAIL: 1; - uint32_t FEWE: 1; - uint32_t SEWE: 1; - uint32_t RESERVED2: 22; - }; - uint32_t Word; -} IAP_CON_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 2; - uint32_t IAPCA: 8; - uint32_t IAPPA: 7; - uint32_t RESERVED1: 3; - uint32_t IFREN: 1; - uint32_t RESERVED2: 11; - }; - uint32_t Word; -} IAP_ADDR_Typedef; - -typedef union -{ - struct - { - uint32_t DATA: 32; - }; - uint32_t Word; -} IAP_DATA_Typedef; - -typedef union -{ - struct - { - uint32_t TRIG: 32; - }; - uint32_t Word; -} IAP_TRIG_Typedef; - -typedef union -{ - struct - { - uint32_t UL: 32; - }; - uint32_t Word; -} IAP_UL_Typedef; - -typedef union -{ - struct - { - uint32_t BSY: 1; - uint32_t PERASE_END: 1; - uint32_t PROG_END: 1; - uint32_t TIMEOUT_ERR: 1; - uint32_t OP_ERR: 1; - uint32_t MERASE_END: 1; - uint32_t UERASE_END: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} IAP_STA_Typedef; - -typedef union -{ - struct - { - uint32_t IAP_WPROT: 32; - }; - uint32_t Word; -} IAP_WPROT0_Typedef; - -typedef union -{ - struct - { - uint32_t IAP_WPROT: 32; - }; - uint32_t Word; -} IAP_WPROT1_Typedef; - -typedef union -{ - struct - { - uint32_t IAP_WPROT: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} IAP_WPROT2_Typedef; - -typedef struct -{ - __IO IAP_CON_Typedef CON; - __IO IAP_ADDR_Typedef ADDR; - __IO IAP_DATA_Typedef DATA; - __IO IAP_TRIG_Typedef TRIG; - __IO IAP_UL_Typedef UL; - __IO IAP_STA_Typedef STA; - __IO IAP_WPROT0_Typedef WPROT0; - __IO IAP_WPROT1_Typedef WPROT1; - __IO IAP_WPROT2_Typedef WPROT2; -} IAP_TypeDef; - -typedef union -{ - struct - { - uint32_t DR: 12; - uint32_t RESERVED0: 20; - }; - uint32_t Word; -} ADC_DR_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t TRIG: 1; - uint32_t ACP_EN: 1; - uint32_t RESERVED0: 1; - uint32_t BIT_SEL: 2; - uint32_t RESERVED1: 26; - }; - uint32_t Word; -} ADC_CON0_Typedef; - -typedef union -{ - struct - { - uint32_t CLKDIV: 3; - uint32_t RESERVED0: 1; - uint32_t CLKS: 2; - uint32_t RESERVED1: 2; - uint32_t VREFP: 2; - uint32_t VREFN: 1; - uint32_t VRBUF_EN: 1; - uint32_t SMPS: 1; - uint32_t SMPON: 1; - uint32_t HSEN: 1; - uint32_t RESERVED2: 1; - uint32_t ST: 5; - uint32_t RESERVED3: 3; - uint32_t VCMBUF_EN: 1; - uint32_t VCMBUF_HS: 1; - uint32_t RESERVED4: 6; - }; - uint32_t Word; -} ADC_CON1_Typedef; - -typedef union -{ - struct - { - uint32_t CHS: 5; - uint32_t RESERVED0: 3; - uint32_t VDD5_FLAG_EN: 1; - uint32_t RESERVED1: 23; - }; - uint32_t Word; -} ADC_CHS_Typedef; - -typedef union -{ - struct - { - uint32_t IE: 1; - uint32_t ACPMINIE: 1; - uint32_t ACPMAXIE: 1; - uint32_t ACPOVIE: 1; - uint32_t RESERVED0: 28; - }; - uint32_t Word; -} ADC_IE_Typedef; - -typedef union -{ - struct - { - uint32_t IF: 1; - uint32_t ACPMINIF: 1; - uint32_t ACPMAXIF: 1; - uint32_t ACPOVIF: 1; - uint32_t RESERVED0: 28; - }; - uint32_t Word; -} ADC_IF_Typedef; - -typedef union -{ - struct - { - uint32_t OVFL_TIME: 12; - uint32_t RESERVED0: 4; - uint32_t TIMES: 2; - uint32_t RESERVED1: 2; - uint32_t CLKS: 1; - uint32_t RESERVED2: 11; - }; - uint32_t Word; -} ADC_ACPC_Typedef; - -typedef union -{ - struct - { - uint32_t CMP_MIN: 12; - uint32_t RESERVED0: 4; - uint32_t CMP_MAX: 12; - uint32_t RESERVED1: 4; - }; - uint32_t Word; -} ADC_ACPCMP_Typedef; - -typedef union -{ - struct - { - uint32_t MEAN_DATA: 12; - uint32_t RESERVED0: 20; - }; - uint32_t Word; -} ADC_ACPMEAN_Typedef; - -typedef union -{ - struct - { - uint32_t VREF_EN: 1; - uint32_t RESERVED2: 1; - uint32_t IREF_EN: 1; - uint32_t RESERVED0: 1; - uint32_t VDET_EN: 1; - uint32_t VDET_SEL: 1; - uint32_t RESERVED1: 26; - }; - uint32_t Word; -} ADC_VREFCON_Typedef; - -typedef struct -{ - __I ADC_DR_Typedef DR; - __IO ADC_CON0_Typedef CON0; - __IO ADC_CON1_Typedef CON1; - __IO ADC_CHS_Typedef CHS; - __IO ADC_IE_Typedef IE; - __IO ADC_IF_Typedef IF; - uint32_t RESERVED0[4] ; - __IO ADC_ACPC_Typedef ACPC; - uint32_t RESERVED1 ; - __IO ADC_ACPCMP_Typedef ACPCMP; - __I ADC_ACPMEAN_Typedef ACPMEAN; - uint32_t RESERVED2[2] ; - __IO ADC_VREFCON_Typedef VREFCON; -} ADC_TypeDef; - -typedef union -{ - struct - { - uint32_t TMUP: 1; - uint32_t TMWR: 1; - uint32_t HSWI: 1; - uint32_t RESERVED0: 1; - uint32_t CLKS: 2; - uint32_t XST: 1; - uint32_t PON: 1; - uint32_t RESERVED1: 24; - }; - uint32_t Word; -} RTC_CON_Typedef; - -typedef union -{ - struct - { - uint32_t CALF: 8; - uint32_t DEV: 1; - uint32_t COCR: 3; - uint32_t CLKC: 1; - uint32_t RESERVED0: 19; - }; - uint32_t Word; -} RTC_CAL_Typedef; - -typedef union -{ - struct - { - uint32_t WM: 7; - uint32_t RESERVED0: 1; - uint32_t WH: 6; - uint32_t RESERVED1: 2; - uint32_t WW: 7; - uint32_t RESERVED2: 9; - }; - uint32_t Word; -} RTC_WA_Typedef; - -typedef union -{ - struct - { - uint32_t DM: 7; - uint32_t RESERVED0: 1; - uint32_t DH: 6; - uint32_t RESERVED1: 18; - }; - uint32_t Word; -} RTC_DA_Typedef; - -typedef union -{ - struct - { - uint32_t SEC: 7; - uint32_t RESERVED0: 1; - uint32_t MIN: 7; - uint32_t RESERVED1: 1; - uint32_t HOUR: 6; - uint32_t RESERVED2: 10; - }; - uint32_t Word; -} RTC_HMS_Typedef; - -typedef union -{ - struct - { - uint32_t WEEK: 7; - uint32_t RESERVED0: 1; - uint32_t DAY: 6; - uint32_t RESERVED1: 2; - uint32_t MON: 5; - uint32_t RESERVED2: 3; - uint32_t YEAR: 8; - }; - uint32_t Word; -} RTC_YMDW_Typedef; - -typedef union -{ - struct - { - uint32_t SCDIE: 1; - uint32_t MINIE: 1; - uint32_t HORIE: 1; - uint32_t DAYIE: 1; - uint32_t MONIE: 1; - uint32_t RESERVED0: 3; - uint32_t DALE: 1; - uint32_t WALE: 1; - uint32_t RESERVED1: 22; - }; - uint32_t Word; -} RTC_IE_Typedef; - -typedef union -{ - struct - { - uint32_t SCDIF: 1; - uint32_t MINIF: 1; - uint32_t HORIF: 1; - uint32_t DAYIF: 1; - uint32_t MONIF: 1; - uint32_t RESERVED0: 3; - uint32_t DAFG: 1; - uint32_t WAFG: 1; - uint32_t RESERVED1: 22; - }; - uint32_t Word; -} RTC_IF_Typedef; - -typedef union -{ - struct - { - uint32_t WP: 32; - }; - uint32_t Word; -} RTC_WP_Typedef; - -typedef struct -{ - __IO RTC_CON_Typedef CON; - __IO RTC_CAL_Typedef CAL; - __IO RTC_WA_Typedef WA; - __IO RTC_DA_Typedef DA; - __IO RTC_HMS_Typedef HMS; - __IO RTC_YMDW_Typedef YMDW; - __IO RTC_IE_Typedef IE; - __IO RTC_IF_Typedef IF; - __IO RTC_WP_Typedef WP; -} RTC_TypeDef; - -typedef union -{ - struct - { - uint32_t LOAD: 32; - }; - uint32_t Word; -} IWDT_LOAD_Typedef; - -typedef union -{ - struct - { - uint32_t VALUE: 32; - }; - uint32_t Word; -} IWDT_VALUE_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t IE: 1; - uint32_t RSTEN: 1; - uint32_t CLKS: 1; - uint32_t RESERVED0: 28; - }; - uint32_t Word; -} IWDT_CON_Typedef; - -typedef union -{ - struct - { - uint32_t INTCLR: 32; - }; - uint32_t Word; -} IWDT_INTCLR_Typedef; - -typedef union -{ - struct - { - uint32_t WDTIF: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} IWDT_RIS_Typedef; - -typedef union -{ - struct - { - uint32_t LOCK: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} IWDT_LOCK_Typedef; - -typedef struct -{ - __O IWDT_LOAD_Typedef LOAD; - __I IWDT_VALUE_Typedef VALUE; - __IO IWDT_CON_Typedef CON; - __O IWDT_INTCLR_Typedef INTCLR; - __I IWDT_RIS_Typedef RIS; - uint32_t RESERVED0[59] ; - __IO IWDT_LOCK_Typedef LOCK; -} IWDT_TypeDef; - -typedef union -{ - struct - { - uint32_t LOAD: 32; - }; - uint32_t Word; -} WWDT_LOAD_Typedef; - -typedef union -{ - struct - { - uint32_t VALUE: 32; - }; - uint32_t Word; -} WWDT_VALUE_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t IE: 1; - uint32_t RSTEN: 1; - uint32_t CLKS: 1; - uint32_t WWDTWIN: 2; - uint32_t RESERVED0: 26; - }; - uint32_t Word; -} WWDT_CON_Typedef; - -typedef union -{ - struct - { - uint32_t INTCLR: 32; - }; - uint32_t Word; -} WWDT_INTCLR_Typedef; - -typedef union -{ - struct - { - uint32_t WWDTIF: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} WWDT_RIS_Typedef; - -typedef union -{ - struct - { - uint32_t LOCK: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} WWDT_LOCK_Typedef; - -typedef struct -{ - __O WWDT_LOAD_Typedef LOAD; - __I WWDT_VALUE_Typedef VALUE; - __IO WWDT_CON_Typedef CON; - __O WWDT_INTCLR_Typedef INTCLR; - __I WWDT_RIS_Typedef RIS; - uint32_t RESERVED0[59] ; - __IO WWDT_LOCK_Typedef LOCK; -} WWDT_TypeDef; - -typedef union -{ - struct - { - uint32_t CNT: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_CNT_Typedef; - -typedef union -{ - struct - { - uint32_t PRECNT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_PRECNT_Typedef; - -typedef union -{ - struct - { - uint32_t PREMAT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_PREMAT_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t CS: 2; - uint32_t SYNC: 1; - uint32_t EDGE: 2; - uint32_t MOD: 2; - uint32_t MAT0S: 2; - uint32_t MAT1S: 2; - uint32_t MAT2S: 2; - uint32_t MAT3S: 2; - uint32_t ASYWEN: 1; - uint32_t RESERVED0: 15; - }; - uint32_t Word; -} T16N_CON0_Typedef; - -typedef union -{ - struct - { - uint32_t CAPPE: 1; - uint32_t CAPNE: 1; - uint32_t CAPIS0: 1; - uint32_t CAPIS1: 1; - uint32_t CAPT: 4; - uint32_t CAPL0: 1; - uint32_t CAPL1: 1; - uint32_t RESERVED0: 22; - }; - uint32_t Word; -} T16N_CON1_Typedef; - -typedef union -{ - struct - { - uint32_t MOE0: 1; - uint32_t MOE1: 1; - uint32_t POL0: 1; - uint32_t POL1: 1; - uint32_t MOM0: 2; - uint32_t MOM1: 2; - uint32_t MOM2: 2; - uint32_t MOM3: 2; - uint32_t PBKEN: 1; - uint32_t PBKPS: 1; - uint32_t PBKF: 1; - uint32_t RESERVED0: 1; - uint32_t PBKS: 3; - uint32_t RESERVED1: 1; - uint32_t PBKL0: 1; - uint32_t PBKL1: 1; - uint32_t RESERVED2: 10; - }; - uint32_t Word; -} T16N_CON2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IE: 1; - uint32_t MAT1IE: 1; - uint32_t MAT2IE: 1; - uint32_t MAT3IE: 1; - uint32_t OVIE: 1; - uint32_t CAP0IE: 1; - uint32_t CAP1IE: 1; - uint32_t PBKIE: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_IE_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IF: 1; - uint32_t MAT1IF: 1; - uint32_t MAT2IF: 1; - uint32_t MAT3IF: 1; - uint32_t OVIF: 1; - uint32_t CAP0IF: 1; - uint32_t CAP1IF: 1; - uint32_t PBKIF: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_IF_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0TAR: 1; - uint32_t MAT1TAR: 1; - uint32_t MAT2TAR: 1; - uint32_t MAT3TAR: 1; - uint32_t OVTAR: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} T16N_TRG_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT0_Typedef; - -typedef union -{ - struct - { - uint32_t MAT1: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT1_Typedef; - -typedef union -{ - struct - { - uint32_t MAT2: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT3: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT3_Typedef; - -typedef struct -{ - __IO T16N_CNT_Typedef CNT; - uint32_t RESERVED0; - __IO T16N_PRECNT_Typedef PRECNT; - __IO T16N_PREMAT_Typedef PREMAT; - __IO T16N_CON0_Typedef CON0; - __IO T16N_CON1_Typedef CON1; - __IO T16N_CON2_Typedef CON2; - uint32_t RESERVED1; - __IO T16N_IE_Typedef IE; - __IO T16N_IF_Typedef IF; - __IO T16N_TRG_Typedef TRG; - uint32_t RESERVED2; - __IO T16N_MAT0_Typedef MAT0; - __IO T16N_MAT1_Typedef MAT1; - __IO T16N_MAT2_Typedef MAT2; - __IO T16N_MAT3_Typedef MAT3; -} T16N_TypeDef; - -typedef union -{ - struct - { - uint32_t CNT: 32; - }; - uint32_t Word; -} T32N_CNT_Typedef; - -typedef union -{ - struct - { - uint32_t PRECNT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T32N_PRECNT_Typedef; - -typedef union -{ - struct - { - uint32_t PREMAT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T32N_PREMAT_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t CS: 2; - uint32_t SYNC: 1; - uint32_t EDGE: 2; - uint32_t MOD: 2; - uint32_t MAT0S: 2; - uint32_t MAT1S: 2; - uint32_t MAT2S: 2; - uint32_t MAT3S: 2; - uint32_t ASYNC_WREN: 1; - uint32_t RESERVED0: 15; - }; - uint32_t Word; -} T32N_CON0_Typedef; - -typedef union -{ - struct - { - uint32_t CAPPE: 1; - uint32_t CAPNE: 1; - uint32_t CAPIS0: 1; - uint32_t CAPIS1: 1; - uint32_t CAPT: 4; - uint32_t CAPL0: 1; - uint32_t CAPL1: 1; - uint32_t RESERVED0: 22; - }; - uint32_t Word; -} T32N_CON1_Typedef; - -typedef union -{ - struct - { - uint32_t MOE0: 1; - uint32_t MOE1: 1; - uint32_t POL0: 1; - uint32_t POL1: 1; - uint32_t MOM0: 2; - uint32_t MOM1: 2; - uint32_t MOM2: 2; - uint32_t MOM3: 2; - uint32_t RESERVED0: 20; - }; - uint32_t Word; -} T32N_CON2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IE: 1; - uint32_t MAT1IE: 1; - uint32_t MAT2IE: 1; - uint32_t MAT3IE: 1; - uint32_t OVIE: 1; - uint32_t CAP0IE: 1; - uint32_t CAP1IE: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} T32N_IE_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IF: 1; - uint32_t MAT1IF: 1; - uint32_t MAT2IF: 1; - uint32_t MAT3IF: 1; - uint32_t OVIF: 1; - uint32_t CAP0IF: 1; - uint32_t CAP1IF: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} T32N_IF_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0TAR: 1; - uint32_t MAT1TAR: 1; - uint32_t MAT2TAR: 1; - uint32_t MAT3TAR: 1; - uint32_t OVTAR: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} T32N_TRG_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0: 32; - }; - uint32_t Word; -} T32N_MAT0_Typedef; - -typedef union -{ - struct - { - uint32_t MAT1: 32; - }; - uint32_t Word; -} T32N_MAT1_Typedef; - -typedef union -{ - struct - { - uint32_t MAT2: 32; - }; - uint32_t Word; -} T32N_MAT2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT3: 32; - }; - uint32_t Word; -} T32N_MAT3_Typedef; - -typedef struct -{ - __IO T32N_CNT_Typedef CNT; - uint32_t RESERVED0; - __IO T32N_PRECNT_Typedef PRECNT; - __IO T32N_PREMAT_Typedef PREMAT; - __IO T32N_CON0_Typedef CON0; - __IO T32N_CON1_Typedef CON1; - __IO T32N_CON2_Typedef CON2; - uint32_t RESERVED1; - __IO T32N_IE_Typedef IE; - __IO T32N_IF_Typedef IF; - __IO T32N_TRG_Typedef TRG; - uint32_t RESERVED2; - __IO T32N_MAT0_Typedef MAT0; - __IO T32N_MAT1_Typedef MAT1; - __IO T32N_MAT2_Typedef MAT2; - __IO T32N_MAT3_Typedef MAT3; -} T32N_TypeDef; - -typedef union -{ - struct - { - uint32_t TXEN: 1; - uint32_t TRST: 1; - uint32_t TXFS: 1; - uint32_t RESERVED0: 1; - uint32_t TXMOD: 3; - uint32_t TXP: 1; - uint32_t RXEN: 1; - uint32_t RRST: 1; - uint32_t RESERVED1: 2; - uint32_t RXMOD: 3; - uint32_t RXP: 1; - uint32_t RESERVED2: 12; - uint32_t BCS: 3; - uint32_t RESERVED3: 1; - }; - uint32_t Word; -} UART_CON_Typedef; - -typedef union -{ - struct - { - uint32_t BRR: 11; - uint32_t RESERVED0: 21; - }; - uint32_t Word; -} UART_BRR_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} UART_TBW_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} UART_RBR_Typedef; - -typedef union -{ - struct - { - uint32_t TB0: 9; - uint32_t RESERVED0: 3; - uint32_t TP0: 1; - uint32_t TBEF0: 1; - uint32_t RESERVED1: 2; - uint32_t TB1: 9; - uint32_t RESERVED2: 3; - uint32_t TP1: 1; - uint32_t TBEF1: 1; - uint32_t RESERVED3: 2; - }; - uint32_t Word; -} UART_TB01_Typedef; - -typedef union -{ - struct - { - uint32_t TB2: 9; - uint32_t RESERVED0: 3; - uint32_t TP2: 1; - uint32_t TBEF2: 1; - uint32_t RESERVED1: 2; - uint32_t TB3: 9; - uint32_t RESERVED2: 3; - uint32_t TP3: 1; - uint32_t TBEF3: 1; - uint32_t RESERVED3: 2; - }; - uint32_t Word; -} UART_TB23_Typedef; - -typedef union -{ - struct - { - uint32_t RB0: 9; - uint32_t RESERVED0: 3; - uint32_t RP0: 1; - uint32_t RBFF0: 1; - uint32_t FE0: 1; - uint32_t PE0: 1; - uint32_t RB1: 9; - uint32_t RESERVED1: 3; - uint32_t RP1: 1; - uint32_t RBFF1: 1; - uint32_t FE1: 1; - uint32_t PE1: 1; - }; - uint32_t Word; -} UART_RB01_Typedef; - -typedef union -{ - struct - { - uint32_t RB2: 9; - uint32_t RESERVED0: 3; - uint32_t RP2: 1; - uint32_t RBFF2: 1; - uint32_t FE2: 1; - uint32_t PE2: 1; - uint32_t RB3: 9; - uint32_t RESERVED1: 3; - uint32_t RP3: 1; - uint32_t RBFF3: 1; - uint32_t FE3: 1; - uint32_t PE3: 1; - }; - uint32_t Word; -} UART_RB23_Typedef; - -typedef union -{ - struct - { - uint32_t TBIE: 1; - uint32_t RBIE: 1; - uint32_t ROIE: 1; - uint32_t FEIE: 1; - uint32_t PEIE: 1; - uint32_t TBEIE: 1; - uint32_t RESERVED0: 2; - uint32_t TBIM: 2; - uint32_t RBIM: 2; - uint32_t TIDIE: 1; - uint32_t RIDIE: 1; - uint32_t RESERVED1: 18; - }; - uint32_t Word; -} UART_IE_Typedef; - -typedef union -{ - struct - { - uint32_t TBIF: 1; - uint32_t RBIF: 1; - uint32_t ROIF: 1; - uint32_t FEIF: 1; - uint32_t PEIF: 1; - uint32_t TBEIF: 1; - uint32_t RESERVED0: 6; - uint32_t TIDIF: 1; - uint32_t RIDIF: 1; - uint32_t RESERVED1: 18; - }; - uint32_t Word; -} UART_IF_Typedef; - -typedef struct -{ - __IO UART_CON_Typedef CON; - __IO UART_BRR_Typedef BRR; - __O UART_TBW_Typedef TBW; - __I UART_RBR_Typedef RBR; - __I UART_TB01_Typedef TB01; - __I UART_TB23_Typedef TB23; - __I UART_RB01_Typedef RB01; - __I UART_RB23_Typedef RB23; - __IO UART_IE_Typedef IE; - __IO UART_IF_Typedef IF; -} UART_TypeDef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t MS: 1; - uint32_t REN: 1; - uint32_t RESERVED0: 1; - uint32_t DRE: 1; - uint32_t DFS: 2; - uint32_t RESERVED1: 8; - uint32_t TME: 1; - uint32_t TMS: 1; - uint32_t TMP: 6; - uint32_t DW: 3; - uint32_t RESERVED2: 3; - uint32_t TXCLR: 1; - uint32_t RXCLR: 1; - }; - uint32_t Word; -} SPI_CON_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} SPI_TBW_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} SPI_RBR_Typedef; - -typedef union -{ - struct - { - uint32_t TBIE: 1; - uint32_t RBIE: 1; - uint32_t TEIE: 1; - uint32_t ROIE: 1; - uint32_t IDIE: 1; - uint32_t NSSIE: 1; - uint32_t TBWEIE: 1; - uint32_t RESERVED0: 1; - uint32_t TBIM: 2; - uint32_t RBIM: 2; - uint32_t RESERVED1: 20; - }; - uint32_t Word; -} SPI_IE_Typedef; - -typedef union -{ - struct - { - uint32_t TBIF: 1; - uint32_t RBIF: 1; - uint32_t TEIF: 1; - uint32_t ROIF: 1; - uint32_t IDIF: 1; - uint32_t NSSIF: 1; - uint32_t TBWEIF: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} SPI_IF_Typedef; - -typedef union -{ - struct - { - uint32_t TB0: 8; - uint32_t TB1: 8; - uint32_t TB2: 8; - uint32_t TB3: 8; - }; - uint32_t Word; -} SPI_TB_Typedef; - -typedef union -{ - struct - { - uint32_t RB0: 8; - uint32_t RB1: 8; - uint32_t RB2: 8; - uint32_t RB3: 8; - }; - uint32_t Word; -} SPI_RB_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 7; - uint32_t NSS: 1; - uint32_t TBEF0: 1; - uint32_t TBEF1: 1; - uint32_t TBEF2: 1; - uint32_t TBEF3: 1; - uint32_t RBFF0: 1; - uint32_t RBFF1: 1; - uint32_t RBFF2: 1; - uint32_t RBFF3: 1; - uint32_t IDLE: 1; - uint32_t RESERVED1: 15; - }; - uint32_t Word; -} SPI_STA_Typedef; - -typedef union -{ - struct - { - uint32_t CKS: 10; - uint32_t RESERVED0: 22; - }; - uint32_t Word; -} SPI_CKS_Typedef; - -typedef struct -{ - __IO SPI_CON_Typedef CON; - uint32_t RESERVED0 ; - __O SPI_TBW_Typedef TBW; - __I SPI_RBR_Typedef RBR; - __IO SPI_IE_Typedef IE; - __IO SPI_IF_Typedef IF; - __I SPI_TB_Typedef TB; - __I SPI_RB_Typedef RB; - __I SPI_STA_Typedef STA; - __IO SPI_CKS_Typedef CKS; -} SPI_TypeDef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t SCKOD: 1; - uint32_t SDAOD: 1; - uint32_t SCKSE: 1; - uint32_t SDASE: 1; - uint32_t RESERVED0: 1; - uint32_t TJE: 1; - uint32_t TJP: 8; - uint32_t RW: 1; - uint32_t SA: 7; - uint32_t RESERVED1: 8; - }; - uint32_t Word; -} I2C_CON_Typedef; - -typedef union -{ - struct - { - uint32_t MS: 1; - uint32_t RDM: 3; - uint32_t CSE: 1; - uint32_t ANAE: 1; - uint32_t SRAE: 1; - uint32_t SPAE: 1; - uint32_t ADLY: 3; - uint32_t ADE: 1; - uint32_t TIS: 4; - uint32_t SRT: 1; - uint32_t SPT: 1; - uint32_t RDT: 1; - uint32_t BLD: 1; - uint32_t RESERVED0: 4; - uint32_t TAS: 1; - uint32_t RESERVED1: 7; - }; - uint32_t Word; -} I2C_MOD_Typedef; - -typedef union -{ - struct - { - uint32_t SRIE: 1; - uint32_t SPIE: 1; - uint32_t TBIE: 1; - uint32_t RBIE: 1; - uint32_t TEIE: 1; - uint32_t ROIE: 1; - uint32_t NAIE: 1; - uint32_t TBWEIE: 1; - uint32_t TBIM: 2; - uint32_t RBIM: 2; - uint32_t TIDLEIE: 1; - uint32_t RESERVED0: 19; - }; - uint32_t Word; -} I2C_IE_Typedef; - -typedef union -{ - struct - { - uint32_t SRIF: 1; - uint32_t SPIF: 1; - uint32_t TBIF: 1; - uint32_t RBIF: 1; - uint32_t TEIF: 1; - uint32_t ROIF: 1; - uint32_t NAIF: 1; - uint32_t TBWEIF: 1; - uint32_t RESERVED0: 4; - uint32_t TIDLEIF: 1; - uint32_t RESERVED1: 19; - }; - uint32_t Word; -} I2C_IF_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} I2C_TBW_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} I2C_RBR_Typedef; - -typedef union -{ - struct - { - uint32_t TB0: 8; - uint32_t TB1: 8; - uint32_t TB2: 8; - uint32_t TB3: 8; - }; - uint32_t Word; -} I2C_TB_Typedef; - -typedef union -{ - struct - { - uint32_t RB0: 8; - uint32_t RB1: 8; - uint32_t RB2: 8; - uint32_t RB3: 8; - }; - uint32_t Word; -} I2C_RB_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 8; - uint32_t TBEF0: 1; - uint32_t TBEF1: 1; - uint32_t TBEF2: 1; - uint32_t TBEF3: 1; - uint32_t RBFF0: 1; - uint32_t RBFF1: 1; - uint32_t RBFF2: 1; - uint32_t RBFF3: 1; - uint32_t ACK: 1; - uint32_t IDLE: 1; - uint32_t RESERVED1: 14; - }; - uint32_t Word; -} I2C_STA_Typedef; - -typedef struct -{ - __IO I2C_CON_Typedef CON; - __IO I2C_MOD_Typedef MOD; - __IO I2C_IE_Typedef IE; - __IO I2C_IF_Typedef IF; - __O I2C_TBW_Typedef TBW; - __I I2C_RBR_Typedef RBR; - __I I2C_TB_Typedef TB; - __I I2C_RB_Typedef RB; - __I I2C_STA_Typedef STA; -} I2C_TypeDef; - -typedef union -{ - struct - { - uint32_t AES_DATA0: 32; - }; - uint32_t Word; -} AES_DATA0_Typedef; - -typedef union -{ - struct - { - uint32_t AES_DATA1: 32; - }; - uint32_t Word; -} AES_DATA1_Typedef; - -typedef union -{ - struct - { - uint32_t AES_DATA2: 32; - }; - uint32_t Word; -} AES_DATA2_Typedef; - -typedef union -{ - struct - { - uint32_t AES_DATA3: 32; - }; - uint32_t Word; -} AES_DATA3_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY0: 32; - }; - uint32_t Word; -} AES_KEY0_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY1: 32; - }; - uint32_t Word; -} AES_KEY1_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY2: 32; - }; - uint32_t Word; -} AES_KEY2_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY3: 32; - }; - uint32_t Word; -} AES_KEY3_Typedef; - -typedef union -{ - struct - { - uint32_t GO_DONE: 1; - uint32_t ENCRYPT: 1; - uint32_t RESERVED0: 4; - uint32_t IE: 1; - uint32_t IF: 1; - uint32_t RESERVED1: 24; - }; - uint32_t Word; -} AES_CON_Typedef; - -typedef struct -{ - __IO AES_DATA0_Typedef DATA0; - __IO AES_DATA1_Typedef DATA1; - __IO AES_DATA2_Typedef DATA2; - __IO AES_DATA3_Typedef DATA3; - __IO AES_KEY0_Typedef KEY0; - __IO AES_KEY1_Typedef KEY1; - __IO AES_KEY2_Typedef KEY2; - __IO AES_KEY3_Typedef KEY3; - __IO AES_CON_Typedef CON; -} AES_TypeDef; - -/******************************************************************************/ -/* 物理地址映射 */ -/******************************************************************************/ - -/* Base addresses */ -#define FLASH_BASE (0x00000000UL) -#define SRAM_BASE (0x20000000UL) -#define APB_BASE (0x40000000UL) -#define RAM_BASE (0x60000000UL) - -/* APB peripherals */ -#define SCU_BASE (APB_BASE + 0x00000) -#define CRC_BASE (APB_BASE + 0x00C00) -#define GPIO_BASE (APB_BASE + 0x20000) -#define IAP_BASE (APB_BASE + 0x00800) -#define ADC_BASE (APB_BASE + 0x01000) -#define RTC_BASE (APB_BASE + 0x01400) -#define IWDT_BASE (APB_BASE + 0x01C00) -#define WWDT_BASE (APB_BASE + 0x01800) -#define T16N0_BASE (APB_BASE + 0x02000) -#define T16N1_BASE (APB_BASE + 0x02400) -#define T16N2_BASE (APB_BASE + 0x02800) -#define T16N3_BASE (APB_BASE + 0x02C00) -#define T32N0_BASE (APB_BASE + 0x04000) -#define UART0_BASE (APB_BASE + 0x06000) -#define UART1_BASE (APB_BASE + 0x06400) -#define UART2_BASE (APB_BASE + 0x06800) -#define UART3_BASE (APB_BASE + 0x06C00) -#define UART4_BASE (APB_BASE + 0x07000) -#define UART5_BASE (APB_BASE + 0x07400) -#define SPI0_BASE (APB_BASE + 0x08000) -#define I2C0_BASE (APB_BASE + 0x09000) -#define AES_BASE (APB_BASE + 0x0A000) - -/******************************************************************************/ -/* 外设定义 */ -/******************************************************************************/ -#define SCU ((SCU_TypeDef *) SCU_BASE ) -#define CRC ((CRC_TypeDef *) CRC_BASE ) -#define GPIO ((GPIO_TypeDef *) GPIO_BASE ) -#define IAP ((IAP_TypeDef *) IAP_BASE ) -#define ADC ((ADC_TypeDef *) ADC_BASE ) -#define RTC ((RTC_TypeDef *) RTC_BASE ) -#define IWDT ((IWDT_TypeDef *) IWDT_BASE ) -#define WWDT ((WWDT_TypeDef *) WWDT_BASE ) -#define T16N0 ((T16N_TypeDef *) T16N0_BASE ) -#define T16N1 ((T16N_TypeDef *) T16N1_BASE ) -#define T16N2 ((T16N_TypeDef *) T16N2_BASE ) -#define T16N3 ((T16N_TypeDef *) T16N3_BASE ) -#define T32N0 ((T32N_TypeDef *) T32N0_BASE ) -#define UART0 ((UART_TypeDef *) UART0_BASE ) -#define UART1 ((UART_TypeDef *) UART1_BASE ) -#define UART2 ((UART_TypeDef *) UART2_BASE ) -#define UART3 ((UART_TypeDef *) UART3_BASE ) -#define UART4 ((UART_TypeDef *) UART4_BASE ) -#define UART5 ((UART_TypeDef *) UART5_BASE ) -#define SPI0 ((SPI_TypeDef *) SPI0_BASE ) -#define I2C0 ((I2C_TypeDef *) I2C0_BASE ) -#define AES ((AES_TypeDef *) AES_BASE ) - - -#endif diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/core_cm0.h b/bsp/essemi/es8p508x/libraries/CMSIS/core_cm0.h deleted file mode 100644 index e788e0a60a..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/core_cm0.h +++ /dev/null @@ -1,668 +0,0 @@ -/**************************************************************************//** - * @file core_cm0.h - * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File - * @version V3.02 - * @date 16. July 2012 - * - * @note - * Copyright (C) 2009-2012 ARM Limited. All rights reserved. - * - * @par - * ARM Limited (ARM) is supplying this software for use with Cortex-M - * processor based microcontrollers. This file can be freely distributed - * within development tools that are supporting such ARM based processors. - * - * @par - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR - * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - * - ******************************************************************************/ -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#endif - -#ifdef __cplusplus - extern "C" { -#endif - -#ifndef __CORE_CM0_H_GENERIC -#define __CORE_CM0_H_GENERIC - -/** \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.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** \ingroup Cortex_M0 - @{ - */ - -/* CMSIS CM0 definitions */ -#define __CM0_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */ -#define __CM0_CMSIS_VERSION_SUB (0x01) /*!< [15:0] CMSIS HAL sub version */ -#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16) | \ - __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x00) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#endif - -/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all -*/ -#define __FPU_USED 0 - -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #warning "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 -#endif - -#include /* standard types definitions */ -#include /* Core Instruction Access */ -#include /* Core Function Access */ - - -#endif /* __CORE_CM0_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_CM0_H_DEPENDANT -#define __CORE_CM0_H_DEPENDANT - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __CM0_REV - #define __CM0_REV 0x0000 - #warning "__CM0_REV not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 2 - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0 - #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 - - IO Type Qualifiers 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 */ - -/*@} 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 - { -#if (__CORTEX_M != 0x04) - uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ -#else - 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 */ -#endif - 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; - - -/** \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; - - -/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ -#if (__CORTEX_M != 0x04) - uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ -#else - 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 */ -#endif - 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; - - -/** \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; - -/*@} 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 -{ - __IO uint32_t ISER[1]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[31]; - __IO uint32_t ICER[1]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[31]; - __IO uint32_t ISPR[1]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[31]; - __IO uint32_t ICPR[1]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[31]; - uint32_t RESERVED4[64]; - __IO uint32_t IP[8]; /*!< 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 -{ - __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - uint32_t RESERVED0; - __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - uint32_t RESERVED1; - __IO uint32_t SHP[2]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ - __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0 /*!< 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 31 /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< 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 16 /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< 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 4 /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< 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 9 /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< 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 15 /*!< 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 -{ - __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0 /*!< 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 0 /*!< 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 0 /*!< 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 31 /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_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_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M0 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. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* The following MACROS handle generation of the register offset and byte masks */ -#define _BIT_SHIFT(IRQn) ( (((uint32_t)(IRQn) ) & 0x03) * 8 ) -#define _SHP_IDX(IRQn) ( ((((uint32_t)(IRQn) & 0x0F)-8) >> 2) ) -#define _IP_IDX(IRQn) ( ((uint32_t)(IRQn) >> 2) ) - - -/** \brief Enable External Interrupt - - The function enables a device-specific interrupt in the NVIC interrupt controller. - - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); -} - - -/** \brief Disable External Interrupt - - The function disables a device-specific interrupt in the NVIC interrupt controller. - - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); -} - - -/** \brief Get Pending Interrupt - - The function reads the pending register in the NVIC and returns the pending bit - for the specified interrupt. - - \param [in] IRQn Interrupt number. - - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); -} - - -/** \brief Set Pending Interrupt - - The function sets the pending bit of an external interrupt. - - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); -} - - -/** \brief Clear Pending Interrupt - - The function clears the pending bit of an external interrupt. - - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */ -} - - -/** \brief Set Interrupt Priority - - The function sets the priority of an interrupt. - - \note The priority cannot be set for every core interrupt. - - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if(IRQn < 0) { - SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | - (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } - else { - NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | - (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } -} - - -/** \brief Get Interrupt Priority - - The function reads the priority of an interrupt. The interrupt - number can be positive to specify an external (device specific) - interrupt, or negative to specify an internal (core) interrupt. - - - \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(IRQn < 0) { - return((uint32_t)((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M0 system interrupts */ - else { - return((uint32_t)((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */ -} - - -/** \brief System Reset - - The function initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | - SCB_AIRCR_SYSRESETREQ_Msk); - __DSB(); /* Ensure completion of memory access */ - while(1); /* wait until reset */ -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0) - -/** \brief System Tick Configuration - - The function 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 __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */ - - SysTick->LOAD = ticks - 1; /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0; /* 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 (0); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - - -#endif /* __CORE_CM0_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ - -#ifdef __cplusplus -} -#endif diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmFunc.h b/bsp/essemi/es8p508x/libraries/CMSIS/core_cmFunc.h deleted file mode 100644 index 0a18fafc30..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmFunc.h +++ /dev/null @@ -1,636 +0,0 @@ -/**************************************************************************//** - * @file core_cmFunc.h - * @brief CMSIS Cortex-M Core Function Access Header File - * @version V3.20 - * @date 25. February 2013 - * - * @note - * - ******************************************************************************/ -/* Copyright (c) 2009 - 2013 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#ifndef __CORE_CMFUNC_H -#define __CORE_CMFUNC_H - - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ - */ - -#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ -/* ARM armcc specific functions */ - -#if (__ARMCC_VERSION < 400677) - #error "Please use ARM Compiler Toolchain V4.0.677 or later!" -#endif - -/* intrinsic void __enable_irq(); */ -/* intrinsic void __disable_irq(); */ - -/** \brief Get Control Register - - This function 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 - - This function 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 - - This function 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 - - This function 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 - - This function 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 - - This function 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 - - This function 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 - - This function 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 - - This function 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 - - This function 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 - - This function 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 (__CORTEX_M >= 0x03) - -/** \brief Enable FIQ - - This function 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 - - This function 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 - - This function 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 - - This function 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 & 0xff); -} - - -/** \brief Get Fault Mask - - This function 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 - - This function 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)1); -} - -#endif /* (__CORTEX_M >= 0x03) */ - - -#if (__CORTEX_M == 0x04) - -/** \brief Get FPSCR - - This function 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 (__FPU_PRESENT == 1) && (__FPU_USED == 1) - register uint32_t __regfpscr __ASM("fpscr"); - return(__regfpscr); -#else - return(0); -#endif -} - - -/** \brief Set FPSCR - - This function 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 (__FPU_PRESENT == 1) && (__FPU_USED == 1) - register uint32_t __regfpscr __ASM("fpscr"); - __regfpscr = (fpscr); -#endif -} - -#endif /* (__CORTEX_M == 0x04) */ - - -#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ -/* IAR iccarm specific functions */ - -#include - - -#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ -/* TI CCS specific functions */ - -#include - - -#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ -/* GNU gcc specific functions */ - -/** \brief Enable IRQ Interrupts - - This function enables IRQ interrupts by clearing the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void) -{ - __ASM volatile ("cpsie i" : : : "memory"); -} - - -/** \brief Disable IRQ Interrupts - - This function disables IRQ interrupts by setting the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void) -{ - __ASM volatile ("cpsid i" : : : "memory"); -} - - -/** \brief Get Control Register - - This function returns the content of the Control Register. - - \return Control Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - - -/** \brief Set Control Register - - This function writes the given value to the Control Register. - - \param [in] control Control Register value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); -} - - -/** \brief Get IPSR Register - - This function returns the content of the IPSR Register. - - \return IPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get APSR Register - - This function returns the content of the APSR Register. - - \return APSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get xPSR Register - - This function returns the content of the xPSR Register. - - \return xPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get Process Stack Pointer - - This function returns the current value of the Process Stack Pointer (PSP). - - \return PSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); - return(result); -} - - -/** \brief Set Process Stack Pointer - - This function assigns the given value to the Process Stack Pointer (PSP). - - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); -} - - -/** \brief Get Main Stack Pointer - - This function returns the current value of the Main Stack Pointer (MSP). - - \return MSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); - return(result); -} - - -/** \brief Set Main Stack Pointer - - This function assigns the given value to the Main Stack Pointer (MSP). - - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); -} - - -/** \brief Get Priority Mask - - This function returns the current state of the priority mask bit from the Priority Mask Register. - - \return Priority Mask value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - - -/** \brief Set Priority Mask - - This function assigns the given value to the Priority Mask Register. - - \param [in] priMask Priority Mask - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); -} - - -#if (__CORTEX_M >= 0x03) - -/** \brief Enable FIQ - - This function enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void) -{ - __ASM volatile ("cpsie f" : : : "memory"); -} - - -/** \brief Disable FIQ - - This function disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void) -{ - __ASM volatile ("cpsid f" : : : "memory"); -} - - -/** \brief Get Base Priority - - This function returns the current value of the Base Priority register. - - \return Base Priority register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); - return(result); -} - - -/** \brief Set Base Priority - - This function assigns the given value to the Base Priority register. - - \param [in] basePri Base Priority value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) -{ - __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); -} - - -/** \brief Get Fault Mask - - This function returns the current value of the Fault Mask register. - - \return Fault Mask register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); - return(result); -} - - -/** \brief Set Fault Mask - - This function assigns the given value to the Fault Mask register. - - \param [in] faultMask Fault Mask value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); -} - -#endif /* (__CORTEX_M >= 0x03) */ - - -#if (__CORTEX_M == 0x04) - -/** \brief Get FPSCR - - This function returns the current value of the Floating Point Status/Control register. - - \return Floating Point Status/Control register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - uint32_t result; - - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} - - -/** \brief Set FPSCR - - This function assigns the given value to the Floating Point Status/Control register. - - \param [in] fpscr Floating Point Status/Control value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} - -#endif /* (__CORTEX_M == 0x04) */ - - -#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ -/* TASKING carm specific functions */ - -/* - * The CMSIS functions have been implemented as intrinsics in the compiler. - * Please use "carm -?i" to get an up to date list of all instrinsics, - * Including the CMSIS ones. - */ - -#endif - -/*@} end of CMSIS_Core_RegAccFunctions */ - - -#endif /* __CORE_CMFUNC_H */ diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmInstr.h b/bsp/essemi/es8p508x/libraries/CMSIS/core_cmInstr.h deleted file mode 100644 index d213f0eed7..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmInstr.h +++ /dev/null @@ -1,688 +0,0 @@ -/**************************************************************************//** - * @file core_cmInstr.h - * @brief CMSIS Cortex-M Core Instruction Access Header File - * @version V3.20 - * @date 05. March 2013 - * - * @note - * - ******************************************************************************/ -/* Copyright (c) 2009 - 2013 ARM LIMITED - - 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 ARM 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 COPYRIGHT HOLDERS AND 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. - ---------------------------------------------------------------------------*/ - - -#ifndef __CORE_CMINSTR_H -#define __CORE_CMINSTR_H - - -/* ########################## Core Instruction Access ######################### */ -/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface - Access to dedicated instructions - @{ -*/ - -#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ -/* ARM armcc specific functions */ - -#if (__ARMCC_VERSION < 400677) - #error "Please use ARM Compiler Toolchain V4.0.677 or later!" -#endif - - -/** \brief No Operation - - No Operation does nothing. This instruction can be used for code alignment purposes. - */ -#define __NOP __nop - - -/** \brief Wait For Interrupt - - 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 - - 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 - - Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -#define __SEV __sev - - -/** \brief Instruction Synchronization Barrier - - 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() __isb(0xF) - - -/** \brief Data Synchronization Barrier - - This function acts as a special kind of Data Memory Barrier. - It completes when all explicit memory accesses before this instruction complete. - */ -#define __DSB() __dsb(0xF) - - -/** \brief Data Memory Barrier - - This function ensures the apparent order of the explicit memory operations before - and after the instruction, without ensuring their completion. - */ -#define __DMB() __dmb(0xF) - - -/** \brief Reverse byte order (32 bit) - - This function reverses the byte order in integer value. - - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV __rev - - -/** \brief Reverse byte order (16 bit) - - This function reverses the byte order in two unsigned short values. - - \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 in signed short value - - This function reverses the byte order in a signed short value with sign extension to integer. - - \param [in] value Value to reverse - \return Reversed value - */ -#ifndef __NO_EMBEDDED_ASM -__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value) -{ - revsh r0, r0 - bx lr -} -#endif - - -/** \brief Rotate Right in unsigned value (32 bit) - - This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. - - \param [in] value Value to rotate - \param [in] value Number of Bits to rotate - \return Rotated value - */ -#define __ROR __ror - - -/** \brief Breakpoint - - This function 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) - - -#if (__CORTEX_M >= 0x03) - -/** \brief Reverse bit order of value - - This function reverses the bit order of the given value. - - \param [in] value Value to reverse - \return Reversed value - */ -#define __RBIT __rbit - - -/** \brief LDR Exclusive (8 bit) - - This function performs a exclusive LDR command for 8 bit value. - - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) - - -/** \brief LDR Exclusive (16 bit) - - This function performs a exclusive LDR command for 16 bit values. - - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) - - -/** \brief LDR Exclusive (32 bit) - - This function performs a exclusive LDR command for 32 bit values. - - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) - - -/** \brief STR Exclusive (8 bit) - - This function performs a exclusive STR command 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(value, ptr) __strex(value, ptr) - - -/** \brief STR Exclusive (16 bit) - - This function performs a exclusive STR command 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(value, ptr) __strex(value, ptr) - - -/** \brief STR Exclusive (32 bit) - - This function performs a exclusive STR command 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(value, ptr) __strex(value, ptr) - - -/** \brief Remove the exclusive lock - - This function removes the exclusive lock which is created by LDREX. - - */ -#define __CLREX __clrex - - -/** \brief Signed Saturate - - This function 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 - - This function 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 Count leading zeros - - This function 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 - -#endif /* (__CORTEX_M >= 0x03) */ - - - -#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ -/* IAR iccarm specific functions */ - -#include - - -#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ -/* TI CCS specific functions */ - -#include - - -#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ -/* GNU gcc specific functions */ - -/* Define macros for porting to both thumb1 and thumb2. - * For thumb1, use low register (r0-r7), specified by constrant "l" - * Otherwise, use general registers, specified by constrant "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 - - No Operation does nothing. This instruction can be used for code alignment purposes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void) -{ - __ASM volatile ("nop"); -} - - -/** \brief Wait For Interrupt - - Wait For Interrupt is a hint instruction that suspends execution - until one of a number of events occurs. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void) -{ - __ASM volatile ("wfi"); -} - - -/** \brief Wait For Event - - 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. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void) -{ - __ASM volatile ("wfe"); -} - - -/** \brief Send Event - - Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void) -{ - __ASM volatile ("sev"); -} - - -/** \brief Instruction Synchronization Barrier - - 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. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void) -{ - __ASM volatile ("isb"); -} - - -/** \brief Data Synchronization Barrier - - This function acts as a special kind of Data Memory Barrier. - It completes when all explicit memory accesses before this instruction complete. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void) -{ - __ASM volatile ("dsb"); -} - - -/** \brief Data Memory Barrier - - This function ensures the apparent order of the explicit memory operations before - and after the instruction, without ensuring their completion. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void) -{ - __ASM volatile ("dmb"); -} - - -/** \brief Reverse byte order (32 bit) - - This function reverses the byte order in integer value. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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) - - This function reverses the byte order in two unsigned short values. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 in signed short value - - This function reverses the byte order in a signed short value with sign extension to integer. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value) -{ -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - return (short)__builtin_bswap16(value); -#else - uint32_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) - - This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. - - \param [in] value Value to rotate - \param [in] value Number of Bits to rotate - \return Rotated value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) -{ - return (op1 >> op2) | (op1 << (32 - op2)); -} - - -/** \brief Breakpoint - - This function 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) - - -#if (__CORTEX_M >= 0x03) - -/** \brief Reverse bit order of value - - This function reverses the bit order of the given value. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); - return(result); -} - - -/** \brief LDR Exclusive (8 bit) - - This function performs a exclusive LDR command for 8 bit value. - - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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(result); -} - - -/** \brief LDR Exclusive (16 bit) - - This function performs a exclusive LDR command for 16 bit values. - - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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(result); -} - - -/** \brief LDR Exclusive (32 bit) - - This function performs a exclusive LDR command for 32 bit values. - - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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) - - This function performs a exclusive STR command for 8 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) -{ - uint32_t result; - - __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); - return(result); -} - - -/** \brief STR Exclusive (16 bit) - - This function performs a exclusive STR command for 16 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) -{ - uint32_t result; - - __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); - return(result); -} - - -/** \brief STR Exclusive (32 bit) - - This function performs a exclusive STR command for 32 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE 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 - - This function removes the exclusive lock which is created by LDREX. - - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void) -{ - __ASM volatile ("clrex" ::: "memory"); -} - - -/** \brief Signed Saturate - - This function 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(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - - -/** \brief Unsigned Saturate - - This function 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(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - - -/** \brief Count leading zeros - - This function 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 - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) ); - return(result); -} - -#endif /* (__CORTEX_M >= 0x03) */ - - - - -#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ -/* TASKING carm specific functions */ - -/* - * 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. - */ - -#endif - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - -#endif /* __CORE_CMINSTR_H */ diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/startup_ES8P508x.s b/bsp/essemi/es8p508x/libraries/CMSIS/startup_ES8P508x.s deleted file mode 100644 index 69e528223e..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/startup_ES8P508x.s +++ /dev/null @@ -1,233 +0,0 @@ -;******************************************************************************* -; *file : startup_ES8P508x.s -; *description: ES8P508x Device Startup File -; *author : Eastsoft MCU Software Team -; *version : V0.01 -; *data : 6/30/2017 -; -; *Copyright (C) 2017 Shanghai Eastsoft Microelectronics Co., Ltd. -; * -; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED -; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF -; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. -; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR -; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. -;******************************************************************************* - - -; Stack Configuration -; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> -; - -Stack_Size EQU 0x00000400 - - 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 0x00000400 - - 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 - -__Vectors DCD __initial_sp ; Top of Stack - DCD Reset_IRQHandler ; Reset Handler - DCD NMI_IRQHandler ; NMI Handler - DCD HardFault_IRQHandler ; HardFault Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD SVC_IRQHandler ; SVCall Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD PendSV_Handler ; PendSV Handler - DCD SysTick_Handler ; SysTick Handler - - ; External Interrupts - DCD PINT0_IRQHandler ;16, PINT0 IRQHandler - DCD PINT1_IRQHandler ;17, PINT1 IRQHandler - DCD PINT2_IRQHandler ;18, PINT2 IRQHandler - DCD PINT3_IRQHandler ;19, PINT3 IRQHandler - DCD PINT4_IRQHandler ;20, PINT4 IRQHandler - DCD PINT5_IRQHandler ;21, PINT5 IRQHandler - DCD PINT6_IRQHandler ;22, PINT6 IRQHandler - DCD PINT7_IRQHandler ;23, PINT7 IRQHandler - DCD T16N0_IRQHandler ;24, T16N0 IRQHandler - DCD T16N1_IRQHandler ;25, T16N1 IRQHandler - DCD T16N2_IRQHandler ;26, T16N2 IRQHandler - DCD T16N3_IRQHandler ;27, T16N3 IRQHandler - DCD T32N0_IRQHandler ;28, T32N0 IRQHandler - DCD 0 ;29, Reserved - DCD IWDT_IRQHandler ;30, IWDT IRQHandler - DCD WWDT_IRQHandler ;31, WWDT IRQHandler - DCD CCM_IRQHandler ;32, WDT IRQHandler - DCD PLK_IRQHandler ;33, PLK IRQHandler - DCD LVD_IRQHandler ;34, LVD IRQHandler - DCD KINT_IRQHandler ;35, KINT IRQHandler - DCD RTC_IRQHandler ;36, RTC IRQHandler - DCD ADC_IRQHandler ;37, ADC IRQHandler - DCD 0 ;38, Reserved - DCD AES_IRQHandler ;39, AES IRQHandler - DCD UART0_IRQHandler ;40, UART0 IRQHandler - DCD UART1_IRQHandler ;41, UART1 IRQHandler - DCD UART2_IRQHandler ;42, UART2 IRQHandler - DCD UART3_IRQHandler ;43, UART3 IRQHandler - DCD UART4_IRQHandler ;44, UART4 IRQHandler - DCD UART5_IRQHandler ;45, UART5 IRQHandler - DCD SPI0_IRQHandler ;46, SPI0 IRQHandler - DCD I2C0_IRQHandler ;47, I2C0 IRQHandler - - AREA |.text|, CODE, READONLY - -; Reset Handler - -Reset_IRQHandler PROC - EXPORT Reset_IRQHandler [WEAK] - IMPORT __main - IMPORT SystemInit - LDR R0, =SystemInit - BLX R0 - LDR R0, =__main - BX R0 - ENDP - -; Dummy Exception IRQHandlers (infinite loops which can be modified) - -NMI_IRQHandler PROC - EXPORT NMI_IRQHandler [WEAK] - B . - ENDP -HardFault_IRQHandler PROC - EXPORT HardFault_IRQHandler [WEAK] - B . - ENDP -SVC_IRQHandler PROC - EXPORT SVC_IRQHandler [WEAK] - B . - ENDP -PendSV_Handler PROC - EXPORT PendSV_Handler [WEAK] - B . - ENDP -SysTick_Handler PROC - EXPORT SysTick_Handler [WEAK] - B . - ENDP - -Default_IRQHandler PROC - EXPORT PINT0_IRQHandler [WEAK] - EXPORT PINT1_IRQHandler [WEAK] - EXPORT PINT2_IRQHandler [WEAK] - EXPORT PINT3_IRQHandler [WEAK] - EXPORT PINT4_IRQHandler [WEAK] - EXPORT PINT5_IRQHandler [WEAK] - EXPORT PINT6_IRQHandler [WEAK] - EXPORT PINT7_IRQHandler [WEAK] - EXPORT T16N0_IRQHandler [WEAK] - EXPORT T16N1_IRQHandler [WEAK] - EXPORT T16N2_IRQHandler [WEAK] - EXPORT T16N3_IRQHandler [WEAK] - EXPORT T32N0_IRQHandler [WEAK] - EXPORT IWDT_IRQHandler [WEAK] - EXPORT WWDT_IRQHandler [WEAK] - EXPORT CCM_IRQHandler [WEAK] - EXPORT PLK_IRQHandler [WEAK] - EXPORT LVD_IRQHandler [WEAK] - EXPORT KINT_IRQHandler [WEAK] - EXPORT RTC_IRQHandler [WEAK] - EXPORT ADC_IRQHandler [WEAK] - EXPORT AES_IRQHandler [WEAK] - EXPORT UART0_IRQHandler [WEAK] - EXPORT UART1_IRQHandler [WEAK] - EXPORT UART2_IRQHandler [WEAK] - EXPORT UART3_IRQHandler [WEAK] - EXPORT UART4_IRQHandler [WEAK] - EXPORT UART5_IRQHandler [WEAK] - EXPORT SPI0_IRQHandler [WEAK] - EXPORT I2C0_IRQHandler [WEAK] - - - -PINT0_IRQHandler -PINT1_IRQHandler -PINT2_IRQHandler -PINT3_IRQHandler -PINT4_IRQHandler -PINT5_IRQHandler -PINT6_IRQHandler -PINT7_IRQHandler -T16N0_IRQHandler -T16N1_IRQHandler -T16N2_IRQHandler -T16N3_IRQHandler -T32N0_IRQHandler -IWDT_IRQHandler -WWDT_IRQHandler -CCM_IRQHandler -PLK_IRQHandler -LVD_IRQHandler -KINT_IRQHandler -RTC_IRQHandler -ADC_IRQHandler -AES_IRQHandler -UART0_IRQHandler -UART1_IRQHandler -UART2_IRQHandler -UART3_IRQHandler -UART4_IRQHandler -UART5_IRQHandler -SPI0_IRQHandler -I2C0_IRQHandler - - 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/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.c b/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.c deleted file mode 100644 index eb22f8c9da..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.c +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************** -*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd -*ļ system_ES8P508x.c -* ߣ Liut -* V1.00 -* ڣ 2017/07/14 -* ⺯ļ -* ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ -***************************************************************/ -#include "system_ES8P508x.h" -#include "lib_config.h" - -uint32_t SystemCoreClock = 48000000; - - -/*************************************************************** -SystemCoreClockUpdate - ϵͳʱΪڲʱ20MHZͬʱSystemCoreClock -ֵ -ֵ -ֵ -***************************************************************/ -void SystemCoreClockUpdate (void) -{ - uint32_t Prot_Temp; - uint16_t Count=0; - SystemClockSelect(SCU_SysClk_HRC , CLK_SEL_HRC); //ѡϵͳʱΪHRCʱ - PLLClock_Config(DISABLE, SCU_PLL_HRC, SCU_PLL_48M,ENABLE); //PLLֹ - Prot_Temp = SCU->PROT.PROT; - if(Prot_Temp != 0) //д - {SCU->PROT.Word = 0x55AA6996;} // - - SCU->SCLKEN1.HRC_EN = 1; //ʹڲ20MHZ - do - { - Count++; - } - while((SCU->SCLKEN1.HRC_RDY == 0)&&(Count != 0xFFF)); //ȴʱӿ - - if(Count == 0xFFF) - { - return ; - } - - SCU->SCLKEN0.SYSCLK_DIV = 0; //ϵͳʱӺƵ1:1 - - switch(SCU->SCLKEN0.CLK_SEL) - { - case 0: - SystemCoreClock = 20000000; //HRC - break; - case 1: - SystemCoreClock = 32000; //LRC - break; - default: - break; - } - - if(Prot_Temp != 0) //д - {SCU->PROT.Word = 0x00000000;} //д -} - -/*************************************************************** -SystemInit - ϵͳʼʱ -ֵ -ֵ -ֵ -***************************************************************/ -void SystemInit (void) -{ - SystemCoreClockUpdate(); -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.h b/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.h deleted file mode 100644 index b0fa1595c9..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.h +++ /dev/null @@ -1,23 +0,0 @@ -/*************************************************************** -*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. -*ļ system_ES8P508x.h -* ߣ Liut -* V1.00 -* ڣ 2017/07/14 -* ⺯ļ -* ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ -***************************************************************/ -#ifndef __SYSTEMES8P508x_H__ -#define __SYSTEMES8P508x_H__ - -#include "ES8P508x.h" -#include "type.h" - -extern uint32_t SystemCoreClock; -extern void SystemInit(void); -extern void SystemCoreClockUpdate(void); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/irqhandler.h b/bsp/essemi/es8p508x/libraries/Library/Include/irqhandler.h deleted file mode 100644 index fec6f2d62d..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/irqhandler.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef __IRQHANDLER_H__ -#define __IRQHANDLER_H__ - -#include "ES8P508x.h" - -extern void systick_irq_cbk(void); - -/************жϺ***********/ -void NMI_IRQHandler(void); -void HardFault_IRQHandler(void); -void SVC_IRQHandler(void); -void PendSV_IRQHandler(void); -void SysTick_IRQHandler(void); - -#endif - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_adc.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_adc.h deleted file mode 100644 index afcb552435..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_adc.h +++ /dev/null @@ -1,239 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_timer.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ADCģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBADC_H__ -#define __LIBADC_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* ڲοѹѡ */ -typedef enum { - ADC_VREF_SEL_2_0 = 0, /* ڲοѹ2.048v*/ - ADC_VREF_SEL_1_6 = 1, /* ڲοѹ1.6v*/ - ADC_VREF_SEL_MAX = 1, -}ADC_TYPE_VREF_SEL; - -/* ADCʱԴѡ */ -typedef enum -{ - ADC_ClkS_PCLK = 0x0 , //ʱӣPCLK - ADC_ClkS_PLL = 0x1 , //ʱӣPLL - ADC_ClkS_32K = 0x2 , //ʱӣADCCLK(32KHZ) -}ADC_TYPE_CLKS; - -/* ADCʱԴԤƵ */ -typedef enum -{ - ADC_ClkDiv_1 = 0x0 , //ԤƵ1:1 - ADC_ClkDiv_2 = 0x1 , //ԤƵ1:2 - ADC_ClkDiv_4 = 0x2 , //ԤƵ1:4 - ADC_ClkDiv_8 = 0x3 , //ԤƵ1:8 - ADC_ClkDiv_16 = 0x4 , //ԤƵ1:16 - ADC_ClkDiv_32 = 0x5 , //ԤƵ1:32 - ADC_ClkDiv_64 = 0x6 , //ԤƵ1:64 - ADC_ClkDiv_256 = 0x7 , //ԤƵ1:256 -}ADC_TYPE_CLKDIV; - -/* οѹѡ */ -typedef enum -{ - ADC_VrefP_Vcc = 0x0 , //οѹVDDѹ - ADC_VrefP_Exter = 0x3 , //οѹⲿοѹ -}ADC_TYPE_VREFP; - -/* ģʽѡ */ -typedef enum -{ - ADC_SMPS_SOFT = 0, /* */ - ADC_SMPS_HARD = 1, /* Ӳ */ -}ADC_TYPE_SMPS; - - -/* תٶѡ */ -typedef enum -{ - ADC_ConvSpeed_Low = 0x0 , //ADתٶȣ - ADC_ConvSpeed_High = 0x1 , //ADתٶȣ -}ADC_TYPE_HSEN; - -/* ADCͨѡ */ -typedef enum -{ - ADC_CHS_AIN0 = 0, /* ͨ 0 */ - ADC_CHS_AIN1 = 1, /* ͨ 1 */ - ADC_CHS_AIN2 = 2, /* ͨ 2 */ - ADC_CHS_AIN3 = 3, /* ͨ 3 */ - ADC_CHS_AIN4 = 4, /* ͨ 4 */ - ADC_CHS_AIN5 = 5, /* ͨ 5 */ - ADC_CHS_AIN6 = 6, /* ͨ 6 */ - ADC_CHS_AIN7 = 7, /* ͨ 7 */ - ADC_CHS_AIN8 = 8, /* ͨ 8 */ - ADC_CHS_AIN9 = 9, /* ͨ 9 */ - ADC_CHS_AIN10 = 10, /* ͨ 10 */ - ADC_CHS_AIN11 = 11, /* ͨ 11 */ - ADC_CHS_AIN12 = 12, /* ͨ 12 */ - ADC_CHS_AIN13 = 13, /* ͨ 13 */ - ADC_CHS_AIN14 = 14, /* ͨ 14 */ - ADC_CHS_AIN15 = 15, /* ͨ 15 */ -}ADC_TYPE_CHS; - -/*ADC coreѡλ*/ -typedef enum -{ - ADC_LP_86ua = 2, //ADC Core Ϊ86Ƽʹ - ADC_LP_215ua = 0, //ADC Core Ϊ215uA - ADC_LP_120ua = 1, //ADC Core Ϊ120uA - ADC_LP_70ua = 3, //ADC Core Ϊ70uA -}ADC_TYPE_BUFLP; - -/*ADC buffѡλ*/ -typedef enum -{ - ADC_BUFF_0ua = 0, //ADC buffΪ0uAƼʹ - ADC_BUFF_34ua = 1, //ADC buffΪ34uA - ADC_BUFF_95ua = 2, //ADC buffΪ95uA -}ADC_TYPE_BUFEN; - -/* ADC IF ״̬ */ -typedef enum -{ - ADC_IF = 0x01, - ADC_IF_ACPMIN = 0x02, - ADC_IF_ACPMAX =0x04, - ADC_IF_ACPOVER = 0x08, -}ADC_TYPE_IF; - -/* ADC IE ״̬ */ -typedef enum -{ - ADC_IE = 0x01, - ADC_IE_ACPMIN = 0x02, - ADC_IE_ACPMAX =0x04, - ADC_IE_ACPOVER = 0x08, -}ADC_TYPE_IE; - -/* ADCʼýṹ嶨 */ -typedef struct -{ - ADC_TYPE_CLKS ADC_ClkS; //ADCCON1:bit3 ADCʱԴѡ - ADC_TYPE_CLKDIV ADC_ClkDiv; //ADCCON1:bit2-0 ADCʱԴԤƵ - ADC_TYPE_VREFP ADC_VrefP; //ADCCON1:bit9-8 ADCοѹѡ - ADC_TYPE_SMPS ADC_SampS; //ADCCON1:bit12 ADCģʽѡ - ADC_TYPE_CHS ADC_ChS; //ADCCHS:bit0-3 ADCģͨѡ - //ADC_TYPE_VREF_SEL VREF_SEL; //οѹѡ - uint8_t ST; //Ӳʱ (ģʽΪӲʱ) 0~31 - TYPE_FUNCEN ADC_VREFN; //οѹѡλ - TYPE_FUNCEN ADC_VRBUF_EN; -}ADC_InitStruType; - -/* ԶȽϵͷֵ ѡ*/ -typedef enum -{ - ADC_ACP_MIN_MIN = 0x0, /* Сͷֵ*/ - ADC_ACP_MIN_MAX = 0xfff, /* ͷֵ*/ -}ADC_TYPE_ACP_MIN; - -/* ԶȽϸ߷ֵ ѡ*/ -typedef enum -{ - ADC_ACP_MAX_MIN = 0x0, /* С߷ֵ*/ - ADC_ACP_MAX_MAX = 0xfff, /* ߷ֵ*/ -}ADC_TYPE_ACP_MAX; - -/* ÿԶתȽʱѡ */ -typedef enum -{ - ADC_ACPC_OVFL_TIME_MAX = 0x9c3, /* ʱ */ -}ADC_TYPE_ACPC_OVFL_TIME; - -/* ԶתȽϴ */ -typedef enum -{ - ADC_ACPC_TIMES_1 = 0, /* 1 */ - ADC_ACPC_TIMES_2 = 1, /* 2 */ - ADC_ACPC_TIMES_4 = 2, /* 4 */ - ADC_ACPC_TIMES_8 = 3, /* 8 */ - ADC_ACPC_TIMES_MAX = 3, -}ADC_TYPE_ACPC_TIMES; - -/* ACPʱӵʱԴ */ -typedef enum -{ - ADC_ACPC_CLKS_PCLK = 0, /* PCLK */ - ADC_ACPC_CLKS_LRC = 1, /* LRC(32KHz) */ -}ADC_TYPE_ACPC_CLKS; - -typedef FuncState ADC_TYPE_CHOP_EN1, ADC_TYPE_CHOP_EN; -typedef FuncState ADC_TYPE_VREF_EN,ADC_TYPE_IREF_EN; -typedef FuncState ADC_TYPE_EN,ADC_TYPE_ACP_EN; - -/* ԶȽϹܳʼṹ*/ -typedef struct -{ - ADC_TYPE_ACP_EN ACP_EN; /* ԶȽϹʹλ*/ - uint16_t ACPC_OVER_TIME; /* ԶȽʱ(ʹó0) 0~0x9c3 */ - ADC_TYPE_ACPC_TIMES ACPC_TIMES; /* ԶȽϴ(ȼʱ) */ - uint16_t ACPC_MIN_TARGET; /* ƽֵͷֵ (0xfffر) 0~0xfff */ - uint16_t ACPC_MAX_TARGET; /* ƽֵ߷ֵ (0x0ر) 0~0xfff */ -}ADC_ACP_TypeDef; - -/************ADCģ궨***********/ -/* ADCʹܿ */ -#define ADC_Enable() (ADC->CON0.EN = 0x1) -#define ADC_Disable() (ADC->CON0.EN = 0x0) - -/* ԶȽϹʹ*/ -#define ADC_ACP_Enable() (ADC->CON0.ACP_EN = 1) -#define ADC_ACP_Disable() (ADC->CON0.ACP_EN = 0) - -/* ADCʼת */ -#define ADC_Start() (ADC->CON0.TRIG = 0x1) - -/* ADC */ -#define ADC_SampStart() (ADC->CON1.SMPON = 0x1) -#define ADC_SampStop() (ADC->CON1.SMPON = 0x0) - -/* ADC VDD */ -#define ADC_VDD5_FLAG_Enable() (ADC->CHS.VDD5_FLAG_EN = 0x1) -#define ADC_VDD5_FLAG_Disable() (ADC->CHS.VDD5_FLAG_EN = 0x0) - -/* ADCжʹܿ */ -#define ADC_IE_Enable() (ADC->IE.IE = 0x1) -#define ADC_IE_Disable() (ADC->IE.IE = 0x0) - -#define ADC_ACPMINIE_Enable() (ADC->IE.ACPMINIE = 1) -#define ADC_ACPMINIE_Disable() (ADC->IE.ACPMINIE = 0) - -#define ADC_ACPMAXIE_Enable() (ADC->IE.ACPMAXIE = 1) -#define ADC_ACPMAXIE_Disable() (ADC->IE.ACPMAXIE = 0) - -#define ADC_ACPOVIE_Enable() (ADC->IE.ACPOVIE = 1) -#define ADC_ACPOVIE_Disable() (ADC->IE.ACPOVIE = 0) - -/************ADCģ麯***********/ -void ADC_Init(ADC_InitStruType * ADC_InitStruct); -void ADC_Set_CH(ADC_TYPE_CHS AdcCH); -uint16_t ADC_GetConvValue(void); -FlagStatus ADC_GetConvStatus(void); -ErrorStatus ADC_ACPConfig(ADC_ACP_TypeDef *ADC_ACP_InitStruct); -ErrorStatus ADC_SoftStart(void); -ErrorStatus ADC_SoftStop(void); -uint16_t ADC_GetACPMeanValue(void); -uint16_t ADC_GetACPMinValue(void); -uint16_t ADC_GetACPMaxValue(void); -FlagStatus ADC_GetFlagStatus(ADC_TYPE_IF IFName); -ITStatus ADC_GetITStatus(ADC_TYPE_IE IEName); -ErrorStatus ADC_ClearIFStatus(ADC_TYPE_IF IFName); -void ADC_Reset(void); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_aes.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_aes.h deleted file mode 100644 index 13c8046278..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_aes.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_aes.c - * ߣ zoux - * V1.00 - * ڣ 2017/07/14 - * AESģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBAES_H__ -#define __LIBAES_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* ܽģʽѡλ */ -typedef enum { - AES_MODE_DECRYPT = 0, /* */ - AES_MODE_ENCRYPT = 1, /* */ -}AES_TYPE_MODE; - -/* /ܿλ */ -typedef enum { - AES_DONE_YES = 0, /* */ - AES_DONE_NO = 1, /* ڼ */ -}AES_TYPE_DONE; - -/* ӽݽṹ */ -typedef struct { - uint32_t DATA[4]; -}AES_DATA_TypeDef; - -typedef enum { - AES_IF_IF = 0x80, -}AES_TYPE_IF; - -typedef enum { - AES_IT_IT = 0x40, -}AES_TYPE_IT; - -/* ӽԿṹ */ -typedef struct { - uint32_t KEY[4]; -}AES_KEY_TypeDef; - -/* ӽܳʼṹ */ -typedef struct { - AES_TYPE_MODE MODE; /* ܻ߽ */ -}AES_InitStruType; - -/* ӽʹܣʼ */ -#define AES_Enable() (AES->CON.GO_DONE = 1) -/* ģر */ -#define AES_Disable() (AES->CON.GO_DONE = 0) - - -/********************* ADCģ麯 *********************/ -void AES_Init(AES_InitStruType * AES_InitStruct); -void AES_WriteKey(uint32_t *AES_KEY); -void AES_ReadKey(uint32_t * AES_KEY); - -void AES_WriteData(uint32_t *AES_DATA); -void AES_ReadData(uint32_t * AES_DATA); - -void AES_ITConfig(AES_TYPE_IT AES_IE, TYPE_FUNCEN NewState); -void AES_ClearITPendingBit(void); -FlagStatus AES_GetFlagStatus(AES_TYPE_IF Flag); - -AES_TYPE_DONE AES_GetDoneStatus(void); -void AES_Reset(void); - -#endif - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_config.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_config.h deleted file mode 100644 index 8178813ca9..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_config.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_config.h - * : Liut - * : V1.00 - * : 2017/07/14 - * ⺯ļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBCONFIG_H__ -#define __LIBCONFIG_H__ - -#include "lib_adc.h" -#include "lib_iic.h" -#include "lib_scs.h" -#include "lib_scu.h" -#include "lib_spi.h" -#include "lib_timer.h" -#include "lib_uart.h" -#include "lib_wdt.h" -#include "lib_flashiap.h" -#include "lib_gpio.h" -#include "lib_printf.h" -#include "lib_iap.h" -#include "lib_crc.h" -#include "lib_aes.h" -#include "lib_rtc.h" - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_crc.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_crc.h deleted file mode 100644 index 1ab36cca7b..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_crc.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBCRC_H -#define __LIBCRC_H - -#include "ES8P508x.h" -#include "type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define CRC_EmptayCheck_addr 0x10000010 -#define CRC_FlashVerify_addr 0x10000014 -#define CRC_UserCal_addr 0x10000018 -#define CRC_CheckReset_addr 0x1000001C - -typedef uint32_t (*CRC_EM)(void* address, uint32_t data_len); -typedef uint32_t (*CRC_FL)(void* address, uint32_t data_len, uint32_t type); -typedef uint32_t (*CRC_US)(void* address, uint32_t data_len, uint32_t type); -typedef uint32_t (*CRC_CH)(void); - - -typedef enum -{ - CRC_XOROUT_NORMAL = 0x0, //ȡ - CRC_XOROUT_ANTI = (1U<<14), //ȡ -} CRC_XOROUT; - -typedef enum -{ - CRC_REFOUT_NORMAL = 0x0, // - CRC_REFOUT_REVERSE = (1U<<13), // -} CRC_REFOUT; - -typedef enum -{ - CRC_REFIN_NORMAL = 0x0, // - CRC_REFIN_REVERSE = (1U<<12), //뵹 -} CRC_REFIN; - - -typedef enum -{ - CRC_MOD_CRC32 = 0x0, //CRCλΪֽ - CRC_MOD_CRC16 = (2U<<8), //CRCλΪ - CRC_MOD_CRC16_CCITT = (3U<<8), //CRCλΪ -} CRC_MOD_TYPE; - -typedef enum -{ - CRC_INIT_DATA_ALL_0 = 0x0, //CRCʼȫΪ0 - CRC_INIT_DATA_ALL_1 = (1U<<3), //CRCʼȫΪ1 -} CRC_INIT_DATA; - -typedef enum -{ - CRC_HS_TYPE_DISABLE = 0x0, //CRCģʽֹ - CRC_HS_TYPE_ENABLE = (1U<<2), //CRCģʽʹܣCRCʱС24Mʱʹ -} CRC_HS_TYPE; - - -/*CRC_CON ֵṹʼ*/ -typedef struct -{ - CRC_XOROUT xorout; - CRC_REFOUT refout; - CRC_REFIN refin; - CRC_MOD_TYPE mode; - CRC_INIT_DATA init_data_type; - CRC_HS_TYPE hs_type; -} CRC_CONValueStruType; - -uint32_t CRC_getTypeValue(CRC_CONValueStruType con_value); -uint32_t CRC_EmptayCheck(void* address, uint32_t data_len); -uint32_t CRC_FlashVerify(void* address, uint32_t data_len, uint32_t type); -uint32_t CRC_UserCal(void* address, uint32_t data_len, uint32_t type); -uint32_t CRC_CheckReset(void); - -#ifdef __cplusplus -} -#endif - -#endif -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_flashiap.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_flashiap.h deleted file mode 100644 index b297e08712..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_flashiap.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_flashiap.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * flashд⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBIAP_H__ -#define __LIBIAP_H__ - -#include "ES8P508x.h" -#include "type.h" - -/*************IAPģ궨************/ - -/* Ĵ */ -#define FlashIAP_RegUnLock() (IAP->UL.UL = 0x49415055) -#define FlashIAP_RegLock() (IAP->UL.UL = 0x00000000) - -/* ʹIAP */ -#define FlashIAP_Enable() (IAP->CON.EN = 0x1) -#define FlashIAP_Disable() (IAP->CON.EN = 0x0) - -/* IAP */ -#define FlashIAP_REQ() (IAP->CON.FLASH_REQ = 0x1) - -/************Flashģ麯***********/ -ErrorStatus FlashIap_Close_WPROT(uint8_t Page); -ErrorStatus FlashIap_Open_WPROT(uint8_t Page); -ErrorStatus FlashIap_CloseAll_WPROT(void); -ErrorStatus FlashIap_OpenAll_WPROT(void); -ErrorStatus FlashIap_Unlock(void); -ErrorStatus FlashIap_WriteEnd(void); -ErrorStatus FlashIap_ErasePage(uint8_t Page_Addr); -ErrorStatus FlashIap_WriteCont(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32); -ErrorStatus FlashIap_WriteWord(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32); -ErrorStatus Flash_Read(uint32_t * Ram_Addr, uint32_t Flash_Addr, uint8_t Len); - -#endif -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_gpio.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_gpio.h deleted file mode 100644 index 301c6b286c..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_gpio.h +++ /dev/null @@ -1,243 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_gpio.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * GPIOģ鼰ⲿжϡжϿ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBGPIO_H__ -#define __LIBGPIO_H__ - -#include "ES8P508x.h" -#include "type.h" - -/*״̬*/ - -/*˿ڶ*/ -typedef enum -{ - GPIOA = 0x0 , - GPIOB = 0x1 , -}GPIO_TYPE; - -/*Ŷ*/ -typedef enum -{ - GPIO_Pin_0 = 0x00, - GPIO_Pin_1 = 0x01, - GPIO_Pin_2 = 0x02, - GPIO_Pin_3 = 0x03, - GPIO_Pin_4 = 0x04, - GPIO_Pin_5 = 0x05, - GPIO_Pin_6 = 0x06, - GPIO_Pin_7 = 0x07, - GPIO_Pin_8 = 0x08, - GPIO_Pin_9 = 0x09, - GPIO_Pin_10 = 0x0A, - GPIO_Pin_11 = 0x0B, - GPIO_Pin_12 = 0x0C, - GPIO_Pin_13 = 0x0D, - GPIO_Pin_14 = 0x0E, - GPIO_Pin_15 = 0x0F, - GPIO_Pin_16 = 0x10, - GPIO_Pin_17 = 0x11, - GPIO_Pin_18 = 0x12, - GPIO_Pin_19 = 0x13, - GPIO_Pin_20 = 0x14, - GPIO_Pin_21 = 0x15, - GPIO_Pin_22 = 0x16, - GPIO_Pin_23 = 0x17, - GPIO_Pin_24 = 0x18, - GPIO_Pin_25 = 0x19, - GPIO_Pin_26 = 0x1A, - GPIO_Pin_27 = 0x1B, - GPIO_Pin_28 = 0x1C, - GPIO_Pin_29 = 0x1D, - GPIO_Pin_30 = 0x1E, - GPIO_Pin_31 = 0x1F, -}GPIO_TYPE_PIN; - -/* Źѡ */ -typedef enum -{ - GPIO_Func_0 = 0x0 , - GPIO_Func_1 = 0x1 , - GPIO_Func_2 = 0x2 , - GPIO_Func_3 = 0x3 , -}GPIO_TYPE_FUNC; - -/* ŷѡ */ -typedef enum -{ - GPIO_Dir_Out = 0x0 , - GPIO_Dir_In = 0x1 , -}GPIO_TYPE_DIR; - -/* ѡ */ -typedef enum -{ - GPIO_DS_Output_Normal = 0, // ͨ - GPIO_DS_Output_Strong = 1, // ǿ -} GPIO_TYPE_DS; - -/* ź */ -typedef enum { - GPIO_Pin_Signal_Digital = 0, // ź - GPIO_Pin_Signal_Analog = 1, // ģź -} GPIO_Pin_Signal; - -/* ʹ */ -typedef enum { - GPIO_PUE_Input_Disable = 0, // ֹ - GPIO_PUE_Input_Enable = 1, // ʹ -} GPIO_PUE_Input; - -/* ʹ */ -typedef enum { - GPIO_PDE_Input_Disable = 0, // ֹ - GPIO_PDE_Input_Enable = 1, // ʹ -} GPIO_PDE_Input; - - -/* ©ʹλ */ -typedef enum { - GPIO_ODE_Output_Disable = 0, // ©ֹ - GPIO_ODE_Output_Enable = 1, // ©ʹ -} GPIO_ODE_Output; - -/* GPIOʼýṹ嶨 */ -typedef struct -{ - GPIO_Pin_Signal GPIO_Signal; /* ϵźֻͣģ */ - GPIO_TYPE_FUNC GPIO_Func; //Źѡ - GPIO_TYPE_DIR GPIO_Direction; //ѡ - GPIO_PUE_Input GPIO_PUEN; //ʹ - GPIO_PDE_Input GPIO_PDEN; //ʹ - GPIO_ODE_Output GPIO_OD; //ģʽ©ʹ - GPIO_TYPE_DS GPIO_DS; // -}GPIO_InitStruType; - -/* PINT */ -typedef enum -{ - PINT0 = 0x0 , - PINT1 = 0x1 , - PINT2 = 0x2 , - PINT3 = 0x3 , - PINT4 = 0x4 , - PINT5 = 0x5 , - PINT6 = 0x6 , - PINT7 = 0x7 , -}PINT_TYPE; - -/* PINT SEL */ -typedef enum -{ - PINT_SEL0 = 0x0 , - PINT_SEL1 = 0x1 , - PINT_SEL2 = 0x2 , - PINT_SEL3 = 0x3 , - PINT_SEL4 = 0x4 , - PINT_SEL5 = 0x5 , - PINT_SEL6 = 0x6 , - PINT_SEL7 = 0x7 , -}PINT_TYPE_SEL; - -/* PINT Trigger */ -typedef enum -{ - PINT_Trig_Rise = 0x0 , - PINT_Trig_Fall = 0x1 , - PINT_Trig_High = 0x2 , - PINT_Trig_Low = 0x3 , - PINT_Trig_Change = 0x4 , -}PINT_TYPE_TRIG; - - -/* PINTжϱ־ */ -typedef enum -{ - PINT_IT_PINT0 = 0x01 , - PINT_IT_PINT1 = 0x02 , - PINT_IT_PINT2 = 0x04 , - PINT_IT_PINT3 = 0x08 , - PINT_IT_PINT4 = 0x10 , - PINT_IT_PINT5 = 0x20 , - PINT_IT_PINT6 = 0x40 , - PINT_IT_PINT7 = 0x80 , - PINT_IT_PINTAll = 0xFF , -}PINT_TYPE_IT; - -/* PINTʹܿ */ -#define PINT0_Enable() (GPIO->PINTIE.PINTIE |= 0X1) -#define PINT1_Enable() (GPIO->PINTIE.PINTIE |= 0x2) -#define PINT2_Enable() (GPIO->PINTIE.PINTIE |= 0x4) -#define PINT3_Enable() (GPIO->PINTIE.PINTIE |= 0x8) -#define PINT4_Enable() (GPIO->PINTIE.PINTIE |= 0x10) -#define PINT5_Enable() (GPIO->PINTIE.PINTIE |= 0x20) -#define PINT6_Enable() (GPIO->PINTIE.PINTIE |= 0x40) -#define PINT7_Enable() (GPIO->PINTIE.PINTIE |= 0x80) -#define PINT0_Disable() (GPIO->PINTIE.PINTIE &= ~0x01) -#define PINT1_Disable() (GPIO->PINTIE.PINTIE &= ~0x02) -#define PINT2_Disable() (GPIO->PINTIE.PINTIE &= ~0x04) -#define PINT3_Disable() (GPIO->PINTIE.PINTIE &= ~0x08) -#define PINT4_Disable() (GPIO->PINTIE.PINTIE &= ~0x10) -#define PINT5_Disable() (GPIO->PINTIE.PINTIE &= ~0x20) -#define PINT6_Disable() (GPIO->PINTIE.PINTIE &= ~0x40) -#define PINT7_Disable() (GPIO->PINTIE.PINTIE &= ~0x80) - -/* PINTʹܿ */ -#define PINT0_MaskEnable() (GPIO->PINTIE.PMASK |= 0X01) -#define PINT1_MaskEnable() (GPIO->PINTIE.PMASK |= 0x02) -#define PINT2_MaskEnable() (GPIO->PINTIE.PMASK |= 0x04) -#define PINT3_MaskEnable() (GPIO->PINTIE.PMASK |= 0x08) -#define PINT4_MaskEnable() (GPIO->PINTIE.PMASK |= 0x10) -#define PINT5_MaskEnable() (GPIO->PINTIE.PMASK |= 0x20) -#define PINT6_MaskEnable() (GPIO->PINTIE.PMASK |= 0x40) -#define PINT7_MaskEnable() (GPIO->PINTIE.PMASK |= 0x80) -#define PINT0_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x01) -#define PINT1_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x02) -#define PINT2_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x04) -#define PINT3_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x08) -#define PINT4_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x10) -#define PINT5_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x20) -#define PINT6_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x40) -#define PINT7_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x80) - -/* PINTжϱ */ -#define PINT_ClearAllITPending() (GPIO->PIF.Word = (uint32_t)0xff) - -void GPIO_Init(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_InitStruType* GPIO_InitStruct); -void GPIO_Write(GPIO_TYPE GPIOx, uint32_t Value); -uint32_t GPIO_Read(GPIO_TYPE GPIOx); -PinStatus GPIO_ReadBit(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx); -void GPIOA_SetBit(GPIO_TYPE_PIN PINx); -void GPIOA_ResetBit(GPIO_TYPE_PIN PINx); -void GPIOA_ToggleBit(GPIO_TYPE_PIN PINx); -void GPIOB_SetBit(GPIO_TYPE_PIN PINx); -void GPIOB_ResetBit(GPIO_TYPE_PIN PINx); -void GPIOB_ToggleBit(GPIO_TYPE_PIN PINx); -void GPIOA_SetDirection(GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir_Type); -void GPIOB_SetDirection(GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir_Type); -void PINT_Config(PINT_TYPE PINTx, PINT_TYPE_SEL SELx, PINT_TYPE_TRIG TRIGx); -void GPIO_SetSingalTypeFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_Pin_Signal GPIO_Signal); -void GPIO_SetDirRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir); -void GPIO_SetODERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_ODE_Output ODE); -void GPIO_SetDSRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DS DS); -void GPIO_SetPUERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PUE_Input PUE); -void GPIO_SetPDERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PDE_Input PDE); -void GPIO_SetFuncxRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_FUNC Func); -FlagStatus PINT_GetIFStatus(PINT_TYPE_IT PINT_Flag); -FlagStatus PINT_GetITStatus(PINT_TYPE_IT PINT_Flag); -void PINT_ClearITPendingBit(PINT_TYPE_IT PINT_Flag); - -#endif - - - - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iap.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_iap.h deleted file mode 100644 index 61a404d3ea..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iap.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __ES8P508x_IAP_TABLE_H -#define __ES8P508x_IAP_TABLE_H - -#include "ES8P508x.h" -#include "type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define IAP_PageProgram_addr 0x10000008 -#define IAP_PageErase_addr 0x10000000 -#define IAP_WordProgram_addr 0x10000004 - -typedef ErrorStatus (*IAP_PE)(uint32_t address); -typedef ErrorStatus (*IAP_WP)(uint32_t address, uint32_t data); -typedef ErrorStatus (*IAP_PP)(uint32_t address, uint32_t data[], uint32_t length, uint32_t erase); - -ErrorStatus IAP_PageErase(uint32_t address); -ErrorStatus IAP_WordProgram(uint32_t address, uint32_t data); -ErrorStatus IAP_PageProgram(uint32_t address, uint32_t data[], uint32_t length, uint32_t erase); -ErrorStatus IAPRead(uint32_t *Ram_Addr, uint32_t Flash_Addr, uint8_t Len); - -#define PageEraseEnable 0x00000001 -#define PageEraseDisable 0x00000000 - -#ifdef __cplusplus -} -#endif - -#endif -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iic.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_iic.h deleted file mode 100644 index dae43c1964..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iic.h +++ /dev/null @@ -1,229 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_iic.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * I2Cģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBIIC_H__ -#define __LIBIIC_H__ - -#include "ES8P508x.h" -#include "type.h" -#include "system_ES8P508x.h" - -/* ſ© */ -typedef enum -{ - I2C_PinMode_PP = 0x0 , //˿ģʽ: - I2C_PinMode_OD = 0x1 , //˿ģʽ:© -}I2C_TYPE_PINOD; - -/* ģʽ */ -typedef enum -{ - I2C_Mode_Master = 0x0 , //ģʽ - I2C_Mode_Slave = 0x1 , //ģʽ -}I2C_TYPE_MODE; - -/* Ӧʱ */ -typedef enum -{ - I2C_AckDelay_0P5 = 0x0 , //Ӧʱ:0.5ʱ - I2C_AckDelay_1 = 0x1 , //Ӧʱ:1ʱ - I2C_AckDelay_1P5 = 0x2 , //Ӧʱ:1.5ʱ - I2C_AckDelay_2 = 0x3 , //Ӧʱ:2ʱ - I2C_AckDelay_2P5 = 0x4 , //Ӧʱ:2.5ʱ - I2C_AckDelay_3 = 0x5 , //Ӧʱ:3ʱ - I2C_AckDelay_3P5 = 0x6 , //Ӧʱ:3.5ʱ - I2C_AckDelay_4 = 0x7 , //Ӧʱ:4ʱ -}I2C_TYPE_ADLY; - -/* ģʽ */ -typedef enum -{ - I2C_RecMode_0 = 0x0 , //ģʽ1ֽڣACK - I2C_RecMode_1 = 0x1 , //ģʽ1ֽڣNACK - I2C_RecMode_2 = 0x2 , //ģʽ2ֽڣÿֽڷACK - I2C_RecMode_3 = 0x3 , //ģʽ2ֽڣǰһֽڷACKһֽڷNACK - I2C_RecMode_4 = 0x4 , //ģʽ4ֽڣÿֽڷACK - I2C_RecMode_5 = 0x5 , //ģʽ4ֽڣǰ3ֽڷACKһֽڷNACK - I2C_RecMode_6 = 0x6, //ģʽգÿֽڷACK - I2C_RecMode_7 = 0x7, //ģʽɸֽڽգNACK -}I2C_TYPE_RECMODE; - -/* ֡ */ -typedef enum -{ - I2C_TI_Disable = 0x0 , //֡:0 - I2C_TI_1 = 0x1 , //֡:1 - I2C_TI_2 = 0x2 , //֡:2 - I2C_TI_3 = 0x3 , //֡:3 - I2C_TI_4 = 0x4 , //֡:4 - I2C_TI_5 = 0x5 , //֡:5 - I2C_TI_6 = 0x6 , //֡:6 - I2C_TI_7 = 0x7 , //֡:7 - I2C_TI_8 = 0x8 , //֡:8 - I2C_TI_9 = 0x9 , //֡:9 - I2C_TI_10 = 0xA , //֡:10 - I2C_TI_11 = 0xB , //֡:11 - I2C_TI_12 = 0xC , //֡:12 - I2C_TI_13 = 0xD , //֡:13 - I2C_TI_14 = 0xE , //֡:14 - I2C_TI_15 = 0xF , //֡:15 -}I2C_TYPE_TIS; - -/* I2Cʼýṹ嶨 */ -typedef struct -{ - I2C_TYPE_PINOD I2C_SclOd; //SCL˿ģʽ - - I2C_TYPE_PINOD I2C_SdaOd; //SDA˿ģʽ - - TYPE_FUNCEN I2C_16XSamp; //˿16ٲʹ - - uint32_t I2C_Clk; //I2CƵ - - I2C_TYPE_MODE I2C_Mode; //ģʽ - - TYPE_FUNCEN I2C_AutoStop; //Զֹͣ - - TYPE_FUNCEN I2C_AutoCall; //ԶѰ -}I2C_InitStruType; - -/* ͡жģʽ */ -typedef enum -{ - I2C_TRBIM_Byte = 0x0 , //ֽж - I2C_TRBIM_HalfWord = 0x1 , //ж - I2C_TRBIM_Word = 0x2 , //ж -}I2C_TYPE_TRBIM; - - -/* дģʽ */ -typedef enum -{ - I2C_Mode_Write = 0x0 , - I2C_Mode_Read = 0x1 , -}I2C_TYPE_RWMODE; - -/* жʹܱ־λ */ -typedef enum -{ - I2C_IT_SR = 0x0001 , //ʼλ - I2C_IT_SP = 0x0002 , //ֹͣλ - I2C_IT_TB = 0x0004 , //ͻ - I2C_IT_RB = 0x0008 , //ջ - I2C_IT_TE = 0x0010 , //ݴ - I2C_IT_RO = 0x0020 , // - I2C_IT_NA = 0x0040 , //δӦNACK - I2C_IT_TBWE = 0x0080 , //д - I2C_IT_TIDLE = 0x01000 , //Ϳж -}I2C_TYPE_IT; - -/* жϱ־λ */ -typedef enum -{ - I2C_Flag_SR = 0x0001 , //ʼλ - I2C_Flag_SP = 0x0002 , //ֹͣλ - I2C_Flag_TB = 0x0004 , //ͻ - I2C_Flag_RB = 0x0008 , //ջ - I2C_Flag_TE = 0x0010 , //ݴ - I2C_Flag_RO = 0x0020 , // - I2C_Flag_NA = 0x0040 , //δӦNACK - I2C_Flag_TBWE = 0x0080, //джϱ־λ - I2C_Flag_TIDLE= 0X1000, //I2C Ϳжϱ־λ -}I2C_TYPE_FLAG; - - -/* ־ */ -typedef enum -{ - I2C_Clr_SR = 0x0001 , //ʼλ - I2C_Clr_SP = 0x0002 , //ֹͣλ - I2C_Clr_TE = 0x0010 , //ݴ - I2C_Clr_RO = 0x0020 , // - I2C_Clr_NA = 0x0040 , //δӦNACK - I2C_Clr_TBWE = 0x0080 , //д - I2C_Clr_TIDLE= 0X01000, //I2C Ϳ -}I2C_CLR_IF; - - -/*************I2Cģ궨************/ - -/* I2Cģʹܿ */ -#define I2C_Enable() (I2C0->CON.EN = 1) -#define I2C_Disable() (I2C0->CON.EN = 0) - -/* I2Cģ鸴λ */ -#define I2C_Reset() (I2C0->CON.RST = 1) - -/* I2Cʱʹܿ */ -#define I2C_TJEnable() (I2C0->CON.TJE = 1) -#define I2C_TJDisable() (I2C0->CON.TJE = 0) - -/* I2Cģʽд */ -#define I2C_Read() (I2C0->CON.RW = 1) -#define I2C_Write() (I2C0->CON.RW = 0) - -/* I2CʱԶȴʹܿƣӻģʽ֧֣ */ -#define I2C_CSEnable() (I2C0->MOD.CSE = 1) -#define I2C_CSDisable() (I2C0->MOD.CSE = 0) - -/* I2CԶδӦʹܿƣӻģʽ֧֣ */ -#define I2C_ANAEnable() (I2C0->MOD.ANAE = 1) -#define I2C_ANADisable() (I2C0->MOD.ANAE = 0) - -/* I2CԶѰʹܿƣģʽ֧֣ */ -#define I2C_SRAEnable() (I2C0->MOD.SRAE = 1) -#define I2C_SRADisable() (I2C0->MOD.SRAE = 0) - -/* I2CԶʹܿƣģʽ֧֣ */ -#define I2C_SPAEnable() (I2C0->MOD.SPAE = 1) -#define I2C_SPADisable() (I2C0->MOD.SPAE = 0) - -/* I2Cʼλģʽ֧֣ */ -#define I2C_SRTrigger() (I2C0->MOD.SRT=1) - -/* I2Cֹͣλģʽ֧֣ */ -#define I2C_SPTrigger() (I2C0->MOD.SPT = 1) - -/* I2Cݴģʽ֧֣ */ -#define I2C_RDTrigger() (I2C0->MOD.RDT = 1) - - -/* I2Cͷ */ -#define I2C_Release() (I2C0->MOD.BLD = 1) - -/* I2CӦãӻģʽ֧֣ */ -#define I2C_TACK() (I2C0->MOD.TAS = 1) -#define I2C_TNACK() (I2C0->MOD.TAS = 0) - -/************I2Cģ麯***********/ -void I2C_Init(I2C_InitStruType* I2C_InitStruct); -void I2C_ITConfig(I2C_TYPE_IT I2C_IT,TYPE_FUNCEN NewState); -void I2C_SendAddress(uint8_t I2C_Address,I2C_TYPE_RWMODE Mode); -void I2C_SetAddress(uint8_t I2C_Address); -void I2C_RecModeConfig(I2C_TYPE_RECMODE RecType); -void I2C_TBIMConfig(I2C_TYPE_TRBIM Type); -void I2C_RBIMConfig(I2C_TYPE_TRBIM Type); -void I2C_AckDelay(I2C_TYPE_ADLY Type,TYPE_FUNCEN NewStatus); -void I2C_TISConfig(I2C_TYPE_TIS Time); -void I2C_SendByte(uint8_t Byte); -void I2C_SendHalfWord(uint16_t HalfWord); -void I2C_SendWord(uint32_t Word); -uint8_t I2C_RecByte(void); -uint16_t I2C_RecHalfWord(void); -uint32_t I2C_RecWord(void); -I2C_TYPE_RWMODE I2C_GetRWMode(void); -FlagStatus I2C_GetTBStatus(void); -FlagStatus I2C_GetFlagStatus(I2C_TYPE_FLAG I2C_Flag); -FlagStatus I2C_GetITStatus( I2C_TYPE_IT I2C_Flag); -void I2C_ClearITPendingBit(I2C_CLR_IF I2C_IT); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_printf.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_printf.h deleted file mode 100644 index 7bee613c8a..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_printf.h +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_printf.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ڴӡ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBPRINTF_H__ -#define __LIBPRINTF_H__ - -#include "lib_uart.h" -#include -#include "type.h" - -int fputc(int ch, FILE *f); -static char *itoa(int value, char *string, int radix); -ErrorStatus UART_printf(uint8_t *Data,...); - -#ifdef __clang__ -ErrorStatus UART_printf(uint8_t *Data, ...); - -#elif defined __CC_ARM - -#define UART_printf printf - -#endif - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_rtc.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_rtc.h deleted file mode 100644 index 86dbb5bcc4..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_rtc.h +++ /dev/null @@ -1,84 +0,0 @@ -/********************************************************* - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ: lib_rtc.h - * : WangMX - * : V1.00 - * : 2017/07/14 - * : RTCģͷļ - * ע: HRSDK-GDB-ES8P508x V1.1 - ѧϰʾʹãûֱôķջеκηΡ - **********************************************************/ -#ifndef __LIBRTC_H__ -#define __LIBRTC_H__ - -#include "ES8P508x.h" -#include "type.h" - -/*RTCʱԴѡ*/ -typedef enum -{ - RTC_LOSC = 0x0, //ⲿ32768HZʱ RTCȷʱ - RTC_LRC = 0x1, //ڲLRCʱ RTCǾȷʱ - RTC_PLCK_256 = 0x2, //PLCLK/256 RTCͨ - RTC_PLCK = 0x3, //PCLK RTCͨ -}RTC_TYPE_CLKS; - -/*RTCʱ12/24Сʱѡ*/ -typedef enum -{ - RTC_HOUR12 = 0x0, //12Сʱ - RTC_HOUR24 = 0x1, //24Сʱ -}RTC_TYPE_TIME; - -/* RTCжԴѡ */ -typedef enum { - RTC_Interrupt_Source_Second = 0x001, // ж - RTC_Interrupt_Source_Minute = 0x002, // ж - RTC_Interrupt_Source_Hour = 0x004, // Сʱж - RTC_Interrupt_Source_Day = 0x008, // ж - RTC_Interrupt_Source_Month = 0x010, // ж - RTC_Interrupt_Source_DayALE = 0x100, // ж - RTC_Interrupt_Source_WeekALE = 0x200, // ж -} RTC_Interrupt_Source; - - -/********************* RTCģ麯 *********************/ -void RTC_Init(RTC_TYPE_CLKS CLKx,RTC_TYPE_TIME HOURx); -uint32_t RTC_ReadHourmode(void); -uint32_t RTC_ReadSecond(void); -uint32_t RTC_ReadMinute(void); -uint32_t RTC_ReadHour(uint32_t *meridiem); -uint32_t RTC_ReadDay(void); -uint32_t RTC_ReadMonth(void); -uint32_t RTC_ReadYear(void); -uint32_t RTC_ReadWeek(void); - -ErrorStatus RTC_WriteSecond(uint32_t second); -ErrorStatus RTC_WriteMinute(uint32_t minute); -ErrorStatus RTC_WriteHour(uint32_t hour, uint32_t meridiem); -ErrorStatus RTC_WriteDay(uint32_t day); -ErrorStatus RTC_WriteMonth(uint32_t month); -ErrorStatus RTC_WriteYear(uint32_t year); -ErrorStatus RTC_WriteWeek(uint32_t week); - -uint32_t RTC_ReadWeekAlarmMinute(void); -uint32_t RTC_ReadWeekAlarmHour(uint32_t *meridiem); -uint32_t RTC_ReadWeekAlarmWeek(void); -uint32_t RTC_ReadDayAlarmMinute(void); -uint32_t RTC_ReadDayAlarmHour(uint32_t *meridiem); - -ErrorStatus RTC_WriteWeekAlarmMinute(uint32_t minute); -ErrorStatus RTC_WriteWeekAlarmHour(uint32_t hour, uint32_t meridiem); -ErrorStatus RTC_WriteWeekAlarmWeek(uint32_t week); -ErrorStatus RTC_WriteDayAlarmMinute(uint32_t minute); -ErrorStatus RTC_WriteDayAlarmHour(uint32_t hour, uint32_t meridiem); - -void RTC_InterruptEnable(RTC_Interrupt_Source src); -void RTC_InterruptDisable(RTC_Interrupt_Source src); -ITStatus RTC_GetITStatus(RTC_Interrupt_Source src); -FlagStatus RTC_GetFlagStatus(RTC_Interrupt_Source src); -void RTC_ClearITPendingBit(RTC_Interrupt_Source src); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scs.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_scs.h deleted file mode 100644 index e69c9a674f..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scs.h +++ /dev/null @@ -1,98 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_scs.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ںģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBNVIC_H__ -#define __LIBNVIC_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* жԴѡ */ -typedef enum -{ - NVIC_PINT0_IRQn = 0, - NVIC_PINT1_IRQn = 1, - NVIC_PINT2_IRQn = 2, - NVIC_PINT3_IRQn = 3, - NVIC_PINT4_IRQn = 4, - NVIC_PINT5_IRQn = 5, - NVIC_PINT6_IRQn = 6, - NVIC_PINT7_IRQn = 7, - NVIC_T16N0_IRQn = 8, - NVIC_T16N1_IRQn = 9, - NVIC_T16N2_IRQn = 10, - NVIC_T16N3_IRQn = 11, - NVIC_T32N0_IRQn = 12, - NVIC_IWDT_IRQn = 14, - NVIC_WWDT_IRQn = 15, - NVIC_CCM_IRQn = 16, - NVIC_PLK_IRQn = 17, - NVIC_LVD_IRQn = 18, - NVIC_KINT_IRQn = 19, - NVIC_RTC_IRQn = 20, - NVIC_ADC_IRQn = 21, - NVIC_AES_IRQn = 23, - NVIC_UART0_IRQn = 24, - NVIC_UART1_IRQn = 25, - NVIC_UART2_IRQn = 26, - NVIC_UART3_IRQn = 27, - NVIC_UART4_IRQn = 28, - NVIC_UART5_IRQn = 29, - NVIC_SPI0_IRQn = 30, - NVIC_I2C0_IRQn = 31, -}NVIC_IRQChannel; - -/* ȼ */ -typedef enum -{ - NVIC_Priority_0 = 0x0 , - NVIC_Priority_1 = 0x1 , - NVIC_Priority_2 = 0x2 , - NVIC_Priority_3 = 0x3 , -}NVIC_IRQPriority; - -/* ģʽ */ -typedef enum -{ - SCB_LP_SleepOnExit = 0x02 , //ISRжϴ򷵻ص߳ģʽʱǷ - SCB_LP_SleepDeep = 0x04 , //˯ - SCB_LP_SEVOPend = 0x10 , //жϹʱǷΪѵѡλ -}SCB_TYPE_SCR; - -/* SysTickʱԴѡ */ -typedef enum -{ - SysTick_ClkS_Base = 0x0 , //׼ʱ(Hclk/3) - SysTick_ClkS_Cpu = 0x1 , //ʱ(Hclk) -}SYST_TYPE_CLKS; - -/* SysTickʼýṹ嶨 */ -typedef struct -{ - uint32_t SysTick_Value; //ݼֵ24λҶ - SYST_TYPE_CLKS SysTick_ClkSource; //ʱԴѡ - TYPE_FUNCEN SysTick_ITEnable; //жʹܡʧ -}SYSTICK_InitStruType; - -/**************ģ궨*************/ - -/*SysTickʹ*/ -#define SysTick_Enable() (SysTick->CTRL |= 0x00000001) -#define SysTick_Disable() (SysTick->CTRL &= 0xFFFFFFFE) - -/************SCSģ麯***********/ -void NVIC_Init(NVIC_IRQChannel Channel,NVIC_IRQPriority Priority,TYPE_FUNCEN Cmd); -void SCB_SystemLPConfig(SCB_TYPE_SCR LowPowerMode, TYPE_FUNCEN NewState); -uint32_t SCB_GetCpuID(void); -void SysTick_Init(SYSTICK_InitStruType* SysT_InitStruct); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scu.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_scu.h deleted file mode 100644 index a07440153b..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scu.h +++ /dev/null @@ -1,314 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_scu.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ںģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBSCU_H -#define __LIBSCU_H - -#include "system_ES8P508x.h" -#include "ES8P508x.h" -#include "type.h" - -/* NMIжѡ */ -typedef enum -{ - SCU_PINT0_IRQn = 0, - SCU_PINT1_IRQn = 1, - SCU_PINT2_IRQn = 2, - SCU_PINT3_IRQn = 3, - SCU_PINT4_IRQn = 4, - SCU_PINT5_IRQn = 5, - SCU_PINT6_IRQn = 6, - SCU_PINT7_IRQn = 7, - SCU_T16N0_IRQn = 8, - SCU_T16N1_IRQn = 9, - SCU_T16N2_IRQn = 10, - SCU_T16N3_IRQn = 11, - SCU_T32N0_IRQn = 12, - SCU_IWDT_IRQn = 14, - SCU_WWDT_IRQn = 15, - SCU_CCM_IRQn = 16, - SCU_PLK_IRQn = 17, - SCU_LVD_IRQn = 18, - SCU_KINT_IRQn = 19, - SCU_RTC_IRQn = 20, - SCU_ADC_IRQn = 21, - SCU_AES_IRQn = 23, - SCU_UART0_IRQn = 24, - SCU_UART1_IRQn = 25, - SCU_UART2_IRQn = 26, - SCU_UART3_IRQn = 27, - SCU_UART4_IRQn = 28, - SCU_UART5_IRQn = 29, - SCU_SPI0_IRQn = 30, - SCU_I2C0_IRQn = 31, -}SCU_TYPE_NMICS; - -/* PWRCλ״̬Ĵ־λ */ -typedef enum -{ - SCU_PWRC_PORF= 0X00001, //PORλ־λ - SCU_PWRC_RRCF = 0X00002, //PORCλ־λ - SCU_PWRC_PORRSTF = 0x00004, //PORܸλ־ - SCU_PWRC_BORF = 0x00008, //BORܸλ־ - SCU_PWRC_WWDTRSTF = 0x00010, //WWDTλ־ - SCU_PWRC_IWDTRSTF = 0x00020, //IWDTλ־ - SCU_PWRC_MRSTF = 0x00040, //MRSTnλ־ - SCU_PWRC_SOFTRSTF = 0x00080, //λ־ -}SCU_TYPE_PWRC; - -/* LVDĴ־λ */ -typedef enum -{ - SCU_LVDFlag_IF = 0x0100, //LVDжϱ־ - SCU_LVDFlag_Out = 0x8000, //״̬λ -}SCU_TYPE_LVD0CON; - -/* ʱѡ */ -typedef enum -{ - SCU_SysClk_HRC = 0x0 , //ڲ20MHZ RCʱ - SCU_SysClk_XTAL = 0x1 , //ⲿʱ - SCU_SysClk_PLL = 0x2 , //PLL -}SCU_TYPE_SYSCLK; - -/*clk_selʱԴѡ*/ -typedef enum -{ - CLK_SEL_HRC = 0x0, //HRC 20M - CLK_SEL_LRC = 0x1, //LRC 32KHz - CLK_SEL_XTAL = 0x2, //ӾXTAL -}SCU_TYPE_CLK_SEL; - -/* PLLʱԴѡ */ -typedef enum -{ - SCU_PLL_HRC = 0x0 , //PLLʱԴHRC - SCU_PLL_LRC = 0x2 , //PLLʱԴLRC - SCU_PLL_XTAL_32K = 0x3 , //PLLʱԴXTAL - SCU_PLL_XTAL_4M = 0x4 , //PLLʱԴXTAL - SCU_PLL_XTAL_8M = 0x5, //PLLʱԴXTAL - SCU_PLL_XTAL_16M = 0x6, //PLLʱԴXTAL - SCU_PLL_XTAL_20M = 0x7, //PLLʱԴXTAL -} SCU_PLL_Origin; - -/* PLLʱƵ */ -typedef enum -{ - SCU_PLL_32M = 0x0 , //PLLʱΪ32MHz - SCU_PLL_48M = 0x1 , //PLLʱΪ48Mhz -} SCU_PLL_Out; - -/************SCUģ궨***********/ -/* SCUд */ -#define SCU_RegUnLock() (SCU->PROT.Word = 0x55AA6996) -#define SCU_RegLock() (SCU->PROT.Word = 0x00000000) - -/* NMIʹܿ */ -#define SCU_NMI_Enable() (SCU->NMICON.NMIEN = 0x1) -#define SCU_NMI_Disable() (SCU->NMICON.NMIEN = 0x0) - -/*-------LVDģ-------*/ - -/* LVDʹܿ */ -#define SCU_LVD_Enable() (SCU->LVDCON.EN = 0x1) -#define SCU_LVD_Disable() (SCU->LVDCON.EN = 0x0) - -/* LVD˲ʹܿ */ -#define SCU_LVDFLT_Enable() (SCU->LVDCON.FLTEN = 0x1) -#define SCU_LVDFLT_Disable() (SCU->LVDCON.FLTEN = 0x0) - -/* LVDѹѡ */ -#define SCU_LVDVS_2V0() (SCU->LVDCON.VS = 0x0) -#define SCU_LVDVS_2V1() (SCU->LVDCON.VS = 0x1) -#define SCU_LVDVS_2V2() (SCU->LVDCON.VS = 0x2) -#define SCU_LVDVS_2V4() (SCU->LVDCON.VS = 0x3) -#define SCU_LVDVS_2V6() (SCU->LVDCON.VS = 0x4) -#define SCU_LVDVS_2V8() (SCU->LVDCON.VS = 0x5) -#define SCU_LVDVS_3V0() (SCU->LVDCON.VS = 0x6) -#define SCU_LVDVS_3V6() (SCU->LVDCON.VS = 0x7) -#define SCU_LVDVS_4V() (SCU->LVDCON.VS = 0x8) -#define SCU_LVDVS_4V6() (SCU->LVDCON.VS = 0x9) -#define SCU_LVDVS_2V3() (SCU->LVDCON.VS = 0xA) -#define SCU_LVDVS_LVDIN() (SCU->LVDCON.VS = 0xE) - -/* LVDжʹܿ */ -#define SCU_LVDIT_Enable() (SCU->LVDCON.IE = 0x1) -#define SCU_LVDIT_Disable() (SCU->LVDCON.IE = 0x0) - -/* LVDжϱ־λ */ -#define SCU_LVDClearIFBit() (SCU->LVDCON.IF = 1) - -/* LVDжϲģʽѡ */ -#define SCU_LVDIFS_Rise() (SCU->LVDCON.IFS = 0x0) //LVDOزж -#define SCU_LVDIFS_Fall() (SCU->LVDCON.IFS = 0x1) //LVDO½زж -#define SCU_LVDIFS_High() (SCU->LVDCON.IFS = 0x2) //LVDOߵƽж -#define SCU_LVDIFS_Low() (SCU->LVDCON.IFS = 0x3) //LVDO͵ƽж -#define SCU_LVDIFS_Change() (SCU->LVDCON.IFS = 0x4) //LVDOƽ仯ж - -/* FLASHʵȴʱѡ */ -#define SCU_FlashWait_1Tclk() (SCU->FLASHWAIT.ACCT = 0x0) -#define SCU_FlashWait_2Tclk() (SCU->FLASHWAIT.ACCT = 0x1) -#define SCU_FlashWait_3Tclk() (SCU->FLASHWAIT.ACCT = 0x2) -#define SCU_FlashWait_4Tclk() (SCU->FLASHWAIT.ACCT = 0x3) -#define SCU_FlashWait_5Tclk() (SCU->FLASHWAIT.ACCT = 0x4) -#define SCU_FlashWait_6Tclk() (SCU->FLASHWAIT.ACCT = 0x5) -#define SCU_FlashWait_7Tclk() (SCU->FLASHWAIT.ACCT = 0x6) -#define SCU_FlashWait_8Tclk() (SCU->FLASHWAIT.ACCT = 0x7) -#define SCU_FlashWait_9Tclk() (SCU->FLASHWAIT.ACCT = 0x8) -#define SCU_FlashWait_10Tclk() (SCU->FLASHWAIT.ACCT = 0x9) -#define SCU_FlashWait_11Tclk() (SCU->FLASHWAIT.ACCT = 0xA) -#define SCU_FlashWait_12Tclk() (SCU->FLASHWAIT.ACCT = 0xB) -#define SCU_FlashWait_13Tclk() (SCU->FLASHWAIT.ACCT = 0xC) -#define SCU_FlashWait_14Tclk() (SCU->FLASHWAIT.ACCT = 0xD) -#define SCU_FlashWait_15Tclk() (SCU->FLASHWAIT.ACCT = 0xE) -#define SCU_FlashWait_16Tclk() (SCU->FLASHWAIT.ACCT = 0xF) - -/* ϵͳʱӺƵѡ */ -#define SCU_SysClk_Div1() (SCU->SCLKEN0.SYSCLK_DIV = 0) -#define SCU_SysClk_Div2() (SCU->SCLKEN0.SYSCLK_DIV = 1) -#define SCU_SysClk_Div4() (SCU->SCLKEN0.SYSCLK_DIV = 2) -#define SCU_SysClk_Div8() (SCU->SCLKEN0.SYSCLK_DIV = 3) -#define SCU_SysClk_Div16() (SCU->SCLKEN0.SYSCLK_DIV = 4) -#define SCU_SysClk_Div32() (SCU->SCLKEN0.SYSCLK_DIV = 5) -#define SCU_SysClk_Div64() (SCU->SCLKEN0.SYSCLK_DIV = 6) -#define SCU_SysClk_Div128() (SCU->SCLKEN0.SYSCLK_DIV = 7) - -/* HRCʹܿ (ڲ20Mhz) */ -#define SCU_HRC_Enable() (SCU->SCLKEN1.HRC_EN = 1) -#define SCU_HRC_Disable() (SCU->SCLKEN1.HRC_EN = 0) - -/* XTALʹܿ */ -#define SCU_XTAL_Enable() (SCU->SCLKEN1.XTAL_EN = 1) -#define SCU_XTAL_Disable() (SCU->SCLKEN1.XTAL_EN = 0) - -/* PLLģʽʹܿ */ -#define SCU_PLL_Enable() (SCU->SCLKEN1.PLL_EN = 1) -#define SCU_PLL_Disable() (SCU->SCLKEN1.PLL_EN = 0) - -/*-------ʱӿ-------*/ -/* SCUʱʹܿ */ -#define SCU_SCUCLK_Enable() (SCU->PCLKEN0.SCU_EN = 1) -#define SCU_SCUCLK_Disable() (SCU->PCLKEN0.SCU_EN = 0) - -/* GPIOʱʹܿ */ -#define SCU_GPIOCLK_Enable() (SCU->PCLKEN0.GPIO_EN = 1) -#define SCU_GPIOCLK_Disable() (SCU->PCLKEN0.GPIO_EN = 0) - -/* FLASH IAPʱʹܿ */ -#define SCU_IAPCLK_Enable() (SCU->PCLKEN0.IAP_EN = 1) -#define SCU_IAPCLK_Disable() (SCU->PCLKEN0.IAP_EN = 0) - -/* CRCʱʹܿ */ -#define SCU_CRCCLK_Enable() (SCU->PCLKEN0.CRC_EN = 1) -#define SCU_CRCCLK_Disable() (SCU->PCLKEN0.CRC_EN = 0) - -/* ADCʱʹܿ */ -#define SCU_ADCCLK_Enable() (SCU->PCLKEN0.ADC_EN = 1) -#define SCU_ADCCLK_Disable() (SCU->PCLKEN0.ADC_EN = 0) - -/* RTCʱʹܿ */ -#define SCU_RTCCLK_Enable() (SCU->PCLKEN0.RTC_EN = 1) -#define SCU_RTCCLK_Disable() (SCU->PCLKEN0.RTC_EN = 0) - -/* IWDTʱʹܿ */ -#define SCU_IWDTCLK_Enable() (SCU->PCLKEN0.IWDT_EN = 1) -#define SCU_IWDTCLK_Disable() (SCU->PCLKEN0.IWDT_EN = 0) - -/* WWDTʱʹܿ */ -#define SCU_WWDTCLK_Enable() (SCU->PCLKEN0.WWDT_EN = 1) -#define SCU_WWDTCLK_Disable() (SCU->PCLKEN0.WWDT_EN = 0) - -/* AESʱʹܿ */ -#define SCU_AESCLK_Enable() (SCU->PCLKEN0.AES_EN = 1) -#define SCU_AESCLK_Disable() (SCU->PCLKEN0.AES_EN = 0) - -/* T16N0ʱʹܿ */ -#define SCU_T16N0CLK_Enable() (SCU->PCLKEN1.T16N0_EN = 1) -#define SCU_T16N0CLK_Disable() (SCU->PCLKEN1.T16N0_EN = 0) - -/* T16N1ʱʹܿ */ -#define SCU_T16N1CLK_Enable() (SCU->PCLKEN1.T16N1_EN = 1) -#define SCU_T16N1CLK_Disable() (SCU->PCLKEN1.T16N1_EN = 0) - -/* T16N2ʱʹܿ */ -#define SCU_T16N2CLK_Enable() (SCU->PCLKEN1.T16N2_EN = 1) -#define SCU_T16N2CLK_Disable() (SCU->PCLKEN1.T16N2_EN = 0) - -/* T16N3ʱʹܿ */ -#define SCU_T16N3CLK_Enable() (SCU->PCLKEN1.T16N3_EN = 1) -#define SCU_T16N3CLK_Disable() (SCU->PCLKEN1.T16N3_EN = 0) - -/* T32N0ʱʹܿ */ -#define SCU_T32N0CLK_Enable() (SCU->PCLKEN1.T32N0_EN = 1) -#define SCU_T32N0CLK_Disable() (SCU->PCLKEN1.T32N0_EN = 0) - -/* UART0ʱʹܿ */ -#define SCU_UART0CLK_Enable() (SCU->PCLKEN1.UART0_EN = 1) -#define SCU_UART0CLK_Disable() (SCU->PCLKEN1.UART0_EN = 0) - -/* UART1ʱʹܿ */ -#define SCU_UART1CLK_Enable() (SCU->PCLKEN1.UART1_EN = 1) -#define SCU_UART1CLK_Disable() (SCU->PCLKEN1.UART1_EN = 0) - -/* UART2ʱʹܿ */ -#define SCU_UART2CLK_Enable() (SCU->PCLKEN1.UART2_EN = 1) -#define SCU_UART2CLK_Disable() (SCU->PCLKEN1.UART2_EN = 0) - -/* UART3ʱʹܿ */ -#define SCU_UART3CLK_Enable() (SCU->PCLKEN1.UART3_EN = 1) -#define SCU_UART3CLK_Disable() (SCU->PCLKEN1.UART3_EN = 0) - -/* UART4ʱʹܿ */ -#define SCU_UART4CLK_Enable() (SCU->PCLKEN1.UART4_EN = 1) -#define SCU_UART4CLK_Disable() (SCU->PCLKEN1.UART4_EN = 0) - -/* UART5ʱʹܿ */ -#define SCU_UART5CLK_Enable() (SCU->PCLKEN1.UART5_EN = 1) -#define SCU_UART5CLK_Disable() (SCU->PCLKEN1.UART5_EN = 0) - -/* SPI0ʱʹܿ */ -#define SCU_SPI0CLK_Enable() (SCU->PCLKEN1.SPI0_EN = 1) -#define SCU_SPI0CLK_Disable() (SCU->PCLKEN1.SPI0_EN = 0) - -/* IIC0ʱʹܿ */ -#define SCU_IIC0CLK_Enable() (SCU->PCLKEN1.I2C0_EN = 1) -#define SCU_IIC0CLK_Disable() (SCU->PCLKEN1.I2C0_EN = 0) - -/* жӳʹܿ */ -#define SCU_TBLRemap_Enable() (SCU->TBLREMAPEN.EN= 1) -#define SCU_TBLRemap_Disable() (SCU->TBLREMAPEN.EN= 0) - -/* жƫƼĴ xΪ2^24=16777216 */ -#define SCU_TBL_Offset(x) (SCU->TBLOFF.TBLOFF = (uint32_t)x) - -/************SCUģ麯***********/ -void SCU_OpenXTAL(void); -void SCU_NMISelect(SCU_TYPE_NMICS NMI_Type); -FlagStatus SCU_GetPWRCFlagStatus(SCU_TYPE_PWRC PWRC_Flag); -void SCU_ClearPWRCFlagBit(SCU_TYPE_PWRC PWRC_Flag); -FlagStatus SCU_GetLVDFlagStatus(SCU_TYPE_LVD0CON LVD_Flag); -void SCU_SysClkSelect(SCU_TYPE_SYSCLK Sysclk); -SCU_TYPE_SYSCLK SCU_GetSysClk(void); -FlagStatus SCU_HRCReadyFlag(void); -FlagStatus SCU_XTALReadyFlag(void); -FlagStatus SCU_PLLReadyFlag(void); -void SystemClockConfig(void); -void SystemClockConfig_1(void); -void DeviceClockAllEnable(void); -void DeviceClockAllDisable(void); -void SystemClockSelect(SCU_TYPE_SYSCLK SYSCLKx , SCU_TYPE_CLK_SEL CLK_SEL); -void PLLClock_Config(TYPE_FUNCEN pll_en , SCU_PLL_Origin pll_origin ,SCU_PLL_Out pll_out,TYPE_FUNCEN sys_pll); -#endif -/*************************END OF FILE**********************/ - - - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_spi.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_spi.h deleted file mode 100644 index 8089ae8b66..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_spi.h +++ /dev/null @@ -1,141 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_spi.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * SPIģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBSPI_H__ -#define __LIBSPI_H__ - -#include "system_ES8P508x.h" -#include "ES8P508x.h" -#include "type.h" - -/* ͨݸʽ */ -typedef enum -{ - SPI_RiseSendFallRec = 0x0 , //ͨݸʽطͣȣ½ؽգ - SPI_FallSendRiseRec = 0x1 , //ͨݸʽ½طͣȣؽգ - SPI_RiseRecFallSend = 0x2 , //ͨݸʽؽգȣ½طͣ - SPI_FallRecRiseSend = 0x3 , //ͨݸʽ½ؽգȣطͣ -}SPI_TYPE_DFS; - -/* ͨѶģʽ */ -typedef enum -{ - SPI_Mode_Master = 0x0 , //ͨѶģʽ - SPI_Mode_Slave = 0x1 , //ͨѶģʽӶ -}SPI_TYPE_MODE; - -/* ADCʼýṹ嶨 */ -typedef struct -{ - uint32_t SPI_Freq; //SPIƵ - - SPI_TYPE_DFS SPI_Df; //ͨѶݸʽ - - SPI_TYPE_MODE SPI_Mode; //ͨѶģʽ - - uint8_t SPI_DW; //֡λ - - TYPE_FUNCEN SPI_DelayRec; //ʱʹ - - TYPE_FUNCEN SPI_DelaySend; //ͼʹ - - uint8_t SPI_SendDelayPeroid;//ͼ - -}SPI_InitStruType; - -/* ־λ */ -typedef enum -{ - SPI_Flag_TB = 0x00000001, - SPI_Flag_RB = 0x00000002, - SPI_Flag_TE = 0x00000004, - SPI_Flag_RO = 0x00000008, - SPI_Flag_ID = 0x00000010, - SPI_Flag_NSSIF = 0x00000020, - SPI_Flag_TBWE = 0x00000040, - SPI_Flag_NSS = 0x00000080, - SPI_Flag_TBEF0 = 0x00000100, - SPI_Flag_TBEF1 = 0x00000200, - SPI_Flag_TBEF2 = 0x00000400, - SPI_Flag_TBEF3 = 0x00000800, - SPI_Flag_RBFF0 = 0x00001000, - SPI_Flag_RBFF1 = 0x00002000, - SPI_Flag_RBFF2 = 0x00004000, - SPI_Flag_RBFF3 = 0x00008000, - SPI_Flag_IDLE = 0x00010000, - SPI_Flag_TMS = 0x00020000, -}SPI_TYPE_FLAG; - -/* жģʽѡ */ -typedef enum -{ - SPI_IType_BYTE = 0x0 , - SPI_IType_HALFWORD = 0x1 , - SPI_IType_WORD = 0x2 , -}SPI_TYPE_TRBIM; - -/* SPIж */ -typedef enum -{ - SPI_IT_TB = 0x01 , - SPI_IT_RB = 0x02 , - SPI_IT_TE = 0x04 , - SPI_IT_RO = 0x08 , - SPI_IT_ID = 0x10 , - SPI_IT_NSS = 0x20 , - SPI_IT_TBWE = 0x40 , -}SPI_TYPE_IT; - -/* SPIжϱ־ */ -typedef enum -{ - SPI_Clr_TE = 0x04 , - SPI_Clr_RO = 0x08 , - SPI_Clr_ID = 0x10 , - SPI_Clr_NSS = 0x20 , - SPI_Clr_TBWE = 0x40 , -}SPI_CLR_IF; - -/************SPIģ궨***********/ - -/* SPIʹܿ */ -#define SPI_Enable() (SPI0->CON.EN = 1) -#define SPI_Disable() (SPI0->CON.EN = 0) - -/* SPIʹܿ */ -#define SPI_RecEnable() (SPI0->CON.REN = 1) -#define SPI_RecDisable() (SPI0->CON.REN = 0) - -/* SPIλ */ -#define SPI_Rst() (SPI0->CON.RST = 1) - -/* SPI */ -#define SPI_RX_CLR() (SPI0->CON.RXCLR = 1) -#define SPI_TX_CLR() (SPI0->CON.TXCLR = 1) - -/************SPIģ麯***********/ -void SPI_Init(SPI_InitStruType* SPI_InitStruct); -void SPI_ITConfig(SPI_TYPE_IT SPI_IE,TYPE_FUNCEN NewState); -void SPI_DataFormatConfig(SPI_TYPE_DFS Type); -void SPI_SendByte(uint8_t Temp); -void SPI_SendHalfWord(uint16_t Temp); -void SPI_SendWord(uint32_t Temp); -uint8_t SPI_RecByte(void); -uint16_t SPI_RecHalfWord(void); -uint32_t SPI_RecWord(void); -void SPI_TBIMConfig(SPI_TYPE_TRBIM Type); -void SPI_RBIMConfig(SPI_TYPE_TRBIM Type); -FlagStatus SPI_GetFlagStatus(SPI_TYPE_FLAG Flag); -ITStatus SPI_GetITStatus(SPI_TYPE_IT Flag); -void SPI_ClearITPendingBit(SPI_CLR_IF Flag); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_timer.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_timer.h deleted file mode 100644 index d5493c8e3a..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_timer.h +++ /dev/null @@ -1,310 +0,0 @@ -/****************************************************************************************** - * Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - * ļ: lib_timer.h - * : Liut - * : V1.00 - * : 2017/07/14 - * : 16λʱ/32λʱ/⺯ͷļ - * ע: ES8P508xϵоƬ - * ѧϰʾʹãûֱôķջеκηΡ - *******************************************************************************************/ -#ifndef __LIBTIMER_H__ -#define __LIBTIMER_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* ʱԴѡ */ -typedef enum -{ - TIM_ClkS_PCLK = 0x0 , //ʱԴѡ:ڲPCLK - TIM_ClkS_CK0 = 0x1 , //ʱԴѡ:ⲿCK0ʱ - TIM_ClkS_CK1 = 0x2 , //ʱԴѡ:ⲿCK1ʱ -}TIM_TYPE_CLKS; - -/* ⲿʱӼѡ */ -typedef enum -{ - TIM_EDGE_Rise = 0x0 , //ⲿʱӼѡ: - TIM_EDGE_Fall = 0x1 , //ⲿʱӼѡ:½ - TIM_EDGE_All = 0x2 , //ⲿʱӼѡ: -}TIM_TYPE_EDGE; - - -/* ģʽѡ */ -typedef enum -{ - TIM_Mode_TC0 = 0x0 , //ģʽ:ʱģʽ - TIM_Mode_TC1 = 0x1 , //ģʽ:ʱģʽ - TIM_Mode_CAP = 0x2 , //ģʽ:׽ģʽ - TIM_Mode_PWM = 0x3 , //ģʽ:ģʽ -}TIM_TYPE_MODE; - -/* TIMʼýṹ嶨 */ -typedef struct -{ - TIM_TYPE_CLKS TIM_ClkS; //ʱԴѡ - TYPE_FUNCEN TIM_SYNC; //ⲿʱͬ - TIM_TYPE_EDGE TIM_EDGE; //ⲿʱӼѡ - TIM_TYPE_MODE TIM_Mode; //ģʽѡ -}TIM_BaseInitStruType; - -/* ƥĴֵƥĹģʽ */ -typedef enum -{ - TIM_Go_No = 0x0 , //ƥĴֵƥĹģʽ:ж - TIM_Hold_Int = 0x1 , //ƥĴֵƥĹģʽ:ּж - TIM_Clr_Int = 0x2 , //ƥĴֵƥĹģʽ:㲢¼ж - TIM_Go_Int = 0x3 , //ƥĴֵƥĹģʽ:ж -}TIM_TYPE_MATCON; - -/* ƥĴֵƥ˿ڵĹģʽ */ -typedef enum -{ - TIM_Out_Hold = 0x0 , //ƥĴֵƥ˿ڵĹģʽ - TIM_Out_Low = 0x1 , //ƥĴֵƥ˿ڵĹģʽ0 - TIM_Out_High = 0x2 , //ƥĴֵƥ˿ڵĹģʽ1 - TIM_Out_Switch = 0x3 , //ƥĴֵƥ˿ڵĹģʽȡ -}TIM_TYPE_MATOUT; - -/* ׽ */ -typedef enum -{ - TIM_CapTime_1 = 0x0 , //׽:1 - TIM_CapTime_2 = 0x1 , //׽:2 - TIM_CapTime_3 = 0x2 , //׽:3 - TIM_CapTime_4 = 0x3 , //׽:4 - TIM_CapTime_5 = 0x4 , //׽:5 - TIM_CapTime_6 = 0x5 , //׽:6 - TIM_CapTime_7 = 0x6 , //׽:7 - TIM_CapTime_8 = 0x7 , //׽:8 - TIM_CapTime_9 = 0x8 , //׽:9 - TIM_CapTime_10 = 0x9 , //׽:10 - TIM_CapTime_11 = 0xA , //׽:11 - TIM_CapTime_12 = 0xB , //׽:12 - TIM_CapTime_13 = 0xC , //׽:13 - TIM_CapTime_14 = 0xD , //׽:14 - TIM_CapTime_15 = 0xE , //׽:15 - TIM_CapTime_16 = 0xF , //׽:16 -}TIM_TYPE_CAPT; - -/* PWM */ -typedef enum -{ - POSITIVE = 0X00, // - NEGATIVE = 0X01, // -}T16Nx_PWMOUT_POLAR_Type; - -/* ƹܳʼṹ嶨 */ -typedef struct -{ - TYPE_FUNCEN T16Nx_MOE0; //˿0ʹ - TYPE_FUNCEN T16Nx_MOE1; //˿1ʹ - T16Nx_PWMOUT_POLAR_Type T16Nx_POL0; //T16NxOUT0ѡλ - T16Nx_PWMOUT_POLAR_Type T16Nx_POL1; //T16NxOUT1ѡλ -}T16Nx_PWMInitStruType; - -/* ׽ܳʼṹ嶨 */ -typedef struct -{ - TYPE_FUNCEN TIM_CapRise; //ز׽ʹ - TYPE_FUNCEN TIM_CapFall; //½ز׽ʹ - TYPE_FUNCEN TIM_CapIS0; //˿0ʹ - TYPE_FUNCEN TIM_CapIS1; //˿1ʹ - TIM_TYPE_CAPT TIM_CapTime; //׽ -}TIM_CapInitStruType; - -/* PWMɲƽ */ -typedef enum -{ - PWMBKOUT_Low = 0, - PWMBKOUT_High = 1, -}T16Nx_PWMBKOUT_LEVEl; - -/* PWMɲźżѡ */ -typedef enum -{ - PWMBKP_High = 0, - PWMBKP_Low = 1, -}T16Nx_PWMBKP_LEVEl; - -/*PWMɲźԴѡ*/ -typedef enum -{ - PWMBKPS_PINT0 = 0, - PWMBKPS_PINT1 = 1, - PWMBKPS_PINT2 = 2, - PWMBKPS_PINT3 = 3, - PWMBKPS_PINT4 = 4, - PWMBKPS_PINT5 = 5, - PWMBKPS_PINT6 = 6, - PWMBKPS_PINT7 = 7, -}T16Nx_PWMBKP_S; - -/*PWMɲ*/ -typedef struct -{ - - T16Nx_PWMBKOUT_LEVEl T16Nx_PWMBKL0; //PWMͨ0ɲƽѡ - T16Nx_PWMBKOUT_LEVEl T16Nx_PWMBKL1; //PWMͨ1ɲƽѡ - T16Nx_PWMBKP_S T16Nx_PWMBKS; //PWMͨźԴѡ - T16Nx_PWMBKP_LEVEl T16Nx_PWMBKPS; //PWMͨɲźżѡ - TYPE_FUNCEN T16Nx_PWMBKEN; //PWMɲʹ -}T16Nx_PWMBK_Type; - -/* ж */ -typedef enum -{ - TIM_IT_MAT0 = 0x01 , - TIM_IT_MAT1 = 0x02 , - TIM_IT_MAT2 = 0x04 , - TIM_IT_MAT3 = 0x08 , - TIM_IT_N = 0x10 , - TIM_IT_CAP0 = 0x20 , - TIM_IT_CAP1 = 0x40 , - TIM_IT_PBK = 0x80 , -}TIM_TYPE_IT; - -typedef enum -{ - TIM_IF_MAT0 = 0x01 , - TIM_IF_MAT1 = 0x02 , - TIM_IF_MAT2 = 0x04 , - TIM_IF_MAT3 = 0x08 , - TIM_IF_N = 0x10 , - TIM_IF_CAP0 = 0x20 , - TIM_IF_CAP1 = 0x40 , - TIM_IF_PBK = 0x80 , -}TIM_TYPE_IF; - -/* ƥĴ */ -typedef enum -{ - TIM_MAT0 = 0x00 , - TIM_MAT1 = 0x01 , - TIM_MAT2 = 0x02 , - TIM_MAT3 = 0x03 , -}TIM_TYPE_MATX; - -/*T16N ADCʹܿ*/ -typedef enum -{ - T16Nx_MAT0 = 0x02, //PWMͨ0ƥ0ʹ - T16Nx_MAT1 = 0x04, //PWMͨ0ƥ1ʹ - T16Nx_MAT2 = 0x20, //PWMͨ1ƥ2ʹ - T16Nx_MAT3 = 0x40, //PWMͨ1ƥ3ʹ -}T16Nx_PWMTRG_type; - -/*************TIMģ궨************/ - -/* TIMģʹܿ */ -#define T16N0_Enable() (T16N0->CON0.EN = 1) -#define T16N1_Enable() (T16N1->CON0.EN = 1) -#define T16N2_Enable() (T16N2->CON0.EN = 1) -#define T16N3_Enable() (T16N3->CON0.EN = 1) -#define T32N0_Enable() (T32N0->CON0.EN = 1) -#define T16N0_Disable() (T16N0->CON0.EN = 0) -#define T16N1_Disable() (T16N1->CON0.EN = 0) -#define T16N2_Disable() (T16N2->CON0.EN = 0) -#define T16N3_Disable() (T16N3->CON0.EN = 0) -#define T32N0_Disable() (T32N0->CON0.EN = 0) - -/* 첽дʹܿ */ -#define T16N0_ASYNCWR_Enable() (T16N0->CON0.ASYWEN = 1) -#define T16N1_ASYNCWR_Enable() (T16N1->CON0.ASYWEN = 1) -#define T16N2_ASYNCWR_Enable() (T16N2->CON0.ASYWEN = 1) -#define T16N3_ASYNCWR_Enable() (T16N3->CON0.ASYWEN = 1) -#define T32N0_ASYNCWR_Enable() (T32N0->CON0.ASYNCWREN = 1) -#define T16N0_ASYNCWR_Disable() (T16N0->CON0.ASYWEN= 0) -#define T16N1_ASYNCWR_Disable() (T16N1->CON0.ASYWEN = 0) -#define T16N2_ASYNCWR_Disable() (T16N2->CON0.ASYWEN = 0) -#define T16N3_ASYNCWR_Disable() (T16N3->CON0.ASYWEN = 0) -#define T32N0_ASYNCWR_Disable() (T32N0->CON0.ASYNCWREN = 0) - -/* PWMʹܿ */ -#define T16N0_PwmOut0_Enable() (T16N0->CON2.MOE0 = 1) -#define T16N1_PwmOut0_Enable() (T16N1->CON2.MOE0 = 1) -#define T16N2_PwmOut0_Enable() (T16N2->CON2.MOE0 = 1) -#define T16N3_PwmOut0_Enable() (T16N3->CON2.MOE0 = 1) -#define T32N0_PwmOut0_Enable() (T32N0->CON2.MOE0 = 1) -#define T16N0_PwmOut1_Enable() (T16N0->CON2.MOE1 = 1) -#define T16N1_PwmOut1_Enable() (T16N1->CON2.MOE1 = 1) -#define T16N2_PwmOut1_Enable() (T16N2->CON2.MOE1 = 1) -#define T16N3_PwmOut1_Enable() (T16N3->CON2.MOE1 = 1) -#define T32N0_PwmOut1_Enable() (T32N0->CON2.MOE1 = 1) -#define T16N0_PwmOut0_Disable() (T16N0->CON2.MOE0 = 0) -#define T16N1_PwmOut0_Disable() (T16N1->CON2.MOE0 = 0) -#define T16N2_PwmOut0_Disable() (T16N2->CON2.MOE0 = 0) -#define T16N3_PwmOut0_Disable() (T16N3->CON2.MOE0 = 0) -#define T32N0_PwmOut0_Disable() (T32N0->CON2.MOE0 = 0) -#define T16N0_PwmOut1_Disable() (T16N0->CON2.MOE1 = 0) -#define T16N1_PwmOut1_Disable() (T16N1->CON2.MOE1 = 0) -#define T16N2_PwmOut1_Disable() (T16N2->CON2.MOE1 = 0) -#define T16N3_PwmOut1_Disable() (T16N3->CON2.MOE1 = 0) -#define T32N0_PwmOut1_Disable() (T32N0->CON2.MOE1 = 0) - -/************T16ģ麯***********/ -void T16Nx_BaseInit(T16N_TypeDef* T16Nx,TIM_BaseInitStruType* TIM_BaseInitStruct); -void T16Nx_CapInit(T16N_TypeDef* T16Nx,TIM_CapInitStruType* TIM_CapInitStruct); -void T16Nx_MAT0ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT1ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT2ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT3ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT0Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_MAT1Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_MAT2Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_MAT3Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState); -void T16Nx_PWMOutConfig(T16N_TypeDef* T16Nx,T16Nx_PWMInitStruType* T16Nx_PWMInitStruct); -void T16Nx_PWMBK_Config(T16N_TypeDef* T16Nx,T16Nx_PWMBK_Type* type); -void T16Nx_TRG_Config(T16N_TypeDef* T16Nx,T16Nx_PWMTRG_type Type,TYPE_FUNCEN NewState); -FlagStatus T16Nx_GetPWMBKF(T16N_TypeDef* T16Nx); -void T16Nx_ResetPWMBKF(T16N_TypeDef* T16Nx); -void T16Nx_SetCNT(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetPRECNT(T16N_TypeDef* T16Nx,uint8_t Value); -void T16Nx_SetPREMAT(T16N_TypeDef* T16Nx,uint8_t Value); -void T16Nx_SetMAT0(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetMAT1(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetMAT2(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetMAT3(T16N_TypeDef* T16Nx,uint16_t Value); -uint16_t T16Nx_GetMAT0(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetMAT1(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetMAT2(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetMAT3(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetCNT(T16N_TypeDef* T16Nx); -uint8_t T16Nx_GetPRECNT(T16N_TypeDef* T16Nx); -FlagStatus T16Nx_GetFlagStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag); -ITStatus T16Nx_GetITStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IT TIM_Flag); -void T16Nx_ClearIFPendingBit(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag); -/************************************T32ģ麯********************************************************/ -void T32Nx_BaseInit(T32N_TypeDef* T32Nx,TIM_BaseInitStruType* TIM_BaseInitStruct); -void T32Nx_CapInit(T32N_TypeDef* T32Nx,TIM_CapInitStruType* TIM_CapInitStruct); -void T32Nx_MAT0ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT1ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT2ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT3ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT0Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_MAT1Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_MAT2Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_MAT3Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState); -void T32Nx_SetCNT(T32N_TypeDef* T16Nx,uint32_t Value); -void T32Nx_SetPRECNT(T32N_TypeDef* T32Nx,uint8_t Value); -void T32Nx_SetPREMAT(T32N_TypeDef* T32Nx,uint8_t Value); -void T32Nx_SetMAT0(T32N_TypeDef* T32Nx,uint32_t Value); -void T32Nx_SetMAT1(T32N_TypeDef* T32Nx,uint32_t Value); -void T32Nx_SetMAT2(T32N_TypeDef* T32Nx,uint32_t Value); -void T32Nx_SetMAT3(T32N_TypeDef* T32Nx,uint32_t Value); -uint32_t T32Nx_GetMAT0(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetMAT1(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetMAT2(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetMAT3(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetCNT(T32N_TypeDef* T32Nx); -uint8_t T32Nx_GetPRECNT(T32N_TypeDef* T32Nx); -FlagStatus T32Nx_GetFlagStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag); -ITStatus T32Nx_GetITStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IT TIM_Flag); -void T32Nx_ClearIFPendingBit(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_uart.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_uart.h deleted file mode 100644 index 7b0d0fe1df..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_uart.h +++ /dev/null @@ -1,171 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_uart.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * UARTģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBUART_H__ -#define __LIBUART_H__ - -#include "ES8P508x.h" -#include "type.h" -#include "system_ES8P508x.h" - -/* ֹ֡ͣλѡ */ -typedef enum -{ - UART_StopBits_1 = 0x0 , //ֹ֡ͣλ1λ - UART_StopBits_2 = 0x1 , //ֹ֡ͣλ2λ -}UART_TYPE_TXFS; - -/* ݸʽ */ -typedef enum -{ - UART_DataMode_7 = 0x0 , //ݸʽ:7λ - UART_DataMode_8 = 0x1 , //ݸʽ:8λ - UART_DataMode_9 = 0x2 , //ݸʽ:9λ - UART_DataMode_7Odd = 0x4 , //ݸʽ:7λ+У - UART_DataMode_7Even = 0x5 , //ݸʽ:7λ+żУ - UART_DataMode_8Odd = 0x6 , //ݸʽ:8λ+У - UART_DataMode_8Even = 0x7 , //ݸʽ:8λ+żУ -}UART_TYPE_DATAMOD; - -/* ˿ڼ */ -typedef enum -{ - UART_Polar_Normal = 0x0 , //Ͷ˿ڼ: - UART_Polar_Opposite = 0x1 , //Ͷ˿ڼ: -}UART_TYPE_RTXP; - -/* ʷʱѡ */ -typedef enum -{ - UART_Clock_1 = 0x1 , //ʷʱ:PCLK - UART_Clock_2 = 0x2 , //ʷʱ:PCLK/2 - UART_Clock_4 = 0x3 , //ʷʱ:PCLK/4 - UART_Clock_8 = 0x4 , //ʷʱ:PCLK/8 - -}UART_TYPE_BCS; - -/* UARTʼýṹ嶨 */ -typedef struct -{ - UART_TYPE_TXFS UART_StopBits; //ֹ֡ͣλѡ - UART_TYPE_DATAMOD UART_TxMode; //֡ʽ - UART_TYPE_RTXP UART_TxPolar; //Ͷ˿ڼ - UART_TYPE_DATAMOD UART_RxMode; //֡ʽ - UART_TYPE_RTXP UART_RxPolar; //ն˿ڼ - uint32_t UART_BaudRate; //䲨 - UART_TYPE_BCS UART_ClockSet; //ʷʱѡ -}UART_InitStruType; - -/* жѡ */ -typedef enum -{ - UART_IT_TB = 0x0001 , - UART_IT_RB = 0x0002 , - UART_IT_RO = 0x0004 , - UART_IT_FE = 0x0008 , - UART_IT_PE = 0x0010 , - UART_IT_TBWE = 0x0020 , - UART_IT_TXIDLE = 0x1000 , - UART_IT_RXIDLE = 0x2000 , -}UART_TYPE_IT; - -/* ־λ */ -typedef enum -{ - UART_FLAG_TB = 0x0001 , - UART_FLAG_RB = 0x0002 , - UART_FLAG_RO = 0x0004 , - UART_FLAG_FE = 0x0008 , - UART_FLAG_PE = 0x0010 , - UART_FLAG_TBWE = 0x0020 , - UART_FLAG_TXIDLE = 0x1000 , - UART_FLAG_RXIDLE = 0x2000 , -}UART_TYPE_FLAG; - -/* жϱ־λ */ -typedef enum -{ - UART_Clr_RO = 0x0004 , - UART_Clr_FE = 0x0008 , - UART_Clr_PE = 0x0010 , - UART_Clr_TBWE = 0x0020 , -}UART_CLR_IF; - -/* ͡жģʽ */ -typedef enum -{ - UART_TRBIM_Byte = 0x0 , //ж:ֽ - UART_TRBIM_HalfWord = 0x1 , //ж: - UART_TRBIM_Word = 0x2 , //ж: -}UART_TYPE_TRBIM; - -/*************UARTģ궨************/ -/* ʹܿ */ -#define UART0_TxEnable() (UART0->CON.TXEN = 1) -#define UART1_TxEnable() (UART1->CON.TXEN = 1) -#define UART2_TxEnable() (UART2->CON.TXEN = 1) -#define UART3_TxEnable() (UART3->CON.TXEN = 1) -#define UART4_TxEnable() (UART4->CON.TXEN = 1) -#define UART5_TxEnable() (UART5->CON.TXEN = 1) -#define UART0_TxDisable() (UART0->CON.TXEN = 0) -#define UART1_TxDisable() (UART1->CON.TXEN = 0) -#define UART2_TxDisable() (UART2->CON.TXEN = 0) -#define UART3_TxDisable() (UART3->CON.TXEN = 0) -#define UART4_TxDisable() (UART4->CON.TXEN = 0) -#define UART5_TxDisable() (UART5->CON.TXEN = 0) - -/* ʹܿ */ -#define UART0_RxEnable() (UART0->CON.RXEN = 1) -#define UART1_RxEnable() (UART1->CON.RXEN = 1) -#define UART2_RxEnable() (UART2->CON.RXEN = 1) -#define UART3_RxEnable() (UART3->CON.RXEN = 1) -#define UART4_RxEnable() (UART4->CON.RXEN = 1) -#define UART5_RxEnable() (UART5->CON.RXEN = 1) -#define UART0_RxDisable() (UART0->CON.RXEN = 0) -#define UART1_RxDisable() (UART1->CON.RXEN = 0) -#define UART2_RxDisable() (UART2->CON.RXEN = 0) -#define UART3_RxDisable() (UART3->CON.RXEN = 0) -#define UART4_RxDisable() (UART4->CON.RXEN = 0) -#define UART5_RxDisable() (UART5->CON.RXEN = 0) - -/* λ */ -#define UART0_TxRst() (UART0->CON.TRST = 1) -#define UART1_TxRst() (UART1->CON.TRST = 1) -#define UART2_TxRst() (UART2->CON.TRST = 1) -#define UART3_TxRst() (UART3->CON.TRST = 1) -#define UART4_TxRst() (UART4->CON.TRST = 1) -#define UART5_TxRst() (UART5->CON.TRST = 1) - -/* λ */ -#define UART0_RxRst() (UART0->CON.RRST = 1) -#define UART1_RxRst() (UART1->CON.RRST = 1) -#define UART2_RxRst() (UART2->CON.RRST = 1) -#define UART3_RxRst() (UART3->CON.RRST = 1) -#define UART4_RxRst() (UART4->CON.RRST = 1) -#define UART5_RxRst() (UART5->CON.RRST = 1) - -/************UARTģ麯***********/ -void UART_Init(UART_TypeDef* UARTx,UART_InitStruType* UART_InitStruct); -void UART_ITConfig(UART_TypeDef* UARTx,UART_TYPE_IT UART_IT,TYPE_FUNCEN NewState); -void UART_TBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type); -void UART_RBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type); -void UART_SendByte(UART_TypeDef* UARTx,uint8_t Temp08); -void UART_SendHalfWord(UART_TypeDef* UARTx,uint16_t Temp16); -void UART_SendWord(UART_TypeDef* UARTx,uint32_t Temp32); -uint8_t UART_RecByte(UART_TypeDef* UARTx); -uint16_t UART_RecHalfWord(UART_TypeDef* UARTx); -uint32_t UART_RecWord(UART_TypeDef* UARTx); -FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx,UART_TYPE_FLAG UART_Flag); -ITStatus UART_GetITStatus(UART_TypeDef* UARTx,UART_TYPE_IT UART_Flag); -void UART_ClearITPendingBit(UART_TypeDef* UARTx,UART_CLR_IF UART_Flag); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_wdt.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_wdt.h deleted file mode 100644 index 45ad9d4287..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_wdt.h +++ /dev/null @@ -1,100 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_wdt.c - * ߣ Liut - * V1.00 - * ڣ 2017/02/04 - * Źģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBWDT_H__ -#define __LIBWDT_H__ - -#include "system_ES8P508x.h" -#include "ES8P508x.h" -#include "type.h" - -/* WDTʱѡ */ -typedef enum -{ - WDT_CLOCK_PCLK = 0x0, //PCLK - WDT_CLOCK_WDT = 0x1, //WDTʱԴ32kHz -} WDT_TYPE_CLKS; - -/* ʼṹ */ -typedef struct -{ - uint32_t WDT_Tms; //ʱʱ䣬λms - TYPE_FUNCEN WDT_IE; //жʹ - TYPE_FUNCEN WDT_Rst; //λʹ - WDT_TYPE_CLKS WDT_Clock;//ʱѡ -} IWDT_InitStruType; - -typedef enum -{ - WDT_WIN_25 = 0x0, //25%ڽֹιιλ - WDT_WIN_50 = 0x1, //50%ڽֹιιλ - WDT_WIN_75 = 0x2, //75%ڽֹιιλ - WDT_WIN_100 = 0x3, //ֹιιʹŹ -} WDT_TYPE_WIN; - -/* ʼṹ */ -typedef struct -{ - uint32_t WDT_Tms; //ʱʱ䣬λms - TYPE_FUNCEN WDT_IE; //жʹ - TYPE_FUNCEN WDT_Rst; //λʹ - WDT_TYPE_CLKS WDT_Clock;//ʱѡ - WDT_TYPE_WIN WDT_Win; //ֹι -} WWDT_InitStruType; - -#define IWDT_RegUnLock() (IWDT->LOCK.Word = 0x1ACCE551) -#define IWDT_RegLock() (IWDT->LOCK.Word = 0x0) - -#define IWDT_Enable() {IWDT_RegUnLock();IWDT->CON.EN = 1;IWDT_RegLock();} -#define IWDT_Disable() {IWDT_RegUnLock();IWDT->CON.EN = 0;IWDT_RegLock();} - -#define IWDT_Clear() {IWDT_RegUnLock();IWDT->INTCLR.INTCLR = 0;IWDT_RegLock();} - -#define IWDT_ITEnable() {IWDT_RegUnLock();IWDT->CON.IE = 1;IWDT_RegLock();} -#define IWDT_ITDisable() {IWDT_RegUnLock();IWDT->CON.IE = 0;IWDT_RegLock();} - -#define IWDT_RstEnable() {IWDT_RegUnLock();IWDT->CON.RSTEN = 1;IWDT_RegLock();} -#define IWDT_RstDisable() {IWDT_RegUnLock();IWDT->CON.RSTEN = 0;IWDT_RegLock();} - -#define IWDT_CLOCK_PCLK() {IWDT_RegUnLock();IWDT->CON.CLKS = 0;IWDT_RegLock();} -#define IWDT_CLOCK_WDT() {IWDT_RegUnLock();IWDT->CON.CLKS = 1;IWDT_RegLock();} - -#define WWDT_RegUnLock() (WWDT->LOCK.Word = 0x1ACCE551) -#define WWDT_RegLock() (WWDT->LOCK.Word = 0x0) - -#define WWDT_Enable() {WWDT_RegUnLock();WWDT->CON.EN = 1;WWDT_RegLock();} -#define WWDT_Disable() {WWDT_RegUnLock();WWDT->CON.EN = 0;WWDT_RegLock();} - -#define WWDT_Clear() {WWDT_RegUnLock();WWDT->INTCLR.INTCLR = 0;WWDT_RegLock();} - -#define WWDT_ITEnable() {WWDT_RegUnLock();WWDT->CON.IE = 1;WWDT_RegLock();} -#define WWDT_ITDisable() {WWDT_RegUnLock();WWDT->CON.IE = 0;WWDT_RegLock();} - -#define WWDT_RstEnable() {WWDT_RegUnLock();WWDT->CON.RSTEN = 1;WWDT_RegLock();} -#define WWDT_RstDisable() {WWDT_RegUnLock();WWDT->CON.RSTEN = 0;WWDT_RegLock();} - -#define WWDT_CLOCK_PCLK() {WWDT_RegUnLock();WWDT->CON.CLKS = 0;WWDT_RegLock();} -#define WWDT_CLOCK_WDT() {WWDT_RegUnLock();WWDT->CON.CLKS = 1;WWDT_RegLock();} - -void IWDT_Init(IWDT_InitStruType *IWDT_InitStruct); -void IWDT_SetReloadValue(uint32_t Value); -uint32_t IWDT_GetValue(void); -FlagStatus IWDT_GetFlagStatus(void); -FlagStatus IWDT_GetITStatus(void); -void WWDT_Init(WWDT_InitStruType *WDT_InitStruct); -void WWDT_SetReloadValue(uint32_t Value); -uint32_t WWDT_GetValue(void); -FlagStatus WWDT_GetFlagStatus(void); -FlagStatus WWDT_GetITStatus(void); - -#endif - -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/type.h b/bsp/essemi/es8p508x/libraries/Library/Include/type.h deleted file mode 100644 index a23d72e8bd..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/type.h +++ /dev/null @@ -1,19 +0,0 @@ -/********************************************************* - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ: type.h - * : Liut - * : V1.01 - * : 2017/11/01 - * : type define - * ע: HRSDK-GDB-8P508x - ѧϰʾʹãûֱôķջеκηΡ - **********************************************************/ -#ifndef __TYPE_H__ -#define __TYPE_H__ - -typedef enum {DISABLE = 0, ENABLE = !DISABLE} TYPE_FUNCEN,FuncState,TYPE_PINTIE,TYPE_PINTMASK,TYPE_BUZZEN; -typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus, PinStatus; -typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus; - - -#endif diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/irqhandler.c b/bsp/essemi/es8p508x/libraries/Library/Source/irqhandler.c deleted file mode 100644 index bd0d9b0f14..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/irqhandler.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "irqhandler.h" - -void NMI_IRQHandler(void) -{ - -} - -void HardFault_IRQHandler(void) -{ - while(1) - { - } -} - -void SVC_IRQHandler(void) -{ - -} - -void PendSV_IRQHandler(void) -{ - -} -void SysTick_Handler(void) -{ - systick_irq_cbk(); -} diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_adc.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_adc.c deleted file mode 100644 index 23aea8a229..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_adc.c +++ /dev/null @@ -1,301 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_timer.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ADCģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_adc.h" - -/*************************************************************** - ADC_Init - ʼADCģ - ֵʼýṹַ - ֵ - ֵ - ***************************************************************/ -void ADC_Init(ADC_InitStruType * ADC_InitStruct) -{ - ADC->VREFCON.VREF_EN = ENABLE; //ڲVREFPʹ - ADC->VREFCON.IREF_EN = ENABLE; //IREFʹλ - ADC->CON1.VCMBUF_EN = ENABLE; //ADCģѹVCM BUFʹ - ADC ->CON1.VCMBUF_HS = ENABLE; //ADCģѹVCM BUFģʽʹ - ADC->CON1.HSEN = ENABLE; //ADCתٶȣ - ADC->CHS.VDD5_FLAG_EN = DISABLE; //VDD - - ADC->CON1.CLKS = ADC_InitStruct->ADC_ClkS; //ADCCON1:bit3 ADCʱԴѡ - ADC->CON1.CLKDIV = ADC_InitStruct->ADC_ClkDiv; //ADCCON1:bit2-0 ADCʱԴԤƵ - ADC->CON1.VREFP = ADC_InitStruct->ADC_VrefP; //ADCCON1:bit9-8 ADCοѹѡ - ADC->CON1.SMPS = ADC_InitStruct->ADC_SampS; //ADCCON1:bit12 ADCģʽѡ - ADC->CHS.CHS = ADC_InitStruct->ADC_ChS; //ADCCHS:bit0-3 ADCģͨѡ - ADC->CON1.ST = ADC_InitStruct->ST; //ADCCON1:bit20-16 ADCʱѡ ST*2+1Tadclk - //ADC->VREFCON.VREF_SEL=ADC_InitStruct->VREF_SEL;//ڲοѹѡ - - ADC->CON1.VREFN = ADC_InitStruct->ADC_VREFN; //οѹʹλ - ADC->CON1.VRBUF_EN = ADC_InitStruct->ADC_VRBUF_EN; //VREF BUFʹλ -} - - -/*************************************************************** - ADC_Set_CH - ѡADCģͨ - ֵͨ - ֵ - ֵ - ***************************************************************/ -void ADC_Set_CH(ADC_TYPE_CHS AdcCH) -{ - ADC->CHS.CHS = AdcCH; -} - -/*************************************************************** - ADC_GetConvValue - ȡADCת - ֵ - ֵ - ֵתֵ - ***************************************************************/ -uint16_t ADC_GetConvValue(void) -{ - return ((uint16_t)ADC->DR.DR); -} - -/*************************************************************** - ADC_GetConvStatus - ȡADCת״̬ - ֵ - ֵ - ֵRESET()/SET(ת) - ***************************************************************/ -FlagStatus ADC_GetConvStatus(void) -{ - FlagStatus bitstatus = RESET; - - /* ת״̬Ĵ */ - if ((ADC->CON0.TRIG != (uint32_t)RESET)) - bitstatus = SET; //ת - else - bitstatus = RESET; //ת - - return bitstatus; -} - -/*************************************************************** - ADC_ACPConfig - ADC ԶȽϹܳʼ - ֵADC_ACP_InitStruct ԶȽϹܳʼṹ - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_ACPConfig(ADC_ACP_TypeDef *ADC_ACP_InitStruct) -{ - if(ADC_ACP_InitStruct->ACPC_OVER_TIME > ADC_ACPC_OVFL_TIME_MAX - ||ADC_ACP_InitStruct->ACPC_TIMES > ADC_ACPC_TIMES_MAX - ||ADC_ACP_InitStruct->ACPC_MIN_TARGET > ADC_ACP_MIN_MAX - ||ADC_ACP_InitStruct->ACPC_MAX_TARGET > ADC_ACP_MAX_MAX) - { - return ERROR; - } - - if(ADC_ACP_InitStruct->ACP_EN == ENABLE) - { - if(ADC->CON1.CLKS == ADC_ClkS_PCLK) - { - ADC->ACPC.CLKS = ADC_ACPC_CLKS_PCLK; - } - else - { - ADC->ACPC.CLKS = ADC_ACPC_CLKS_LRC; - } - - ADC->ACPC.OVFL_TIME = ADC_ACP_InitStruct ->ACPC_OVER_TIME; - ADC->ACPC.TIMES = ADC_ACP_InitStruct->ACPC_TIMES; - ADC->IE.ACPOVIE = ENABLE; - - /* û߷ֵó0(Сֵ)ǿΪرոù */ - if(ADC_ACP_InitStruct ->ACPC_MAX_TARGET ==0x0) - { - ADC->IE.ACPMAXIE = DISABLE; - } - else - { - ADC->ACPCMP.CMP_MAX =ADC_ACP_InitStruct ->ACPC_MAX_TARGET; - ADC->IE.ACPMAXIE = ENABLE; - } - - /* ûͷֵó0xfff(ֵ)ǿΪرոù */ - if(ADC_ACP_InitStruct ->ACPC_MIN_TARGET == 0xfff) - { - ADC->IE.ACPMINIE = DISABLE; - } - else - { - ADC->ACPCMP.CMP_MIN =ADC_ACP_InitStruct ->ACPC_MIN_TARGET; - ADC->IE.ACPMINIE = ENABLE; - } - - ADC->CON0.ACP_EN = ENABLE; - - } - else - { - ADC->CON0.ACP_EN = DISABLE; - } - - return SUCCESS; -} - -/*************************************************************** - ADC_SampStart - ADC - - ֵ - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_SoftStart(void) -{ - if(ADC->CON1.SMPS == ADC_SMPS_HARD) - return ERROR; - - ADC ->CON1.SMPON = SET; - return SUCCESS; -} - -/*************************************************************** - ADC_SampStop - ADC -ֹͣ - ֵ - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_SoftStop(void) -{ - if(ADC->CON1.SMPS == ADC_SMPS_HARD) - return ERROR; - - ADC->CON1.SMPON = RESET; - return SUCCESS; -} - -/*************************************************************** - ADC_GetACPMeanValue - ADC õԶȽƽֵ - ֵ - ֵ - ֵ - ***************************************************************/ -uint16_t ADC_GetACPMeanValue(void) -{ - return ((uint16_t)ADC->ACPMEAN.MEAN_DATA); -} - -/*************************************************************** - ADC_GetACPMINValue - ADC õԶȽƽֵ - ֵ - ֵ - ֵ - ***************************************************************/ -uint16_t ADC_GetACPMinValue(void) -{ - return ((uint16_t)ADC->ACPCMP.CMP_MIN); -} - -/*************************************************************** - ADC_GetACPMAXValue - ADC õԶȽƽֵ - ֵ - ֵ - ֵ - ***************************************************************/ -uint16_t ADC_GetACPMaxValue(void) -{ - return ((uint16_t)ADC->ACPCMP.CMP_MAX); -} - -/*************************************************************** - ADC_GetFlagStatus - ȡADC־λ״̬ - ֵIFNameADCжϱ־ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus ADC_GetFlagStatus(ADC_TYPE_IF IFName) -{ - FlagStatus bitstatus = RESET; - - /* жϱ־λ */ - if (((ADC->IF.Word & IFName) != (uint32_t)RESET)) - bitstatus = SET; //ת - else - bitstatus = RESET; //ж - - return bitstatus; -} - -/*************************************************************** - ADC_GetITStatus - ȡADCж״̬δʹӦжʱ᷵SET - ֵ - ֵ - ֵSETжϣ/RESETжϣ - ***************************************************************/ -ITStatus ADC_GetITStatus(ADC_TYPE_IE IEName) -{ - ITStatus bitstatus = RESET; - - /* жϱ־λ */ - if (((ADC->IE.Word & IEName) != (uint32_t)RESET)) - bitstatus = SET; //תɣж - else - bitstatus = RESET; //ж - - return bitstatus; -} - -/*************************************************************** - ADC_ClearIFStatus - ADC ضж - ֵIFName жѡ - ADC_IF ADCж - ADC_IF_ACPMIN Զתͷֵж - ADC_IF_ACPMAX Զת߷ֵж - ADC_IF_ACPOVER Զתж - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_ClearIFStatus(ADC_TYPE_IF IFName) -{ - ADC->IF.Word = (uint32_t)IFName; - - return SUCCESS; -} -/*************************************************************** - ADC_Reset - ADCλ - ֵ - ֵ - ֵ - ***************************************************************/ -void ADC_Reset(void) -{ - ADC->CON0.Word = 0x00000030; - ADC->CON1.Word = 0x00041000; - ADC->CHS.Word = 0x00000100; - ADC->IE.Word = 0x00000000; - ADC->IF.Word = 0x00000000; - ADC->ACPC.Word = 0x00000000; - ADC->ACPCMP.Word = 0x0FFF0000; - ADC->VREFCON.Word = 0x00000000; -} - -/*************************END OF FILE**********************/ - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_aes.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_aes.c deleted file mode 100644 index e8f07e8bba..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_aes.c +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : AE - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508оƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_aes.h" - -/*************************************************************** -AES_Init - AESܳʼ -ֵAES_InitStruct ʼṹ -ֵ -ֵ -***************************************************************/ -void AES_Init(AES_InitStruType * AES_InitStruct) -{ - - - AES_Reset(); - - AES->CON.ENCRYPT = AES_InitStruct->MODE; - return; -} - -/*************************************************************** -AES_WriteKey - AESдԿ -ֵAES_KEY дԿ -ֵ -ֵ -***************************************************************/ -void AES_WriteKey(uint32_t *AES_KEY) -{ - uint32_t *address = AES_KEY; - - AES->KEY3.AES_KEY3 = *address; - address ++; - AES->KEY2.AES_KEY2 = *address; - address ++; - AES->KEY1.AES_KEY1 = *address; - address ++; - AES->KEY0.AES_KEY0 = *address; -} - -/*************************************************************** -AES_ReadKey - AESԿ -ֵ -ֵAES_DATAԿλ -ֵ -***************************************************************/ -void AES_ReadKey(uint32_t * AES_KEY) -{ - uint32_t *address = AES_KEY; - - *address = AES->KEY3.AES_KEY3; - address ++; - *address = AES->KEY2.AES_KEY2; - address ++; - *address = AES->KEY1.AES_KEY1; - address ++; - *address = AES->KEY0.AES_KEY0; - return; -} - -/*************************************************************** -AES_WriteData - AESдݺ -ֵAES_DATA д -ֵ -ֵ -***************************************************************/ -void AES_WriteData(uint32_t *AES_DATA) -{ - uint32_t *address = AES_DATA; - - AES->DATA3.AES_DATA3 = *address; - address ++; - AES->DATA2.AES_DATA2 = *address; - address ++; - AES->DATA1.AES_DATA1 = *address; - address ++; - AES->DATA0.AES_DATA0 = *address; -} - -/*************************************************************** -AES_WriteData - AESݺ -ֵ -ֵAES_DATAݴλ -ֵ -***************************************************************/ -void AES_ReadData(uint32_t * AES_DATA) -{ - uint32_t *address = AES_DATA; - - *address = AES->DATA3.AES_DATA3; - address ++; - *address = AES->DATA2.AES_DATA2; - address ++; - *address = AES->DATA1.AES_DATA1; - address ++; - *address = AES->DATA0.AES_DATA0; - return; -} - -/*************************************************************** -AES_ITConfig - AESжʹ -ֵAES_IE - NewState Enable/Disable -ֵ -ֵ -***************************************************************/ -void AES_ITConfig(AES_TYPE_IT AES_IE, TYPE_FUNCEN NewState) -{ - uint32_t Word = AES->CON.Word&0xffffff8e; - - if(AES->CON.GO_DONE == 1) - { - return; - } - - if (NewState == ENABLE) - Word |= (uint32_t)AES_IE; - else - - Word &= ~(uint32_t)AES_IE; - - AES->CON.Word = Word; - return; - -} - -/*************************************************************** -AES_GetFlagStatus - AESضжϱ־ -ֵIFName - AES_IF_IF ӽж -ֵ -ֵжϱ־ -***************************************************************/ -FlagStatus AES_GetFlagStatus(AES_TYPE_IF IFName) -{ - - if(AES->CON.Word & IFName) { - return SET; - } - return RESET; -} - -/*************************************************************** -AES_ClearITPendingBit - AESضжϱ־ -ֵIFName - AES_IF_DONE ӽж -ֵ -ֵ -***************************************************************/ -void AES_ClearITPendingBit(void) -{ - /* ǵIFGO_DONEͬһwordУIFֵܻһЩ - * GO_DONE1ʱȡֵGO_DONE0ֵԭ1ٶиֵ - * òҪв - */ - - if(AES->CON.GO_DONE == SET) - { - return; - } - - AES->CON.IF = SET; - - return; -} - -/*************************************************************** -AES_GetDoneStatus - AESǷ/ -ֵ -ֵ -ֵAES_DONE_NO δ - AES_DONE_YES δܻ߼Ѿ -***************************************************************/ -AES_TYPE_DONE AES_GetDoneStatus(void) -{ - if(AES->CON.GO_DONE == 1) - { - return AES_DONE_NO; - } - - return AES_DONE_YES; -} - -/*************************************************************** -AES_Reset - AESλ -ֵ -ֵ -ֵ -***************************************************************/ -void AES_Reset(void) -{ - AES->DATA0.Word = 0x00000000; - AES->DATA1.Word = 0x00000000; - AES->DATA2.Word = 0x00000000; - AES->DATA3.Word = 0x00000000; - - AES->KEY0.Word = 0x00000000; - AES->KEY1.Word = 0x00000000; - AES->KEY2.Word = 0x00000000; - AES->KEY3.Word = 0x00000000; - - AES->CON.Word = 0x00000000; -} - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_crc.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_crc.c deleted file mode 100644 index 547d50fddf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_crc.c +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_crc.h" - - /*************************************************************** - CRC_getTypeValue - òһCRC_CONò - ֵcon_value CRC_CON ֵṹ - ֵCRC_CONֵ - ***************************************************************/ -uint32_t CRC_getTypeValue(CRC_CONValueStruType con_value) -{ - uint32_t type =0; - type = (con_value.xorout | con_value.refout | con_value.refin |\ - con_value.mode|con_value.hs_type|con_value.init_data_type); - return type; -} - - /*************************************************************** - CRC_EmptayCheck - պ - ֵaddress: ׵ַ data_lenֽڳ - ֵ1ɹ0 ʧ - ***************************************************************/ -uint32_t CRC_EmptayCheck(void* address, uint32_t data_len) -{ - CRC_EM CRC_EmptayCheck = (CRC_EM)(*(uint32_t *)CRC_EmptayCheck_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_EmptayCheck)(address, data_len); - __ASM("CPSIE i"); - return result; -} - - /*************************************************************** - CRC_FlashVerify - FLASHУ麯 - ֵaddress: У׵ַ data_lenУֽڳȣ type:У鷽ʽ - ֵCRCУ - ***************************************************************/ -uint32_t CRC_FlashVerify(void* address, uint32_t data_len, uint32_t type) -{ - CRC_FL CRC_FlashVerify = (CRC_FL)(*(uint32_t *)CRC_FlashVerify_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_FlashVerify)(address, data_len, type); - __ASM("CPSIE i"); - return result; -} - - /*************************************************************** - CRC_UserCal - ûУ麯 - ֵaddress: ûУ׵ַ data_lenУֽڳȣ type:У鷽ʽ - ֵCRCУ - ***************************************************************/ -uint32_t CRC_UserCal(void* address, uint32_t data_len, uint32_t type) -{ - CRC_US CRC_UserCal = (CRC_US)(*(uint32_t *)CRC_UserCal_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_UserCal)(address, data_len, type); - __ASM("CPSIE i"); - return result; -} - - /*************************************************************** - CRC_CheckReset - CRCλѯ - ֵ - ֵλ־1иλ־0޸λ־ - ***************************************************************/ -uint32_t CRC_CheckReset(void) -{ - CRC_CH CRC_CheckReset = (CRC_CH)(*(uint32_t *)CRC_CheckReset_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_CheckReset)(); - __ASM("CPSIE i"); - return result; -} - -/************************END OF FILE**************************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_flashiap.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_flashiap.c deleted file mode 100644 index 599478b164..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_flashiap.c +++ /dev/null @@ -1,355 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_flashiap.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * flashд⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_flashiap.h" - -/*************************************************************** - FlashIap_Close_WPROT - IAPرд - ֵPage:0-63,ÿpageӦ2Kֽ,64 ΪINFO - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_Close_WPROT(uint8_t Page) -{ - if(Page > 64) - return ERROR; - - if(Page == 64) - { - IAP->WPROT2.Word = 0x00000000; - return SUCCESS; - } - - if(Page < 32) - { - IAP->WPROT0.Word &=~ ((uint32_t)0x1 << Page); - } - else - { - Page -= 32; - IAP->WPROT1.Word &=~ ((uint32_t)0x1 << Page); - } - - return SUCCESS; -} - -/*************************************************************** - FlashIap_Open_WPROT - IAPд - ֵPage:0-63,ÿpageӦ2Kֽ,,64 ΪINFO - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_Open_WPROT(uint8_t Page) -{ - if(Page > 64) - return ERROR; - - if(Page == 64) - { - IAP->WPROT2.Word = 0x00000001; - return SUCCESS; - } - - if(Page < 32) - { - IAP->WPROT0.Word &=~ ((uint32_t)0x1 << Page); - IAP->WPROT0.Word |= ((uint32_t)0x1 << Page); - } - else - { - Page -= 32; - IAP->WPROT1.Word &=~ ((uint32_t)0x1 << Page); - IAP->WPROT1.Word |= ((uint32_t)0x1 << Page); - } - - return SUCCESS; -} - -/*************************************************************** - FlashIap_CloseAll_WPROT - IAPرд - ֵPage:0-63,ÿpageӦ2Kֽ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_CloseAll_WPROT(void) -{ - IAP->WPROT0.Word = 0x00000000; - IAP->WPROT1.Word = 0x00000000; - IAP->WPROT2.Word = 0x00000000; - - return SUCCESS; -} -/*************************************************************** - FlashIap_OpenAll_WPROT - IAPд - ֵ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_OpenAll_WPROT(void) -{ - IAP->WPROT0.Word = 0xFFFFFFFF; - IAP->WPROT1.Word = 0xFFFFFFFF; - IAP->WPROT2.Word = 0xFFFFFFFF; - - return SUCCESS; -} - -/*************************************************************** - FlashIap_Unlock - IAP - ֵ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_Unlock(void) -{ - uint16_t Temp16; - - FlashIAP_RegUnLock(); // IAP - - FlashIAP_Enable(); //ʹIAP - - FlashIAP_REQ(); // - - for(Temp16 = 0; Temp16 < 0xFFFF; Temp16++) //ȴFLASHӦź - { - if(IAP->CON.FLASH_ACK != 0) - break; - } - - if(Temp16 == 0xFFFF) - return ERROR; - else - return SUCCESS; -} - -/*************************************************************** - FlashIap_WriteEnd - IAPд - ֵ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_WriteEnd(void) -{ - uint32_t Temp32; - - FlashIAP_RegUnLock(); //IAP - - IAP->CON.Word &= 0xFFFFFFEE; //IAPFLASH() - - for(Temp32 = 0; Temp32 < 0xFFFF; Temp32++) //ȴFLASHӦź() - { - if(IAP->CON.FLASH_ACK == 0) - break; - } - - if(Temp32 == 0xFFFF) - return ERROR; - else - return SUCCESS; -} - -/*************************************************************** - FlashIap_ErasePage - IAPҳ - ֵPage_Addrҳַ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_ErasePage(uint8_t Page_Addr) -{ - uint16_t Temp16; - uint32_t temp; - - temp = __get_PRIMASK(); //ȡPRIMASKĴǰ״̬ - __disable_irq(); //ж - - if(FlashIap_Unlock() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_CloseAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); - return ERROR; - } - - IAP->ADDR.IAPPA = Page_Addr; //ҳַ - - IAP->TRIG.TRIG = 0x00005EA1; // - - for(Temp16 = 0; Temp16 < 0xFFFF; Temp16++) - { //жIAP״̬ - if((IAP->STA.Word & (uint32_t)0x01) == (uint32_t)0x00) - break; - } - - if(Temp16 == 0xFFFF) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - for(Temp16 = 0; Temp16 < 0xFFFF; Temp16++) - { - if((IAP->STA.Word & (uint32_t)0x02) == (uint32_t)0x02) //жIAPҳ־ - break; - } - - if(Temp16 == 0xFFFF) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_WriteEnd() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_OpenAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); - return ERROR; - } - - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - - return SUCCESS; -} - -/*************************************************************** - FlashIap_WriteCont - IAPд - ֵUnit_addrԪַ Page_addrҳַ Data32 - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_WriteCont(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32) -{ - uint16_t temp16; - - IAP->ADDR.IAPPA = Page_addr; //ַ - IAP->ADDR.IAPCA = Unit_addr; - - IAP->DATA.DATA = Data32; // - IAP->TRIG.TRIG = 0x00005DA2; // - - for(temp16 = 0; temp16 < 0xFFFF; temp16++) - { - if((IAP->STA.Word & (uint32_t)0x01) == (uint32_t)0x00) //жIAP״̬ - break; - } - - if(temp16 == 0xFFFF) - return ERROR; - - for(temp16 = 0; temp16 < 0xFFFF; temp16++) - { - if((IAP->STA.Word & 0x04)==0x04) //жIAP̽־ - break; - } - - if(temp16 == 0xFFFF) - return ERROR; - - return SUCCESS; -} - -/*************************************************************** - FlashIap_WriteWord - IAPдһ - ֵUnit_addrԪַ Page_addrҳַ Data32 - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_WriteWord(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32) -{ - uint32_t temp; - - temp = __get_PRIMASK(); //ȡPRIMASKĴǰ״̬ - __disable_irq(); //ж - - if(FlashIap_Unlock() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_CloseAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); //رд״̬ - return ERROR; - } - - if(FlashIap_WriteCont(Unit_addr, Page_addr, Data32) == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_WriteEnd() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_OpenAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); //д״̬ - return ERROR; - } - - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - - return SUCCESS; -} - -/*************************************************************** - Flash_Read - Flash - ֵRam_AddrݵĴŵַ Flash_AddrFlashַ0x00000000 ~ 0x0001FFFF Lenȡֳ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus Flash_Read(uint32_t * Ram_Addr, uint32_t Flash_Addr, uint8_t Len) -{ - uint8_t i; - uint32_t *ram_addr32; - const uint32_t *flash_addr32; - - ram_addr32 = (uint32_t *)Ram_Addr; - flash_addr32 = (const uint32_t *)Flash_Addr; - - if((Len == 0) & (Len>(0x20000 - Flash_Addr) / 4)) //ж϶ȡǷϷ - { - return ERROR; - } - - for(i=0; iGPIO_Signal == GPIO_Pin_Signal_Analog) { - GPIO_SetSingalTypeFromPin(GPIOx, PINx, GPIO_Pin_Signal_Analog); - GPIO_SetDirRegFromPin(GPIOx, PINx, GPIO_Dir_In); - GPIO_SetFuncxRegFromPin(GPIOx, PINx, GPIO_Func_0); - } - else { - GPIO_SetSingalTypeFromPin(GPIOx, PINx, GPIO_Pin_Signal_Digital); - GPIO_SetDirRegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_Direction); - GPIO_SetFuncxRegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_Func); - - if (GPIO_InitStruct->GPIO_Direction == GPIO_Dir_Out) { - GPIO_SetODERegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_OD); - GPIO_SetDSRegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_DS); - } - GPIO_SetPUERegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_PUEN); - GPIO_SetPDERegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_PDEN); - } -} - -/*************************************************************** - GPIO_SetFuncxRegFromPin - GPIOŵĹܸ - ֵPinĿ - Funcܸñ - ֵ - ֵ - ***************************************************************/ -void GPIO_SetFuncxRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_FUNC Func) -{ - uint32_t value; - - switch (Func) { - case GPIO_Func_0: - value = 0; - break; - case GPIO_Func_1: - value = 1; - break; - case GPIO_Func_2: - value = 2; - break; - case GPIO_Func_3: - value = 3; - break; - default: - value = 0; - break; - } - - /* Ź */ - if(GPIOx == GPIOB){ - switch (PINx) { - case GPIO_Pin_0: - GPIO->PBFUNC0.PB0 = value; - break; - case GPIO_Pin_1: - GPIO->PBFUNC0.PB1 = value; - break; - case GPIO_Pin_2: - GPIO->PBFUNC0.PB2 = value; - break; - case GPIO_Pin_3: - GPIO->PBFUNC0.PB3 = value; - break; - case GPIO_Pin_4: - GPIO->PBFUNC0.PB4 = value; - break; - case GPIO_Pin_5: - GPIO->PBFUNC0.PB5 = value; - break; - case GPIO_Pin_6: - GPIO->PBFUNC0.PB6 = value; - break; - case GPIO_Pin_7: - GPIO->PBFUNC0.PB7 = value; - break; - case GPIO_Pin_8: - GPIO->PBFUNC1.PB8 = value; - break; - case GPIO_Pin_9: - GPIO->PBFUNC1.PB9 = value; - break; - case GPIO_Pin_10: - GPIO->PBFUNC1.PB10 = value; - break; - case GPIO_Pin_11: - GPIO->PBFUNC1.PB11 = value; - break; - case GPIO_Pin_12: - GPIO->PBFUNC1.PB12 = value; - break; - case GPIO_Pin_13: - GPIO->PBFUNC1.PB13 = value; - break; - default: - break; - } - } - - else{ - switch (PINx) { - case GPIO_Pin_0: - GPIO->PAFUNC0.PA0 = value; - break; - case GPIO_Pin_1: - GPIO->PAFUNC0.PA1 = value; - break; - case GPIO_Pin_2: - GPIO->PAFUNC0.PA2 = value; - break; - case GPIO_Pin_3: - GPIO->PAFUNC0.PA3 = value; - break; - case GPIO_Pin_4: - GPIO->PAFUNC0.PA4 = value; - break; - case GPIO_Pin_5: - GPIO->PAFUNC0.PA5 = value; - break; - case GPIO_Pin_6: - GPIO->PAFUNC0.PA6 = value; - break; - case GPIO_Pin_7: - GPIO->PAFUNC0.PA7 = value; - break; - case GPIO_Pin_8: - GPIO->PAFUNC1.PA8 = value; - break; - case GPIO_Pin_9: - GPIO->PAFUNC1.PA9 = value; - break; - case GPIO_Pin_10: - GPIO->PAFUNC1.PA10 = value; - break; - case GPIO_Pin_11: - GPIO->PAFUNC1.PA11 = value; - break; - case GPIO_Pin_12: - GPIO->PAFUNC1.PA12 = value; - break; - case GPIO_Pin_13: - GPIO->PAFUNC1.PA13 = value; - break; - case GPIO_Pin_14: - GPIO->PAFUNC1.PA14 = value; - break; - case GPIO_Pin_15: - GPIO->PAFUNC1.PA15 = value; - break; - case GPIO_Pin_16: - GPIO->PAFUNC2.PA16 = value; - break; - case GPIO_Pin_17: - GPIO->PAFUNC2.PA17 = value; - break; - case GPIO_Pin_18: - GPIO->PAFUNC2.PA18 = value; - break; - case GPIO_Pin_19: - GPIO->PAFUNC2.PA19 = value; - break; - case GPIO_Pin_20: - GPIO->PAFUNC2.PA20 = value; - break; - case GPIO_Pin_21: - GPIO->PAFUNC2.PA21 = value; - break; - case GPIO_Pin_22: - GPIO->PAFUNC2.PA22 = value; - break; - case GPIO_Pin_23: - GPIO->PAFUNC2.PA23 = value; - break; - case GPIO_Pin_24: - GPIO->PAFUNC3.PA24 = value; - break; - case GPIO_Pin_25: - GPIO->PAFUNC3.PA25 = value; - break; - case GPIO_Pin_26: - GPIO->PAFUNC3.PA26 = value; - break; - case GPIO_Pin_27: - GPIO->PAFUNC3.PA27 = value; - break; - case GPIO_Pin_28: - GPIO->PAFUNC3.PA28 = value; - break; - case GPIO_Pin_29: - GPIO->PAFUNC3.PA29 = value; - break; - case GPIO_Pin_30: - GPIO->PAFUNC3.PA30 = value; - break; - case GPIO_Pin_31: - GPIO->PAFUNC3.PA31 = value; - break; - default: - break; - } - } - return; -} - -/*************************************************************** - GPIO_SetSingalTypeFromPin - ŵź - ֵPin: Ŀ - Signal: ŵź - ֵ - ֵ - ***************************************************************/ -void GPIO_SetSingalTypeFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_Pin_Signal GPIO_Signal) -{ - if(GPIOx == GPIOB) { - if (GPIO_Signal == GPIO_Pin_Signal_Digital) - GPIO->PBINEB.Word &= (~(1 << PINx)); - else - GPIO->PBINEB.Word |= (1 << PINx); - } - else{ - if (GPIO_Signal == GPIO_Pin_Signal_Digital) - GPIO->PAINEB.Word &= (~(1 << PINx)); - else - GPIO->PAINEB.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetDirRegFromPin - ŵ - ֵPin: Ŀ - Dirŷ - ֵ - ֵ - ***************************************************************/ -void GPIO_SetDirRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir) -{ - if (GPIOx == GPIOB) { - if (Dir == GPIO_Dir_In) - GPIO->PBDIRBSR.Word = (1 << PINx); - else - GPIO->PBDIRBCR.Word = (1 << PINx); - } - else { - if (Dir == GPIO_Dir_In) - GPIO->PADIRBSR.Word = (1 << PINx); - else - GPIO->PADIRBCR.Word = (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetODERegFromPin - ŵ©ʽ - ֵPin: Ŀ -ODE: ©ʽ -ֵ -ֵ - ***************************************************************/ -void GPIO_SetODERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_ODE_Output ODE) -{ - if (GPIOx == GPIOB) { - if (ODE == GPIO_ODE_Output_Disable) - GPIO->PBODE.Word &= (~(1 << PINx)); - else - GPIO->PBODE.Word |= (1 << PINx); - } - else { - if (ODE == GPIO_ODE_Output_Disable) - GPIO->PAODE.Word &= (~(1 << PINx)); - else - GPIO->PAODE.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetDSRegFromPin - ŵ - ֵPin: Ŀ -DS: ʽ -ֵ -ֵ - ***************************************************************/ -void GPIO_SetDSRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DS DS) -{ - if (GPIOx == GPIOB) { - if (DS == GPIO_DS_Output_Normal) - GPIO->PBDS.Word &= (~(1 << PINx)); - else - GPIO->PBDS.Word |= (1 << PINx); - } - else { - if (DS == GPIO_DS_Output_Normal) - GPIO->PADS.Word &= (~(1 << PINx)); - else - GPIO->PADS.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetPUERegFromPin - ŵʽ - ֵPin: Ŀ -PUE: ʽ -ֵ -ֵ - ***************************************************************/ -void GPIO_SetPUERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PUE_Input PUE) -{ - if (GPIOx == GPIOB) { - if (PUE == GPIO_PUE_Input_Disable) - GPIO->PBPUE.Word &= (~(1 << PINx)); - else - GPIO->PBPUE.Word |= (1 << PINx); - } - else { - if (PUE == GPIO_PUE_Input_Disable) - GPIO->PAPUE.Word &= (~(1 << PINx)); - else - GPIO->PAPUE.Word |= (1 << PINx); - } -} - -/*************************************************************** - GPIO_SetPDERegFromPin - ŵʽ - ֵPin: Ŀ - PDEʽ - ֵ - ֵ - ***************************************************************/ -void GPIO_SetPDERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PDE_Input PDE) -{ - if (GPIOx == GPIOB) { - if (PDE == GPIO_PDE_Input_Disable) - GPIO->PBPDE.Word &= (~(1 << PINx)); - else - GPIO->PBPDE.Word |= (1 << PINx); - } - else { - if (PDE == GPIO_PDE_Input_Disable) - GPIO->PAPDE.Word &= (~(1 << PINx)); - else - GPIO->PAPDE.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_Write - GPIO˿д - ֵGPIOxGPIOA/GPIOB ValueҪдݡע⣺ЩڵţõֵӦλõ - ֵ - ֵ - ***************************************************************/ -void GPIO_Write(GPIO_TYPE GPIOx, uint32_t Value) -{ - if(GPIOx == GPIOA) - GPIO->PADATA.Word = Value; - else if(GPIOx == GPIOB) - GPIO->PBDATA.Word = Value; -} - -/*************************************************************** - GPIO_Read - GPIO˿ڶ - ֵGPIOxGPIOA/GPIOB - ֵ - ֵݡע⣺ЩڵţֵӦλЧ - ***************************************************************/ -uint32_t GPIO_Read(GPIO_TYPE GPIOx) -{ - if(GPIOx == GPIOA) - return GPIO->PAPORT.Word; - else if(GPIOx == GPIOB) - return GPIO->PBPORT.Word; - - return 0; -} - -/*************************************************************** - GPIO_ReadBit - GPIO˿ڶijλ - ֵGPIOxGPIOA/GPIOB PINx:GPIO_Pin_0 GPIO_Pin_31 - ֵ - ֵݡע⣺ЩڵţֵЧ - ***************************************************************/ -PinStatus GPIO_ReadBit(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx) -{ - PinStatus bitstatus = RESET; - - if(GPIOx == GPIOA) - { - if((GPIO->PAPORT.Word&((uint32_t)0x1<PBPORT.Word&((uint32_t)0x1<PADATABSR.Word = (uint32_t)0x1<PADATABCR.Word = (uint32_t)0x1<PADATABRR.Word = (uint32_t)0x1<PBDATABSR.Word = (uint32_t)0x1<PBDATABCR.Word = (uint32_t)0x1<PBDATABRR.Word = (uint32_t)0x1<PADIR.Word &=~((uint32_t)0x1 << PINx); - GPIO->PADIR.Word |= ((uint32_t)Dir_Type <PBDIR.Word &=~((uint32_t)0x1 << PINx); - GPIO->PBDIR.Word |= ((uint32_t)Dir_Type <BUZC.BUZ_LOAD = (SystemCoreClock/(freq*2)) - 1; - GPIO->BUZC.BUZEN = buzz_en; -} -/*************************************************************** - PINT_Config - PINT - ֵPINTxѡPINT0 PINT7 SELxѡ TRIGxѡ - ֵ - ֵ - ***************************************************************/ -void PINT_Config(PINT_TYPE PINTx, PINT_TYPE_SEL SELx, PINT_TYPE_TRIG TRIGx) -{ - GPIO->PINTSEL.Word &= ~((uint32_t)0x07<<(PINTx*4)); - GPIO->PINTSEL.Word |=((uint32_t)SELx << (PINTx*4)); //selѡ - - GPIO->PINTCFG.Word &= ~((uint32_t)0x07<<(PINTx*4)); - GPIO->PINTCFG.Word |=((uint32_t)TRIGx << (PINTx*4)); //ʽѡ -} - -/*************************************************************** - PINT_GetIFStatus - PINTȡжϱ־ - ֵPINTxPINT0-PINT7 - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus PINT_GetIFStatus(PINT_TYPE_IT PINT_Flag) -{ - FlagStatus bitstatus = RESET; - - if((GPIO->PINTIF.Word & (uint32_t)PINT_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - PINT_GetITStatus - PINTȡжϱ־ - ֵPINTxPINT0-PINT7 - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus PINT_GetITStatus(PINT_TYPE_IT PINT_Flag) -{ - FlagStatus bitstatus = RESET; - - if((GPIO->PINTIF.Word & (uint32_t)PINT_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - PINT_ClearITPendingBit - PINTжϱ־ - ֵPINTж - ֵ - ֵ - ***************************************************************/ -void PINT_ClearITPendingBit(PINT_TYPE_IT PINT_Flag) -{ - GPIO->PINTIF.Word = (uint32_t)PINT_Flag; -} - -/*************************END OF FILE**********************/ - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iap.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_iap.c deleted file mode 100644 index 9cd1bb4daf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iap.c +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508оƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_iap.h" - -/************************************************* - * @brief IAP ҳ.ص̻ROMеij - * @param address: ҳ׵ַ - * @retval None - ***********************************************/ -ErrorStatus IAP_PageErase(uint32_t address) -{ - IAP_PE IAPPageErase = (IAP_PE)(*(uint32_t *)IAP_PageErase_addr); - - ErrorStatus result; - __ASM("CPSID i"); - result = (*IAPPageErase)(address); - __ASM("CPSIE i"); - return result; -} - -/************************************************* - * @brief IAP Ա.ص̻ROMеij - * @param address: ׵ַ - * @param data: - * @retval None - ************************************************/ -ErrorStatus IAP_WordProgram(uint32_t address, uint32_t data) -{ - IAP_WP IAPWordProgram = (IAP_WP)(*(uint32_t *)IAP_WordProgram_addr); - - ErrorStatus result; - __ASM("CPSID i"); - result = (*IAPWordProgram)( address, data); - __ASM("CPSIE i"); - return result; -} - -/************************************************ - * @brief IAP Ա.ص̻ROMеij - * @param address: ׵ַ - * @param data[]: - * @param length: ݳȣֽڣ - * @param address: ҳǷȲ - * @arg 0: - * @arg 1: - * @retval None - **********************************************/ -ErrorStatus IAP_PageProgram(uint32_t address, uint32_t data[], uint32_t length, uint32_t erase) //@0x100001c5 -{ - IAP_PP IAPPageProgram = (IAP_PP)(*(uint32_t *)IAP_PageProgram_addr); - - ErrorStatus result; - __ASM("CPSID i"); - result = (*IAPPageProgram)(address,data,length,erase); - __ASM("CPSIE i"); - return result; -} -/************************************* - IARead - Flash - ֵڴַ--ȡݵĴŵַ - Flashַ - ȡݵijȣλΪ֣4ֽڣ - ֵɹ/ʧ - **************************************/ -ErrorStatus IAPRead(uint32_t *Ram_Addr, uint32_t Flash_Addr, uint8_t Len) -{ - uint8_t i; - uint32_t *ram_addr; - const uint32_t *flash_addr; - - ram_addr = Ram_Addr; - flash_addr = (const uint32_t *)Flash_Addr; - - if (Len == 0) - return ERROR; - - for (i = 0; i < Len; ++i) - { - *ram_addr = *flash_addr; - ++ram_addr; - ++flash_addr; - } - - return SUCCESS; -} - -/************************END OF FILE**************************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iic.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_iic.c deleted file mode 100644 index ab987843f1..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iic.c +++ /dev/null @@ -1,311 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_iic.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * IICģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_iic.h" - -/*************************************************************** - I2C_Init - I2Cʼ - ֵI2C_InitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void I2C_Init(I2C_InitStruType* I2C_InitStruct) -{ - uint32_t temp; - - if(I2C_InitStruct->I2C_Mode == I2C_Mode_Master) - { - if(I2C_InitStruct->I2C_16XSamp != DISABLE) - temp = SystemCoreClock/24/I2C_InitStruct->I2C_Clk - 1; - else - temp = SystemCoreClock/16/I2C_InitStruct->I2C_Clk - 1; - - if(temp > 254) - temp = 255; - - I2C0->CON.TJP = temp; //ʱʱ - - I2C0->CON.TJE = 0x1; //ʹʱʱ - } - - I2C0->CON.SDASE = I2C_InitStruct->I2C_16XSamp; //16 - I2C0->CON.SCKSE = I2C_InitStruct->I2C_16XSamp; - I2C0->CON.SCKOD = I2C_InitStruct->I2C_SclOd; //˿ڿ© - I2C0->CON.SDAOD = I2C_InitStruct->I2C_SdaOd; - I2C0->MOD.MS = I2C_InitStruct->I2C_Mode; //ģʽ - I2C0->MOD.SPAE = I2C_InitStruct->I2C_AutoStop; //Զֹͣ - I2C0->MOD.SRAE = I2C_InitStruct->I2C_AutoCall; //ԶѰ -} - -/*************************************************************** - I2C_ITConfig - I2Cж - ֵI2C_ITҪõж NewStateʹܻر - ֵ - ֵ - ***************************************************************/ -void I2C_ITConfig(I2C_TYPE_IT I2C_IT,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - I2C0->IE.Word |= (uint32_t)I2C_IT; - else - I2C0->IE.Word &= ~((uint32_t)I2C_IT); -} - -/*************************************************************** - I2C_SendAddress - I2Cʹӻַ - ֵI2C_Address7λӻַ 0x00~0xfe Modeд - ֵ - ֵ - ***************************************************************/ -void I2C_SendAddress(uint8_t I2C_Address,I2C_TYPE_RWMODE Mode) -{ - I2C0->CON.SA = I2C_Address>>1; - I2C0->CON.RW = Mode; -} - -/*************************************************************** - I2C_SetAddress - I2Cõַڴӻģʽ - ֵI2C_Address7λӻַ 0x00~0xfe - ֵ - ֵ - ***************************************************************/ -void I2C_SetAddress(uint8_t I2C_Address) -{ - I2C0->CON.SA = I2C_Address>>1; -} - -/*************************************************************** - I2C_RecModeConfig - I2Cýģʽ - ֵRecTypeģʽ - ֵ - ֵ - ***************************************************************/ -void I2C_RecModeConfig(I2C_TYPE_RECMODE RecType) -{ - I2C0->MOD.RDM = RecType; -} - -/*************************************************************** - I2C_TBIMConfig - I2Cͻжģʽѡ - ֵTypeжģʽ - ֵ - ֵ - ***************************************************************/ -void I2C_TBIMConfig(I2C_TYPE_TRBIM Type) -{ - I2C0->IE.TBIM = Type; -} - -/*************************************************************** - I2C_RBIMConfig - I2Cջжģʽѡ - ֵTypeжģʽ - ֵ - ֵ - ***************************************************************/ -void I2C_RBIMConfig(I2C_TYPE_TRBIM Type) -{ - I2C0->IE.RBIM = Type; -} - -/*************************************************************** - I2C_AckDelay - I2CӦʱ - ֵTypeʱʱ NewStatusʹܡʧ - ֵ - ֵ - ***************************************************************/ -void I2C_AckDelay(I2C_TYPE_ADLY Type,TYPE_FUNCEN NewStatus) -{ - I2C0->MOD.ADLY = Type; - I2C0->MOD.ADE = NewStatus; -} - -/*************************************************************** - I2C_TISConfig - I2C֡ - ֵTime - ֵ - ֵ - ***************************************************************/ -void I2C_TISConfig(I2C_TYPE_TIS Time) -{ - I2C0->MOD.TIS = Time; -} - -/*************************************************************** - I2C_SendByte - I2Cֽڷ - ֵByteֽ - ֵ - ֵ - ***************************************************************/ -void I2C_SendByte(uint8_t Byte) -{ - I2C0->TBW.Byte[0] = Byte; -} - -/*************************************************************** - I2C_SendHalfWord - I2Cַ - ֵHalfWord - ֵ - ֵ - ***************************************************************/ -void I2C_SendHalfWord(uint16_t HalfWord) -{ - I2C0->TBW.HalfWord[0] = HalfWord; -} - -/*************************************************************** - I2C_SendWord - I2Cַ - ֵWord - ֵ - ֵ - ***************************************************************/ -void I2C_SendWord(uint32_t Word) -{ - I2C0->TBW.Word = Word; -} - -/*************************************************************** - I2C_RecByte - I2C-ֽ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint8_t I2C_RecByte(void) -{ - return I2C0->RBR.Byte[0] ; -} - -/*************************************************************** - I2C_RecHalfWord - I2C- - ֵ - ֵ - ֵյ - ***************************************************************/ -uint16_t I2C_RecHalfWord(void) -{ - return I2C0->RBR.HalfWord[0]; -} - -/*************************************************************** - I2C_RecWord - I2C- - ֵ - ֵ - ֵյ - ***************************************************************/ -uint32_t I2C_RecWord(void) -{ - return I2C0->RBR.Word ; -} - -/*************************************************************** - I2C_GetRWMode - I2Cд״̬ȡ - ֵ - ֵ - ֵ/д - ***************************************************************/ -I2C_TYPE_RWMODE I2C_GetRWMode(void) -{ - I2C_TYPE_RWMODE Status = I2C_Mode_Write; - - if(I2C0->CON.RW != 0) - Status = I2C_Mode_Read; - else - Status = I2C_Mode_Write; - - return Status; -} - -/*************************************************************** - I2C_GetTBStatus - I2CȡͻĴ״̬,TB0-TB3ȫ򷵻SET,򷵻RESET - ֵ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus I2C_GetTBStatus(void) -{ - FlagStatus bitstatus = RESET; - - if((I2C0->STA.Word&(uint32_t)0x0f00) != (uint32_t)0x0f00) - bitstatus = RESET; - else - bitstatus = SET; - - return bitstatus; -} - -/*************************************************************** - I2C_GetFlagStatus - I2Cȡ־λ״̬ - ֵI2C_FlagѡҪı־λ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus I2C_GetFlagStatus(I2C_TYPE_FLAG I2C_Flag) -{ - FlagStatus bitstatus = RESET; - - if ((I2C0->IF.Word & (uint32_t)I2C_Flag) != RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/************************************* - I2C_GetITStatus - ȡжʹ״̬ - ֵI2C_Flag жʹλ - ж - ֵSET/RESET - **************************************/ -FlagStatus I2C_GetITStatus( I2C_TYPE_IT I2C_Flag) -{ - FlagStatus status = RESET; - - if ((I2C0->IE.Word & (uint32_t)I2C_Flag) == RESET) - return status; - - if ((I2C0->IF.Word & (uint32_t)I2C_Flag) != RESET) - status = SET; - - return status; -} - -/*************************************************************** - I2C_ClearITPendingBit - I2Cжϱ־ - ֵI2C_IT־λ - ֵ - ֵ - ***************************************************************/ -void I2C_ClearITPendingBit(I2C_CLR_IF I2C_IT) -{ - I2C0->IF.Word = (uint32_t)I2C_IT; -} - -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_printf.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_printf.c deleted file mode 100644 index f2afdc3142..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_printf.c +++ /dev/null @@ -1,283 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_printf.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ڴӡ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_printf.h" -#include - -/*************************************************************** - fputc - ضc⺯printfUART - ֵ - ֵ - ֵ - ***************************************************************/ -/*ʹprintf()Ҫ΢⣺Use MicroLIB*/ -int fputc(int ch, FILE *f) -{ - FlagStatus Status = RESET; - uint32_t Count=0; - -#if defined __PRINTF_USE_UART3__ - UART_SendByte(UART3, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART3,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#elif defined __PRINTF_USE_UART2__ - UART_SendByte(UART2, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART2,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#elif defined __PRINTF_USE_UART1__ - UART_SendByte(UART1, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART1,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#else - UART_SendByte(UART0, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART0,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#endif - return (ch); -} - -#ifdef __clang__ //ʹõidesignerʱ򲻵΢ -/*************************************************************** - תַ - ֵ -radix =10 ʾ10ƣΪ0 - * -value Ҫת - * -buf תַ - * -radix = 10 - ֵ - ***************************************************************/ -static char *itoa(int value, char *string, int radix) -{ - int i, d; - int flag = 0; - char *ptr = string; - - /* This implementation only works for decimal numbers. */ - if (radix != 10) - { - *ptr = 0; - return string; - } - - if (!value) - { - *ptr++ = 0x30; - *ptr = 0; - return string; - } - - /* if this is a negative value insert the minus sign. */ - if (value < 0) - { - *ptr++ = '-'; - - /* Make the value positive. */ - value *= -1; - } - - for (i = 10000; i > 0; i /= 10) - { - d = value / i; - - if (d || flag) - { - *ptr++ = (char)(d + 0x30); - value -= (d * i); - flag = 1; - } - } - - /* Null terminate the string. */ - *ptr = 0; - - return string; -} -/*************************************************************** - ʽCеprintfûõC - ֵ -UARTx ͨ - * -Data Ҫ͵ڵݵָ - * -... - ֵ - Ӧã UART_printf("\r\n this is a demo \r\n" ); - * UART1_printf("\r\n %d \r\n", i ); - * UART1_printf("\r\n %s \r\n", j ); - ***************************************************************/ -/* δCʱʹô˺Cеprintfprintfȫ - ֻ֧\r \n %d %s */ -ErrorStatus UART_printf(uint8_t *Data,...) -{ - UART_TypeDef *UARTx; - const char *s; - int d; - char buf[16]; - ErrorStatus RET = SUCCESS; - FlagStatus Status = RESET; - uint32_t Count=0; - va_list ap; - -/** - ** - **ʹú궨ѡʹһ - ** -***/ -#if defined __PRINTF_USE_UART3__ - - UARTx = UART3; - -#elif defined __PRINTF_USE_UART2__ - - UARTx = UART2; - -#elif defined __PRINTF_USE_UART1__ - - UARTx = UART1; - -#else - - UARTx = UART0; - -#endif - - va_start(ap, Data); - - while ( *Data != 0) // жǷ񵽴ַ - { - if ( *Data == 0x5c ) //'\' - { - switch ( *++Data ) - { - case 'r': //س - Count=0; - UART_SendByte(UARTx, 0x0d); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - - Data ++; - break; - - case 'n': //з - Count=0; - UART_SendByte(UARTx, 0x0a); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - - Data ++; - break; - - default: - Data ++; - break; - } - } - else if ( *Data == '%') - { - switch ( *++Data ) - { - case 's': //ַ - s = va_arg(ap, const char *); - for ( ; *s; s++) - { - Count=0; - UART_SendByte(UARTx,*s); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - } - Data++; - break; - - case 'd': //ʮ - d = va_arg(ap, int); - itoa(d, buf, 10); - for (s = buf; *s; s++) - { - Count=0; - UART_SendByte(UARTx,*s); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - } - Data++; - break; - default: - Data++; - break; - } - } /* end of else if */ - else - { - Count=0; - UART_SendByte(UARTx, *Data++); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - } - } - return RET; -} - -#endif -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_rtc.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_rtc.c deleted file mode 100644 index dfede6ca29..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_rtc.c +++ /dev/null @@ -1,1906 +0,0 @@ -/********************************************************* - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ: lib_rtc.c - * : Liut - * : V1.00 - * : 2017/07/14 - * : RTCģ - * ע: HRSDK-GDB-ES8P508 V1.1 - ѧϰʾʹãûֱôķջеκηΡ - **********************************************************/ -#include "lib_rtc.h" -#include "lib_scu.h" - -/*************************************************************** - RTC_Init - ʵʱʱӳʼ - ֵCLKx:RTCʱԴѡHOURx12Сʱ/24Сʱѡ - ֵ - ֵ - ***************************************************************/ -void RTC_Init(RTC_TYPE_CLKS CLKx,RTC_TYPE_TIME HOURx) -{ - uint32_t flag; - - if(CLKx == RTC_LOSC ) - { - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU_XTAL_Enable(); //ʹⲿ32kHZ - while(SCU_XTALReadyFlag() != SET); //ȴʱӿ - - if(Prot_Temp != 0) - SCU_RegLock(); //д - } - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - RTC->CON.PON = 0; // 㣬ʹRTC - RTC->CON.HSWI = HOURx; // 24Сʱģʽ - RTC->CON.CLKS = CLKx; // ʱԴѡ32768Hz - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; -} -/*************************************************************** - RTC_StartRead - ʵʱʱӶ - ֵ - ֵ - ֵ - ***************************************************************/ -void RTC_StartRead(void) -{ - RTC->CON.TMWR = 0; // Ƕ - RTC->CON.TMUP = 1; // - while (RTC->CON.TMUP == 1); //ȴ -} - -/*************************************************************** - RTC_ReadHourmode - ȡСʱģʽ - ֵ - ֵ - ֵǰСʱģʽ - ***************************************************************/ -uint32_t RTC_ReadHourmode(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - result = RTC->CON.HSWI; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} -/*************************************************************** - RTC_ReadSecond - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadSecond(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->HMS.SEC & (uint32_t)0x01) * 1); - result += (((RTC->HMS.SEC >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->HMS.SEC >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->HMS.SEC >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->HMS.SEC >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->HMS.SEC >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->HMS.SEC >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadMinute - ȡ - ֵ - ֵ - ֵǰķ - ***************************************************************/ -uint32_t RTC_ReadMinute(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->HMS.MIN & (uint32_t)0x01) * 1); - result += (((RTC->HMS.MIN >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->HMS.MIN >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->HMS.MIN >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->HMS.MIN >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->HMS.MIN >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->HMS.MIN >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadHour - ȡСʱ - ֵ - ֵ - ֵǰСʱ - ***************************************************************/ -uint32_t RTC_ReadHour(uint32_t *meridiem) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->HMS.HOUR & (uint32_t)0x01) * 1); - result += (((RTC->HMS.HOUR >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->HMS.HOUR >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->HMS.HOUR >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->HMS.HOUR >> 4) & (uint32_t)0x01) * 10); - - if(RTC_ReadHourmode() == RTC_HOUR24) //24Сʱģʽ20Сʱ - { - result += (((RTC->HMS.HOUR >> 5) & (uint32_t)0x01) * 20); - } - else //12Сʱģʽ1 PM,0 AM - { - *meridiem = (((RTC->HMS.HOUR >> 5) & (uint32_t)0x01)); - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadDay - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadDay(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->YMDW.DAY & (uint32_t)0x01) * 1); - result += (((RTC->YMDW.DAY >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->YMDW.DAY >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->YMDW.DAY >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->YMDW.DAY >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->YMDW.DAY >> 5) & (uint32_t)0x01) * 20); - - /* RTCд */ - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return result; -} - -/*************************************************************** - RTC_ReadMonth - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadMonth(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->YMDW.MON & (uint32_t)0x01) * 1); - result += (((RTC->YMDW.MON >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->YMDW.MON >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->YMDW.MON >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->YMDW.MON >> 4) & (uint32_t)0x01) * 10); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadYear - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadYear(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->YMDW.YEAR & (uint32_t)0x01) * 1); - result += (((RTC->YMDW.YEAR >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->YMDW.YEAR >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->YMDW.YEAR >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->YMDW.YEAR >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->YMDW.YEAR >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->YMDW.YEAR >> 6) & (uint32_t)0x01) * 40); - result += (((RTC->YMDW.YEAR >> 7) & (uint32_t)0x01) * 80); - result += 2000; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} -/*************************************************************** - RTC_ReadWeek - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadWeek(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - switch(RTC->YMDW.WEEK) - { - case 0x00: result = 0;break; - case 0x01: result = 1;break; - case 0x02: result = 2;break; - case 0x03: result = 3;break; - case 0x04: result = 4;break; - case 0x05: result = 5;break; - case 0x06: result = 6;break; - default: result = 0;break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_StartRead - ʵʱʱд - ֵ - ֵ - ֵ - ***************************************************************/ -void RTC_StartWrite(void) -{ - /* д */ - RTC->CON.TMWR = 1; // д - RTC->CON.TMUP = 1; // д - while (RTC->CON.TMUP == 1); //ȴд -} - -/*************************************************************** - RTC_WriteSecond - ޸ - ֵsecond: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteSecond(uint32_t second) -{ - uint32_t flag = 0; - uint32_t sec_buf = 0; - - /* */ - if (second >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (second >= 40) - { - sec_buf |= (uint32_t)1<<6; - second -= 40; - } - else - { - sec_buf &= ~(uint32_t)1<<6; - } - - if (second >= 20) - { - sec_buf |= (uint32_t)1<<5; - second -= 20; - } - else - { - sec_buf &= ~(uint32_t)1<<5; - } - - if (second >= 10) - { - sec_buf |= (uint32_t)1<<4; - second -= 10; - } - else - { - sec_buf &= ~(uint32_t)1<<4; - } - - if (second >= 8) - { - sec_buf |= (uint32_t)1<<3; - second -= 8; - } - else - { - sec_buf &= ~(uint32_t)1<<3; - } - - if (second >= 4) - { - sec_buf |= (uint32_t)1<<2; - second -= 4; - } - else - { - sec_buf &= ~(uint32_t)1<<2; - } - - if (second >= 2) - { - sec_buf |= (uint32_t)1<<1; - second -= 2; - } - else - { - sec_buf &= ~(uint32_t)1<<1; - } - - if (second >= 1) - { - sec_buf |= (uint32_t)1; - second -= 1; - } - else - { - sec_buf &= ~(uint32_t)1; - } - - RTC->HMS.SEC = sec_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteMinute - ޸ - ֵminute: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteMinute(uint32_t minute) -{ - uint32_t flag; - uint32_t min_buf = 0; - - /* */ - if (minute >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (minute >= 40) - { - min_buf |= (uint32_t)1<<6; - minute -= 40; - } - else - { - min_buf &= ~(uint32_t)1<<6; - } - - if (minute >= 20) - { - min_buf |= (uint32_t)1<<5; - minute -= 20; - } - else - { - min_buf &= ~(uint32_t)1<<5; - } - - if (minute >= 10) - { - min_buf |= (uint32_t)1<<4; - minute -= 10; - } - else - { - min_buf &= ~(uint32_t)1<<4; - } - - if (minute >= 8) - { - min_buf |= (uint32_t)1<<3; - minute -= 8; - } - else - { - min_buf &= ~(uint32_t)1<<3; - } - - if (minute >= 4) - { - min_buf |= (uint32_t)1<<2; - minute -= 4; - } - else - { - min_buf &= ~(uint32_t)1<<2; - } - - if (minute >= 2) - { - min_buf |= (uint32_t)1<<1; - minute -= 2; - } - else - { - min_buf &= ~(uint32_t)1<<1; - } - - if (minute >= 1) - { - min_buf |= (uint32_t)1; - minute -= 1; - } - else - { - min_buf &= ~(uint32_t)1; - } - - RTC->HMS.MIN = min_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - - -/*************************************************************** - RTC_WriteHour - ޸ʱ - ֵhour: ʱ - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteHour(uint32_t hour, uint32_t meridiem) -{ - uint32_t flag,mode; - uint32_t hour_buf = 0; - - /* */ - if (hour >= 24) - return ERROR; - - mode = RTC_ReadHourmode(); - - if(mode == RTC_HOUR12 && hour > 12) //12Сʱģʽɴ12Сʱ - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if(mode == RTC_HOUR24) - { - if (hour >= 20) - { - hour_buf |= (uint32_t)1<<5; - hour -= 20; - } - else - { - hour_buf &= ~((uint32_t)1<<5); - } - } - else - { - if(meridiem == 1) - hour_buf |= (uint32_t)1<<5; - else - hour_buf &= ~((uint32_t)1<<5); - } - - if (hour >= 10) - { - hour_buf |= (uint32_t)1<<4; - hour -= 10; - } - else - { - hour_buf &= ~((uint32_t)1<<4); - } - - if (hour >= 8) - { - hour_buf |= (uint32_t)1<<3; - hour -= 8; - } - else - { - hour_buf &= ~((uint32_t)1<<3); - } - - if (hour >= 4) - { - hour_buf |= (uint32_t)1<<2; - hour -= 4; - } - else - { - hour_buf &= ~((uint32_t)1<<2); - } - - if (hour >= 2) - { - hour_buf |= (uint32_t)1<<1; - hour -= 2; - } - else - { - hour_buf &= ~((uint32_t)1<<1); - } - - if (hour >= 1) - { - hour_buf |= (uint32_t)1; - hour -= 1; - } - else - { - hour_buf &= ~(uint32_t)1; - } - - RTC->HMS.HOUR = hour_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteDay - ޸ - ֵday: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteDay(uint32_t day) -{ - uint32_t flag; - uint32_t day_buf = 0; - - /* */ - if ((day == 0) || (day >= 32)) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (day >= 20) - { - day_buf |= (uint32_t)1<<5; - day -= 20; - } - else - { - day_buf &= ~((uint32_t)1<<5); - } - - if (day >= 10) - { - day_buf |= (uint32_t)1<<4; - day -= 10; - } - else - { - day_buf &= ~((uint32_t)1<<4); - } - - if (day >= 8) - { - day_buf |= (uint32_t)1<<3; - day -= 8; - } - else - { - day_buf &= ~((uint32_t)1<<3); - } - - if (day >= 4) - { - day_buf |= (uint32_t)1<<2; - day -= 4; - } - else - { - day_buf &= ~((uint32_t)1<<2); - } - - if (day >= 2) - { - day_buf |= (uint32_t)1<<1; - day -= 2; - } - else - { - day_buf &= ~((uint32_t)1<<1); - } - - if (day >= 1) - { - day_buf |= (uint32_t)1; - day -= 1; - } - else - { - day_buf &= ~(uint32_t)1; - } - - RTC->YMDW.DAY = day_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - - -/*************************************************************** - RTC_WriteMonth - ޸ - ֵmonth: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteMonth(uint32_t month) -{ - uint32_t flag; - uint32_t month_buf = 0; - - /* */ - if ((month == 0) || (month >= 13)) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (month >= 10) - { - month_buf |= (uint32_t)1<<4; - month -= 10; - } - else - { - month_buf &= ~((uint32_t)1<<4); - } - - if (month >= 8) - { - month_buf |= (uint32_t)1<<3; - month -= 8; - } - else - { - month_buf &= ~((uint32_t)1<<3); - } - - if (month >= 4) - { - month_buf |= (uint32_t)1<<2; - month -= 4; - } - else - { - month_buf &= ~((uint32_t)1<<2); - } - - if (month >= 2) - { - month_buf |= (uint32_t)1<<1; - month -= 2; - } - else - { - month_buf &= ~((uint32_t)1<<1); - } - - if (month >= 1) - { - month_buf |= (uint32_t)1; - month -= 1; - } - else - { - month_buf &= ~(uint32_t)1; - } - - RTC->YMDW.MON = month_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteYear - ޸ - ֵyear: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteYear(uint32_t year) -{ - uint32_t flag; - uint32_t year_buf = 0; - - /* */ - if ((year < 2000) || (year > 2099)) - return ERROR; - - /* ת */ - year -= 2000; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (year >= 80) - { - year_buf |= (uint32_t)1<<7; - year -= 80; - } - else - { - year_buf &= ~((uint32_t)1<<7); - } - - if (year >= 40) - { - year_buf |= (uint32_t)1<<6; - year -= 40; - } - else - { - year_buf &= ~((uint32_t)1<<6); - } - - if (year >= 20) - { - year_buf |= (uint32_t)1<<5; - year -= 20; - } - else - { - year_buf &= ~((uint32_t)1<<5); - } - - if (year >= 10) - { - year_buf |= (uint32_t)1<<4; - year -= 10; - } - else - { - year_buf &= ~((uint32_t)1<<4); - } - - if (year >= 8) - { - year_buf |= (uint32_t)1<<3; - year -= 8; - } - else - { - year_buf &= ~((uint32_t)1<<3); - } - - if (year >= 4) - { - year_buf |= (uint32_t)1<<2; - year -= 4; - } - else - { - year_buf &= ~((uint32_t)1<<2); - } - - if (year >= 2) - { - year_buf |= (uint32_t)1<<1; - year -= 2; - } - else - { - year_buf &= ~((uint32_t)1<<1); - } - - if (year >= 1) - { - year_buf |= (uint32_t)1; - year -= 1; - } - else - { - year_buf &= ~(uint32_t)1; - } - - RTC->YMDW.YEAR = year_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteWeek - ޸ - ֵweek: ڣ0-6 - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeek(uint32_t week) -{ - uint32_t flag; - - /* */ - if (week > 6) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - RTC->YMDW.WEEK = week; - - /* д */ - RTC->CON.TMWR = 1; // д - RTC->CON.TMUP = 1; // д - while (RTC->CON.TMUP == 1); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_ReadWeekAlarmMinute - ȡ - ֵ - ֵ - ֵǰķ - ***************************************************************/ -uint32_t RTC_ReadWeekAlarmMinute(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->WA.WM & (uint32_t)0x01) * 1); - result += (((RTC->WA.WM >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->WA.WM >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->WA.WM >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->WA.WM >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->WA.WM >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->WA.WM >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadWeekAlarmHour - ȡСʱ - ֵ - ֵ - ֵǰСʱ - ***************************************************************/ -uint32_t RTC_ReadWeekAlarmHour(uint32_t *meridiem) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->WA.WH & (uint32_t)0x01) * 1); - result += (((RTC->WA.WH >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->WA.WH >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->WA.WH >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->WA.WH >> 4) & (uint32_t)0x01) * 10); - - if(RTC_ReadHourmode() == RTC_HOUR24) //24Сʱģʽ20Сʱ - { - result += (((RTC->WA.WH >> 5) & (uint32_t)0x01) * 20); - } - else //12Сʱģʽ1 PM,0 AM - { - *meridiem = (((RTC->WA.WH >> 5) & (uint32_t)0x01)); - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadWeekAlarmWeek - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadWeekAlarmWeek(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - switch(RTC->WA.WW) - { - case 0x00: result = 0;break; - case 0x01: result = 1;break; - case 0x02: result = 2;break; - case 0x03: result = 3;break; - case 0x04: result = 4;break; - case 0x05: result = 5;break; - case 0x06: result = 6;break; - default: result = 0;break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - - -/*************************************************************** - RTC_ReadDayAlarmMinute - ȡ - ֵ - ֵ - ֵǰķ - ***************************************************************/ -uint32_t RTC_ReadDayAlarmMinute(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->DA.DM & (uint32_t)0x01) * 1); - result += (((RTC->DA.DM >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->DA.DM >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->DA.DM >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->DA.DM >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->DA.DM >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->DA.DM >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadDaykAlarmHour - ȡСʱ - ֵ - ֵ - ֵǰСʱ - ***************************************************************/ -uint32_t RTC_ReadDayAlarmHour(uint32_t *meridiem) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->DA.DH & (uint32_t)0x01) * 1); - result += (((RTC->DA.DH >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->DA.DH >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->DA.DH >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->DA.DH >> 4) & (uint32_t)0x01) * 10); - - if(RTC_ReadHourmode() == RTC_HOUR24) //24Сʱģʽ20Сʱ - { - result += (((RTC->DA.DH >> 5) & (uint32_t)0x01) * 20); - } - else //12Сʱģʽ1 PM,0 AM - { - *meridiem = (((RTC->DA.DH >> 5) & (uint32_t)0x01)); - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_WriteWeekAlarmMinute - ޸ķ - ֵminute: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeekAlarmMinute(uint32_t minute) -{ - uint32_t flag; - uint32_t minute_buf = 0; - - /* */ - if (minute >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (minute >= 40) - { - minute_buf |= (uint32_t)1<<6; - minute -= 40; - } - else - { - minute_buf &= ~(uint32_t)1<<6; - } - - if (minute >= 20) - { - minute_buf |= (uint32_t)1<<5; - minute -= 20; - } - else - { - minute_buf &= ~(uint32_t)1<<5; - } - - if (minute >= 10) - { - minute_buf |= (uint32_t)1<<4; - minute -= 10; - } - else - { - minute_buf &= ~(uint32_t)1<<4; - } - - if (minute >= 8) - { - minute_buf |= (uint32_t)1<<3; - minute -= 8; - } - else - { - minute_buf &= ~(uint32_t)1<<3; - } - - if (minute >= 4) - { - minute_buf |= (uint32_t)1<<2; - minute -= 4; - } - else - { - minute_buf &= ~(uint32_t)1<<2; - } - - if (minute >= 2) - { - minute_buf |= (uint32_t)1<<1; - minute -= 2; - } - else - { - minute_buf &= ~(uint32_t)1<<1; - } - - if (minute >= 1) - { - minute_buf |= (uint32_t)1; - minute -= 1; - } - else - { - minute_buf &= ~(uint32_t)1; - } - - RTC->WA.WM = minute_buf; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteWeekAlarmHour - ޸Сʱ - ֵhour: Сʱ - meridiem(12СʱģʽʱЧ) - 0 AM - 1 PM - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeekAlarmHour(uint32_t hour, uint32_t meridiem) -{ - uint32_t flag,mode; - uint32_t hour_buf = 0; - - /* */ - if (hour >= 24) - return ERROR; - - mode = RTC_ReadHourmode(); - - if(mode == RTC_HOUR12 && hour > 12) //12Сʱģʽɴ12Сʱ - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if(mode == RTC_HOUR24) - { - if (hour >= 20) - { - hour_buf |= (uint32_t)1<<5; - hour -= 20; - } - else - { - hour_buf &= ~((uint32_t)1<<5); - } - } - else - { - if(meridiem == 1) - hour_buf |= (uint32_t)1<<5; - else - hour_buf &= ~((uint32_t)1<<5); - } - - if (hour >= 10) - { - hour_buf |= (uint32_t)1<<4; - hour -= 10; - } - else - { - hour_buf &= ~((uint32_t)1<<4); - } - - if (hour >= 8) - { - hour_buf |= (uint32_t)1<<3; - hour -= 8; - } - else - { - hour_buf &= ~((uint32_t)1<<3); - } - - if (hour >= 4) - { - hour_buf |= (uint32_t)1<<2; - hour -= 4; - } - else - { - hour_buf &= ~((uint32_t)1<<2); - } - - if (hour >= 2) - { - hour_buf |= (uint32_t)1<<1; - hour -= 2; - } - else - { - hour_buf &= ~((uint32_t)1<<1); - } - - if (hour >= 1) - { - hour_buf |= (uint32_t)1; - hour -= 1; - } - else - { - hour_buf &= ~(uint32_t)1; - } - - RTC->WA.WH = hour_buf; - - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} -/*************************************************************** - RTC_WriteWeekAlarmWeek - ޸ - ֵweek: ڣ0-6 - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeekAlarmWeek(uint32_t week) -{ - uint32_t flag; - - /* */ - if (week > 6) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - RTC->WA.WW = week; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteDayAlarmMinute - ޸ķ - ֵminute: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteDayAlarmMinute(uint32_t minute) -{ - uint32_t flag,minute_buf; - - /* */ - if (minute >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (minute >= 40) - { - minute_buf |= (uint32_t)1<<6; - minute -= 40; - } - else - { - minute_buf &= ~(uint32_t)1<<6; - } - - if (minute >= 20) - { - minute_buf |= (uint32_t)1<<5; - minute -= 20; - } - else - { - minute_buf &= ~(uint32_t)1<<5; - } - - if (minute >= 10) - { - minute_buf |= (uint32_t)1<<4; - minute -= 10; - } - else - { - minute_buf &= ~(uint32_t)1<<4; - } - - if (minute >= 8) - { - minute_buf |= (uint32_t)1<<3; - minute -= 8; - } - else - { - minute_buf &= ~(uint32_t)1<<3; - } - - if (minute >= 4) - { - minute_buf |= (uint32_t)1<<2; - minute -= 4; - } - else - { - minute_buf &= ~(uint32_t)1<<2; - } - - if (minute >= 2) - { - minute_buf |= (uint32_t)1<<1; - minute -= 2; - } - else - { - minute_buf &= ~(uint32_t)1<<1; - } - - if (minute >= 1) - { - minute_buf |= (uint32_t)1; - minute -= 1; - } - else - { - minute_buf &= ~(uint32_t)1; - } - - RTC->DA.DM = minute_buf; - - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteDayAlarmHour - ޸Сʱ - ֵhour: Сʱ - meridiem(12СʱģʽʱЧ) - 0 AM - 1 PM - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteDayAlarmHour(uint32_t hour, uint32_t meridiem) -{ - uint32_t flag,mode; - uint32_t hour_buf = 0; - - /* */ - if (hour >= 24) - return ERROR; - - mode = RTC_ReadHourmode(); - - if(mode == RTC_HOUR12 && hour > 12) //12Сʱģʽɴ12Сʱ - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if(mode == RTC_HOUR24) - { - if (hour >= 20) - { - hour_buf |= (uint32_t)1<<5; - hour -= 20; - } - else - { - hour_buf &= ~((uint32_t)1<<5); - } - } - else - { - if(meridiem == 1) - hour_buf |= (uint32_t)1<<5; - else - hour_buf &= ~((uint32_t)1<<5); - } - - if (hour >= 10) - { - hour_buf |= (uint32_t)1<<4; - hour -= 10; - } - else - { - hour_buf &= ~((uint32_t)1<<4); - } - - if (hour >= 8) - { - hour_buf |= (uint32_t)1<<3; - hour -= 8; - } - else - { - hour_buf &= ~((uint32_t)1<<3); - } - - if (hour >= 4) - { - hour_buf |= (uint32_t)1<<2; - hour -= 4; - } - else - { - hour_buf &= ~((uint32_t)1<<2); - } - - if (hour >= 2) - { - hour_buf |= (uint32_t)1<<1; - hour -= 2; - } - else - { - hour_buf &= ~((uint32_t)1<<1); - } - - if (hour >= 1) - { - hour_buf |= (uint32_t)1; - hour -= 1; - } - else - { - hour_buf &= ~(uint32_t)1; - } - - RTC->DA.DH = hour_buf; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - - -/*************************************************************** - RTC_InterruptEnable - ʹʵʱʱӵijЩж - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵ - ***************************************************************/ -void RTC_InterruptEnable(RTC_Interrupt_Source src) -{ - uint32_t flag; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - switch (src) - { - case RTC_Interrupt_Source_Second: - RTC->IE.SCDIE = 1; - break; - case RTC_Interrupt_Source_Minute: - RTC->IE.MINIE = 1; - break; - case RTC_Interrupt_Source_Hour: - RTC->IE.HORIE = 1; - break; - case RTC_Interrupt_Source_Day: - RTC->IE.DAYIE = 1; - break; - case RTC_Interrupt_Source_Month: - RTC->IE.MONIE = 1; - break; - case RTC_Interrupt_Source_DayALE: - RTC->IE.DALE = 1; - break; - case RTC_Interrupt_Source_WeekALE: - RTC->IE.WALE = 1; - break; - default: - break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - NVIC->ISER[0] |= (1 << 20); // ʹNVICж - return; -} - -/*************************************************************** - RTC_InterruptDisable - ʵʱʱӵijЩж - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵ - ***************************************************************/ -void RTC_InterruptDisable(RTC_Interrupt_Source src) -{ - uint32_t flag; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - switch (src) - { - case RTC_Interrupt_Source_Second: - RTC->IE.SCDIE = 0; - break; - case RTC_Interrupt_Source_Minute: - RTC->IE.MINIE = 0; - break; - case RTC_Interrupt_Source_Hour: - RTC->IE.HORIE = 0; - break; - case RTC_Interrupt_Source_Day: - RTC->IE.DAYIE = 0; - break; - case RTC_Interrupt_Source_Month: - RTC->IE.MONIE = 0; - break; - case RTC_Interrupt_Source_DayALE: - RTC->IE.DALE = 0; - break; - case RTC_Interrupt_Source_WeekALE: - RTC->IE.WALE = 0; - break; - default: - break; - } - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return; -} - -/*************************************************************** - RTC_GetITStatus - ȡʵʱʱӵijЩж״̬ - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵжϱ־ - ***************************************************************/ -ITStatus RTC_GetITStatus(RTC_Interrupt_Source src) -{ - ITStatus result = RESET; - - switch (src) - { - case RTC_Interrupt_Source_Second: - if(RTC->IE.SCDIE) - result = SET; - break; - case RTC_Interrupt_Source_Minute: - if(RTC->IE.MINIE) - result = SET; - break; - case RTC_Interrupt_Source_Hour: - if(RTC->IE.HORIE) - result = SET; - break; - case RTC_Interrupt_Source_Day: - if(RTC->IE.DAYIE) - result = SET; - break; - case RTC_Interrupt_Source_Month: - if(RTC->IE.MONIE) - result = SET; - break; - case RTC_Interrupt_Source_DayALE: - if(RTC->IE.DALE) - result = SET; - break; - case RTC_Interrupt_Source_WeekALE: - if(RTC->IE.WALE) - result = SET; - break; - default: - result = RESET; - break; - } - - return result; -} - -/*************************************************************** - RTC_GetFlagStatus - ȡʵʱʱӵijЩжϱ־ - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵжϱ־ - ***************************************************************/ -FlagStatus RTC_GetFlagStatus(RTC_Interrupt_Source src) -{ - FlagStatus result = RESET; - - switch (src) - { - case RTC_Interrupt_Source_Second: - if(RTC->IF.SCDIF) - result = SET; - break; - case RTC_Interrupt_Source_Minute: - if(RTC->IF.MINIF) - result = SET; - break; - case RTC_Interrupt_Source_Hour: - if(RTC->IF.HORIF) - result = SET; - break; - case RTC_Interrupt_Source_Day: - if(RTC->IF.DAYIF) - result = SET; - break; - case RTC_Interrupt_Source_Month: - if(RTC->IF.MONIF) - result = SET; - break; - case RTC_Interrupt_Source_DayALE: - if(RTC->IF.DAFG) - result = SET; - break; - case RTC_Interrupt_Source_WeekALE: - if(RTC->IF.WAFG) - result = SET; - break; - default: - result = RESET; - break; - } - - return result; -} - -/*************************************************************** - RTC_ClearITPendingBit - ָжϱ־λ - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵ - ***************************************************************/ -void RTC_ClearITPendingBit(RTC_Interrupt_Source src) -{ - uint32_t flag; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - switch (src) - { - case RTC_Interrupt_Source_Second: - RTC->IF.Word = RTC_Interrupt_Source_Second; - break; - case RTC_Interrupt_Source_Minute: - RTC->IF.Word = RTC_Interrupt_Source_Minute; - break; - case RTC_Interrupt_Source_Hour: - RTC->IF.Word = RTC_Interrupt_Source_Hour; - break; - case RTC_Interrupt_Source_Day: - RTC->IF.Word = RTC_Interrupt_Source_Day; - break; - case RTC_Interrupt_Source_Month: - RTC->IF.Word = RTC_Interrupt_Source_Month; - break; - case RTC_Interrupt_Source_DayALE: - RTC->IF.Word = RTC_Interrupt_Source_DayALE; - break; - case RTC_Interrupt_Source_WeekALE: - RTC->IF.Word = RTC_Interrupt_Source_WeekALE; - break; - default: - - break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return; -} - -/*************************END OF FILE**********************/ - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scs.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_scs.c deleted file mode 100644 index 6579ddaee1..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scs.c +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_scs.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ںģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_scs.h" - -/*************************************************************** - NVIC_Init - NVICʼ - ֵChannelжͨ Priorityжȼ Cmdʧܻʹ - ֵ - ֵ - ***************************************************************/ -void NVIC_Init(NVIC_IRQChannel Channel,NVIC_IRQPriority Priority,TYPE_FUNCEN Cmd) -{ - uint32_t tmppriority = 0x00; - - if (Cmd != DISABLE) - { - /* Compute the Corresponding IRQ Priority */ - tmppriority = NVIC->IP[Channel >> 0x02]; - tmppriority &= (uint32_t)(~(((uint32_t)0xFF) << ((Channel & 0x03) * 8))); - tmppriority |= (uint32_t)((((uint32_t)Priority << 6) & 0xFF) << ((Channel & 0x03) * 8)); - - NVIC->IP[Channel >> 0x02] = tmppriority; - - /* Enable the Selected IRQ Channels */ - NVIC->ISER[0] = (uint32_t)0x01 << (Channel & (uint8_t)0x1F); - } - else - { - /* Disable the Selected IRQ Channels */ - NVIC->ICER[0] = (uint32_t)0x01 << (Channel & (uint8_t)0x1F); - } -} - -/*************************************************************** - SCB_SystemLPConfig - ϵͳģʽ - ֵLowPowerModeģʽ NewStateʹܡʹ - ֵ - ֵ - ***************************************************************/ -void SCB_SystemLPConfig(SCB_TYPE_SCR LowPowerMode, TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - SCB->SCR |= LowPowerMode; - else - SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode); -} - -/*************************************************************** - SCB_GetCpuID - ȡCPUID - ֵ - ֵ - ֵ32λIDֵ - ***************************************************************/ -uint32_t SCB_GetCpuID(void) -{ - return (SCB->CPUID); -} - -/*************************************************************** - SysTick_Init - SysTickʼ - ֵʼýṹַ - ֵ - ֵ - ***************************************************************/ -void SysTick_Init(SYSTICK_InitStruType* SysT_InitStruct) -{ - uint32_t temp32 = 0; - - SysTick->LOAD = SysT_InitStruct->SysTick_Value; - SysTick->VAL = (uint32_t)0; - - if(SysT_InitStruct->SysTick_ClkSource != SysTick_ClkS_Base) - temp32 |= 0x00000004; - else - temp32 &= 0xFFFFFFFB; - - if(SysT_InitStruct->SysTick_ITEnable != DISABLE) - temp32 |= 0x00000002; - else - temp32 &= 0xFFFFFFFD; - - SysTick->CTRL = temp32; -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scu.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_scu.c deleted file mode 100644 index 48a3b51ac9..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scu.c +++ /dev/null @@ -1,387 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_scu.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ϵͳģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_scu.h" - -/*************************************************************** - SCU_OpenXTAL - : ⲿʱ - ֵ - ֵ - ֵϵͳʱԴ - ***************************************************************/ -void SCU_OpenXTAL(void) -{ - SCU_RegUnLock(); - SCU->SCLKEN1.XTAL_EN = 1; - SCU->SCLKEN0.XTAL_LP = 0; - while(SCU->SCLKEN1.XTAL_RDY == 0); //ȴⲿʱȶ - SCU_RegLock() ; -} - -/*************************************************************** - SCU_NMISelect - NMIж - ֵж - ֵ - ֵ - ***************************************************************/ -void SCU_NMISelect(SCU_TYPE_NMICS NMI_Type) -{ - SCU_RegUnLock(); - SCU->NMICON.NMICS = NMI_Type; - SCU_RegLock() ; -} - -/*************************************************************** - SCU_GetPWRCFlagStatus - ȡPWRCλ״̬Ĵ־λ״̬ - ֵPWRCĴ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus SCU_GetPWRCFlagStatus(SCU_TYPE_PWRC PWRC_Flag) -{ - FlagStatus bitstatus = RESET; - if((SCU->PWRC.Word & (uint32_t)PWRC_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_ClearPWRCFlagBit - PWRCλ״̬Ĵ־λ - ֵPWRCĴ־λ - ֵ - ֵ - ***************************************************************/ -void SCU_ClearPWRCFlagBit(SCU_TYPE_PWRC PWRC_Flag) -{ - SCU_RegUnLock() ; - SCU->PWRC.Word &= ~((uint32_t)PWRC_Flag); - SCU_RegLock() ; -} - -/*************************************************************** - SCU_GetLVDFlagStatus - ȡLVDDĴ־λ״̬ - ֵLVDĴ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus SCU_GetLVDFlagStatus(SCU_TYPE_LVD0CON LVD_Flag) -{ - FlagStatus bitstatus = RESET; - - if((SCU->LVDCON.Word & (uint32_t)LVD_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_SysClkSelect - ѡϵͳʱ - ֵʱԴ - ֵ - ֵ - ***************************************************************/ -void SCU_SysClkSelect(SCU_TYPE_SYSCLK Sysclk) -{ - SCU_RegUnLock() ; - SCU->SCLKEN0.CLK_SEL = Sysclk; - SCU_RegLock() ; -} - -/*************************************************************** - SCU_GetSysClk - ȡϵͳʱԴ - ֵ - ֵ - ֵϵͳʱԴ - ***************************************************************/ -SCU_TYPE_SYSCLK SCU_GetSysClk(void) -{ - return (SCU_TYPE_SYSCLK)(SCU->SCLKEN0.CLK_SEL); -} - -/*************************************************************** - SCU_HRCReadyFlag - ȡHRCȶ־λ - ֵ - ֵ - ֵRESETȶ/SETȶ - ***************************************************************/ -FlagStatus SCU_HRCReadyFlag(void) -{ - FlagStatus bitstatus = RESET; - - if((SCU->SCLKEN1.HRC_RDY) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_XTALReadyFlag - ȡXTALȶ־λ - ֵ - ֵ - ֵRESETȶ/SETȶ - ***************************************************************/ -FlagStatus SCU_XTALReadyFlag(void) -{ - FlagStatus bitstatus = RESET; - - if((SCU->SCLKEN1.XTAL_RDY) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_LOSCReadyFlag - ȡLOSCȶ־λ - ֵ - ֵ - ֵRESETȶ/SETȶ - ***************************************************************/ -FlagStatus SCU_PLLReadyFlag(void) -{ - FlagStatus bitstatus = RESET; - - if((SCU->SCLKEN1.PLL_RDY) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SystemClockConfig - ϵͳʱãڲʱӣ20MHZʱ - ֵ - ֵ - ֵ -***************************************************************/ -void SystemClockConfig(void) -{ - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU_HRC_Enable(); //ʹڲ20MHZ - while(SCU_HRCReadyFlag() != SET); //ȴʱӿ - SCU_SysClkSelect(SCU_SysClk_HRC); //ѡڲ20MHZΪϵͳʱ - - SCU_SysClk_Div1(); //ϵͳʱӺƵ1:1 - - SystemCoreClock = 20000000; - - if(Prot_Temp != 0) //д - SCU_RegLock(); //д -} - -/*************************************************************** - DeviceClockAllEnable - ʱ - ֵ - ֵ - ֵ - ***************************************************************/ -void DeviceClockAllEnable(void) -{ - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU->PCLKEN0.Word = 0xFFFFFFFF; - SCU->PCLKEN1.Word = 0xFFFFFFFF; //ʱ - - if(Prot_Temp != 0) //д - SCU_RegLock(); //д -} - -/*************************************************************** - DeviceClockAllDisable - رʱ - ֵ - ֵ - ֵ - ***************************************************************/ -void DeviceClockAllDisable(void) -{ - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU->PCLKEN0.Word = 0x00000000; //رʱӣscu޷ر - SCU->PCLKEN1.Word = 0x00000000; - - if(Prot_Temp != 0) //д - SCU_RegLock(); //д -} - -/*************************************************************** - SystemClockConfig - ϵͳʱѡ - ֵCLKx ϵͳʱԴѡ - ֵ - ֵ - ***************************************************************/ -void SystemClockSelect(SCU_TYPE_SYSCLK SYSCLKx , SCU_TYPE_CLK_SEL CLK_SEL) -{ - SCU_RegUnLock(); // - - switch(SYSCLKx) - { - case 0: - SCU_HRC_Enable(); - while(SCU_HRCReadyFlag() != SET); - break; - case 1: - SCU_XTAL_Enable(); - while(SCU_XTALReadyFlag() != SET); - break; - case 2: - SCU_PLL_Enable(); - while(SCU_PLLReadyFlag() != SET); - break; - default:break; - } - - SCU->SCLKEN0.SYSCLK_DIV = 0; - SCU->SCLKEN0.CLK_SEL = CLK_SEL; - - SCU_RegLock(); -} - - -/*************************************************************** - PLLClock_Config - PLLʱ,PLLʱΪϵͳʱ - ֵpll_en:ǷPLLpll_originpllʱԴѡpll_outpllƵѡsys_pllϵͳʱǷʹPLLʱ - ֵ - ֵ - ***************************************************************/ -void PLLClock_Config(TYPE_FUNCEN pll_en , SCU_PLL_Origin pll_origin ,SCU_PLL_Out pll_out,TYPE_FUNCEN sys_pll) -{ - SCU_RegUnLock(); - - if(pll_en == DISABLE) //PLLΪֱֹӽֹPLL - { - SCU->SCLKEN0.PLL_MUX = 0; - SCU->SCLKEN1.PLL_BYLOCK = 0; - SCU->SCLKEN0.CLKFLT_BY = 0x00; - SCU->SCLKEN1.PLL_EN = 0; - return; - } - - if((pll_origin == SCU_PLL_HRC)) //ʹڲʱӣ迪ڲʱ - { - if(SCU->SCLKEN1.HRC_RDY == 0) - { - SCU->SCLKEN1.HRC_EN = 1; - while(SCU->SCLKEN1.HRC_RDY == 0); //ȴHRC - } - } - - if((pll_origin == SCU_PLL_XTAL_32K) - || (pll_origin == SCU_PLL_XTAL_4M) - ||(pll_origin == SCU_PLL_XTAL_8M) - || (pll_origin == SCU_PLL_XTAL_16M) - || (pll_origin == SCU_PLL_XTAL_20M)) //ʹⲿʱӣ迪ⲿʱ - { - if(SCU->SCLKEN1.XTAL_RDY == 0) - { - SCU->SCLKEN1.XTAL_EN = 1; - SCU->SCLKEN0.XTAL_LP = 0; - while(SCU->SCLKEN1.XTAL_RDY == 0); //ȴXTAL - } - } - - switch(pll_origin) - { - case SCU_PLL_HRC: - SCU->SCLKEN1.PLL_REF_SEL = 0x00; - break; - case SCU_PLL_LRC: - SCU->SCLKEN1.PLL_REF_SEL = 0x02; - break; - case SCU_PLL_XTAL_32K: - SCU->SCLKEN1.PLL_REF_SEL = 0x03; - break; - case SCU_PLL_XTAL_4M: - SCU->SCLKEN1.PLL_REF_SEL = 0x04; - break; - case SCU_PLL_XTAL_8M: - SCU->SCLKEN1.PLL_REF_SEL = 0x05; - break; - case SCU_PLL_XTAL_16M: - SCU->SCLKEN1.PLL_REF_SEL = 0x06; - break; - case SCU_PLL_XTAL_20M: - SCU->SCLKEN1.PLL_REF_SEL = 0x07; - break; - default: - break; - } - - SCU->SCLKEN1.PLL_48M_SEL = pll_out; //PLLΪ3248Mhz - - SCU->SCLKEN1.PLL_EN = 1; - while(SCU->SCLKEN1.PLL_RDY == 0); - - - if(sys_pll == ENABLE) - { - - if(pll_out == SCU_PLL_32M) - { - SCU->SCLKEN0.CLKFLT_BY = 0; - } - else - { - SCU->SCLKEN0.CLKFLT_BY = 0x55; //48M ʱ˲· - } - SCU->SCLKEN1.PLL_BYLOCK = 1; - SCU->SCLKEN0.PLL_MUX = 1; - } - else - { - SCU->SCLKEN0.PLL_MUX = 0; - SCU->SCLKEN1.PLL_BYLOCK = 0; - SCU->SCLKEN0.CLKFLT_BY = 0x00; - } - - SCU_RegLock(); -} - -/*************************END OF FILE**********************/ - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_spi.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_spi.c deleted file mode 100644 index 666c142dcf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_spi.c +++ /dev/null @@ -1,233 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_spi.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * SPIģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_spi.h" - -/*************************************************************** - SPI0_Init - SPIʼ - ֵʼýṹַ - ֵ - ֵ - ***************************************************************/ -void SPI_Init(SPI_InitStruType* SPI_InitStruct) -{ - uint32_t Temp = 0; - - Temp = SystemCoreClock / (SPI_InitStruct->SPI_Freq * 2); - if(Temp > 254) - Temp = 255; - - SPI0->CKS.CKS = Temp; - - SPI0->CON.DFS = SPI_InitStruct->SPI_Df; - SPI0->CON.MS = SPI_InitStruct->SPI_Mode; - SPI0->CON.DW = SPI_InitStruct->SPI_DW; - SPI0->CON.DRE = SPI_InitStruct->SPI_DelayRec; - SPI0->CON.TME = SPI_InitStruct->SPI_DelaySend; - - Temp = (uint32_t)SPI_InitStruct->SPI_SendDelayPeroid - 1; - if(Temp > 62) - Temp = 63; - - SPI0->CON.TMP = Temp; -} - -/*************************************************************** - SPI0_ITConfig - SPIж - ֵSPI_IEж NewStateʹܡʧ - ֵ - ֵ - ***************************************************************/ -void SPI_ITConfig(SPI_TYPE_IT SPI_IE,TYPE_FUNCEN NewState) -{ - if(NewState != DISABLE) - SPI0->IE.Word |= (uint32_t)SPI_IE; - else - SPI0->IE.Word &= ~((uint32_t)SPI_IE); -} - -/*************************************************************** - SPI0_DataFormatConfig - SPIݸʽ - ֵݸʽ - ֵ - ֵ - ***************************************************************/ -void SPI_DataFormatConfig(SPI_TYPE_DFS Type) -{ - SPI0->CON.DFS = Type; -} - -/*************************************************************** - SPI0_SendByte - SPIһֽڣ8λ - ֵҪ͵ - ֵ - ֵ - ***************************************************************/ -void SPI_SendByte(uint8_t Temp) -{ - SPI0->TBW.Byte[0] = Temp; -} - -/*************************************************************** - SPI0_SendHalfWord - SPIһ֣16λ - ֵҪ͵ - ֵ - ֵ - ***************************************************************/ -void SPI_SendHalfWord(uint16_t Temp) -{ - SPI0->TBW.HalfWord[0] = Temp; -} - -/*************************************************************** - SPI0_SendWord - SPIһ֣32λ - ֵҪ͵ - ֵ - ֵ - ***************************************************************/ -void SPI_SendWord(uint32_t Temp) -{ - SPI0->TBW.Word = Temp; -} - -/*************************************************************** - SPI0_RecByte - SPIһֽ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint8_t SPI_RecByte(void) -{ - return SPI0->RBR.Byte[0]; -} - -/*************************************************************** - SPI0_RecHalfWord - SPIһ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint16_t SPI_RecHalfWord(void) -{ - return SPI0->RBR.HalfWord[0]; -} - -/*************************************************************** - SPI0_RecWord - SPIһ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint32_t SPI_RecWord(void) -{ - return SPI0->RBR.Word; -} - -/*************************************************************** - SPI0_TBIMConfig - SPIͻжģʽѡ - ֵжģʽ - ֵ - ֵ - ***************************************************************/ -void SPI_TBIMConfig(SPI_TYPE_TRBIM Type) -{ - SPI0->IE.TBIM = Type; -} - -/*************************************************************** - SPI0_RBIMConfig - SPIջжģʽѡ - ֵжģʽ - ֵ - ֵ - ***************************************************************/ -void SPI_RBIMConfig(SPI_TYPE_TRBIM Type) -{ - SPI0->IE.RBIM = Type; -} - -/*************************************************************** - SPI0_GetFlagStatus - SPI־λ״̬ - ֵ־λ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus SPI_GetFlagStatus(SPI_TYPE_FLAG Flag) -{ - FlagStatus bitstatus = RESET; - - /* ȡĴ */ - if((uint32_t)Flag <= 0x00000040) - { - if ((SPI0->IF.Word & Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - } - - else - { - if ((SPI0->STA.Word & Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - } - - return bitstatus; -} - -/*************************************************************** - SPI0_GetITStatus - SPIж״̬,δʹӦжʱ᷵SET - ֵжϱ־λ - ֵ - ֵSET/RESET - ***************************************************************/ -ITStatus SPI_GetITStatus(SPI_TYPE_IT Flag) -{ - FlagStatus bitstatus = RESET; - uint32_t itstatus = 0x0, itenable = 0x0; - - itstatus = SPI0->IF.Word & (uint32_t)Flag; - itenable = SPI0->IE.Word & (uint32_t)Flag; - - if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET)) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SPI0_ClearITPendingBit - SPIжϱ־ - ֵ־λ - ֵ - ֵ - ***************************************************************/ -void SPI_ClearITPendingBit(SPI_CLR_IF Flag) -{ - SPI0->IF.Word = (uint32_t)Flag; -} - -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_timer.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_timer.c deleted file mode 100644 index 495e53b4cf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_timer.c +++ /dev/null @@ -1,569 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_timer.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ʱģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_timer.h" - -/*************************************************************** - T16Nx_BaseInit - T16Nxʼ - ֵT16NxT16N0/1/2/3 TIM_BaseInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T16Nx_BaseInit(T16N_TypeDef* T16Nx,TIM_BaseInitStruType* TIM_BaseInitStruct) -{ - T16Nx->CON0.CS = TIM_BaseInitStruct->TIM_ClkS; - T16Nx->CON0.SYNC = TIM_BaseInitStruct->TIM_SYNC; - T16Nx->CON0.EDGE = TIM_BaseInitStruct->TIM_EDGE; - T16Nx->CON0.MOD = TIM_BaseInitStruct->TIM_Mode; -} -/*************************************************************** - T32Nx_BaseInit - T32Nxʼ - ֵT32NxT32N0 TIM_BaseInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T32Nx_BaseInit(T32N_TypeDef* T32Nx,TIM_BaseInitStruType* TIM_BaseInitStruct) -{ - T32Nx->CON0.CS = TIM_BaseInitStruct->TIM_ClkS; - T32Nx->CON0.SYNC = TIM_BaseInitStruct->TIM_SYNC; - T32Nx->CON0.EDGE = TIM_BaseInitStruct->TIM_EDGE; - T32Nx->CON0.MOD = TIM_BaseInitStruct->TIM_Mode; -} -/*************************************************************** - T16Nx_CapInit - T16Nx׽ʼ - ֵT16NxT16N0/1/2/3 TIM_CapInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T16Nx_CapInit(T16N_TypeDef* T16Nx,TIM_CapInitStruType* TIM_CapInitStruct) -{ - T16Nx->CON1.CAPPE = TIM_CapInitStruct->TIM_CapRise; - T16Nx->CON1.CAPNE = TIM_CapInitStruct->TIM_CapFall; - T16Nx->CON1.CAPIS0 = TIM_CapInitStruct->TIM_CapIS0; - T16Nx->CON1.CAPIS1 = TIM_CapInitStruct->TIM_CapIS1; - T16Nx->CON1.CAPT = TIM_CapInitStruct->TIM_CapTime; -} -/*************************************************************** - T32Nx_CapInit - T32Nx׽ʼ - ֵT32NxT32N0 TIM_CapInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T32Nx_CapInit(T32N_TypeDef* T32Nx,TIM_CapInitStruType* TIM_CapInitStruct) -{ - T32Nx->CON1.CAPPE = TIM_CapInitStruct->TIM_CapRise; - T32Nx->CON1.CAPNE = TIM_CapInitStruct->TIM_CapFall; - T32Nx->CON1.CAPIS0 = TIM_CapInitStruct->TIM_CapIS0; - T32Nx->CON1.CAPIS1 = TIM_CapInitStruct->TIM_CapIS1; - T32Nx->CON1.CAPT = TIM_CapInitStruct->TIM_CapTime; -} -/*************************************************************** - T16Nx_MATxITConfig - T16NxƥĹģʽ - ֵT16NxT16N0/1/2/3 TypeƥĹģʽ - ֵ - ֵ - ***************************************************************/ -void T16Nx_MAT0ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT0S = Type; -} -void T16Nx_MAT1ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT1S = Type; -} -void T16Nx_MAT2ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT2S = Type; -} -void T16Nx_MAT3ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT3S = Type; -} -/*************************************************************** - T32Nx_MATxITConfig - T32NxƥĹģʽ - ֵT32NxT32N0 TypeƥĹģʽ - ֵ - ֵ - ***************************************************************/ -void T32Nx_MAT0ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT0S = Type; -} -void T32Nx_MAT1ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT1S = Type; -} -void T32Nx_MAT2ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT2S = Type; -} -void T32Nx_MAT3ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT3S = Type; -} -/*************************************************************** - T16Nx_MATxOutxConfig - T16Nxƥ˿ڵģʽ - ֵT16NxT16N0/1/2/3 Typeƥ˿ڵĹģʽ - ֵ - ֵ - ***************************************************************/ -void T16Nx_MAT0Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM0 = Type; -} -void T16Nx_MAT1Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM1 = Type; -} -void T16Nx_MAT2Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM2 = Type; -} -void T16Nx_MAT3Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM3 = Type; -} -/*************************************************************** - T32Nx_MATxOutxConfig - T32Nxƥ˿ڵģʽ - ֵT32NxT32N0 Typeƥ˿ڵĹģʽ - ֵ - ֵ - ***************************************************************/ -void T32Nx_MAT0Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM0 = Type; -} -void T32Nx_MAT1Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM1 = Type; -} -void T32Nx_MAT2Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM2 = Type; -} -void T32Nx_MAT3Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM3 = Type; -} -/*************************************************************** - T16Nx_ITConfig - T16Nж - ֵT16NxT16N0/1/2/3 Typeж NewStateʹ/ʧ - ֵ - ֵ - ***************************************************************/ -void T16Nx_ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - T16Nx->IE.Word |= (uint32_t)Type; - else - T16Nx->IE.Word &= (~(uint32_t)Type); -} -/*************************************************************** - T32Nx_ITConfig - T32Nж - ֵT32NxT32N0 Typeж NewStateʹ/ʧ - ֵ - ֵ - ***************************************************************/ -void T32Nx_ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - T32Nx->IE.Word|= (uint32_t)Type; - else - T32Nx->IE.Word &= (~(uint32_t)Type); -} -/*************************************************************** - T16Nx_PWMOutConfig - T16N0OUT0,T16N1OUT0T16N2OUT0T16N3OUT0 áԭΪʹuartƣ˲uartͬʱʹá - ֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_PWMOutConfig(T16N_TypeDef* T16Nx,T16Nx_PWMInitStruType* T16Nx_PWMInitStruct) -{ - T16Nx->CON2.MOE0 = T16Nx_PWMInitStruct->T16Nx_MOE0; //˿0Ƿʹ - T16Nx->CON2.MOE1 = T16Nx_PWMInitStruct->T16Nx_MOE1; //˿1Ƿʹ - T16Nx->CON2.POL0 = T16Nx_PWMInitStruct->T16Nx_POL0; //T16NxOut0 - T16Nx->CON2.POL1 = T16Nx_PWMInitStruct->T16Nx_POL1; //T16NxOut1 -} -/*************************************************************** - T16Nx_PWMBK_Config - PWMɲ - ֵT16NxT16N0/1/2/3 ,Type PWMɲṹ - ֵ - ֵ - ***************************************************************/ -void T16Nx_PWMBK_Config(T16N_TypeDef* T16Nx,T16Nx_PWMBK_Type* type) -{ - T16Nx->CON2.PBKL0 = type->T16Nx_PWMBKL0; //PWMͨ0ɲƽѡ - T16Nx->CON2.PBKL1 = type->T16Nx_PWMBKL1; //PWMͨ1ɲƽѡ - T16Nx->CON2.PBKS = type->T16Nx_PWMBKS; //PWMźԴѡ - T16Nx->CON2.PBKPS = type->T16Nx_PWMBKPS; //PWMͨɲźżѡ - T16Nx->CON2.PBKEN = type->T16Nx_PWMBKEN; //PWMͨɲʹ -} -/*************************************************************** - T16Nx_TRG_Config - : T16N ADCʹ - ֵT16NxT16N0/1/2/3 - ֵ - ֵ - ***************************************************************/ -void T16Nx_TRG_Config(T16N_TypeDef* T16Nx,T16Nx_PWMTRG_type Type,TYPE_FUNCEN NewState) -{ - if(Type == T16Nx_MAT0) - T16Nx->TRG.MAT0TAR = 1; - else if(Type == T16Nx_MAT1) - T16Nx->TRG.MAT1TAR = 1; - else if(Type == T16Nx_MAT2) - T16Nx->TRG.MAT2TAR = 1; - else if(Type == T16Nx_MAT3) - T16Nx->TRG.MAT3TAR = 1; - - T16Nx->TRG.OVTAR = NewState; -} -/*************************************************************** - T16Nx_GetPWMBKF - ȡPWMBKFɲ־λ - ֵT16NxT16N0/1/2/3 - ֵPWMBKF־λֵSETɲ¼RESETδɲ¼ - ֵ - ***************************************************************/ -FlagStatus T16Nx_GetPWMBKF(T16N_TypeDef* T16Nx) -{ - if(T16Nx->CON2.PBKF == 1) - return SET; - else - return RESET; -} -/*************************************************************** - T16Nx_ResetPWMBKF - : PWMBKF־־PWM˿ڻָshuc - ֵT16NxT16N0/1/2/3 - ֵ - ֵ - ***************************************************************/ -void T16Nx_ResetPWMBKF(T16N_TypeDef* T16Nx) -{ - T16Nx->CON2.PBKF = 1; -} -/*************************************************************** - T16Nx_SetCNT - üֵ - ֵT16NxT16N0/1/2/3 Value16λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetCNT(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->CNT.CNT = Value; -} -/*************************************************************** - T32Nx_SetCNT - üֵ - ֵT32NxT32N0 Value32λֵ16λʱҶ룩 - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetCNT(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->CNT.CNT = Value; -} -/*************************************************************** - T16Nx_SetPRECNT - ԤƵĴֵ - ֵT16NxT16N0/1/2/3 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetPRECNT(T16N_TypeDef* T16Nx,uint8_t Value) -{ - T16Nx->PRECNT.PRECNT = Value; -} -/*************************************************************** - T32Nx_SetPRECNT - ԤƵĴֵ - ֵT32NxT32N0 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetPRECNT(T32N_TypeDef* T32Nx,uint8_t Value) -{ - T32Nx->PRECNT.PRECNT = Value - 1; -} -/*************************************************************** - T16Nx_SetPREMAT - ԤƵƥĴֵ - ֵT16NxT16N0/1/2/3 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetPREMAT(T16N_TypeDef* T16Nx,uint8_t Value) -{ - T16Nx->PREMAT.PREMAT = Value - 1; -} -/*************************************************************** - T32Nx_SetPREMAT - ԤƵƥĴֵ - ֵT32NxT32N0 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetPREMAT(T32N_TypeDef* T32Nx,uint8_t Value) -{ - T32Nx->PREMAT.PREMAT = Value - 1; -} -/*************************************************************** - T16Nx_SetMATx - ƥĴ - ֵT16NxT16N0/1/2/3 MATxTIM_MAT0/1/2/3 Value16λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetMAT0(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT0.MAT0 = Value; -} -void T16Nx_SetMAT1(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT1.MAT1 = Value; -} -void T16Nx_SetMAT2(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT2.MAT2 = Value; -} -void T16Nx_SetMAT3(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT3.MAT3 = Value; -} -/*************************************************************** - T32Nx_SetMATx - ƥĴ - ֵT32NxT32N0 MATxTIM_MAT0/1/2/3 Value32λֵ - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetMAT0(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT0.MAT0 = Value; -} -void T32Nx_SetMAT1(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT1.MAT1 = Value; -} -void T32Nx_SetMAT2(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT2.MAT2 = Value; -} -void T32Nx_SetMAT3(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT3.MAT3 = Value; -} -/*************************************************************** - T16Nx_GetMATx - ȡƥĴֵ - ֵT16NxT16N0/1/2/3 - ֵ - ֵ16λֵ - ***************************************************************/ -uint16_t T16Nx_GetMAT0(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT0.MAT0); -} -uint16_t T16Nx_GetMAT1(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT1.MAT1); -} -uint16_t T16Nx_GetMAT2(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT2.MAT2); -} -uint16_t T16Nx_GetMAT3(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT3.MAT3); -} -/*************************************************************** - T32Nx_GetMATx - ȡƥĴֵ - ֵT32NxT32N0/3 MATxTIM_MAT0/1/2/3 - ֵ - ֵ32λֵ - ***************************************************************/ -uint32_t T32Nx_GetMAT0(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT0.MAT0); -} -uint32_t T32Nx_GetMAT1(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT1.MAT1); -} -uint32_t T32Nx_GetMAT2(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT2.MAT2); -} -uint32_t T32Nx_GetMAT3(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT3.MAT3); -} -/*************************************************************** - T16Nx_GetCNT - ȡĴֵ - ֵT16NxT16N0/1/2/3 - ֵ16λֵ - ***************************************************************/ -uint16_t T16Nx_GetCNT(T16N_TypeDef* T16Nx) -{ - return (T16Nx->CNT.CNT); -} -/*************************************************************** - T32Nx_GetCNT - ȡĴֵ - ֵT32NxT32N0/3 - ֵ16/32λֵ - ***************************************************************/ -uint32_t T32Nx_GetCNT(T32N_TypeDef* T32Nx) -{ - return (T32Nx->CNT.CNT); -} -/*************************************************************** - T16Nx_GetPRECNT - ȡԤƵĴֵ - ֵT16NxT16N0/1/2/3 - ֵ - ֵ8λֵ - ***************************************************************/ -uint8_t T16Nx_GetPRECNT(T16N_TypeDef* T16Nx) -{ - return (uint8_t)(T16Nx->PRECNT.PRECNT); -} -/*************************************************************** - T32Nx_GetPRECNT - ȡԤƵĴֵ - ֵT32NxT32N0 - ֵ - ֵ8λֵ - ***************************************************************/ -uint8_t T32Nx_GetPRECNT(T32N_TypeDef* T32Nx) -{ - return (uint8_t)(T32Nx->PRECNT.PRECNT); -} -/*************************************************************** - T16Nx_GetFlagStatus - ȡָ־λ - ֵT16NxT16N0/1/2/3 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus T16Nx_GetFlagStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag) -{ - FlagStatus bitstatus = RESET; - - if((T16Nx->IF.Word & (uint32_t)TIM_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} -/*************************************************************** - T32Nx_GetFlagStatus - ȡָ־λ - ֵT32NxT32N0 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus T32Nx_GetFlagStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag) -{ - FlagStatus bitstatus = RESET; - - if((T32Nx->IF.Word & (uint32_t)TIM_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - T16Nx_GetITStatus - ȡָжϱ־λ,δʹӦжʱ᷵SET - ֵT16NxT16N0/1/2/3 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -ITStatus T16Nx_GetITStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IT TIM_Flag) -{ - ITStatus bitstatus = RESET; - uint32_t itstatus = 0x0, itenable = 0x0; - - itstatus = T16Nx->IF.Word & (uint32_t)TIM_Flag; - itenable = T16Nx->IE.Word & (uint32_t)TIM_Flag; - - if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET)) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} -/*************************************************************** - T32Nx_GetITStatus - ȡָжϱ־λ,δʹӦжʱ᷵SET - ֵT32NxT32N0 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -ITStatus T32Nx_GetITStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IT TIM_Flag) -{ - ITStatus bitstatus = RESET; - uint32_t itstatus = 0x0, itenable = 0x0; - - itstatus = T32Nx->IF.Word & (uint32_t)TIM_Flag; - itenable = T32Nx->IE.Word & (uint32_t)TIM_Flag; - - if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET)) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} -/*************************************************************** - T16Nx_ClearIFPendingBit - ָжϱ־λ - ֵT16NxT16N0/1/2/3 TIM_Flagжϱ־λ - ֵ - ֵ - ***************************************************************/ -void T16Nx_ClearIFPendingBit(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag) -{ - T16Nx->IF.Word = (uint32_t)TIM_Flag; -} -/*************************************************************** - T32Nx_ClearIFPendingBit - ָжϱ־λ - ֵT32NxT32N0 TIM_Flagжϱ־λ - ֵ - ֵ - ***************************************************************/ -void T32Nx_ClearIFPendingBit(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag) -{ - T32Nx->IF.Word = (uint32_t)TIM_Flag; -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_uart.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_uart.c deleted file mode 100644 index 0314562ff0..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_uart.c +++ /dev/null @@ -1,198 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_uart.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * UARTģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_uart.h" - -/*************************************************************** - UART_Init - UARTʼ - ֵUARTxUART0/1/2/3/4/5 UART_InitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void UART_Init(UART_TypeDef* UARTx,UART_InitStruType* UART_InitStruct) -{ - uint32_t BaudClockTemp = 0, BaudTemp = 0; - - if(UART_InitStruct->UART_ClockSet == UART_Clock_1) - { - BaudClockTemp = (SystemCoreClock/16)%UART_InitStruct->UART_BaudRate; - if(UART_InitStruct->UART_BaudRate >= (2*BaudClockTemp)) - { - BaudTemp = (SystemCoreClock/16/UART_InitStruct->UART_BaudRate)-1; - } - else - { - BaudTemp = SystemCoreClock/16/UART_InitStruct->UART_BaudRate; - } - } - else if(UART_InitStruct->UART_ClockSet == UART_Clock_2) - { - BaudClockTemp = (SystemCoreClock/32)%UART_InitStruct->UART_BaudRate; - if(UART_InitStruct->UART_BaudRate >= (2*BaudClockTemp)) - { - BaudTemp = (SystemCoreClock/32/UART_InitStruct->UART_BaudRate)-1; - } - else - { - BaudTemp = SystemCoreClock/32/UART_InitStruct->UART_BaudRate; - } - } - else if(UART_InitStruct->UART_ClockSet == UART_Clock_4) - { - BaudClockTemp = (SystemCoreClock/64)%UART_InitStruct->UART_BaudRate; - if(UART_InitStruct->UART_BaudRate >= (2*BaudClockTemp)) - { - BaudTemp = (SystemCoreClock/64/UART_InitStruct->UART_BaudRate)-1; - } - else - { - BaudTemp = SystemCoreClock/64/UART_InitStruct->UART_BaudRate; - } - } - - if(BaudTemp > 2046) - { - BaudTemp = 2047; - } - - UARTx->CON.BCS = UART_InitStruct->UART_ClockSet; - UARTx->BRR.BRR = BaudTemp ; - - UARTx->CON.TXFS = UART_InitStruct->UART_StopBits; - UARTx->CON.TXMOD = UART_InitStruct->UART_TxMode; - UARTx->CON.TXP = UART_InitStruct->UART_TxPolar; - UARTx->CON.RXMOD = UART_InitStruct->UART_RxMode; - UARTx->CON.RXP = UART_InitStruct->UART_RxPolar; -} -/*************************************************************** - UART_ITConfig - UARTж - ֵUARTxUART0/1/2/3/4/5 UART_ITж NewStateʹ/ʧ - ֵ - ֵ - ***************************************************************/ -void UART_ITConfig(UART_TypeDef* UARTx,UART_TYPE_IT UART_IT,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - UARTx->IE.Word = (UARTx->IE.Word & (uint32_t)0x0000FFFF) | (uint32_t) UART_IT; - else - UARTx->IE.Word = (UARTx->IE.Word & (uint32_t)0x0000FFFF) & (~((uint32_t) UART_IT)); -} -/*************************************************************** - UART_TBIMConfig - UARTͻжģʽѡ - ֵUARTxUART0/1/2/3/4/5 Typeжģʽ - ֵ - ֵ - ***************************************************************/ -void UART_TBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type) -{ - UARTx->IE.TBIM = Type; -} -/*************************************************************** - UART_RBIMConfig - UARTջжģʽѡ - ֵUARTxUART0/1/2/3 Typeжģʽ - ֵ - ֵ - ***************************************************************/ -void UART_RBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type) -{ - UARTx->IE.RBIM = Type; -} -/*************************************************************** - UART_Sendxxxx - UARTֽڡ֡ - ֵUARTxUART0/1/2/3/4/5 - ֵ - ֵ - ***************************************************************/ -void UART_SendByte(UART_TypeDef* UARTx,uint8_t Temp08) -{ - UARTx->TBW.Byte[0] = Temp08; -} -void UART_SendHalfWord(UART_TypeDef* UARTx,uint16_t Temp16) -{ - UARTx->TBW.HalfWord[0] = Temp16; -} -void UART_SendWord(UART_TypeDef* UARTx,uint32_t Temp32) -{ - UARTx->TBW.Word = Temp32; -} -/*************************************************************** - UART_Recxxxx - UARTֽڡ֡ - ֵUARTxUART0/1/2/3/4/5 - ֵ - ֵ - ***************************************************************/ -uint8_t UART_RecByte(UART_TypeDef* UARTx) -{ - return UARTx->RBR.Byte[0]; -} -uint16_t UART_RecHalfWord(UART_TypeDef* UARTx) -{ - return UARTx->RBR.HalfWord[0]; -} -uint32_t UART_RecWord(UART_TypeDef* UARTx) -{ - return UARTx->RBR.Word; -} -/*************************************************************** - UART_GetFlagStatus - UARTȡ־λ״̬ - ֵUARTxUART0/1/2/3/4/5 UART_Flag־λ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx,UART_TYPE_FLAG UART_Flag) -{ - FlagStatus bitstatus = RESET; - - if ((UARTx->IF.Word & ((uint32_t)UART_Flag)) != RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - UART_GetITStatus - UARTȡж״̬ - ֵUARTxUART0/1/2/3/4/5 UART_Flag־λ - ֵ - ֵSET/RESET - ***************************************************************/ -ITStatus UART_GetITStatus(UART_TypeDef* UARTx,UART_TYPE_IT UART_IT) -{ - FlagStatus bitstatus = RESET; - - if((UARTx->IE.Word & ((uint32_t)UART_IT)) == 0) - bitstatus = RESET; - else - bitstatus = SET; - - return bitstatus; -} -/*************************************************************** - UART_ClearIFPendingBit - UART־λ - ֵUARTxUART0/1/2/3/4/5 UART_Flag־λ - ֵ - ֵ - ***************************************************************/ -void UART_ClearIFPendingBit(UART_TypeDef* UARTx,UART_CLR_IF UART_Flag) -{ - UARTx->IF.Word = (uint32_t)UART_Flag; -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_wdt.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_wdt.c deleted file mode 100644 index 2218a204a9..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_wdt.c +++ /dev/null @@ -1,172 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_wdt.c - * ߣ Liut - * V1.00 - * ڣ 2017/02/04 - * Źģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_wdt.h" - -/************************************* - IWDT_Init - IWDTʼ - ֵʼṹ - ֵ - **************************************/ -void IWDT_Init(IWDT_InitStruType *WDT_InitStruct) -{ - uint32_t tmp; - - if (WDT_InitStruct->WDT_Clock != WDT_CLOCK_PCLK) - tmp = (uint32_t)(32 * WDT_InitStruct->WDT_Tms); - else - tmp = SystemCoreClock / 1000 * WDT_InitStruct->WDT_Tms; - - IWDT->LOAD.LOAD = tmp; - IWDT->CON.CLKS = WDT_InitStruct->WDT_Clock; - IWDT->CON.IE = WDT_InitStruct->WDT_IE; - IWDT->CON.RSTEN = WDT_InitStruct->WDT_Rst; - - return; -} - -/************************************* - IWDT_SetReloadValue - WDTصijֵ - ֵʼֵ32-bit޷ - ֵ - **************************************/ -void IWDT_SetReloadValue(uint32_t Value) -{ - IWDT->LOAD.LOAD = Value; - return; -} - -/************************************* - IWDT_GetValue - ȡWDTǰֵ - ֵ - ֵǰֵ - **************************************/ -uint32_t IWDT_GetValue(void) -{ - return (uint32_t)IWDT->VALUE.VALUE; -} - -/************************************* - IWDT_GetFlagStatus - ȡWDTж״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus IWDT_GetFlagStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (IWDT->RIS.WDTIF != RESET) - bitstatus = SET; - - return bitstatus; -} - -/************************************* - IWDT_GetITStatus - ȡWDTʹж״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus IWDT_GetITStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (IWDT->CON.IE != RESET) - bitstatus = SET; - - return bitstatus; -} - -/************************************* - WWDT_Init - WWDTʼ - ֵʼṹ - ֵ - **************************************/ -void WWDT_Init(WWDT_InitStruType *WDT_InitStruct) -{ - uint32_t tmp; - - if (WDT_InitStruct->WDT_Clock != WDT_CLOCK_PCLK) - tmp = (uint32_t)(32 * WDT_InitStruct->WDT_Tms); - else - tmp = SystemCoreClock / 1000 * WDT_InitStruct->WDT_Tms; - - WWDT->LOAD.LOAD = tmp; - WWDT->CON.CLKS = WDT_InitStruct->WDT_Clock; - WWDT->CON.IE = WDT_InitStruct->WDT_IE; - WWDT->CON.RSTEN = WDT_InitStruct->WDT_Rst; - WWDT->CON.WWDTWIN = WDT_InitStruct->WDT_Win; - - return; -} - -/************************************* - WWDT_SetReloadValue - WDTصijֵ - ֵʼֵ32-bit޷ - ֵ - **************************************/ -void WWDT_SetReloadValue(uint32_t Value) -{ - WWDT->LOAD.LOAD = Value; - return; -} - -/************************************* - WWDT_GetValue - ȡWDTǰֵ - ֵ - ֵǰֵ - **************************************/ -uint32_t WWDT_GetValue(void) -{ - return (uint32_t)WWDT->VALUE.VALUE; -} - -/************************************* - WWDT_GetFlagStatus - ȡWDTж״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus WWDT_GetFlagStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (WWDT->RIS.WWDTIF != RESET) - bitstatus = SET; - - return bitstatus; -} - -/************************************* - WWDT_GetIEStatus - ȡWDTжʹ״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus WWDT_GetITStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (WWDT->CON.IE != RESET) - bitstatus = SET; - - return bitstatus; -} - -/*************************END OF FILE**********************/ - - diff --git a/bsp/essemi/es8p508x/libraries/SConscript b/bsp/essemi/es8p508x/libraries/SConscript deleted file mode 100644 index e67dc9e4e3..0000000000 --- a/bsp/essemi/es8p508x/libraries/SConscript +++ /dev/null @@ -1,27 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() - -# The set of source files associated with this SConscript file. -src = [] - -src += Glob('Library/Source/*.c') -src += ['CMSIS/system_ES8P508x.c'] - -#add for startup script -if rtconfig.CROSS_TOOL == 'gcc': - src = src -elif rtconfig.CROSS_TOOL == 'keil': - src = src + ['CMSIS/startup_ES8P508x.s'] -elif rtconfig.CROSS_TOOL == 'iar': - src = src - -path = [cwd + '/CMSIS', - cwd + '/Library/Include',] - -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) - -Return('group') diff --git a/bsp/essemi/es8p508x/project.uvopt b/bsp/essemi/es8p508x/project.uvopt deleted file mode 100644 index 26bbe6a024..0000000000 --- a/bsp/essemi/es8p508x/project.uvopt +++ /dev/null @@ -1,174 +0,0 @@ - - - - 1.0 - -
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - - - - 0 - 0 - - - - rt-thread - 0x4 - ARM-ADS - - 20000000 - - 1 - 1 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 0 - 0 - 1 - - 0 - - SARMCM3.DLL - - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - - TARMCM1.DLL - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 0 - 0 - 1 - 13 - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - 0 - JL2CM3 - -U12345678 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC800 -FN1 -FF0ES8P508x -FS00 -FL020000 - - - 0 - CMSIS_AGDI - -X"essemi CMSIS-DAP" -U0001A000000A -O207 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -FO15 -FD20000000 -FC6000 -FN1 -FF0ES8P508x -FS00 -FL020000 - - - 0 - UL2CM3 - UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC6000 -FN1 -FF0ES8P508x -FS00000000 -FL020000) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - -
diff --git a/bsp/essemi/es8p508x/project.uvproj b/bsp/essemi/es8p508x/project.uvproj deleted file mode 100644 index 26dac69d04..0000000000 --- a/bsp/essemi/es8p508x/project.uvproj +++ /dev/null @@ -1,790 +0,0 @@ - - - 1.1 -
### uVision Project, (C) Keil Software
- - - rt-thread - 0x4 - ARM-ADS - - - ES8P508xFLXX - ES - IRAM(0x20000000-0x20005FFF) IROM(0x00000000-0x0001FFFF) CLOCK(20000000) CPUTYPE("Cortex-M0") - - "STARTUP\HR\startup_ES8P508x.s" ("ES8P508x Startup Code") - UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC6000 -FN1 -FF0ES8P508x -FS00000000 -FL020000) - 0 - ES8P508x.h - - - - - - - - - - SFD\HR\ES8P508x.SFR - 0 - 0 - - - - HR\ - HR\ - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\ - rt-thread - 1 - 0 - 0 - 1 - 1 - .\build\keil\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - fromelf --text -c ".\build\keil\@L.axf" --output ".\build\keil\@L.txt" - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - - TARMCM1.DLL - - - - - 1 - 0 - 0 - 0 - 16 - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 0 - - 0 - 13 - - - - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - - 1 - 0 - 0 - 1 - 1 - 4096 - - 1 - BIN\UL2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M0" - - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 3 - 5 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x6000 - - - 1 - 0x0 - 0x20000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x20000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x6000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - --c99 - - - .;..\..\..\include;applications;.;drivers;libraries\CMSIS;libraries\Library\Include;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m0;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\common - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x00000000 - 0x20000000 - - - - - - - - - - - - Kernel - - - clock.c - 1 - ..\..\..\src\clock.c - - - - - components.c - 1 - ..\..\..\src\components.c - - - - - device.c - 1 - ..\..\..\src\device.c - - - - - idle.c - 1 - ..\..\..\src\idle.c - - - - - ipc.c - 1 - ..\..\..\src\ipc.c - - - - - irq.c - 1 - ..\..\..\src\irq.c - - - - - kservice.c - 1 - ..\..\..\src\kservice.c - - - - - mem.c - 1 - ..\..\..\src\mem.c - - - - - mempool.c - 1 - ..\..\..\src\mempool.c - - - - - object.c - 1 - ..\..\..\src\object.c - - - - - scheduler.c - 1 - ..\..\..\src\scheduler.c - - - - - signal.c - 1 - ..\..\..\src\signal.c - - - - - thread.c - 1 - ..\..\..\src\thread.c - - - - - timer.c - 1 - ..\..\..\src\timer.c - - - - - Applications - - - main.c - 1 - applications\main.c - - - - - Drivers - - - board.c - 1 - drivers\board.c - - - - - drv_gpio.c - 1 - drivers\drv_gpio.c - - - - - drv_uart.c - 1 - drivers\drv_uart.c - - - - - Libraries - - - irqhandler.c - 1 - libraries\Library\Source\irqhandler.c - - - - - lib_adc.c - 1 - libraries\Library\Source\lib_adc.c - - - - - lib_aes.c - 1 - libraries\Library\Source\lib_aes.c - - - - - lib_crc.c - 1 - libraries\Library\Source\lib_crc.c - - - - - lib_flashiap.c - 1 - libraries\Library\Source\lib_flashiap.c - - - - - lib_gpio.c - 1 - libraries\Library\Source\lib_gpio.c - - - - - lib_iap.c - 1 - libraries\Library\Source\lib_iap.c - - - - - lib_iic.c - 1 - libraries\Library\Source\lib_iic.c - - - - - lib_printf.c - 1 - libraries\Library\Source\lib_printf.c - - - - - lib_rtc.c - 1 - libraries\Library\Source\lib_rtc.c - - - - - lib_scs.c - 1 - libraries\Library\Source\lib_scs.c - - - - - lib_scu.c - 1 - libraries\Library\Source\lib_scu.c - - - - - lib_spi.c - 1 - libraries\Library\Source\lib_spi.c - - - - - lib_timer.c - 1 - libraries\Library\Source\lib_timer.c - - - - - lib_uart.c - 1 - libraries\Library\Source\lib_uart.c - - - - - lib_wdt.c - 1 - libraries\Library\Source\lib_wdt.c - - - - - system_ES8P508x.c - 1 - libraries\CMSIS\system_ES8P508x.c - - - - - startup_ES8P508x.s - 2 - libraries\CMSIS\startup_ES8P508x.s - - - - - cpu - - - backtrace.c - 1 - ..\..\..\libcpu\arm\common\backtrace.c - - - - - div0.c - 1 - ..\..\..\libcpu\arm\common\div0.c - - - - - showmem.c - 1 - ..\..\..\libcpu\arm\common\showmem.c - - - - - cpuport.c - 1 - ..\..\..\libcpu\arm\cortex-m0\cpuport.c - - - - - context_rvds.S - 2 - ..\..\..\libcpu\arm\cortex-m0\context_rvds.S - - - - - DeviceDrivers - - - pin.c - 1 - ..\..\..\components\drivers\misc\pin.c - - - - - serial.c - 1 - ..\..\..\components\drivers\serial\serial.c - - - - - completion.c - 1 - ..\..\..\components\drivers\src\completion.c - - - - - dataqueue.c - 1 - ..\..\..\components\drivers\src\dataqueue.c - - - - - pipe.c - 1 - ..\..\..\components\drivers\src\pipe.c - - - - - ringblk_buf.c - 1 - ..\..\..\components\drivers\src\ringblk_buf.c - - - - - ringbuffer.c - 1 - ..\..\..\components\drivers\src\ringbuffer.c - - - - - waitqueue.c - 1 - ..\..\..\components\drivers\src\waitqueue.c - - - - - workqueue.c - 1 - ..\..\..\components\drivers\src\workqueue.c - - - - - finsh - - - shell.c - 1 - ..\..\..\components\finsh\shell.c - - - - - cmd.c - 1 - ..\..\..\components\finsh\cmd.c - - - - - msh.c - 1 - ..\..\..\components\finsh\msh.c - - - - - - -
diff --git a/bsp/essemi/es8p508x/rtconfig.h b/bsp/essemi/es8p508x/rtconfig.h deleted file mode 100644 index 034174f9ec..0000000000 --- a/bsp/essemi/es8p508x/rtconfig.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef RT_CONFIG_H__ -#define RT_CONFIG_H__ - -/* Automatically generated file; DO NOT EDIT. */ -/* RT-Thread 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 100 -#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_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 "uart5" -#define RT_VER_NUM 0x40002 - -/* RT-Thread Components */ - -#define RT_USING_COMPONENTS_INIT -#define RT_USING_USER_MAIN -#define RT_MAIN_THREAD_STACK_SIZE 2048 -#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 2048 -#define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT -#define FINSH_USING_MSH_ONLY -#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 */ - - -/* peripheral libraries and drivers */ - - -/* miscellaneous packages */ - - -/* samples: kernel and components samples */ - -#define SOC_ES8P508x - -/* Hardware Drivers Config */ - -/* On-chip Peripheral Drivers */ - -#define BSP_USING_GPIO - -/* UART Drivers */ - -#define BSP_USING_UART5 - -/* Onboard Peripheral Drivers */ - -/* Offboard Peripheral Drivers */ - - -#endif diff --git a/bsp/essemi/es8p508x/rtconfig.py b/bsp/essemi/es8p508x/rtconfig.py deleted file mode 100644 index eb371bf3a7..0000000000 --- a/bsp/essemi/es8p508x/rtconfig.py +++ /dev/null @@ -1,135 +0,0 @@ -import os -import sys - -# toolchains options -CROSS_TOOL = 'keil' - -if os.getenv('RTT_CC'): - CROSS_TOOL = os.getenv('RTT_CC') - -# device options -ARCH = 'arm' -CPU = 'cortex-m0' - -# cross_tool provides the cross compiler -# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR -if CROSS_TOOL == 'gcc': # not support gcc yet - PLATFORM = 'gcc' - EXEC_PATH = 'C:/GCC' - -elif CROSS_TOOL == 'keil': - PLATFORM = 'armcc' - EXEC_PATH = 'C:/Keil' - -elif CROSS_TOOL == 'iar': # not support iar yet - PLATFORM = 'iar' - EXEC_PATH = 'C:/IAR' - -if os.getenv('RTT_EXEC_PATH'): - EXEC_PATH = os.getenv('RTT_EXEC_PATH') - -BUILD = 'debug' -#BUILD = 'release' - -if PLATFORM == 'gcc': - # toolchains - PREFIX = 'arm-none-eabi-' - CC = PREFIX + 'gcc' - CXX = PREFIX + 'g++' - AS = PREFIX + 'gcc' - AR = PREFIX + 'ar' - LINK = PREFIX + 'gcc' - TARGET_EXT = 'elf' - SIZE = PREFIX + 'size' - OBJDUMP = PREFIX + 'objdump' - OBJCPY = PREFIX + 'objcopy' - DEVICE = ' -mcpu=' + CPU + ' -mthumb -ffunction-sections -fdata-sections' - CFLAGS = DEVICE - AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb' - LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T drivers/linker_scripts/link.lds' - - CPATH = '' - LPATH = '' - - if BUILD == 'debug': - CFLAGS += ' -O0 -gdwarf-2 -g' - AFLAGS += ' -gdwarf-2' - else: - CFLAGS += ' -O2' - - POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + OBJCPY + ' -O ihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n' -elif PLATFORM == 'armcc': - # toolchains - CC = 'armcc' - AS = 'armasm' - AR = 'armar' - LINK = 'armlink' - TARGET_EXT = 'axf' - - DEVICE = ' --device DARMSTM' - CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' - AFLAGS = DEVICE + ' --apcs=interwork ' - LFLAGS = DEVICE + ' --scatter "drivers/linker_scripts/link.sct" --info sizes --info totals --info unused --info veneers --list rtthread.map --strict' - - CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include' - LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/ARMCC/lib' - - CFLAGS += ' -D__MICROLIB ' - AFLAGS += ' --pd "__MICROLIB SETA 1" ' - LFLAGS += ' --library_type=microlib ' - EXEC_PATH += '/ARM/ARMCC/bin' - - 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 = '-Dewarm' - - 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 += ' --silent' - - AFLAGS = DEVICE - AFLAGS += ' -s+' - AFLAGS += ' -w+' - AFLAGS += ' -r' - AFLAGS += ' --cpu Cortex-M0' - AFLAGS += ' --fpu None' - AFLAGS += ' -S' - - LFLAGS = ' --config "drivers\linker_scripts\link.icf"' - LFLAGS += ' --redirect _Printf=_PrintfTiny' - LFLAGS += ' --redirect _Scanf=_ScanfSmall' - if BUILD == 'debug': - CFLAGS += ' --debug' - CFLAGS += ' -On' - else: - CFLAGS += ' -Oh' - - LFLAGS += ' --entry __iar_program_start' - EXEC_PATH = EXEC_PATH + '/arm/bin/' - POST_ACTION = '' diff --git a/bsp/essemi/es8p508x/template.uvopt b/bsp/essemi/es8p508x/template.uvopt deleted file mode 100644 index 26bbe6a024..0000000000 --- a/bsp/essemi/es8p508x/template.uvopt +++ /dev/null @@ -1,174 +0,0 @@ - - - - 1.0 - -
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - - - - 0 - 0 - - - - rt-thread - 0x4 - ARM-ADS - - 20000000 - - 1 - 1 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 0 - 0 - 1 - - 0 - - SARMCM3.DLL - - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - - TARMCM1.DLL - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 0 - 0 - 1 - 13 - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - 0 - JL2CM3 - -U12345678 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC800 -FN1 -FF0ES8P508x -FS00 -FL020000 - - - 0 - CMSIS_AGDI - -X"essemi CMSIS-DAP" -U0001A000000A -O207 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -FO15 -FD20000000 -FC6000 -FN1 -FF0ES8P508x -FS00 -FL020000 - - - 0 - UL2CM3 - UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC6000 -FN1 -FF0ES8P508x -FS00000000 -FL020000) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - -
diff --git a/bsp/essemi/es8p508x/template.uvproj b/bsp/essemi/es8p508x/template.uvproj deleted file mode 100644 index fe2d881412..0000000000 --- a/bsp/essemi/es8p508x/template.uvproj +++ /dev/null @@ -1,400 +0,0 @@ - - - - 1.1 - -
### uVision Project, (C) Keil Software
- - - - rt-thread - 0x4 - ARM-ADS - - - ES8P508xFLXX - ES - IRAM(0x20000000-0x20005FFF) IROM(0x00000000-0x0001FFFF) CLOCK(20000000) CPUTYPE("Cortex-M0") - - "STARTUP\HR\startup_ES8P508x.s" ("ES8P508x Startup Code") - UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC6000 -FN1 -FF0ES8P508x -FS00000000 -FL020000) - 0 - ES8P508x.h - - - - - - - - - - SFD\HR\ES8P508x.SFR - 0 - 0 - - - - HR\ - HR\ - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\ - rt-thread - 1 - 0 - 0 - 1 - 1 - .\build\keil\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - fromelf --text -c ".\build\keil\@L.axf" --output ".\build\keil\@L.txt" - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - - DARMCM1.DLL - -pCM0 - SARMCM3.DLL - - TARMCM1.DLL - - - - - 1 - 0 - 0 - 0 - 16 - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 0 - - 0 - 13 - - - - - - - - - - - - - - BIN\CMSIS_AGDI.dll - - - - - 1 - 0 - 0 - 1 - 1 - 4096 - - 1 - BIN\UL2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M0" - - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 3 - 5 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x6000 - - - 1 - 0x0 - 0x20000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x20000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x6000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - --c99 - - - - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x00000000 - 0x20000000 - - - - --map --first='startup_M451Series.o(RESET)' --datacompressor=off --info=inline --entry Reset_Handler - - - - - - - - -