[更新] 添加i2c spi romfs spiflash sdcard pct2075驱动.
This commit is contained in:
parent
5126111778
commit
c6bfe11afa
|
@ -0,0 +1,427 @@
|
|||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# RT-Thread Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# RT-Thread Kernel
|
||||
#
|
||||
CONFIG_RT_NAME_MAX=8
|
||||
# CONFIG_RT_USING_SMP is not set
|
||||
CONFIG_RT_ALIGN_SIZE=4
|
||||
# CONFIG_RT_THREAD_PRIORITY_8 is not set
|
||||
CONFIG_RT_THREAD_PRIORITY_32=y
|
||||
# CONFIG_RT_THREAD_PRIORITY_256 is not set
|
||||
CONFIG_RT_THREAD_PRIORITY_MAX=32
|
||||
CONFIG_RT_TICK_PER_SECOND=1000
|
||||
CONFIG_RT_USING_OVERFLOW_CHECK=y
|
||||
CONFIG_RT_USING_HOOK=y
|
||||
CONFIG_RT_USING_IDLE_HOOK=y
|
||||
CONFIG_RT_IDEL_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_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="uart0"
|
||||
CONFIG_RT_VER_NUM=0x40000
|
||||
CONFIG_ARCH_ARM=y
|
||||
CONFIG_ARCH_ARM_CORTEX_M=y
|
||||
CONFIG_ARCH_ARM_CORTEX_M4=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 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 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=4
|
||||
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
|
||||
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=4096
|
||||
# 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=y
|
||||
# CONFIG_RT_USING_DFS_RAMFS is not set
|
||||
# CONFIG_RT_USING_DFS_UFFS is not set
|
||||
# CONFIG_RT_USING_DFS_JFFS2 is not set
|
||||
|
||||
#
|
||||
# Device Drivers
|
||||
#
|
||||
CONFIG_RT_USING_DEVICE_IPC=y
|
||||
CONFIG_RT_PIPE_BUFSZ=512
|
||||
CONFIG_RT_USING_SERIAL=y
|
||||
# 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=y
|
||||
CONFIG_RT_USING_I2C_BITOPS=y
|
||||
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_MTD 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=y
|
||||
# CONFIG_RT_USING_QSPI is not set
|
||||
CONFIG_RT_USING_SPI_MSD=y
|
||||
CONFIG_RT_USING_SFUD=y
|
||||
# CONFIG_RT_SFUD_USING_SFDP is not set
|
||||
CONFIG_RT_SFUD_USING_FLASH_INFO_TABLE=y
|
||||
# CONFIG_RT_SFUD_USING_QSPI is not set
|
||||
# CONFIG_RT_DEBUG_SFUD is not set
|
||||
# CONFIG_RT_USING_W25QXX is not set
|
||||
# CONFIG_RT_USING_GD 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
|
||||
|
||||
#
|
||||
# Using WiFi
|
||||
#
|
||||
# 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 is not set
|
||||
CONFIG_RT_USING_POSIX=y
|
||||
# CONFIG_RT_USING_POSIX_MMAP is not set
|
||||
# CONFIG_RT_USING_POSIX_TERMIOS is not set
|
||||
# CONFIG_RT_USING_POSIX_AIO is not set
|
||||
# CONFIG_RT_USING_MODULE is not set
|
||||
|
||||
#
|
||||
# Network
|
||||
#
|
||||
|
||||
#
|
||||
# Socket abstraction layer
|
||||
#
|
||||
# CONFIG_RT_USING_SAL is not set
|
||||
|
||||
#
|
||||
# light weight TCP/IP stack
|
||||
#
|
||||
# CONFIG_RT_USING_LWIP is not set
|
||||
|
||||
#
|
||||
# Modbus master and slave stack
|
||||
#
|
||||
# CONFIG_RT_USING_MODBUS 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_LOGTRACE is not set
|
||||
# CONFIG_RT_USING_RYM is not set
|
||||
# CONFIG_RT_USING_ULOG is not set
|
||||
|
||||
#
|
||||
# ARM CMSIS
|
||||
#
|
||||
# CONFIG_RT_USING_CMSIS_OS is not set
|
||||
# CONFIG_RT_USING_RTT_CMSIS 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_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_CJSON is not set
|
||||
# CONFIG_PKG_USING_JSMN 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_COAP is not set
|
||||
# CONFIG_PKG_USING_NOPOLL is not set
|
||||
# CONFIG_PKG_USING_NETUTILS is not set
|
||||
# CONFIG_PKG_USING_AT_DEVICE 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_IOTKIT is not set
|
||||
|
||||
#
|
||||
# security packages
|
||||
#
|
||||
# CONFIG_PKG_USING_MBEDTLS is not set
|
||||
# CONFIG_PKG_USING_libsodium is not set
|
||||
# CONFIG_PKG_USING_TINYCRYPT is not set
|
||||
|
||||
#
|
||||
# language packages
|
||||
#
|
||||
# CONFIG_PKG_USING_LUA is not set
|
||||
# CONFIG_PKG_USING_JERRYSCRIPT is not set
|
||||
# CONFIG_PKG_USING_MICROPYTHON is not set
|
||||
|
||||
#
|
||||
# multimedia packages
|
||||
#
|
||||
# CONFIG_PKG_USING_OPENMV is not set
|
||||
# CONFIG_PKG_USING_MUPDF is not set
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
#
|
||||
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
|
||||
# CONFIG_PKG_USING_SHT2X is not set
|
||||
# CONFIG_PKG_USING_AHT10 is not set
|
||||
# CONFIG_PKG_USING_AP3216C 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_MPU6XXX 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_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
|
||||
|
||||
#
|
||||
# sample package
|
||||
#
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# example package: hello
|
||||
#
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
|
||||
#
|
||||
# Privated Packages of RealThread
|
||||
#
|
||||
# CONFIG_PKG_USING_CODEC is not set
|
||||
# CONFIG_PKG_USING_PLAYER is not set
|
||||
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
|
||||
|
||||
#
|
||||
# Network Utilities
|
||||
#
|
||||
# CONFIG_PKG_USING_WICED is not set
|
||||
# CONFIG_PKG_USING_CLOUDSDK is not set
|
||||
# CONFIG_PKG_USING_COREMARK is not set
|
||||
# CONFIG_PKG_USING_POWER_MANAGER is not set
|
||||
# CONFIG_PKG_USING_RT_OTA is not set
|
||||
# CONFIG_PKG_USING_RDBD_SRC is not set
|
||||
# CONFIG_PKG_USING_RTINSIGHT is not set
|
||||
# CONFIG_PKG_USING_SMARTCONFIG is not set
|
||||
|
||||
#
|
||||
# rtpkgs online packages
|
||||
#
|
||||
# CONFIG_PKG_USING_CSTRING is not set
|
||||
# CONFIG_PKG_USING_ARGPARSE is not set
|
||||
# CONFIG_PKG_USING_LIBBMPREAD is not set
|
||||
# CONFIG_PKG_USING_LIBUTILS is not set
|
||||
# CONFIG_PKG_USING_SAM is not set
|
||||
# CONFIG_PKG_USING_LIBCALLBACK is not set
|
||||
# CONFIG_PKG_USING_Z_EVENT is not set
|
||||
# CONFIG_PKG_USING_LIBSTM32HAL is not set
|
||||
CONFIG_SOC_LPC54114=y
|
||||
|
||||
#
|
||||
# LPC54110 Bsp Config
|
||||
#
|
||||
|
||||
#
|
||||
# Select uart drivers
|
||||
#
|
||||
CONFIG_BSP_USING_UART0=y
|
||||
|
||||
#
|
||||
# Select spi bus drivers
|
||||
#
|
||||
CONFIG_BSP_USING_SPI2=y
|
||||
|
||||
#
|
||||
# Select i2c bus drivers
|
||||
#
|
||||
CONFIG_BSP_USING_I2C4=y
|
||||
|
||||
#
|
||||
# Select spi bus drivers
|
||||
#
|
||||
CONFIG_BSP_USING_SDCARD=y
|
||||
CONFIG_BSP_USING_SPIFLASH=y
|
||||
CONFIG_BSP_USING_PCT2075=y
|
|
@ -23,5 +23,5 @@ config SOC_LPC54114
|
|||
select ARCH_ARM_CORTEX_M4
|
||||
default y
|
||||
|
||||
source "$BSP_DIR/drivers/Kconfig"
|
||||
|
||||
source "$BSP_DIR/drivers/Kconfig"
|
||||
|
|
|
@ -410,7 +410,7 @@ status_t SPI_MasterTransferBlocking(SPI_Type *base, spi_transfer_t *xfer)
|
|||
uint32_t fifoDepth;
|
||||
|
||||
/* check params */
|
||||
assert(!((NULL == base) || (NULL == xfer) || ((NULL == xfer->txData) && (NULL == xfer->rxData))));
|
||||
// assert(!((NULL == base) || (NULL == xfer) || ((NULL == xfer->txData) && (NULL == xfer->rxData))));
|
||||
if ((NULL == base) || (NULL == xfer) || ((NULL == xfer->txData) && (NULL == xfer->rxData)))
|
||||
{
|
||||
return kStatus_InvalidArgument;
|
||||
|
|
|
@ -23,7 +23,7 @@ LPC54114-Lite 开发板由万利电子提供,双核高性能,专注语音应
|
|||
该开发板常用**板载资源**如下:
|
||||
|
||||
- MCU:LPC54114J256BD64 Cortex-M4/M0+ 双核 MCU ,主频 100MHz,256KB FLASH ,192KB RAM
|
||||
- 外部 FLASH:型号 MD25D16SIG,16MB
|
||||
- 外部 FLASH:型号 MD25D16SIG,16MBIT
|
||||
- 常用外设
|
||||
- LED:8 个,LD4-LD7(绿色,PIO0_30、PIO0_29、PIO0_26、PIO0_25),LD8-LD11(红色,PIO0_22、PIO0_21、PIO0_19、PIO0_15)
|
||||
- 按键:4 个,PB2-PB5(PIO1_8、PIO1_9、PIO1_10、PIO1_11)
|
||||
|
@ -38,22 +38,22 @@ LPC54114-Lite 开发板的更多详细信息请参考万利电子 [开发板用
|
|||
|
||||
|**板载外设** |**支持情况**|**备注** |
|
||||
| ----------------- | :----------: | ------------------------------------- |
|
||||
| SPI Flash | 暂不支持 | |
|
||||
| SPI TF 卡 | 暂不支持 | |
|
||||
| I2C 温度传感器 <BR>(PCT2075DP) | 暂不支持 | |
|
||||
| I2S 音频输入 / 输出接口 <BR>(WM8904) | 暂不支持 | |
|
||||
| PDM 数字麦克风 <BR>(SPH0641LM4H) | 暂不支持 | |
|
||||
| SPI Flash | 支持 |- |
|
||||
| SPI TF 卡 | 支持 |- |
|
||||
| I2C 温度传感器 <BR>(PCT2075DP) | 支持 |- |
|
||||
| I2S 音频输入 / 输出接口 <BR>(WM8904) | 暂不支持 |- |
|
||||
| PDM 数字麦克风 <BR>(SPH0641LM4H) | 暂不支持 |- |
|
||||
|**片上外设** |**支持情况**|**备注** |
|
||||
| GPIO | 支持 | PIO0_0 ... PIO1_31 ---> PIN: 0, 1...63 |
|
||||
| UART | 支持 | UART0 |
|
||||
| SPI | 暂不支持 | 即将支持 |
|
||||
| I2C | 暂不支持 | 即将支持 |
|
||||
| SPI | 支持 | 暂时只支持SPI2 |
|
||||
| I2C | 支持 | 暂时只支持I2C4 |
|
||||
| ADC | 暂不支持 | 即将支持 |
|
||||
| PWM | 暂不支持 | 即将支持 |
|
||||
| USB Device | 暂不支持 | 即将支持 |
|
||||
| IWG | 暂不支持 | 即将支持 |
|
||||
|**板外外设** |**支持情况**|**备注** |
|
||||
| Arduino 扩展接口 | 暂不支持 | |
|
||||
| Arduino 扩展接口 | 暂不支持 |- |
|
||||
|
||||
## 使用说明
|
||||
|
||||
|
|
|
@ -16,11 +16,10 @@ int main(void)
|
|||
{
|
||||
/* user app entry */
|
||||
rt_pin_mode(LED4_PIN, PIN_MODE_OUTPUT);
|
||||
|
||||
while (1)
|
||||
{
|
||||
rt_pin_write(LED4_PIN, !rt_pin_read(LED4_PIN));
|
||||
rt_thread_delay(1000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,30 @@
|
|||
|
||||
#include <rtthread.h>
|
||||
|
||||
#if defined(RT_USING_DFS)
|
||||
#include <dfs_file.h>
|
||||
#include <dfs_posix.h>
|
||||
#endif
|
||||
|
||||
#define BSP_FLASH_MOUNT_PATH "/mnt/flash"
|
||||
#define BSP_SDCARD_MOUNT_PATH "/mnt/sd"
|
||||
|
||||
int mnt_init(void)
|
||||
{
|
||||
#if defined(BSP_USING_SPIFLASH)
|
||||
if(dfs_mount("flash0", BSP_FLASH_MOUNT_PATH, "elm", 0, 0) != 0)
|
||||
{
|
||||
rt_kprintf("spi flash mount '%s' failed.\n", BSP_FLASH_MOUNT_PATH);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BSP_USING_SDCARD)
|
||||
if(dfs_mount("sd0", BSP_SDCARD_MOUNT_PATH, "elm", 0, 0) != 0)
|
||||
{
|
||||
rt_kprintf("sdcard mount '%s' failed.\n", BSP_SDCARD_MOUNT_PATH);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_APP_EXPORT(mnt_init);
|
||||
|
|
|
@ -1,4 +1,43 @@
|
|||
config RT_USING_UART0
|
||||
bool "Enable UART0"
|
||||
default y
|
||||
# RT1050 bsp Config!
|
||||
menu "LPC54110 Bsp Config"
|
||||
|
||||
menu "Select uart drivers"
|
||||
config BSP_USING_UART0
|
||||
bool "Enable UART0"
|
||||
default y
|
||||
endmenu
|
||||
|
||||
menu "Select spi bus drivers"
|
||||
config BSP_USING_SPI2
|
||||
bool "Enable SPI2"
|
||||
default y
|
||||
endmenu
|
||||
|
||||
menu "Select i2c bus drivers"
|
||||
config BSP_USING_I2C4
|
||||
bool "Enable I2C4"
|
||||
default y
|
||||
endmenu
|
||||
|
||||
menu "Select spi bus drivers"
|
||||
config BSP_USING_SPI2
|
||||
bool "Enable SPI2"
|
||||
default y
|
||||
endmenu
|
||||
|
||||
config BSP_USING_SDCARD
|
||||
bool "Enable SDCARD"
|
||||
select BSP_USING_SPI2
|
||||
default y
|
||||
|
||||
config BSP_USING_SPIFLASH
|
||||
bool "Enable SPI Flash"
|
||||
select BSP_USING_SPI2
|
||||
default y
|
||||
|
||||
config BSP_USING_PCT2075
|
||||
bool "Enable PCT2075"
|
||||
select BSP_USING_I2C4
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -1,13 +1,36 @@
|
|||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
|
||||
src = Split("""
|
||||
board.c
|
||||
clock_config.c
|
||||
""")
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# remove no need file.
|
||||
if GetDepend('RT_USING_LWIP') == False:
|
||||
SrcRemove(src, 'drv_emac.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
# add driver code
|
||||
if GetDepend('BSP_USING_UART0'):
|
||||
src = src + ['drv_uart.c']
|
||||
|
||||
if GetDepend('BSP_USING_SPI2'):
|
||||
src = src + ['drv_spi.c']
|
||||
|
||||
if GetDepend('BSP_USING_I2C4'):
|
||||
src = src + ['drv_i2c.c']
|
||||
|
||||
if GetDepend('BSP_USING_SDCARD'):
|
||||
src = src + ['drv_sdcard.c']
|
||||
|
||||
if GetDepend('BSP_USING_SPIFLASH'):
|
||||
src = src + ['drv_spi_flash.c']
|
||||
|
||||
if GetDepend('BSP_USING_PCT2075'):
|
||||
src = src + ['drv_pct2075.c']
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "drv_i2c.h"
|
||||
|
||||
#include "fsl_common.h"
|
||||
#include "fsl_iocon.h"
|
||||
#include "fsl_i2c.h"
|
||||
|
||||
struct lpc_i2c
|
||||
{
|
||||
struct rt_i2c_bus_device bus;
|
||||
|
||||
I2C_Type *base;
|
||||
|
||||
char *device_name;
|
||||
};
|
||||
|
||||
static uint32_t get_i2c_freq(I2C_Type *base)
|
||||
{
|
||||
uint32_t freq = 0;
|
||||
|
||||
#if defined(BSP_USING_I2C4)
|
||||
if(base == I2C4)
|
||||
{
|
||||
freq = CLOCK_GetFreq(kCLOCK_Flexcomm4);
|
||||
}
|
||||
#endif
|
||||
|
||||
return freq;
|
||||
}
|
||||
|
||||
static rt_size_t master_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg msgs[], rt_uint32_t num)
|
||||
{
|
||||
rt_size_t ret = (0);
|
||||
|
||||
rt_uint32_t index = 0;
|
||||
struct lpc_i2c *lpc_i2c = RT_NULL;
|
||||
struct rt_i2c_msg *msg = RT_NULL;
|
||||
i2c_master_transfer_t xfer = {0};
|
||||
|
||||
RT_ASSERT(bus != RT_NULL);
|
||||
|
||||
lpc_i2c = (struct lpc_i2c *)bus;
|
||||
|
||||
for(index = 0; index < num; index++)
|
||||
{
|
||||
msg = &msgs[index];
|
||||
|
||||
xfer.slaveAddress = msg->addr;
|
||||
xfer.flags = kI2C_TransferDefaultFlag;
|
||||
xfer.subaddress = 0;
|
||||
xfer.subaddressSize = 1;
|
||||
xfer.data = msg->buf;
|
||||
xfer.dataSize = msg->len;
|
||||
|
||||
if (msg->flags & RT_I2C_RD)
|
||||
{
|
||||
xfer.direction = kI2C_Read;
|
||||
}
|
||||
else
|
||||
{
|
||||
xfer.direction = kI2C_Write;
|
||||
}
|
||||
|
||||
if(I2C_MasterTransferBlocking(lpc_i2c->base, &xfer) != kStatus_Success)
|
||||
{
|
||||
rt_kprintf("i2c bus write failed, i2c bus stop!\n");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
ret = index;
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static rt_size_t slave_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg msgs[], rt_uint32_t num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static rt_err_t i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t cmd, rt_uint32_t arg)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bus_device_ops ops =
|
||||
{
|
||||
.master_xfer = master_xfer,
|
||||
.slave_xfer = slave_xfer,
|
||||
.i2c_bus_control = i2c_bus_control,
|
||||
};
|
||||
|
||||
#if defined(BSP_USING_I2C4)
|
||||
static struct lpc_i2c i2c4 =
|
||||
{
|
||||
.base = I2C4,
|
||||
.device_name = "i2c4",
|
||||
.bus.ops = &ops
|
||||
};
|
||||
#endif
|
||||
|
||||
int rt_hw_i2c_init(void)
|
||||
{
|
||||
CLOCK_EnableClock(kCLOCK_Iocon);
|
||||
|
||||
#if defined(BSP_USING_I2C4)
|
||||
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);
|
||||
RESET_PeripheralReset(kFC4_RST_SHIFT_RSTn);
|
||||
|
||||
IOCON_PinMuxSet(IOCON, 1, 1, IOCON_MODE_PULLUP | IOCON_FUNC5 | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
|
||||
IOCON_PinMuxSet(IOCON, 1, 2, IOCON_MODE_PULLUP | IOCON_FUNC5 | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
|
||||
|
||||
i2c_master_config_t masterConfig;
|
||||
|
||||
I2C_MasterGetDefaultConfig(&masterConfig);
|
||||
masterConfig.baudRate_Bps = 100*1000U;
|
||||
|
||||
I2C_MasterInit(I2C4, &masterConfig, get_i2c_freq(I2C4));
|
||||
|
||||
rt_i2c_bus_device_register(&i2c4.bus, i2c4.device_name);
|
||||
#endif
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_BOARD_EXPORT(rt_hw_i2c_init);
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __DRV_I2C_H__
|
||||
#define __DRV_I2C_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
int rt_hw_i2c_init(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "drv_pct2075.h"
|
||||
|
||||
#define PCT2075_I2C_NAME "i2c4"
|
||||
#define PCT2075_I2C_ADDR (0x4C)
|
||||
|
||||
static struct rt_i2c_bus_device *i2c_bus = RT_NULL;
|
||||
|
||||
float pct2075_read(void)
|
||||
{
|
||||
struct rt_i2c_msg msg = {0};
|
||||
rt_uint8_t buf[2] = {0};
|
||||
float data = -0.666666f;
|
||||
|
||||
if(i2c_bus == RT_NULL)
|
||||
{
|
||||
return -0.666666f;
|
||||
}
|
||||
|
||||
msg.addr = PCT2075_I2C_ADDR;
|
||||
msg.flags = RT_I2C_RD;
|
||||
msg.len = 2;
|
||||
msg.buf = buf;
|
||||
|
||||
if (rt_i2c_transfer(i2c_bus, &msg, 1) != 1)
|
||||
{
|
||||
rt_kprintf("I2C write data failed.\n");
|
||||
return data;
|
||||
}
|
||||
|
||||
if((buf[0]&0x80) == 0x00)
|
||||
{
|
||||
data = ((float)(((buf[0]<<8) + buf[1])>>5) * 0.125f);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = 0x800 - ((buf[0]<<8) + buf[1]>>5 );
|
||||
data = -(((float)(data)) * 0.125f);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
MSH_CMD_EXPORT(pct2075_read, read pct2075 oC);
|
||||
|
||||
int rt_hw_pct2075_init(void)
|
||||
{
|
||||
rt_err_t ret = RT_EOK;
|
||||
|
||||
i2c_bus = rt_i2c_bus_device_find(PCT2075_I2C_NAME);
|
||||
if(i2c_bus == RT_NULL)
|
||||
{
|
||||
rt_kprintf("I2c bus not find.\n");
|
||||
ret = (-RT_EIO);
|
||||
goto __fail;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
|
||||
__fail:
|
||||
return ret;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_pct2075_init);
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __DRV_PCT2075_H__
|
||||
#define __DRV_PCT2075_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
int rt_hw_pct2075_init(void);
|
||||
float pct2075_read(void);
|
||||
|
||||
#endif
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "drv_sdcard.h"
|
||||
#include "drv_spi.h"
|
||||
#include "spi_msd.h"
|
||||
|
||||
#define RT_SDCARD_CS_PIN (3)
|
||||
|
||||
int rt_hw_sdcard_init(void)
|
||||
{
|
||||
rt_err_t ret;
|
||||
|
||||
ret = lpc_spi_bus_attach_device("spi2", "spi21", RT_SDCARD_CS_PIN);
|
||||
if(ret != RT_EOK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = msd_init("sd0", "spi21");
|
||||
|
||||
return ret;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_sdcard_init);
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __DRV_SDCARD_H__
|
||||
#define __DRV_SDCARD_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
int rt_hw_sdcard_init(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "drv_spi.h"
|
||||
|
||||
#include "fsl_common.h"
|
||||
#include "fsl_iocon.h"
|
||||
#include "fsl_spi.h"
|
||||
|
||||
struct lpc_spi
|
||||
{
|
||||
SPI_Type *base;
|
||||
struct rt_spi_configuration *cfg;
|
||||
};
|
||||
|
||||
static uint32_t get_spi_freq(SPI_Type *base)
|
||||
{
|
||||
uint32_t freq = 0;
|
||||
|
||||
#if defined(BSP_USING_SPI2)
|
||||
if(base == SPI2)
|
||||
{
|
||||
freq = CLOCK_GetFreq(kCLOCK_Flexcomm2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return freq;
|
||||
}
|
||||
|
||||
static rt_err_t spi_init(SPI_Type *base, struct rt_spi_configuration *cfg)
|
||||
{
|
||||
spi_master_config_t masterConfig = {0};
|
||||
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
|
||||
if(cfg->data_width != 8 && cfg->data_width != 16)
|
||||
{
|
||||
return (-RT_EINVAL);
|
||||
}
|
||||
|
||||
SPI_MasterGetDefaultConfig(&masterConfig);
|
||||
|
||||
if(cfg->max_hz > 12*1000*1000)
|
||||
{
|
||||
cfg->max_hz = 12*1000*1000;
|
||||
}
|
||||
masterConfig.baudRate_Bps = cfg->max_hz;
|
||||
|
||||
if(cfg->data_width == 8)
|
||||
{
|
||||
masterConfig.dataWidth = kSPI_Data8Bits;
|
||||
}
|
||||
else if(cfg->data_width == 16)
|
||||
{
|
||||
masterConfig.dataWidth = kSPI_Data16Bits;
|
||||
}
|
||||
|
||||
if(cfg->mode & RT_SPI_MSB)
|
||||
{
|
||||
masterConfig.direction = kSPI_MsbFirst;
|
||||
}
|
||||
else
|
||||
{
|
||||
masterConfig.direction = kSPI_LsbFirst;
|
||||
}
|
||||
|
||||
if(cfg->mode & RT_SPI_CPHA)
|
||||
{
|
||||
masterConfig.phase = kSPI_ClockPhaseSecondEdge;
|
||||
}
|
||||
else
|
||||
{
|
||||
masterConfig.phase = kSPI_ClockPhaseFirstEdge;
|
||||
}
|
||||
|
||||
if(cfg->mode & RT_SPI_CPOL)
|
||||
{
|
||||
masterConfig.polarity = kSPI_ClockPolarityActiveLow;
|
||||
}
|
||||
else
|
||||
{
|
||||
masterConfig.polarity = kSPI_ClockPolarityActiveHigh;
|
||||
}
|
||||
|
||||
masterConfig.txWatermark = kSPI_TxFifo0,
|
||||
masterConfig.rxWatermark = kSPI_RxFifo1,
|
||||
|
||||
// masterConfig.sselNum = kSPI_Ssel3;
|
||||
SPI_MasterInit(base, &masterConfig, get_spi_freq(base));
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
rt_err_t lpc_spi_bus_attach_device(const char *bus_name, const char *device_name, rt_uint32_t pin)
|
||||
{
|
||||
rt_err_t ret = RT_EOK;
|
||||
|
||||
struct rt_spi_device *spi_device = (struct rt_spi_device *)rt_malloc(sizeof(struct rt_spi_device));
|
||||
RT_ASSERT(spi_device != RT_NULL);
|
||||
|
||||
struct lpc_sw_spi_cs *cs_pin = (struct lpc_sw_spi_cs *)rt_malloc(sizeof(struct lpc_sw_spi_cs));
|
||||
RT_ASSERT(cs_pin != RT_NULL);
|
||||
|
||||
cs_pin->pin = pin;
|
||||
rt_pin_mode(pin, PIN_MODE_OUTPUT);
|
||||
rt_pin_write(pin, PIN_HIGH);
|
||||
|
||||
ret = rt_spi_bus_attach_device(spi_device, device_name, bus_name, (void *)cs_pin);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static rt_err_t configure(struct rt_spi_device *device, struct rt_spi_configuration *cfg)
|
||||
{
|
||||
rt_err_t ret = RT_EOK;
|
||||
struct lpc_spi *spi = RT_NULL;
|
||||
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
spi = (struct lpc_spi *)(device->bus->parent.user_data);
|
||||
spi->cfg = cfg;
|
||||
ret = spi_init(spi->base, cfg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
|
||||
{
|
||||
spi_transfer_t transfer = {0};
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(device->bus != RT_NULL);
|
||||
RT_ASSERT(device->bus->parent.user_data != RT_NULL);
|
||||
|
||||
struct lpc_spi *spi = (struct lpc_spi *)(device->bus->parent.user_data);
|
||||
struct lpc_sw_spi_cs *cs = device->parent.user_data;
|
||||
|
||||
if(message->cs_take)
|
||||
{
|
||||
rt_pin_write(cs->pin, PIN_LOW);
|
||||
}
|
||||
|
||||
transfer.dataSize = message->length;
|
||||
transfer.rxData = (uint8_t *)(message->recv_buf);
|
||||
transfer.txData = (uint8_t *)(message->send_buf);
|
||||
transfer.configFlags |= kSPI_FrameAssert;
|
||||
|
||||
SPI_MasterTransferBlocking(spi->base, &transfer);
|
||||
|
||||
if(message->cs_release)
|
||||
{
|
||||
rt_pin_write(cs->pin, PIN_HIGH);
|
||||
}
|
||||
|
||||
return message->length;
|
||||
}
|
||||
|
||||
#if defined(BSP_USING_SPI2)
|
||||
static struct lpc_spi spi2 =
|
||||
{
|
||||
.base = SPI2
|
||||
};
|
||||
static struct rt_spi_bus spi2_bus =
|
||||
{
|
||||
.parent.user_data = &spi2
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct rt_spi_ops lpc_spi_ops =
|
||||
{
|
||||
.configure = configure,
|
||||
.xfer = spixfer
|
||||
};
|
||||
|
||||
int rt_hw_spi_init(void)
|
||||
{
|
||||
CLOCK_EnableClock(kCLOCK_Iocon);
|
||||
|
||||
#if defined(BSP_USING_SPI2)
|
||||
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2);
|
||||
RESET_PeripheralReset(kFC2_RST_SHIFT_RSTn);
|
||||
|
||||
IOCON_PinMuxSet(IOCON, 0, 8, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_GPIO_MODE | IOCON_DIGITAL_EN)); /* SPI2_MOSI */
|
||||
IOCON_PinMuxSet(IOCON, 0, 9, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_GPIO_MODE | IOCON_DIGITAL_EN)); /* SPI2_MISO */
|
||||
IOCON_PinMuxSet(IOCON, 0, 10, (IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_GPIO_MODE | IOCON_DIGITAL_EN)); /* SPI2_SCK */
|
||||
|
||||
rt_spi_bus_register(&spi2_bus, "spi2", &lpc_spi_ops);
|
||||
#endif
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_BOARD_EXPORT(rt_hw_spi_init);
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __DRV_SPI_H__
|
||||
#define __DRV_SPI_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
struct lpc_sw_spi_cs
|
||||
{
|
||||
rt_uint32_t pin;
|
||||
};
|
||||
|
||||
int rt_hw_spi_init(void);
|
||||
rt_err_t lpc_spi_bus_attach_device(const char *bus_name, const char *device_name, rt_uint32_t pin);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "drv_spi.h"
|
||||
#include "drv_spi_flash.h"
|
||||
|
||||
#include "rtthread.h"
|
||||
#include "rtdevice.h"
|
||||
#include "spi_flash.h"
|
||||
#include "spi_flash_sfud.h"
|
||||
|
||||
#define RT_SPI_FLASH_CS_PIN (2)
|
||||
|
||||
int rt_hw_flash_init(void)
|
||||
{
|
||||
rt_err_t result;
|
||||
|
||||
result = lpc_spi_bus_attach_device("spi2", "spi20", RT_SPI_FLASH_CS_PIN);
|
||||
if(result != RT_EOK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if(rt_sfud_flash_probe("flash0", "spi20") == RT_NULL)
|
||||
{
|
||||
return RT_ERROR;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_flash_init);
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-11-08 ZYH the first version
|
||||
*/
|
||||
#ifndef __DRV_SPI_FLASH_H_
|
||||
#define __DRV_SPI_FLASH_H_
|
||||
|
||||
int rt_hw_w25qxx_init(void);
|
||||
|
||||
#endif
|
|
@ -142,7 +142,7 @@ int rt_hw_uart_init(void)
|
|||
struct lpc_uart *uart;
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
|
||||
#ifdef RT_USING_UART0
|
||||
#ifdef BSP_USING_UART0
|
||||
|
||||
uart = &uart0;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -184,6 +184,7 @@
|
|||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
|
@ -337,7 +338,7 @@
|
|||
<MiscControls>--library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186</MiscControls>
|
||||
<Define>SDK_DEBUGCONSOLE=0, CPU_LPC54114, CORE_M4, RT_USING_ARM_LIBC, CPU_LPC54114J256BD64_cm4=1</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>applications;.;drivers;Libraries\CMSIS\Include;Libraries\devices\LPC54114\drivers;Libraries\devices\LPC54114\utilities;Libraries\devices\LPC54114;..\..\include;..\..\libcpu\arm\cortex-m4;..\..\libcpu\arm\common;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common</IncludePath>
|
||||
<IncludePath>applications;.;drivers;Libraries\CMSIS\Include;Libraries\devices\LPC54114\drivers;Libraries\devices\LPC54114\utilities;Libraries\devices\LPC54114;..\..\include;..\..\libcpu\arm\cortex-m4;..\..\libcpu\arm\common;..\..\components\dfs\include;..\..\components\dfs\filesystems\devfs;..\..\components\dfs\filesystems\elmfat;..\..\components\dfs\filesystems\romfs;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\spi;..\..\components\drivers\include;..\..\components\drivers\spi\sfud\inc;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
|
@ -406,16 +407,36 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>drivers\clock_config.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>
|
||||
<File>
|
||||
<FileName>drv_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_spi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>drv_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>drv_sdcard.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_sdcard.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>drv_spi_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_spi_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>drv_pct2075.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>drivers\drv_pct2075.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -636,11 +657,6 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\..\src\mem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>memheap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\src\memheap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mempool.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -704,8 +720,157 @@
|
|||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>DeviceDrivers</GroupName>
|
||||
<GroupName>Filesystem</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>dfs.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\src\dfs.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dfs_file.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\src\dfs_file.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dfs_fs.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\src\dfs_fs.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dfs_posix.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\src\dfs_posix.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>poll.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\src\poll.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>select.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\src\select.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>devfs.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dfs_elm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ff.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ccsbcs.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\filesystems\elmfat\option\ccsbcs.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dfs_romfs.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\filesystems\romfs\dfs_romfs.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>romfs.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\dfs\filesystems\romfs\romfs.c</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> --c99</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>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>
|
||||
|
@ -716,6 +881,31 @@
|
|||
<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>spi_msd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\drivers\spi\spi_msd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>spi_flash_sfud.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\drivers\spi\spi_flash_sfud.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sfud.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\drivers\spi\sfud\src\sfud.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>completion.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@ -851,6 +1041,11 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\libc\compilers\armlibc\mem_std.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stdio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\components\libc\compilers\armlibc\stdio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stubs.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
#define RT_USING_IDLE_HOOK
|
||||
#define RT_IDEL_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 */
|
||||
|
@ -32,7 +29,6 @@
|
|||
/* Memory Management */
|
||||
|
||||
#define RT_USING_MEMPOOL
|
||||
#define RT_USING_MEMHEAP
|
||||
#define RT_USING_SMALL_MEM
|
||||
#define RT_USING_HEAP
|
||||
|
||||
|
@ -74,13 +70,38 @@
|
|||
|
||||
/* Device virtual file system */
|
||||
|
||||
#define RT_USING_DFS
|
||||
#define DFS_USING_WORKDIR
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
|
||||
/* 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 4096
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
#define RT_USING_DFS_DEVFS
|
||||
#define RT_USING_DFS_ROMFS
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
#define RT_USING_DEVICE_IPC
|
||||
#define RT_PIPE_BUFSZ 512
|
||||
#define RT_USING_SERIAL
|
||||
#define RT_USING_I2C
|
||||
#define RT_USING_I2C_BITOPS
|
||||
#define RT_USING_PIN
|
||||
#define RT_USING_SPI
|
||||
#define RT_USING_SPI_MSD
|
||||
#define RT_USING_SFUD
|
||||
#define RT_SFUD_USING_FLASH_INFO_TABLE
|
||||
|
||||
/* Using WiFi */
|
||||
|
||||
|
@ -91,6 +112,7 @@
|
|||
/* POSIX layer and C standard library */
|
||||
|
||||
#define RT_USING_LIBC
|
||||
#define RT_USING_POSIX
|
||||
|
||||
/* Network */
|
||||
|
||||
|
@ -159,7 +181,35 @@
|
|||
|
||||
/* example package: hello */
|
||||
|
||||
|
||||
/* Privated Packages of RealThread */
|
||||
|
||||
|
||||
/* Network Utilities */
|
||||
|
||||
|
||||
/* rtpkgs online packages */
|
||||
|
||||
#define SOC_LPC54114
|
||||
#define RT_USING_UART0
|
||||
|
||||
/* LPC54110 Bsp Config */
|
||||
|
||||
/* Select uart drivers */
|
||||
|
||||
#define BSP_USING_UART0
|
||||
|
||||
/* Select spi bus drivers */
|
||||
|
||||
#define BSP_USING_SPI2
|
||||
|
||||
/* Select i2c bus drivers */
|
||||
|
||||
#define BSP_USING_I2C4
|
||||
|
||||
/* Select spi bus drivers */
|
||||
|
||||
#define BSP_USING_SDCARD
|
||||
#define BSP_USING_SPIFLASH
|
||||
#define BSP_USING_PCT2075
|
||||
|
||||
#endif
|
||||
|
|
|
@ -117,6 +117,11 @@
|
|||
<pMon>BIN\CMSIS_AGDI.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>CMSIS_AGDI</Key>
|
||||
<Name>-X"Any" -UAny -O206 -S9 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0LPC5411x_256.FLM -FS00 -FL040000 -FP0($$Device:LPC54114J256BD64$Flash\LPC5411x_256.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
|
@ -168,6 +173,7 @@
|
|||
<pMultCmdsp></pMultCmdsp>
|
||||
<DebugDescription>
|
||||
<Enable>1</Enable>
|
||||
<EnableFlashSeq>0</EnableFlashSeq>
|
||||
<EnableLog>0</EnableLog>
|
||||
<Protocol>2</Protocol>
|
||||
<DbgClock>5000000</DbgClock>
|
||||
|
|
|
@ -184,6 +184,7 @@
|
|||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
|
|
Loading…
Reference in New Issue