From b3c7bc964bdab9a4ff04f06e9cfb85bd2f9c6107 Mon Sep 17 00:00:00 2001 From: Jonne Date: Fri, 10 Apr 2020 21:40:33 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0mini2440=20bsp=E5=8C=85:?= =?UTF-8?q?=201=E3=80=81=E5=8A=A0=E5=85=A5Kconfig=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=9B=BE=E5=BD=A2=E5=8C=96=E8=8F=9C=E5=8D=95=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=202=E3=80=81=E7=BC=96=E8=AF=91=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=8A=A8=E6=80=81=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=8F=82=E6=95=B0=203=E3=80=81=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E8=87=AA=E5=8A=A8=E5=88=9D=E5=A7=8B=E5=8C=96=E6=9C=BA?= =?UTF-8?q?=E5=88=B6=E6=94=AF=E6=8C=81=204=E3=80=81=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E4=B8=B2=E5=8F=A3=E9=A9=B1=E5=8A=A8=E4=BB=A5=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=BC=80=E5=90=AFposix=E6=94=AF=E6=8C=81=E5=90=8E=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E6=97=A0=E5=93=8D=E5=BA=94=E9=97=AE=E9=A2=98=205?= =?UTF-8?q?=E3=80=81=E8=A7=A3=E5=86=B3dm9000=E7=BD=91=E5=8D=A1=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8link=20up=E9=97=AE=E9=A2=98=206=E3=80=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0mnt.c=E6=96=87=E4=BB=B6=E7=94=A8=E6=9D=A5=E6=8C=82?= =?UTF-8?q?=E8=BD=BD=E6=96=87=E4=BB=B6=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/mini2440/.config | 513 ++++++++++++++++++++++++ bsp/mini2440/Kconfig | 28 ++ bsp/mini2440/SConstruct | 4 +- bsp/mini2440/applications/application.c | 252 ------------ bsp/mini2440/applications/main.c | 28 ++ bsp/mini2440/applications/mnt.c | 23 ++ bsp/mini2440/applications/startup.c | 165 -------- bsp/mini2440/drivers/SConscript | 4 +- bsp/mini2440/drivers/board.c | 154 +++---- bsp/mini2440/drivers/board.h | 1 - bsp/mini2440/drivers/console.c | 180 --------- bsp/mini2440/drivers/dm9000.c | 7 +- bsp/mini2440/drivers/dm9000.h | 2 +- bsp/mini2440/drivers/key.c | 2 +- bsp/mini2440/drivers/sdcard.c | 9 +- bsp/mini2440/drivers/touch.c | 2 +- bsp/mini2440/drivers/uart.c | 183 +++++++++ bsp/mini2440/rtconfig.h | 353 +++++++++------- bsp/mini2440/rtconfig.py | 13 +- libcpu/arm/s3c24x0/serial.c | 291 -------------- libcpu/arm/s3c24x0/serial.h | 66 --- 21 files changed, 1060 insertions(+), 1220 deletions(-) create mode 100644 bsp/mini2440/.config create mode 100644 bsp/mini2440/Kconfig delete mode 100644 bsp/mini2440/applications/application.c create mode 100644 bsp/mini2440/applications/main.c create mode 100644 bsp/mini2440/applications/mnt.c delete mode 100644 bsp/mini2440/applications/startup.c delete mode 100644 bsp/mini2440/drivers/console.c create mode 100644 bsp/mini2440/drivers/uart.c delete mode 100644 libcpu/arm/s3c24x0/serial.c delete mode 100644 libcpu/arm/s3c24x0/serial.h diff --git a/bsp/mini2440/.config b/bsp/mini2440/.config new file mode 100644 index 0000000000..e10689caa8 --- /dev/null +++ b/bsp/mini2440/.config @@ -0,0 +1,513 @@ +# +# Automatically generated file; DO NOT EDIT. +# RT-Thread Project Configuration +# +CONFIG_BOARD_MINI2440=y + +# +# 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=y +CONFIG_RT_TIMER_THREAD_PRIO=4 +CONFIG_RT_TIMER_THREAD_STACK_SIZE=512 +CONFIG_RT_DEBUG=y +# CONFIG_RT_DEBUG_COLOR is not set +# CONFIG_RT_DEBUG_INIT_CONFIG is not set +# CONFIG_RT_DEBUG_THREAD_CONFIG is not set +# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set +# CONFIG_RT_DEBUG_IPC_CONFIG is not set +# CONFIG_RT_DEBUG_TIMER_CONFIG is not set +# CONFIG_RT_DEBUG_IRQ_CONFIG is not set +# CONFIG_RT_DEBUG_MEM_CONFIG is not set +# CONFIG_RT_DEBUG_SLAB_CONFIG is not set +# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set +# CONFIG_RT_DEBUG_MODULE_CONFIG is not set + +# +# Inter-Thread communication +# +CONFIG_RT_USING_SEMAPHORE=y +CONFIG_RT_USING_MUTEX=y +CONFIG_RT_USING_EVENT=y +CONFIG_RT_USING_MAILBOX=y +CONFIG_RT_USING_MESSAGEQUEUE=y +# CONFIG_RT_USING_SIGNALS is not set + +# +# Memory Management +# +CONFIG_RT_USING_MEMPOOL=y +CONFIG_RT_USING_MEMHEAP=y +# CONFIG_RT_USING_NOHEAP is not set +CONFIG_RT_USING_SMALL_MEM=y +# CONFIG_RT_USING_SLAB is not set +# CONFIG_RT_USING_MEMHEAP_AS_HEAP 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="uart" +CONFIG_RT_VER_NUM=0x40003 +CONFIG_ARCH_ARM=y +# CONFIG_RT_USING_CPU_FFS is not set +CONFIG_ARCH_ARM_ARM9=y +# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set + +# +# RT-Thread Components +# +CONFIG_RT_USING_COMPONENTS_INIT=y +CONFIG_RT_USING_USER_MAIN=y +CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048 +CONFIG_RT_MAIN_THREAD_PRIORITY=10 + +# +# C++ features +# +CONFIG_RT_USING_CPLUSPLUS=y + +# +# 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 is not set +CONFIG_FINSH_ARG_MAX=10 + +# +# Device virtual file system +# +CONFIG_RT_USING_DFS=y +CONFIG_DFS_USING_WORKDIR=y +CONFIG_DFS_FILESYSTEMS_MAX=5 +CONFIG_DFS_FILESYSTEM_TYPES_MAX=5 +CONFIG_DFS_FD_MAX=16 +# CONFIG_RT_USING_DFS_MNTTABLE is not set +CONFIG_RT_USING_DFS_ELMFAT=y + +# +# elm-chan's FatFs, Generic FAT Filesystem Module +# +CONFIG_RT_DFS_ELM_CODE_PAGE=437 +CONFIG_RT_DFS_ELM_WORD_ACCESS=y +# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set +# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set +# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set +CONFIG_RT_DFS_ELM_USE_LFN_3=y +CONFIG_RT_DFS_ELM_USE_LFN=3 +CONFIG_RT_DFS_ELM_MAX_LFN=255 +CONFIG_RT_DFS_ELM_DRIVES=2 +CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512 +# CONFIG_RT_DFS_ELM_USE_ERASE is not set +CONFIG_RT_DFS_ELM_REENTRANT=y +CONFIG_RT_USING_DFS_DEVFS=y +# CONFIG_RT_USING_DFS_ROMFS is not set +CONFIG_RT_USING_DFS_RAMFS=y +# CONFIG_RT_USING_DFS_UFFS is not set +# CONFIG_RT_USING_DFS_JFFS2 is not set +# CONFIG_RT_USING_DFS_NFS is not set + +# +# Device Drivers +# +CONFIG_RT_USING_DEVICE_IPC=y +CONFIG_RT_PIPE_BUFSZ=512 +CONFIG_RT_USING_SYSTEM_WORKQUEUE=y +CONFIG_RT_SYSTEM_WORKQUEUE_STACKSIZE=2048 +CONFIG_RT_SYSTEM_WORKQUEUE_PRIORITY=23 +CONFIG_RT_USING_SERIAL=y +CONFIG_RT_SERIAL_USING_DMA=y +CONFIG_RT_SERIAL_RB_BUFSZ=64 +# CONFIG_RT_USING_CAN is not set +# CONFIG_RT_USING_HWTIMER is not set +# CONFIG_RT_USING_CPUTIME is not set +# CONFIG_RT_USING_I2C is not set +CONFIG_RT_USING_PIN=y +# CONFIG_RT_USING_ADC is not set +# CONFIG_RT_USING_PWM is not set +# CONFIG_RT_USING_MTD_NOR is not set +# CONFIG_RT_USING_MTD_NAND is not set +# CONFIG_RT_USING_PM is not set +# CONFIG_RT_USING_RTC is not set +# CONFIG_RT_USING_SDIO is not set +# CONFIG_RT_USING_SPI is not set +# CONFIG_RT_USING_WDT is not set +# CONFIG_RT_USING_AUDIO is not set +# CONFIG_RT_USING_SENSOR is not set +# CONFIG_RT_USING_TOUCH is not set +# CONFIG_RT_USING_HWCRYPTO is not set +# CONFIG_RT_USING_PULSE_ENCODER is not set +# CONFIG_RT_USING_INPUT_CAPTURE is not set +# CONFIG_RT_USING_WIFI is not set + +# +# Using USB +# +# CONFIG_RT_USING_USB_HOST is not set +# CONFIG_RT_USING_USB_DEVICE is not set + +# +# POSIX layer and C standard library +# +CONFIG_RT_USING_LIBC=y +CONFIG_RT_USING_PTHREADS=y +CONFIG_PTHREAD_NUM_MAX=8 +CONFIG_RT_USING_POSIX=y +CONFIG_RT_USING_POSIX_MMAP=y +CONFIG_RT_USING_POSIX_TERMIOS=y +CONFIG_RT_USING_POSIX_AIO=y +CONFIG_RT_USING_MODULE=y +CONFIG_RT_USING_CUSTOM_DLMODULE=y + +# +# Network +# + +# +# Socket abstraction layer +# +CONFIG_RT_USING_SAL=y + +# +# protocol stack implement +# +CONFIG_SAL_USING_LWIP=y +CONFIG_SAL_USING_POSIX=y + +# +# Network interface device +# +CONFIG_RT_USING_NETDEV=y +CONFIG_NETDEV_USING_IFCONFIG=y +CONFIG_NETDEV_USING_PING=y +CONFIG_NETDEV_USING_NETSTAT=y +CONFIG_NETDEV_USING_AUTO_DEFAULT=y +# CONFIG_NETDEV_USING_IPV6 is not set +CONFIG_NETDEV_IPV4=1 +CONFIG_NETDEV_IPV6=0 +# CONFIG_NETDEV_IPV6_SCOPES is not set + +# +# light weight TCP/IP stack +# +CONFIG_RT_USING_LWIP=y +# CONFIG_RT_USING_LWIP141 is not set +# CONFIG_RT_USING_LWIP202 is not set +CONFIG_RT_USING_LWIP210=y +# CONFIG_RT_USING_LWIP_IPV6 is not set +CONFIG_RT_LWIP_IGMP=y +CONFIG_RT_LWIP_ICMP=y +# CONFIG_RT_LWIP_SNMP is not set +CONFIG_RT_LWIP_DNS=y +CONFIG_RT_LWIP_DHCP=y +CONFIG_IP_SOF_BROADCAST=1 +CONFIG_IP_SOF_BROADCAST_RECV=1 + +# +# Static IPv4 Address +# +CONFIG_RT_LWIP_IPADDR="192.168.0.30" +CONFIG_RT_LWIP_GWADDR="192.168.0.1" +CONFIG_RT_LWIP_MSKADDR="255.255.255.0" +CONFIG_RT_LWIP_UDP=y +CONFIG_RT_LWIP_TCP=y +CONFIG_RT_LWIP_RAW=y +# CONFIG_RT_LWIP_PPP is not set +CONFIG_RT_MEMP_NUM_NETCONN=8 +CONFIG_RT_LWIP_PBUF_NUM=16 +CONFIG_RT_LWIP_RAW_PCB_NUM=4 +CONFIG_RT_LWIP_UDP_PCB_NUM=4 +CONFIG_RT_LWIP_TCP_PCB_NUM=4 +CONFIG_RT_LWIP_TCP_SEG_NUM=40 +CONFIG_RT_LWIP_TCP_SND_BUF=8196 +CONFIG_RT_LWIP_TCP_WND=8196 +CONFIG_RT_LWIP_TCPTHREAD_PRIORITY=10 +CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=8 +CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE=1024 +# CONFIG_LWIP_NO_RX_THREAD is not set +# CONFIG_LWIP_NO_TX_THREAD is not set +CONFIG_RT_LWIP_ETHTHREAD_PRIORITY=12 +CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=1024 +CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=8 +# CONFIG_RT_LWIP_REASSEMBLY_FRAG is not set +CONFIG_LWIP_NETIF_STATUS_CALLBACK=1 +CONFIG_LWIP_NETIF_LINK_CALLBACK=1 +CONFIG_SO_REUSE=1 +CONFIG_LWIP_SO_RCVTIMEO=1 +CONFIG_LWIP_SO_SNDTIMEO=1 +CONFIG_LWIP_SO_RCVBUF=1 +CONFIG_RT_LWIP_NETIF_LOOPBACK=y +CONFIG_LWIP_NETIF_LOOPBACK=1 +CONFIG_RT_LWIP_STATS=y +# CONFIG_RT_LWIP_USING_HW_CHECKSUM is not set +CONFIG_RT_LWIP_USING_PING=y +# CONFIG_RT_LWIP_DEBUG is not set + +# +# AT commands +# +# CONFIG_RT_USING_AT is not set +# CONFIG_LWIP_USING_DHCPD is not set + +# +# VBUS(Virtual Software BUS) +# +# CONFIG_RT_USING_VBUS is not set + +# +# Utilities +# +CONFIG_RT_USING_RYM=y +CONFIG_YMODEM_USING_CRC_TABLE=y +CONFIG_YMODEM_USING_FILE_TRANSFER=y +# CONFIG_RT_USING_ULOG is not set +# CONFIG_RT_USING_UTEST is not set +# CONFIG_RT_USING_LWP is not set + +# +# RT-Thread online packages +# + +# +# IoT - internet of things +# +# CONFIG_PKG_USING_PAHOMQTT is not set +# CONFIG_PKG_USING_WEBCLIENT is not set +# CONFIG_PKG_USING_WEBNET is not set +# CONFIG_PKG_USING_MONGOOSE is not set +# CONFIG_PKG_USING_MYMQTT is not set +# CONFIG_PKG_USING_KAWAII_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_PPP_DEVICE is not set +# CONFIG_PKG_USING_AT_DEVICE is not set +# CONFIG_PKG_USING_ATSRV_SOCKET is not set +# CONFIG_PKG_USING_WIZNET is not set + +# +# IoT Cloud +# +# CONFIG_PKG_USING_ONENET is not set +# CONFIG_PKG_USING_GAGENT_CLOUD is not set +# CONFIG_PKG_USING_ALI_IOTKIT is not set +# CONFIG_PKG_USING_AZURE is not set +# CONFIG_PKG_USING_TENCENT_IOTHUB is not set +# CONFIG_PKG_USING_JIOT-C-SDK is not set +# CONFIG_PKG_USING_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 + +# +# 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 + +# +# language packages +# +# CONFIG_PKG_USING_LUA is not set +# CONFIG_PKG_USING_JERRYSCRIPT is not set +# CONFIG_PKG_USING_MICROPYTHON is not set + +# +# multimedia packages +# +# CONFIG_PKG_USING_OPENMV is not set +# CONFIG_PKG_USING_MUPDF is not set +# CONFIG_PKG_USING_STEMWIN is not set +# CONFIG_PKG_USING_WAVPLAYER is not set +# CONFIG_PKG_USING_TJPGD is not set + +# +# tools packages +# +# CONFIG_PKG_USING_CMBACKTRACE is not set +# CONFIG_PKG_USING_EASYFLASH is not set +# CONFIG_PKG_USING_EASYLOGGER is not set +# CONFIG_PKG_USING_SYSTEMVIEW is not set +# CONFIG_PKG_USING_RDB is not set +# CONFIG_PKG_USING_QRCODE is not set +# CONFIG_PKG_USING_ULOG_EASYFLASH is not set +# CONFIG_PKG_USING_ADBD is not set +# CONFIG_PKG_USING_COREMARK is not set +# CONFIG_PKG_USING_DHRYSTONE is not set +# CONFIG_PKG_USING_NR_MICRO_SHELL is not set +# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set +# CONFIG_PKG_USING_LUNAR_CALENDAR is not set +# CONFIG_PKG_USING_BS8116A is not set + +# +# system packages +# +# CONFIG_PKG_USING_GUIENGINE is not set +# CONFIG_PKG_USING_PERSIMMON is not set +# CONFIG_PKG_USING_CAIRO is not set +# CONFIG_PKG_USING_PIXMAN is not set +# CONFIG_PKG_USING_LWEXT4 is not set +# CONFIG_PKG_USING_PARTITION is not set +# CONFIG_PKG_USING_FAL is not set +# CONFIG_PKG_USING_SQLITE is not set +# CONFIG_PKG_USING_RTI is not set +# CONFIG_PKG_USING_LITTLEVGL2RTT is not set +# CONFIG_PKG_USING_CMSIS is not set +# CONFIG_PKG_USING_DFS_YAFFS is not set +# CONFIG_PKG_USING_LITTLEFS is not set +# CONFIG_PKG_USING_THREAD_POOL is not set +# CONFIG_PKG_USING_ROBOTS is not set +# 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 + +# +# 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_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_EMBARC_BSP is not set +# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS 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 + +# +# miscellaneous packages +# +# CONFIG_PKG_USING_LIBCSV is not set +# CONFIG_PKG_USING_OPTPARSE is not set +# CONFIG_PKG_USING_FASTLZ is not set +# CONFIG_PKG_USING_MINILZO is not set +# CONFIG_PKG_USING_QUICKLZ is not set +# CONFIG_PKG_USING_MULTIBUTTON is not set +# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set +# CONFIG_PKG_USING_CANFESTIVAL is not set +# CONFIG_PKG_USING_ZLIB is not set +# CONFIG_PKG_USING_DSTR is not set +# CONFIG_PKG_USING_TINYFRAME is not set +# CONFIG_PKG_USING_KENDRYTE_DEMO is not set +# CONFIG_PKG_USING_DIGITALCTRL is not set +# CONFIG_PKG_USING_UPACKER is not set +# CONFIG_PKG_USING_UPARAM is not set + +# +# samples: kernel and components samples +# +# CONFIG_PKG_USING_KERNEL_SAMPLES is not set +# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set +# CONFIG_PKG_USING_NETWORK_SAMPLES is not set +# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set +# CONFIG_PKG_USING_HELLO is not set +# CONFIG_PKG_USING_VI is not set +# CONFIG_PKG_USING_NNOM is not set +# CONFIG_PKG_USING_LIBANN is not set +# CONFIG_PKG_USING_ELAPACK is not set +# CONFIG_PKG_USING_ARMv7M_DWT is not set +# CONFIG_PKG_USING_VT100 is not set +# CONFIG_PKG_USING_ULAPACK is not set +# CONFIG_PKG_USING_UKAL is not set diff --git a/bsp/mini2440/Kconfig b/bsp/mini2440/Kconfig new file mode 100644 index 0000000000..44da5183eb --- /dev/null +++ b/bsp/mini2440/Kconfig @@ -0,0 +1,28 @@ +mainmenu "RT-Thread Project Configuration" + +config BSP_DIR + string + option env="BSP_ROOT" + default "." + +config RTT_DIR + string + option env="RTT_ROOT" + default "../.." + +config PKGS_DIR + string + option env="PKGS_ROOT" + default "packages" + +config BOARD_MINI2440 + bool "mini2440" + select ARCH_ARM_ARM9 + select RT_USING_COMPONENTS_INIT + select RT_USING_USER_MAIN + default y + +source "$RTT_DIR/Kconfig" +source "$PKGS_DIR/Kconfig" + + diff --git a/bsp/mini2440/SConstruct b/bsp/mini2440/SConstruct index a89673811c..93120f79ec 100644 --- a/bsp/mini2440/SConstruct +++ b/bsp/mini2440/SConstruct @@ -27,8 +27,8 @@ Export('rtconfig') # prepare building environment objs = PrepareBuilding(env, RTT_ROOT) -if GetDepend('RT_USING_RTGUI'): - objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0) +#if GetDepend('RT_USING_RTGUI'): +# objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0) # libc testsuite # objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0) diff --git a/bsp/mini2440/applications/application.c b/bsp/mini2440/applications/application.c deleted file mode 100644 index 89dbfb6b19..0000000000 --- a/bsp/mini2440/applications/application.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * File : application.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2007-11-20 Yi.Qiu add rtgui application - * 2008-6-28 Bernard no rtgui init - */ - -/** - * @addtogroup mini2440 - */ - -/*@{*/ - -#include -#include "touch.h" -#include "lcd.h" -#include "led.h" -#include "dm9000.h" - -#ifdef RT_USING_DFS -/* dfs filesystem:ELM FatFs filesystem init */ -#include -/* dfs Filesystem APIs */ -#include -#ifdef RT_USING_DFS_UFFS -/* dfs filesystem:UFFS filesystem init */ -#include -#endif -#endif - -#ifdef RT_USING_LWIP -#include -#endif - -#ifdef RT_USING_RTGUI -#include -#endif - -#ifdef RT_USING_FTK -#include "ftk.h" -#endif - -#define RT_INIT_THREAD_STACK_SIZE (2*1024) - -#ifdef RT_USING_DFS_ROMFS -#include -#endif - -#ifdef RT_USING_FTK -static int argc = 1; -static char* argv[] = {"ftk", NULL}; - -void rt_ftk_thread_entry(void *parameter) -{ - int FTK_MAIN(int argc, char *argv[]); - - FTK_MAIN(argc, argv); - - return; -} - -#endif - -void rt_init_thread_entry(void *parameter) -{ -/* Filesystem Initialization */ -#ifdef RT_USING_DFS - { - /* init the device filesystem */ - dfs_init(); - -#if defined(RT_USING_DFS_ELMFAT) - /* init the elm chan FatFs filesystam*/ - elm_init(); - /* mount sd card fat partition 1 as root directory */ - if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) - { - rt_kprintf("File System initialized!\n"); - } - else - rt_kprintf("File System initialzation failed!\n"); -#endif - -#if defined(RT_USING_DFS_ROMFS) - dfs_romfs_init(); - if (dfs_mount(RT_NULL, "/rom", "rom", 0, &romfs_root) == 0) - { - rt_kprintf("ROM File System initialized!\n"); - } - else - rt_kprintf("ROM File System initialzation failed!\n"); -#endif - -#if defined(RT_USING_DFS_DEVFS) - devfs_init(); - if (dfs_mount(RT_NULL, "/dev", "devfs", 0, 0) == 0) - rt_kprintf("Device File System initialized!\n"); - else - rt_kprintf("Device File System initialzation failed!\n"); - - #ifdef RT_USING_NEWLIB - /* init libc */ - libc_system_init("uart0"); - #endif -#endif - -#if defined(RT_USING_DFS) && defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS) - /* NFSv3 Initialization */ - nfs_init(); - - if (dfs_mount(RT_NULL, "/nfs", "nfs", 0, RT_NFS_HOST_EXPORT) == 0) - rt_kprintf("NFSv3 File System initialized!\n"); - else - rt_kprintf("NFSv3 File System initialzation failed!\n"); -#endif - -#if defined(RT_USING_DFS_UFFS) - /* init the uffs filesystem */ - dfs_uffs_init(); - - /* mount flash device as flash directory */ - if (dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0) - rt_kprintf("UFFS File System initialized!\n"); - else - rt_kprintf("UFFS File System initialzation failed!\n"); -#endif - } -#endif - -#ifdef RT_USING_RTGUI - { - extern void rtgui_system_server_init(void); - - rt_device_t lcd; - - /* init lcd */ - rt_hw_lcd_init(); - - /* init touch panel */ - rtgui_touch_hw_init(); - - /* init keypad */ - rt_hw_key_init(); - - /* find lcd device */ - lcd = rt_device_find("lcd"); - - /* set lcd device as rtgui graphic driver */ - rtgui_graphic_set_device(lcd); - - /* initalize rtgui system server */ - rtgui_system_server_init(); - } -#endif - -/* LwIP Initialization */ -#ifdef RT_USING_LWIP - { - extern void lwip_sys_init(void); - eth_system_device_init(); - - /* register ethernetif device */ - rt_hw_dm9000_init(); - - /* init lwip system */ - lwip_sys_init(); - rt_kprintf("TCP/IP initialized!\n"); - } -#endif - -#ifdef RT_USING_FTK - { - rt_thread_t ftk_thread; - - /* init lcd */ - rt_hw_lcd_init(); - - /* init touch panel */ - rtgui_touch_hw_init(); - - /* init keypad */ - rt_hw_key_init(); - - /* create ftk thread */ - ftk_thread = rt_thread_create("ftk", - rt_ftk_thread_entry, RT_NULL, - 10 * 1024, 8, 20); - - /* startup ftk thread */ - if (ftk_thread != RT_NULL) - rt_thread_startup(ftk_thread); - } -#endif -} - -void rt_led_thread_entry(void *parameter) -{ - while (1) - { - /* light on leds for one second */ - rt_hw_led_on(LED2|LED3); - rt_hw_led_off(LED1|LED4); - rt_thread_delay(100); - - /* light off leds for one second */ - rt_hw_led_off(LED2|LED3); - rt_hw_led_on(LED1|LED4); - rt_thread_delay(100); - } -} - -int rt_application_init(void) -{ - rt_thread_t init_thread; - rt_thread_t led_thread; - -#if (RT_THREAD_PRIORITY_MAX == 32) - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - RT_INIT_THREAD_STACK_SIZE, 8, 20); - - led_thread = rt_thread_create("led", - rt_led_thread_entry, RT_NULL, - 512, 20, 20); -#else - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - RT_INIT_THREAD_STACK_SIZE, 80, 20); - - led_thread = rt_thread_create("led", - rt_led_thread_entry, RT_NULL, - 512, 200, 20); -#endif - - if (init_thread != RT_NULL) - rt_thread_startup(init_thread); - - if (led_thread != RT_NULL) - rt_thread_startup(led_thread); - - return 0; -} - -/*@}*/ diff --git a/bsp/mini2440/applications/main.c b/bsp/mini2440/applications/main.c new file mode 100644 index 0000000000..a67ff93f7a --- /dev/null +++ b/bsp/mini2440/applications/main.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +#include "led.h" + +int main(void) +{ + printf("hello rt-thread\n"); + + while (1) + { + /* light on leds for one second */ + rt_hw_led_on(LED2|LED3); + rt_hw_led_off(LED1|LED4); + rt_thread_delay(100); + + /* light off leds for one second */ + rt_hw_led_off(LED2|LED3); + rt_hw_led_on(LED1|LED4); + rt_thread_delay(100); + } + + return 0; +} + + diff --git a/bsp/mini2440/applications/mnt.c b/bsp/mini2440/applications/mnt.c new file mode 100644 index 0000000000..fc9f915167 --- /dev/null +++ b/bsp/mini2440/applications/mnt.c @@ -0,0 +1,23 @@ +#include + +#ifdef RT_USING_DFS +#include +#include "dfs_ramfs.h" + +int mnt_init(void) +{ + + if(dfs_mount(RT_NULL, "/", "ram", 0, dfs_ramfs_create(rt_malloc(1024),1024)) == 0) + { + rt_kprintf("RAM file system initializated!\n"); + } + else + { + rt_kprintf("RAM file system initializate failed!\n"); + } + + return 0; +} +INIT_ENV_EXPORT(mnt_init); +#endif + diff --git a/bsp/mini2440/applications/startup.c b/bsp/mini2440/applications/startup.c deleted file mode 100644 index fab223d834..0000000000 --- a/bsp/mini2440/applications/startup.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * File : startup.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Develop Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2006-02-26 Bernard first implementation - * 2006-05-05 Bernard add two test thread - * 2006-08-10 Bernard use rt_show_version to display version information - * 2008-07-14 Bernard modify the heap memory init parameter - */ - -#include -#include - -#include -#ifdef RT_USING_FINSH -#include -#endif - -extern void rt_hw_interrupt_init(void); -extern void rt_hw_board_init(void); -extern void rt_hw_rtc_init(void); -extern void rt_serial_init(void); -extern void rt_system_timer_init(void); -extern void rt_system_scheduler_init(void); -extern void rt_thread_idle_init(void); -extern void rt_hw_cpu_icache_enable(void); -extern void rt_show_version(void); -extern void rt_system_heap_init(void*, void*); -extern void rt_hw_finsh_init(void); -extern void rt_application_init(void); - -extern struct serial_device uart0; -extern struct rt_device uart0_device; -extern struct serial_device uart2; -extern struct rt_device uart2_device; - -/** - * @addtogroup mini2440 - */ - -/*@{*/ -#if defined(__CC_ARM) - extern int Image$$ER_ZI$$ZI$$Base; - extern int Image$$ER_ZI$$ZI$$Length; - extern int Image$$ER_ZI$$ZI$$Limit; -#elif (defined (__GNUC__)) - rt_uint8_t _irq_stack_start[1024]; - rt_uint8_t _fiq_stack_start[1024]; - rt_uint8_t _undefined_stack_start[512]; - rt_uint8_t _abort_stack_start[512]; - rt_uint8_t _svc_stack_start[4096] SECTION(".nobss"); - extern unsigned char __bss_start; - extern unsigned char __bss_end; -#endif - -#ifdef RT_USING_FINSH -extern int finsh_system_init(void); -#endif - -/** - * This function will startup RT-Thread RTOS. - */ -void rtthread_startup(void) -{ - /* enable cpu cache */ - rt_hw_cpu_icache_enable(); - rt_hw_cpu_dcache_enable(); - - /* init hardware interrupt */ - rt_hw_interrupt_init(); - - /* init board */ - rt_hw_board_init(); - - /* show version */ - rt_show_version(); - - /* init tick */ - rt_system_tick_init(); - - /* init kernel object */ - rt_system_object_init(); - - /* init timer system */ - rt_system_timer_init(); - - /* init heap memory system */ -#ifdef __CC_ARM - rt_system_heap_init((void*)&Image$$ER_ZI$$ZI$$Limit, (void*)0x33F00000); -#else - rt_system_heap_init((void*)&__bss_end, (void*)0x33F00000); -#endif - -#ifdef RT_USING_MODULE - /* init module system*/ - rt_system_module_init(); -#endif - - /* init scheduler system */ - rt_system_scheduler_init(); - -#ifdef RT_USING_DEVICE - /* register uart0 */ - rt_hw_serial_register(&uart0_device, "uart0", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM, - &uart0); - - /* register uart2, used for RTI debug */ - rt_hw_serial_register(&uart2_device, "uart2", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM, - &uart2); - -#ifdef RT_USING_DFS - rt_hw_sdcard_init(); -#ifdef RT_USING_DFS_UFFS - rt_hw_nand_init(); -#endif -#endif - - /* rtc init */ - rt_hw_rtc_init(); -#endif - - /* init application */ - rt_application_init(); - -#ifdef RT_USING_FINSH - /* init finsh */ - finsh_system_init(); -#ifdef RT_USING_DEVICE - finsh_set_device("uart0"); -#endif -#endif - - rt_system_timer_thread_init(); - - /* init idle thread */ - rt_thread_idle_init(); - - /* start scheduler */ - rt_system_scheduler_start(); - - /* never reach here */ - return ; -} - -int main(void) -{ - /* disable interrupt first */ - rt_hw_interrupt_disable(); - - /* startup RT-Thread RTOS */ - rtthread_startup(); - - return 0; -} - -/*@}*/ diff --git a/bsp/mini2440/drivers/SConscript b/bsp/mini2440/drivers/SConscript index 55c8b43cd5..8b36ce3aab 100644 --- a/bsp/mini2440/drivers/SConscript +++ b/bsp/mini2440/drivers/SConscript @@ -8,7 +8,7 @@ cwd = os.path.join(str(Dir('#')), 'drivers') src = Split(""" board.c led.c -console.c +uart.c """) if GetDepend('RT_USING_DFS'): @@ -18,7 +18,7 @@ if GetDepend('RT_USING_LWIP'): src += ['dm9000.c'] if GetDepend('RT_USING_RTGUI'): - src += ['touch.c', 'key.c', 'calibration.c'] + src += ['touch.c', 'key.c'] if GetDepend('RT_USING_FTK'): src += ['touch.c', 'key.c'] diff --git a/bsp/mini2440/drivers/board.c b/bsp/mini2440/drivers/board.c index fc623386b4..14e2e426df 100644 --- a/bsp/mini2440/drivers/board.c +++ b/bsp/mini2440/drivers/board.c @@ -26,6 +26,29 @@ */ /*@{*/ +#if defined(__CC_ARM) + extern int Image$$ER_ZI$$ZI$$Base; + extern int Image$$ER_ZI$$ZI$$Length; + extern int Image$$ER_ZI$$ZI$$Limit; +#elif (defined (__GNUC__)) + rt_uint8_t _irq_stack_start[1024]; + rt_uint8_t _fiq_stack_start[1024]; + rt_uint8_t _undefined_stack_start[512]; + rt_uint8_t _abort_stack_start[512]; + rt_uint8_t _svc_stack_start[4096] SECTION(".nobss"); +#endif + +#if defined(__CC_ARM) +extern int Image$$RW_IRAM1$$ZI$$Limit; +#define HEAP_BEGIN ((void*)&Image$$RW_IRAM1$$ZI$$Limit) +#elif defined(__GNUC__) +extern int __bss_end; +#define HEAP_BEGIN (((void*)&__bss_end) + 0x1000) +#endif + +#define HEAP_END (void*)(0x33F00000) + + extern rt_uint32_t PCLK, FCLK, HCLK, UCLK; extern void rt_hw_clock_init(void); @@ -35,26 +58,6 @@ extern void rt_hw_get_clock(void); extern void rt_hw_set_dividor(rt_uint8_t hdivn, rt_uint8_t pdivn); extern void rt_hw_set_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv); -#define UART0 ((struct uartport *)&U0BASE) -struct serial_int_rx uart0_int_rx; -struct serial_device uart0 = -{ - UART0, - &uart0_int_rx, - RT_NULL -}; -struct rt_device uart0_device; - -#define UART2 ((struct uartport *)&U2BASE) -struct serial_int_rx uart2_int_rx; -struct serial_device uart2 = -{ - UART2, - &uart2_int_rx, - RT_NULL -}; -struct rt_device uart2_device; - /** * This function will handle rtos timer */ @@ -63,92 +66,6 @@ static void rt_timer_handler(int vector, void *param) rt_tick_increase(); } -/** - * This function will handle serial - */ -static void rt_serial0_handler(int vector, void *param) -{ - INTSUBMSK |= (BIT_SUB_RXD0); - - rt_hw_serial_isr(&uart0_device); - - SUBSRCPND |= BIT_SUB_RXD0; - - /* Unmask sub interrupt (RXD0) */ - INTSUBMSK &=~(BIT_SUB_RXD0); -} - -/** - * This function will handle serial - */ -static void rt_serial2_handler(int vector, void *param) -{ - INTSUBMSK |= (BIT_SUB_RXD2); - - rt_hw_serial_isr(&uart2_device); - - SUBSRCPND |= BIT_SUB_RXD2; - - /* Unmask sub interrupt (RXD0) */ - INTSUBMSK &=~(BIT_SUB_RXD2); -} - -/** - * This function will handle init uart - */ -static void rt_hw_uart_init(void) -{ - int i; - /* UART0 port configure */ - GPHCON |= 0xAA; - /* PULLUP is disable */ - GPHUP |= 0xF; - - /* FIFO enable, Tx/Rx FIFO clear */ - uart0.uart_device->ufcon = 0x0; - /* disable the flow control */ - uart0.uart_device->umcon = 0x0; - /* Normal,No parity,1 stop,8 bit */ - uart0.uart_device->ulcon = 0x3; - /* - * tx=level,rx=edge,disable timeout int.,enable rx error int., - * normal,interrupt or polling - */ - uart0.uart_device->ucon = 0x245; - /* Set uart0 bps */ - uart0.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1; - /* output PCLK to UART0/1, PWMTIMER */ - CLKCON |= 0x0D00; - - /* FIFO enable, Tx/Rx FIFO clear */ - uart2.uart_device->ufcon = 0x0; - /* disable the flow control */ - uart2.uart_device->umcon = 0x0; - /* Normal,No parity,1 stop,8 bit */ - uart2.uart_device->ulcon = 0x3; - /* - * tx=level,rx=edge,disable timeout int.,enable rx error int., - * normal,interrupt or polling - */ - uart2.uart_device->ucon = 0x245; - /* Set uart0 bps */ - uart2.uart_device->ubrd = (rt_int32_t)(PCLK / (BPS * 16)) - 1; - - for (i = 0; i < 100; i++); - - /* install uart0 isr */ - INTSUBMSK &= ~(BIT_SUB_RXD0); - - /* install uart2 isr */ - INTSUBMSK &= ~(BIT_SUB_RXD2); - - rt_hw_interrupt_install(INTUART0, rt_serial0_handler, RT_NULL, "UART0"); - rt_hw_interrupt_umask(INTUART0); - - rt_hw_interrupt_install(INTUART2, rt_serial2_handler, RT_NULL, "UART2"); - rt_hw_interrupt_umask(INTUART2); -} - /** * This function will init timer4 for system ticks */ @@ -177,6 +94,12 @@ static void rt_hw_timer_init(void) */ void rt_hw_board_init(void) { + rt_hw_cpu_icache_enable(); + rt_hw_cpu_dcache_enable(); + + /* init hardware interrupt */ + rt_hw_interrupt_init(); + /* initialize the system clock */ rt_hw_clock_init(); @@ -186,14 +109,27 @@ void rt_hw_board_init(void) /* initialize led port */ rt_hw_led_init(); - /* initialize uart */ - rt_hw_uart_init(); - /* initialize mmu */ rt_hw_mmu_init(); /* initialize timer4 */ rt_hw_timer_init(); + + /* initialize system heap */ + rt_system_heap_init(HEAP_BEGIN, HEAP_END); + + rt_components_board_init(); + +#ifdef RT_USING_CONSOLE + rt_console_set_device("uart0"); +#endif + } +#ifdef RT_USING_MODULE +int rt_system_module_init(void) +{ + return 0; +} +#endif /*@}*/ diff --git a/bsp/mini2440/drivers/board.h b/bsp/mini2440/drivers/board.h index 2635ab147a..434f725216 100644 --- a/bsp/mini2440/drivers/board.h +++ b/bsp/mini2440/drivers/board.h @@ -16,7 +16,6 @@ #define __BOARD_H__ #include -#include void rt_hw_board_init(void); void rt_hw_sdcard_init(void); diff --git a/bsp/mini2440/drivers/console.c b/bsp/mini2440/drivers/console.c deleted file mode 100644 index 70a57a7370..0000000000 --- a/bsp/mini2440/drivers/console.c +++ /dev/null @@ -1,180 +0,0 @@ -#include - -#include - -#define RT_CONSOLE_WIDTH 240 -#define RT_CONSOLE_HEIGHT 320 - -#define RT_CONSOLE_FONT_WIDTH 8 -#define RT_CONSOLE_FONT_HEIGHT 16 - -#define RT_CONSOLE_COL (RT_CONSOLE_WIDTH/RT_CONSOLE_FONT_WIDTH) -#define RT_CONSOLE_ROW (RT_CONSOLE_HEIGHT/RT_CONSOLE_FONT_HEIGHT) - -#define RT_CONSOLE_TAB 4 - -#define RT_CONSOLE_FOREPIXEL (0x001f) - -extern struct serial_device uart0; - -struct rt_console -{ - rt_uint8_t* video_ptr; - rt_uint8_t* font_ptr; - - /* bpp and pixel of width */ - rt_uint8_t bpp; - rt_uint32_t pitch; - - /* current cursor */ - rt_uint8_t current_col; - rt_uint8_t current_row; -}; -struct rt_console console; - -void rt_hw_console_init(rt_uint8_t* video_ptr, rt_uint8_t* font_ptr, rt_uint8_t bpp); -void rt_hw_console_newline(void); -void rt_hw_console_putc(char c); -void rt_hw_console_clear(void); - -void rt_hw_console_init(rt_uint8_t* video_ptr, rt_uint8_t* font_ptr, rt_uint8_t bpp) -{ - rt_memset(&console, 0, sizeof(struct rt_console)); - - console.video_ptr = video_ptr; - console.font_ptr = font_ptr; - console.bpp = bpp; - console.pitch = console.bpp * RT_CONSOLE_WIDTH; - - rt_hw_console_clear(); -} - -void rt_hw_console_putc(char c) -{ - switch (c) - { - case 10: - case 11: - case 12: - case 13: - /* to next line */ - rt_hw_console_newline(); - console.current_col = 0; - break; - - case 9: - console.current_col += RT_CONSOLE_TAB; - break; - - default: - { - rt_uint8_t* font_ptr; - register rt_uint32_t cursor; - register rt_uint32_t i, j; - - if (console.current_col == RT_CONSOLE_COL) - { - rt_hw_console_newline(); - console.current_col = 0; - - rt_hw_console_putc(c); - return; - } - - font_ptr = console.font_ptr + c * RT_CONSOLE_FONT_HEIGHT; - cursor = (console.current_row * RT_CONSOLE_FONT_HEIGHT) * console.pitch - + console.current_col * RT_CONSOLE_FONT_WIDTH * console.bpp; - - for (i = 0; i < RT_CONSOLE_FONT_HEIGHT; i ++ ) - { - for (j = 0; j < RT_CONSOLE_FONT_WIDTH; j ++) - { - if ( ((font_ptr[i] >> (7-j)) & 0x01) != 0 ) - { - /* draw a pixel */ - rt_uint8_t *ptr = &(console.video_ptr[cursor + i * console.pitch + j * console.bpp]); - switch(console.bpp) - { - case 1: - *ptr = RT_CONSOLE_FOREPIXEL; - break; - case 2: - *(rt_uint16_t*)ptr = RT_CONSOLE_FOREPIXEL; - break; - case 3: - ptr[0] = RT_CONSOLE_FOREPIXEL & 0xff; - ptr[1] = (RT_CONSOLE_FOREPIXEL >> 8) & 0xff; - ptr[2] = (RT_CONSOLE_FOREPIXEL >> 16) & 0xff; - break; - case 4: - *(rt_uint32_t*)ptr = RT_CONSOLE_FOREPIXEL; - break; - } - } - } - } - - console.current_col ++; - } - break; - } -} - -void rt_hw_console_newline() -{ - console.current_row ++; - if (console.current_row >= RT_CONSOLE_ROW) - { - rt_uint32_t i; - - /* scroll to next line */ - for (i = 0; i < RT_CONSOLE_ROW - 1; i ++) - { - rt_memcpy(console.video_ptr + i * RT_CONSOLE_FONT_HEIGHT * console.pitch, - console.video_ptr + (i + 1) * RT_CONSOLE_FONT_HEIGHT * console.pitch, - RT_CONSOLE_FONT_HEIGHT * console.pitch); - } - - /* clear last line */ - rt_memset(console.video_ptr + (RT_CONSOLE_ROW - 1) * RT_CONSOLE_FONT_HEIGHT * console.pitch, - 0, - RT_CONSOLE_FONT_HEIGHT * console.pitch); - - console.current_row = RT_CONSOLE_ROW - 1; - } -} - -void rt_hw_console_clear() -{ - console.current_col = 0; - console.current_row = 0; - - rt_memset(console.video_ptr, 0, RT_CONSOLE_HEIGHT * console.pitch); -} - -/* write one character to serial, must not trigger interrupt */ -void rt_hw_serial_putc(const char c) -{ - /* - to be polite with serial console add a line feed - to the carriage return character - */ - if (c=='\n')rt_hw_serial_putc('\r'); - - while (!(uart0.uart_device->ustat & USTAT_TXB_EMPTY)); - uart0.uart_device->utxh = (c & 0x1FF); -} - -/** - * This function is used by rt_kprintf to display a string on console. - * - * @param str the displayed string - */ -void rt_hw_console_output(const char* str) -{ - while (*str) - { - rt_hw_serial_putc(*str++); - } -} - diff --git a/bsp/mini2440/drivers/dm9000.c b/bsp/mini2440/drivers/dm9000.c index e3f1f0d634..22afb322c7 100644 --- a/bsp/mini2440/drivers/dm9000.c +++ b/bsp/mini2440/drivers/dm9000.c @@ -287,6 +287,9 @@ static rt_err_t rt_dm9000_init(rt_device_t dev) } } + /* send a notify */ + eth_device_linkchange(&dm9000_device.parent, RT_TRUE); + /* see what we've got */ lnk = phy_read(17) >> 12; rt_kprintf("operating at "); @@ -588,7 +591,7 @@ void INTEINT4_7_handler(int irqno, void *param) EINTPEND = eint_pend; } -void rt_hw_dm9000_init() +int rt_hw_dm9000_init() { /* Set GPF7 as EINT7 */ GPFCON = GPFCON & (~(3 << 14)) | (2 << 14); @@ -641,6 +644,8 @@ void rt_hw_dm9000_init() rt_hw_interrupt_umask(INTEINT4_7); } +INIT_DEVICE_EXPORT(rt_hw_dm9000_init); + void dm9000a(void) { rt_kprintf("\n"); diff --git a/bsp/mini2440/drivers/dm9000.h b/bsp/mini2440/drivers/dm9000.h index 1dda60bfd2..28499c22d8 100644 --- a/bsp/mini2440/drivers/dm9000.h +++ b/bsp/mini2440/drivers/dm9000.h @@ -143,6 +143,6 @@ #define GPCR_GEP_CNTL (1<<0) -void rt_hw_dm9000_init(void); +int rt_hw_dm9000_init(void); #endif diff --git a/bsp/mini2440/drivers/key.c b/bsp/mini2440/drivers/key.c index 3c73c7a788..d75ffd6d26 100644 --- a/bsp/mini2440/drivers/key.c +++ b/bsp/mini2440/drivers/key.c @@ -79,7 +79,7 @@ static void rt_hw_key_isr(void) /** * This function is only for QEMU emulation */ -static void rt_key_handler(int vector) +static void rt_key_handler(int vector, void *param) { INTSUBMSK |= (BIT_SUB_RXD1); diff --git a/bsp/mini2440/drivers/sdcard.c b/bsp/mini2440/drivers/sdcard.c index b2ab684e48..0f5b79bb25 100644 --- a/bsp/mini2440/drivers/sdcard.c +++ b/bsp/mini2440/drivers/sdcard.c @@ -550,7 +550,7 @@ static rt_size_t rt_sdcard_write(rt_device_t dev, return size; } -void rt_hw_sdcard_init(void) +int rt_hw_sdcard_init(void) { rt_uint8_t i, status; rt_uint8_t *sector; @@ -574,7 +574,7 @@ void rt_hw_sdcard_init(void) { rt_kprintf("allocate partition sector buffer failed\n"); - return; + return RT_ERROR; } status = sd_readblock(0, sector); if (status == RT_EOK) @@ -637,12 +637,15 @@ void rt_hw_sdcard_init(void) /* release sector buffer */ rt_free(sector); - return; + return RT_ERROR; } else { rt_kprintf("sdcard init failed\n"); } + + return RT_EOK; } +INIT_BOARD_EXPORT(rt_hw_sdcard_init); #endif diff --git a/bsp/mini2440/drivers/touch.c b/bsp/mini2440/drivers/touch.c index 08d41080be..e584c379e3 100644 --- a/bsp/mini2440/drivers/touch.c +++ b/bsp/mini2440/drivers/touch.c @@ -349,7 +349,7 @@ static void s3c2410_intc_stylus_updown(void) SUBSRCPND |= BIT_SUB_TC; } -static void rt_touch_handler(int irqno) +static void rt_touch_handler(int irqno, void *param) { if (SUBSRCPND & BIT_SUB_ADC) { diff --git a/bsp/mini2440/drivers/uart.c b/bsp/mini2440/drivers/uart.c new file mode 100644 index 0000000000..f7bf1d9461 --- /dev/null +++ b/bsp/mini2440/drivers/uart.c @@ -0,0 +1,183 @@ +/* + * File : uart.c + * Drivers for s3c2440 uarts. + * Change Logs: + * Date Author Notes + * 2020-04-09 Jonne Code refactoring for new bsp + */ + +#include +#include +#include + +#define ULCON_OFS 0x00 +#define UCON_OFS 0x04 +#define UFCON_OFS 0x08 +#define UMCON_OFS 0x0c +#define UTRSTAT_OFS 0x10 +#define UERSTAT_OFS 0x14 +#define UFSTAT_OFS 0x18 +#define UMSTAT_OFS 0x1c +#define UTXH_OFS 0x20 +#define URXH_OFS 0x24 +#define UBRDIV_OFS 0x28 + +#define readl(addr) (*(volatile unsigned long *)(addr)) +#define writel(addr, value) (*(volatile unsigned long *)(addr) = value) + +#define PCLK_HZ 50000000 + +struct hw_uart_device +{ + rt_uint32_t hw_base; + rt_uint32_t irqno; +}; + +static rt_err_t s3c2440_serial_configure(struct rt_serial_device *serial, struct serial_configure *cfg) +{ + struct hw_uart_device* uart = serial->parent.user_data; + + writel(uart->hw_base + UBRDIV_OFS, PCLK_HZ / (cfg->baud_rate * 16)); + + writel(uart->hw_base + ULCON_OFS, 0x03);// 8bit data, 1bit stop, No parity + writel(uart->hw_base + UCON_OFS, 0x05); + writel(uart->hw_base + UFCON_OFS, 0x00); + writel(uart->hw_base + UMCON_OFS, 0x00); + + return RT_EOK; +} + +static rt_err_t s3c2440_serial_control(struct rt_serial_device *serial, int cmd, void *arg) +{ + struct hw_uart_device *uart; + + RT_ASSERT(serial != RT_NULL); + uart = (struct hw_uart_device *)serial->parent.user_data; + + switch (cmd) + { + case RT_DEVICE_CTRL_CLR_INT: + /* disable rx irq */ + INTSUBMSK |= BIT_SUB_RXD0; + + break; + + case RT_DEVICE_CTRL_SET_INT: + /* enable rx irq */ + INTSUBMSK &= ~(BIT_SUB_RXD0); + break; + } + + return RT_EOK; +} +static int s3c2440_putc(struct rt_serial_device *serial, char c) +{ + struct hw_uart_device* uart = serial->parent.user_data; + + while(!(readl(uart->hw_base + UTRSTAT_OFS) & (1<<2))) + { + } + + writel(uart->hw_base + UTXH_OFS, c); + + return 0; + + +} +static int s3c2440_getc(struct rt_serial_device *serial) +{ + struct hw_uart_device* uart = serial->parent.user_data; + int ch = -1; + + if(readl(uart->hw_base + UTRSTAT_OFS) & (1<<0)) + { + ch = readl(uart->hw_base + URXH_OFS) & 0x000000FF; + } + + return ch; +} + +static void rt_hw_uart_isr(int irqno, void *param) +{ + struct rt_serial_device *serial = (struct rt_serial_device *)param; + + rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND); + + /*clear SUBSRCPND*/ + if(irqno == INTUART0) + { + SUBSRCPND = BIT_SUB_RXD0; + } + else if(irqno == INTUART1) + { + SUBSRCPND = BIT_SUB_RXD1; + } + else + { + SUBSRCPND = BIT_SUB_RXD2; + } +} + +static struct rt_uart_ops s3c2440_uart_ops = { + .configure = s3c2440_serial_configure, + .control = s3c2440_serial_control, + .putc = s3c2440_putc, + .getc = s3c2440_getc +}; + + +static struct rt_serial_device _serial0 = { + .ops = &s3c2440_uart_ops, + .config = RT_SERIAL_CONFIG_DEFAULT, + .serial_rx = NULL, + .serial_tx = NULL +}; +static struct hw_uart_device _hwserial0 = { + .hw_base = 0x50000000, + .irqno = INTUART0 +}; + +static struct rt_serial_device _serial1 = { + .ops = &s3c2440_uart_ops, + .config = RT_SERIAL_CONFIG_DEFAULT, + .serial_rx = NULL, + .serial_tx = NULL +}; +static struct hw_uart_device _hwserial1 = { + .hw_base = 0x50004000, + .irqno = INTUART1 +}; + +static struct rt_serial_device _serial2 = { + .ops = &s3c2440_uart_ops, + .config = RT_SERIAL_CONFIG_DEFAULT, + .serial_rx = NULL, + .serial_tx = NULL +}; +static struct hw_uart_device _hwserial2 = { + .hw_base = 0x50008000, + .irqno = INTUART2 +}; + + +int rt_hw_uart_init(void) +{ + /* register UART0 device */ + rt_hw_serial_register(&_serial0, "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial0); + rt_hw_interrupt_install(_hwserial0.irqno, rt_hw_uart_isr, &_serial0, "uart0"); + rt_hw_interrupt_umask(INTUART0); + + /* register UART1 device */ + rt_hw_serial_register(&_serial1, "uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial1); + rt_hw_interrupt_install(_hwserial1.irqno, rt_hw_uart_isr, &_serial1, "uart1"); + rt_hw_interrupt_umask(INTUART1); + + /* register UART2 device */ + rt_hw_serial_register(&_serial2, "uart2", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial2); + rt_hw_interrupt_install(_hwserial2.irqno, rt_hw_uart_isr, &_serial2, "uart2"); + rt_hw_interrupt_umask(INTUART2); + + return 0; +} + +INIT_BOARD_EXPORT(rt_hw_uart_init); diff --git a/bsp/mini2440/rtconfig.h b/bsp/mini2440/rtconfig.h index 8147715c8f..5d65b46148 100644 --- a/bsp/mini2440/rtconfig.h +++ b/bsp/mini2440/rtconfig.h @@ -1,176 +1,243 @@ -/* RT-Thread config file */ -#ifndef __RTTHREAD_CFG_H__ -#define __RTTHREAD_CFG_H__ +#ifndef RT_CONFIG_H__ +#define RT_CONFIG_H__ -// +/* Automatically generated file; DO NOT EDIT. */ +/* RT-Thread Project Configuration */ -// -#define RT_NAME_MAX 32 -// -#define RT_ALIGN_SIZE 4 -// -// 8 -// 32 -// 256 -// -#define RT_THREAD_PRIORITY_MAX 256 -// -#define RT_TICK_PER_SECOND 100 -//
-// #define RT_DEBUG -// -// #define RT_THREAD_DEBUG -// +#define BOARD_MINI2440 + +/* 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_INTERRUPT_INFO -//
- -// #define RT_USING_HOOK -//
-// #define RT_USING_TIMER_SOFT -// -#define RT_TIMER_THREAD_PRIO 8 -// -#define RT_TIMER_THREAD_STACK_SIZE 512 -// -#define RT_TIMER_TICK_PER_SECOND 10 -//
+#define RT_USING_IDLE_HOOK +#define RT_IDLE_HOOK_LIST_SIZE 4 +#define IDLE_THREAD_STACK_SIZE 256 +#define RT_USING_TIMER_SOFT +#define RT_TIMER_THREAD_PRIO 4 +#define RT_TIMER_THREAD_STACK_SIZE 512 +#define RT_DEBUG + +/* Inter-Thread communication */ -//
-// #define RT_USING_SEMAPHORE -// #define RT_USING_MUTEX -// #define RT_USING_EVENT -// #define RT_USING_MAILBOX -// #define RT_USING_MESSAGEQUEUE -//
-//
-// +/* Memory Management */ + #define RT_USING_MEMPOOL -// -#define RT_USING_HEAP -// +#define RT_USING_MEMHEAP #define RT_USING_SMALL_MEM -// -// #define RT_USING_SLAB -//
+#define RT_USING_HEAP + +/* Kernel Device Object */ -//
#define RT_USING_DEVICE -#define RT_USING_DEVICE_IPC -// -#define RT_USING_UART0 -// -#define RT_UART_RX_BUFFER_SIZE 64 -//
- -//
#define RT_USING_CONSOLE -// -#define RT_CONSOLEBUF_SIZE 128 -//
+#define RT_CONSOLEBUF_SIZE 128 +#define RT_CONSOLE_DEVICE_NAME "uart" +#define RT_VER_NUM 0x40003 +#define ARCH_ARM +#define ARCH_ARM_ARM9 + +/* 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 */ + +#define RT_USING_CPLUSPLUS + +/* 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_STACK_SIZE 4096 -//
+#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_ARG_MAX 10 -//
-// -#define RT_USING_LIBC -// -#define RT_USING_PTHREADS -//
+/* Device virtual file system */ -//
#define RT_USING_DFS -// #define DFS_USING_WORKDIR -// -#define DFS_FILESYSTEMS_MAX 2 -// -#define DFS_FD_MAX 4 -// +#define DFS_FILESYSTEMS_MAX 5 +#define DFS_FILESYSTEM_TYPES_MAX 5 +#define DFS_FD_MAX 16 #define RT_USING_DFS_ELMFAT -// -// 1 -// 2 -// -#define RT_DFS_ELM_USE_LFN 1 -// -#define RT_DFS_ELM_CODE_PAGE 936 -// -// #define RT_DFS_ELM_CODE_PAGE_FILE -// -#define RT_DFS_ELM_MAX_LFN 255 -// -// #define RT_USING_DFS_YAFFS2 -// -// #define RT_USING_DFS_UFFS -// + +/* elm-chan's FatFs, Generic FAT Filesystem Module */ + +#define RT_DFS_ELM_CODE_PAGE 437 +#define RT_DFS_ELM_WORD_ACCESS +#define RT_DFS_ELM_USE_LFN_3 +#define RT_DFS_ELM_USE_LFN 3 +#define RT_DFS_ELM_MAX_LFN 255 +#define RT_DFS_ELM_DRIVES 2 +#define RT_DFS_ELM_MAX_SECTOR_SIZE 512 +#define RT_DFS_ELM_REENTRANT #define RT_USING_DFS_DEVFS -// -// #define RT_USING_DFS_NFS -// -#define RT_NFS_HOST_EXPORT "192.168.1.5:/" -//
+#define RT_USING_DFS_RAMFS + +/* Device Drivers */ + +#define RT_USING_DEVICE_IPC +#define RT_PIPE_BUFSZ 512 +#define RT_USING_SYSTEM_WORKQUEUE +#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048 +#define RT_SYSTEM_WORKQUEUE_PRIORITY 23 +#define RT_USING_SERIAL +#define RT_SERIAL_USING_DMA +#define RT_SERIAL_RB_BUFSZ 64 +#define RT_USING_PIN + +/* Using USB */ + + +/* POSIX layer and C standard library */ + +#define RT_USING_LIBC +#define RT_USING_PTHREADS +#define PTHREAD_NUM_MAX 8 +#define RT_USING_POSIX +#define RT_USING_POSIX_MMAP +#define RT_USING_POSIX_TERMIOS +#define RT_USING_POSIX_AIO +#define RT_USING_MODULE +#define RT_USING_CUSTOM_DLMODULE + +/* Network */ + +/* Socket abstraction layer */ + +#define RT_USING_SAL + +/* protocol stack implement */ + +#define SAL_USING_LWIP +#define SAL_USING_POSIX + +/* Network interface device */ + +#define RT_USING_NETDEV +#define NETDEV_USING_IFCONFIG +#define NETDEV_USING_PING +#define NETDEV_USING_NETSTAT +#define NETDEV_USING_AUTO_DEFAULT +#define NETDEV_IPV4 1 +#define NETDEV_IPV6 0 + +/* light weight TCP/IP stack */ -//
#define RT_USING_LWIP -// +#define RT_USING_LWIP210 +#define RT_LWIP_IGMP #define RT_LWIP_ICMP -// -// #define RT_LWIP_IGMP -// -#define RT_LWIP_UDP -// -#define RT_LWIP_TCP -// #define RT_LWIP_DNS -// -#define RT_LWIP_TCP_PCB_NUM 5 -// -#define RT_LWIP_TCP_SND_BUF 8192 -// -#define RT_LWIP_TCP_WND 8192 -// -// #define RT_LWIP_SNMP -// -// #define RT_LWIP_DHCP -// -#define RT_LWIP_TCP_SEG_NUM 40 -// -#define RT_LWIP_TCPTHREAD_PRIORITY 12 -// -#define RT_LWIP_TCPTHREAD_MBOX_SIZE 32 -// -#define RT_LWIP_TCPTHREAD_STACKSIZE 4096 -// -#define RT_LWIP_ETHTHREAD_PRIORITY 144 -// -#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32 -// -#define RT_LWIP_ETHTHREAD_STACKSIZE 512 -// -#define RT_LWIP_IPADDR "192.168.1.30" -// -#define RT_LWIP_GWADDR "192.168.1.1" -// -#define RT_LWIP_MSKADDR "255.255.255.0" -//
+#define RT_LWIP_DHCP +#define IP_SOF_BROADCAST 1 +#define IP_SOF_BROADCAST_RECV 1 + +/* Static IPv4 Address */ + +#define RT_LWIP_IPADDR "192.168.0.30" +#define RT_LWIP_GWADDR "192.168.0.1" +#define RT_LWIP_MSKADDR "255.255.255.0" +#define RT_LWIP_UDP +#define RT_LWIP_TCP +#define RT_LWIP_RAW +#define RT_MEMP_NUM_NETCONN 8 +#define RT_LWIP_PBUF_NUM 16 +#define RT_LWIP_RAW_PCB_NUM 4 +#define RT_LWIP_UDP_PCB_NUM 4 +#define RT_LWIP_TCP_PCB_NUM 4 +#define RT_LWIP_TCP_SEG_NUM 40 +#define RT_LWIP_TCP_SND_BUF 8196 +#define RT_LWIP_TCP_WND 8196 +#define RT_LWIP_TCPTHREAD_PRIORITY 10 +#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8 +#define RT_LWIP_TCPTHREAD_STACKSIZE 1024 +#define RT_LWIP_ETHTHREAD_PRIORITY 12 +#define RT_LWIP_ETHTHREAD_STACKSIZE 1024 +#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8 +#define LWIP_NETIF_STATUS_CALLBACK 1 +#define LWIP_NETIF_LINK_CALLBACK 1 +#define SO_REUSE 1 +#define LWIP_SO_RCVTIMEO 1 +#define LWIP_SO_SNDTIMEO 1 +#define LWIP_SO_RCVBUF 1 +#define RT_LWIP_NETIF_LOOPBACK +#define LWIP_NETIF_LOOPBACK 1 +#define RT_LWIP_STATS +#define RT_LWIP_USING_PING + +/* AT commands */ + + +/* VBUS(Virtual Software BUS) */ + + +/* Utilities */ + +#define RT_USING_RYM +#define YMODEM_USING_CRC_TABLE +#define YMODEM_USING_FILE_TRANSFER + +/* 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 */ -//
#endif diff --git a/bsp/mini2440/rtconfig.py b/bsp/mini2440/rtconfig.py index dd574acb16..106597711a 100644 --- a/bsp/mini2440/rtconfig.py +++ b/bsp/mini2440/rtconfig.py @@ -9,14 +9,14 @@ ARCH = 'arm' CPU = 's3c24x0' TextBase = '0x30000000' -CROSS_TOOL = 'keil' +CROSS_TOOL = 'gcc' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin' + EXEC_PATH = '/opt/gcc-arm-none-eabi-6_2-2016q4/bin' elif CROSS_TOOL == 'keil': PLATFORM = 'armcc' EXEC_PATH = 'C:/Keil' @@ -43,12 +43,21 @@ if PLATFORM == 'gcc': SIZE = PREFIX + 'size' OBJDUMP = PREFIX + 'objdump' OBJCPY = PREFIX + 'objcopy' + STRIP = PREFIX + 'strip' DEVICE = ' -mcpu=arm920t' CFLAGS = DEVICE AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' + ' -DTEXT_BASE=' + TextBase LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread_mini2440.map,-cref,-u,_start -nostartfiles -T mini2440_ram.ld' + ' -Ttext ' + TextBase + # module setting + CXXFLAGS = ' -Woverloaded-virtual -fno-exceptions -fno-rtti ' + M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC ' + M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC' + M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\ + ' -shared -fPIC -nostartfiles -static-libgcc' + M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n' + CPATH = '' LPATH = '' diff --git a/libcpu/arm/s3c24x0/serial.c b/libcpu/arm/s3c24x0/serial.c deleted file mode 100644 index 1eca1b1110..0000000000 --- a/libcpu/arm/s3c24x0/serial.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2006-03-13 Bernard first version - * 2009-04-20 yi.qiu modified according bernard's stm32 version - */ - -#include - -#include "serial.h" - -/** - * @addtogroup S3C24X0 - */ -/*@{*/ - -/* RT-Thread Device Interface */ -/** - * This function initializes serial - */ -static rt_err_t rt_serial_init(rt_device_t dev) -{ - struct serial_device* uart = (struct serial_device*) dev->user_data; - - if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) - { - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_memset(uart->int_rx->rx_buffer, 0, - sizeof(uart->int_rx->rx_buffer)); - uart->int_rx->read_index = uart->int_rx->save_index = 0; - } - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - rt_memset(uart->int_tx->tx_buffer, 0, - sizeof(uart->int_tx->tx_buffer)); - uart->int_tx->write_index = uart->int_tx->save_index = 0; - } - - dev->flag |= RT_DEVICE_FLAG_ACTIVATED; - } - - return RT_EOK; -} - -/* save a char to serial buffer */ -static void rt_serial_savechar(struct serial_device* uart, char ch) -{ - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; - uart->int_rx->save_index ++; - if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->save_index = 0; - - /* if the next position is read index, discard this 'read char' */ - if (uart->int_rx->save_index == uart->int_rx->read_index) - { - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); -} - -static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) -{ - RT_ASSERT(dev != RT_NULL); - - return RT_EOK; -} - -static rt_err_t rt_serial_close(rt_device_t dev) -{ - RT_ASSERT(dev != RT_NULL); - - return RT_EOK; -} - -static rt_size_t rt_serial_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) -{ - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - ptr = buffer; - err_code = RT_EOK; - uart = (struct serial_device*)dev->user_data; - - if (ptr == RT_NULL) - { - err_code = -RT_ENOMEM; - rt_set_errno(err_code); - return -RT_ENOMEM; - } - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_base_t level; - - /* interrupt mode Rx */ - while (size) - { - if (uart->int_rx->read_index != uart->int_rx->save_index) - { - *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; - size --; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - } - else - { - /* set error code */ - err_code = -RT_EEMPTY; - break; - } - } - } - else - { - /* polling mode */ - while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) - { - while (uart->uart_device->ustat & USTAT_RCV_READY) - { - *ptr = uart->uart_device->urxh & 0xff; - ptr ++; - } - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; -} - -static rt_size_t rt_serial_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) -{ - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - err_code = RT_EOK; - ptr = (rt_uint8_t*)buffer; - uart = (struct serial_device*)dev->user_data; - - if (ptr == RT_NULL) - { - err_code = -RT_ENOMEM; - rt_set_errno(err_code); - return -RT_ENOMEM; - } - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - /* interrupt mode Tx */ - while (uart->int_tx->save_index != uart->int_tx->write_index) - { - /* save on tx buffer */ - uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; - - -- size; - - /* move to next position */ - uart->int_tx->save_index ++; - - /* wrap save index */ - if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) - uart->int_tx->save_index = 0; - } - - /* set error code */ - if (size > 0) - err_code = -RT_EFULL; - } - else - { - /* polling mode */ - while (size) - { - /* - * to be polite with serial console add a line feed - * to the carriage return character - */ - if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) - { - while (!(uart->uart_device->ustat & USTAT_TXB_EMPTY)); - uart->uart_device->utxh = '\r'; - } - - while (!(uart->uart_device->ustat & USTAT_TXB_EMPTY)); - uart->uart_device->utxh = (*ptr & 0xFF); - - ++ptr; - --size; - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; -} - -static rt_err_t rt_serial_control(rt_device_t dev, int cmd, void *args) -{ - RT_ASSERT(dev != RT_NULL); - - switch (cmd) - { - case RT_DEVICE_CTRL_SUSPEND: - /* suspend device */ - dev->flag |= RT_DEVICE_FLAG_SUSPENDED; - break; - - case RT_DEVICE_CTRL_RESUME: - /* resume device */ - dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; - break; - } - - return RT_EOK; -} - -/* - * serial register - */ -rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial) -{ - RT_ASSERT(device != RT_NULL); - - device->type = RT_Device_Class_Char; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - device->user_data = serial; - - /* register a character device */ - return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); -} - -/* ISR for serial interrupt */ -void rt_hw_serial_isr(rt_device_t device) -{ - struct serial_device* uart = (struct serial_device*) device->user_data; - - /* interrupt mode receive */ - RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); - - /* save on rx buffer */ - while (uart->uart_device->ustat & USTAT_RCV_READY) - { - rt_serial_savechar(uart, uart->uart_device->urxh & 0xff); - } - - /* invoke callback */ - if (device->rx_indicate != RT_NULL) - { - rt_size_t rx_length; - - /* get rx length */ - rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? - UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : - uart->int_rx->save_index - uart->int_rx->read_index; - - device->rx_indicate(device, rx_length); - } -} - -/*@}*/ diff --git a/libcpu/arm/s3c24x0/serial.h b/libcpu/arm/s3c24x0/serial.h deleted file mode 100644 index 8a647ef35f..0000000000 --- a/libcpu/arm/s3c24x0/serial.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef __RT_HW_SERIAL_H__ -#define __RT_HW_SERIAL_H__ - -#include -#include - -#include "s3c24x0.h" - -#define USTAT_RCV_READY 0x01 /* receive data ready */ -#define USTAT_TXB_EMPTY 0x02 /* tx buffer empty */ -#define BPS 115200 /* serial baudrate */ - -#define UART_RX_BUFFER_SIZE 64 -#define UART_TX_BUFFER_SIZE 64 - -struct serial_int_rx -{ - rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; - rt_uint32_t read_index, save_index; -}; - -struct serial_int_tx -{ - rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; - rt_uint32_t write_index, save_index; -}; - -typedef struct uartport -{ - volatile rt_uint32_t ulcon; - volatile rt_uint32_t ucon; - volatile rt_uint32_t ufcon; - volatile rt_uint32_t umcon; - volatile rt_uint32_t ustat; - volatile rt_uint32_t urxb; - volatile rt_uint32_t ufstat; - volatile rt_uint32_t umstat; - volatile rt_uint32_t utxh; - volatile rt_uint32_t urxh; - volatile rt_uint32_t ubrd; -}uartport; - -struct serial_device -{ - uartport* uart_device; - - /* rx structure */ - struct serial_int_rx* int_rx; - - /* tx structure */ - struct serial_int_tx* int_tx; -}; - -rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial); - -void rt_hw_serial_isr(rt_device_t device); - -#endif From 0227b5823e39087f4d2f466dc7eec4c8a004bf48 Mon Sep 17 00:00:00 2001 From: Jonne Date: Sat, 11 Apr 2020 17:56:02 +0800 Subject: [PATCH 2/4] 1. Remove unuseful function(rt_system_module_init) 2. Modify the return code to -1 when failed 3. Change the mounting filesystem from ramfs to sdcard 4. Replace RT_USING_RTGUI with PKG_USING_GUIENGINE and remove RT_USING_FTK --- bsp/mini2440/applications/mnt.c | 21 ++++++++++----------- bsp/mini2440/drivers/SConscript | 11 ++++------- bsp/mini2440/drivers/board.c | 7 ------- bsp/mini2440/drivers/dm9000.c | 2 ++ bsp/mini2440/drivers/sdcard.c | 4 ++-- 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/bsp/mini2440/applications/mnt.c b/bsp/mini2440/applications/mnt.c index fc9f915167..50ade3a3eb 100644 --- a/bsp/mini2440/applications/mnt.c +++ b/bsp/mini2440/applications/mnt.c @@ -6,17 +6,16 @@ int mnt_init(void) { - - if(dfs_mount(RT_NULL, "/", "ram", 0, dfs_ramfs_create(rt_malloc(1024),1024)) == 0) - { - rt_kprintf("RAM file system initializated!\n"); - } - else - { - rt_kprintf("RAM file system initializate failed!\n"); - } - - return 0; + if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) + { + rt_kprintf("File System initialized!\n"); + } + else + { + rt_kprintf("File System initialzation failed!\n"); + } + + return RT_EOK; } INIT_ENV_EXPORT(mnt_init); #endif diff --git a/bsp/mini2440/drivers/SConscript b/bsp/mini2440/drivers/SConscript index 8b36ce3aab..2c81f19e33 100644 --- a/bsp/mini2440/drivers/SConscript +++ b/bsp/mini2440/drivers/SConscript @@ -17,16 +17,13 @@ if GetDepend('RT_USING_DFS'): if GetDepend('RT_USING_LWIP'): src += ['dm9000.c'] -if GetDepend('RT_USING_RTGUI'): - src += ['touch.c', 'key.c'] - -if GetDepend('RT_USING_FTK'): - src += ['touch.c', 'key.c'] +if GetDepend('PKG_USING_GUIENGINE'): + src += ['touch.c', 'key.c'] if GetDepend('RT_USING_RTI'): - src += ['rti_stub.c'] + src += ['rti_stub.c'] -if GetDepend('RT_USING_RTGUI') or GetDepend('RT_USING_FTK'): +if GetDepend('PKG_USING_GUIENGINE'): if rtconfig.RT_USING_LCD_TYPE == 'PNL_A70': src += ['lcd_a70.c'] elif rtconfig.RT_USING_LCD_TYPE == 'PNL_N35': diff --git a/bsp/mini2440/drivers/board.c b/bsp/mini2440/drivers/board.c index 14e2e426df..48df4a3e87 100644 --- a/bsp/mini2440/drivers/board.c +++ b/bsp/mini2440/drivers/board.c @@ -125,11 +125,4 @@ void rt_hw_board_init(void) #endif } - -#ifdef RT_USING_MODULE -int rt_system_module_init(void) -{ - return 0; -} -#endif /*@}*/ diff --git a/bsp/mini2440/drivers/dm9000.c b/bsp/mini2440/drivers/dm9000.c index 22afb322c7..2bdbd43a12 100644 --- a/bsp/mini2440/drivers/dm9000.c +++ b/bsp/mini2440/drivers/dm9000.c @@ -642,6 +642,8 @@ int rt_hw_dm9000_init() /* instal interrupt */ rt_hw_interrupt_install(INTEINT4_7, INTEINT4_7_handler, RT_NULL, "EINT4_7"); rt_hw_interrupt_umask(INTEINT4_7); + + return RT_EOK; } INIT_DEVICE_EXPORT(rt_hw_dm9000_init); diff --git a/bsp/mini2440/drivers/sdcard.c b/bsp/mini2440/drivers/sdcard.c index 0f5b79bb25..d20bfe71bb 100644 --- a/bsp/mini2440/drivers/sdcard.c +++ b/bsp/mini2440/drivers/sdcard.c @@ -574,7 +574,7 @@ int rt_hw_sdcard_init(void) { rt_kprintf("allocate partition sector buffer failed\n"); - return RT_ERROR; + return -1; } status = sd_readblock(0, sector); if (status == RT_EOK) @@ -637,7 +637,7 @@ int rt_hw_sdcard_init(void) /* release sector buffer */ rt_free(sector); - return RT_ERROR; + return -1; } else { From e5fac04e7deb0f1ba777660e46d5ce0c421f83ca Mon Sep 17 00:00:00 2001 From: Jonne Date: Sat, 11 Apr 2020 21:12:15 +0800 Subject: [PATCH 3/4] Add gpio and interrupt settings for uart1 uart2 --- bsp/mini2440/drivers/uart.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/bsp/mini2440/drivers/uart.c b/bsp/mini2440/drivers/uart.c index f7bf1d9461..cd18c343d4 100644 --- a/bsp/mini2440/drivers/uart.c +++ b/bsp/mini2440/drivers/uart.c @@ -50,21 +50,35 @@ static rt_err_t s3c2440_serial_configure(struct rt_serial_device *serial, struct static rt_err_t s3c2440_serial_control(struct rt_serial_device *serial, int cmd, void *arg) { struct hw_uart_device *uart; + int mask; RT_ASSERT(serial != RT_NULL); uart = (struct hw_uart_device *)serial->parent.user_data; + if(uart->irqno == INTUART0) + { + mask = BIT_SUB_RXD0; + } + else if(uart->irqno == INTUART1) + { + mask = BIT_SUB_RXD1; + } + else + { + mask = BIT_SUB_RXD2; + } + switch (cmd) { case RT_DEVICE_CTRL_CLR_INT: /* disable rx irq */ - INTSUBMSK |= BIT_SUB_RXD0; + INTSUBMSK |= mask; break; case RT_DEVICE_CTRL_SET_INT: /* enable rx irq */ - INTSUBMSK &= ~(BIT_SUB_RXD0); + INTSUBMSK &= ~mask; break; } @@ -162,6 +176,11 @@ static struct hw_uart_device _hwserial2 = { int rt_hw_uart_init(void) { + /* UART0 UART1 UART2 port configure */ + GPHCON |= 0xAAAA; + /* PULLUP is disable */ + GPHUP |= 0xFFF; + /* register UART0 device */ rt_hw_serial_register(&_serial0, "uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, &_hwserial0); rt_hw_interrupt_install(_hwserial0.irqno, rt_hw_uart_isr, &_serial0, "uart0"); From 204376f0ec0b2bae9d1a25edd974f8f20aa2866c Mon Sep 17 00:00:00 2001 From: Jonne Date: Mon, 13 Apr 2020 08:46:51 +0800 Subject: [PATCH 4/4] Modify the return code with using macro --- bsp/mini2440/drivers/sdcard.c | 4 ++-- bsp/mini2440/drivers/uart.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bsp/mini2440/drivers/sdcard.c b/bsp/mini2440/drivers/sdcard.c index d20bfe71bb..9815770bab 100644 --- a/bsp/mini2440/drivers/sdcard.c +++ b/bsp/mini2440/drivers/sdcard.c @@ -574,7 +574,7 @@ int rt_hw_sdcard_init(void) { rt_kprintf("allocate partition sector buffer failed\n"); - return -1; + return -RT_ERROR; } status = sd_readblock(0, sector); if (status == RT_EOK) @@ -637,7 +637,7 @@ int rt_hw_sdcard_init(void) /* release sector buffer */ rt_free(sector); - return -1; + return -RT_ERROR; } else { diff --git a/bsp/mini2440/drivers/uart.c b/bsp/mini2440/drivers/uart.c index cd18c343d4..6226a3cb17 100644 --- a/bsp/mini2440/drivers/uart.c +++ b/bsp/mini2440/drivers/uart.c @@ -196,7 +196,7 @@ int rt_hw_uart_init(void) rt_hw_interrupt_install(_hwserial2.irqno, rt_hw_uart_isr, &_serial2, "uart2"); rt_hw_interrupt_umask(INTUART2); - return 0; + return RT_EOK; } INIT_BOARD_EXPORT(rt_hw_uart_init);