delete essemi bsp es32f0334 (all)
This commit is contained in:
parent
7d5a97e3ea
commit
d77b9d8234
|
@ -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
|
|
@ -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
|
|
@ -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)
|
||||
|
|
@ -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')
|
|
@ -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)
|
|
@ -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')
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#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;
|
||||
}
|
|
@ -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
|
|
@ -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')
|
|
@ -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 <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
#include "drv_gpio.h"
|
||||
#include <ald_cmu.h>
|
||||
#include <ald_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)
|
||||
{
|
||||
/* 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);
|
||||
}
|
|
@ -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 <rtthread.h>
|
||||
#include <es32f033x.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#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);
|
|
@ -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 <rtthread.h>
|
||||
#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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* 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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
/* 引脚编号,通过查看驱动文件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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
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);
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#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);
|
|
@ -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 <rtthread.h>
|
||||
|
||||
#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);
|
|
@ -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 <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "board.h"
|
||||
#include "drv_adc.h"
|
||||
#include <ald_gpio.h>
|
||||
#include <ald_adc.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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 <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
#include "board.h"
|
||||
#include "drv_gpio.h"
|
||||
#include <ald_cmu.h>
|
||||
#include <ald_gpio.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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 <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <drv_hwtimer.h>
|
||||
#include <board.h>
|
||||
#include <ald_cmu.h>
|
||||
#include <ald_timer.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <rtdbg.h>
|
||||
#include "board.h"
|
||||
#include "drv_i2c.h"
|
||||
#include <ald_i2c.h>
|
||||
#include <ald_gpio.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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 <board.h>
|
||||
#include <drv_lptim.h>
|
||||
#include <ald_lptim.h>
|
||||
|
||||
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);
|
|
@ -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 <rtthread.h>
|
||||
|
||||
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__ */
|
|
@ -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 <rthw.h>
|
||||
#include <board.h>
|
||||
#include <rtdevice.h>
|
||||
#include <drv_lptim.h>
|
||||
#include <ald_cmu.h>
|
||||
#include <ald_pmu.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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 <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <board.h>
|
||||
#include <ald_cmu.h>
|
||||
#include <ald_timer.h>
|
||||
#include <ald_gpio.h>
|
||||
|
||||
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);
|
|
@ -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
|
|
@ -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 <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
#include "board.h"
|
||||
#include "drv_rtc.h"
|
||||
#include <ald_cmu.h>
|
||||
#include <ald_rtc.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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 <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <string.h>
|
||||
#include <rthw.h>
|
||||
#include "board.h"
|
||||
#include "drv_spi.h"
|
||||
#include <ald_spi.h>
|
||||
#include <ald_gpio.h>
|
||||
#include <ald_cmu.h>
|
||||
|
||||
#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
|
|
@ -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 <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
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
|
|
@ -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 <rtthread.h>
|
||||
#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
|
|
@ -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
|
|
@ -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 <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
#include <ald_gpio.h>
|
||||
#include <ald_uart.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.2 MiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 MiB |
Binary file not shown.
Before Width: | Height: | Size: 150 KiB |
Binary file not shown.
Before Width: | Height: | Size: 172 KiB |
Binary file not shown.
Before Width: | Height: | Size: 201 KiB |
Binary file not shown.
Before Width: | Height: | Size: 210 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -1,871 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>rt-thread</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ES32F0334LT</Device>
|
||||
<Vendor>Eastsoft</Vendor>
|
||||
<PackID>Eastsoft.ES32_DFP.7.2350</PackID>
|
||||
<PackURL>http://www.essemi.com</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F033x -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM))</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ES32F0334LT$Device\Include\es32f033x.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:ES32F0334LT$SVD\es32f0xx.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\build\keil\</OutputDirectory>
|
||||
<OutputName>rtthread</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\build\keil\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin !L --output rtthread.bin</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> -MPU </SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU </TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M0"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>0</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x8000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x8000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>1</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define>ES32F033x</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>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</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<uClangAs>0</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>1</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x08000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile></ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>Applications</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>applications\main.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>cpu</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>backtrace.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\libcpu\arm\common\backtrace.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>div0.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\libcpu\arm\common\div0.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>showmem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\libcpu\arm\common\showmem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cpuport.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\libcpu\arm\cortex-m0\cpuport.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>context_rvds.S</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\libcpu\arm\cortex-m0\context_rvds.S</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>DeviceDrivers</GroupName>
|
||||
<GroupOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>0</ComprImg>
|
||||
</CommonProperty>
|
||||
<GroupArmAds>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>0</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define> </Define>
|
||||
<Undefine> </Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>2</interw>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<thumb>2</thumb>
|
||||
<SplitLS>2</SplitLS>
|
||||
<SwStkChk>2</SwStkChk>
|
||||
<NoWarn>2</NoWarn>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<useXO>2</useXO>
|
||||
<uClangAs>2</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
</GroupArmAds>
|
||||
</GroupOption>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>hwtimer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\hwtimer\hwtimer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>i2c_core.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\i2c\i2c_core.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>i2c_dev.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\i2c\i2c_dev.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>i2c-bit-ops.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>pin.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\misc\pin.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\misc\adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rt_drv_pwm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\misc\rt_drv_pwm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>pm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\pm\pm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rtc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\rtc\rtc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>serial.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\serial\serial.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>spi_core.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\spi\spi_core.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>spi_dev.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\spi\spi_dev.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>completion.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\src\completion.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dataqueue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\src\dataqueue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>pipe.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\src\pipe.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ringblk_buf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\src\ringblk_buf.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ringbuffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\src\ringbuffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>waitqueue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\src\waitqueue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>workqueue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\drivers\src\workqueue.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>board.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\board.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>drv_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>drv_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_uart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>finsh</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>shell.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\finsh\shell.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cmd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\finsh\cmd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msh.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\components\finsh\msh.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Kernel</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>clock.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\clock.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>components.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\components.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>device.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\device.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>idle.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\idle.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ipc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\ipc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>irq.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\irq.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>kservice.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\kservice.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\mem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mempool.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\mempool.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>object.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\object.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>scheduler.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\scheduler.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>signal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\signal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>thread.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\thread.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\src\timer.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Libraries</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ald_acmp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_acmp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_adc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_adc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_bkpc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_bkpc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_calc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_calc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_cmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_cmu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_crc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_crc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_crypt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_crypt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_dma.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_flash_ext.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_flash_ext.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_iap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_iap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_lcd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lcd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_lptim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lptim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_lpuart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_lpuart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_pis.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_pis.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_pmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_pmu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_rmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_rmu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_rtc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_rtc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_smartcard.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_smartcard.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_trng.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_trng.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_tsense.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_tsense.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_usart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ald_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\ald_wdt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>libraries\ES32F033x_ALD_StdPeriph_Driver\Source\utils.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_es32f033x.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>libraries\CMSIS\Device\EastSoft\es32f033x\Startup\keil\startup_es32f033x.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components/>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
</Project>
|
|
@ -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
|
|
@ -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 = ''
|
|
@ -1,182 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj; *.o</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
<nMigrate>0</nMigrate>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>rt-thread</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
<RunAbUc>0</RunAbUc>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\keil\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>255</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
<tRSysVw>1</tRSysVw>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>3</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\CMSIS_AGDI.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>CMSIS_AGDI</Key>
|
||||
<Name>-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)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>JL2CM3</Key>
|
||||
<Name>-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)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F033x -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM))</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<bLintAuto>0</bLintAuto>
|
||||
<bAutoGenD>0</bAutoGenD>
|
||||
<LntExFlags>0</LntExFlags>
|
||||
<pMisraName></pMisraName>
|
||||
<pszMrule></pszMrule>
|
||||
<pSingCmds></pSingCmds>
|
||||
<pMultCmds></pMultCmds>
|
||||
<pMisraNamep></pMisraNamep>
|
||||
<pszMrulep></pszMrulep>
|
||||
<pSingCmdsp></pSingCmdsp>
|
||||
<pMultCmdsp></pMultCmdsp>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
</ProjectOpt>
|
|
@ -1,389 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>rt-thread</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ES32F0334LT</Device>
|
||||
<Vendor>Eastsoft</Vendor>
|
||||
<PackID>Eastsoft.ES32_DFP.7.2350</PackID>
|
||||
<PackURL>http://www.essemi.com</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0ES32F033x -FS00 -FL040000 -FP0($$Device:ES32F0334LT$Flash\ES32F033x.FLM))</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ES32F0334LT$Device\Include\es32f033x.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:ES32F0334LT$SVD\es32f0xx.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\build\keil\</OutputDirectory>
|
||||
<OutputName>rtthread</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\build\keil\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin !L --output rtthread.bin</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> -MPU </SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU </TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M0"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>0</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x8000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x8000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>1</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<uClangAs>0</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>1</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x08000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile></ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components/>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue