Skip to content

Commit 040b876

Browse files
committed
bsp: k230: add qspi driver
1 parent 27e3460 commit 040b876

File tree

8 files changed

+1440
-10
lines changed

8 files changed

+1440
-10
lines changed

bsp/k230/.config

Lines changed: 162 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ CONFIG_FINSH_THREAD_STACK_SIZE=8192
227227
CONFIG_FINSH_USING_HISTORY=y
228228
CONFIG_FINSH_HISTORY_LINES=5
229229
# CONFIG_FINSH_USING_WORD_OPERATION is not set
230+
# CONFIG_FINSH_USING_FUNC_EXT is not set
230231
CONFIG_FINSH_USING_SYMTAB=y
231232
CONFIG_FINSH_CMD_SIZE=80
232233
CONFIG_MSH_USING_BUILT_IN_COMMANDS=y
@@ -316,12 +317,12 @@ CONFIG_CPUTIME_TIMER_FREQ=25000000
316317
# CONFIG_RT_USING_I2C is not set
317318
# CONFIG_RT_USING_PHY is not set
318319
# CONFIG_RT_USING_PHY_V2 is not set
319-
# CONFIG_RT_USING_ADC is not set
320+
CONFIG_RT_USING_ADC=y
320321
# CONFIG_RT_USING_DAC is not set
321322
CONFIG_RT_USING_NULL=y
322323
CONFIG_RT_USING_ZERO=y
323324
CONFIG_RT_USING_RANDOM=y
324-
# CONFIG_RT_USING_PWM is not set
325+
CONFIG_RT_USING_PWM=y
325326
# CONFIG_RT_USING_PULSE_ENCODER is not set
326327
# CONFIG_RT_USING_INPUT_CAPTURE is not set
327328
# CONFIG_RT_USING_MTD_NOR is not set
@@ -338,8 +339,14 @@ CONFIG_RT_MMCSD_THREAD_PRIORITY=22
338339
CONFIG_RT_MMCSD_MAX_PARTITION=16
339340
# CONFIG_RT_SDIO_DEBUG is not set
340341
# CONFIG_RT_USING_SDHCI is not set
341-
# CONFIG_RT_USING_SPI is not set
342-
# CONFIG_RT_USING_WDT is not set
342+
CONFIG_RT_USING_SPI=y
343+
# CONFIG_RT_USING_SOFT_SPI is not set
344+
CONFIG_RT_USING_QSPI=y
345+
# CONFIG_RT_USING_SPI_MSD is not set
346+
# CONFIG_RT_USING_SFUD is not set
347+
# CONFIG_RT_USING_ENC28J60 is not set
348+
# CONFIG_RT_USING_SPI_WIFI is not set
349+
CONFIG_RT_USING_WDT=y
343350
# CONFIG_RT_USING_AUDIO is not set
344351
# CONFIG_RT_USING_SENSOR is not set
345352
# CONFIG_RT_USING_TOUCH is not set
@@ -425,6 +432,7 @@ CONFIG_RT_USING_POSIX_TIMER=y
425432
#
426433
CONFIG_RT_USING_SAL=y
427434
CONFIG_SAL_INTERNET_CHECK=y
435+
CONFIG_SOCKET_TABLE_STEP_LEN=4
428436

429437
#
430438
# Docking with protocol stacks
@@ -520,8 +528,46 @@ CONFIG_RT_LWIP_USING_PING=y
520528
# Utilities
521529
#
522530
# CONFIG_RT_USING_RYM is not set
523-
# CONFIG_RT_USING_ULOG is not set
524-
# CONFIG_RT_USING_UTEST is not set
531+
CONFIG_RT_USING_ULOG=y
532+
# CONFIG_ULOG_OUTPUT_LVL_A is not set
533+
# CONFIG_ULOG_OUTPUT_LVL_E is not set
534+
# CONFIG_ULOG_OUTPUT_LVL_W is not set
535+
# CONFIG_ULOG_OUTPUT_LVL_I is not set
536+
CONFIG_ULOG_OUTPUT_LVL_D=y
537+
# CONFIG_ULOG_OUTPUT_LVL_EMERG is not set
538+
# CONFIG_ULOG_OUTPUT_LVL_ALERT is not set
539+
# CONFIG_ULOG_OUTPUT_LVL_CRIT is not set
540+
# CONFIG_ULOG_OUTPUT_LVL_ERROR is not set
541+
# CONFIG_ULOG_OUTPUT_LVL_WARNING is not set
542+
# CONFIG_ULOG_OUTPUT_LVL_NOTICE is not set
543+
# CONFIG_ULOG_OUTPUT_LVL_INFO is not set
544+
# CONFIG_ULOG_OUTPUT_LVL_DEBUG is not set
545+
CONFIG_ULOG_OUTPUT_LVL=7
546+
# CONFIG_ULOG_USING_ISR_LOG is not set
547+
CONFIG_ULOG_ASSERT_ENABLE=y
548+
CONFIG_ULOG_LINE_BUF_SIZE=128
549+
# CONFIG_ULOG_USING_ASYNC_OUTPUT is not set
550+
551+
#
552+
# log format
553+
#
554+
# CONFIG_ULOG_OUTPUT_FLOAT is not set
555+
CONFIG_ULOG_USING_COLOR=y
556+
CONFIG_ULOG_OUTPUT_TIME=y
557+
# CONFIG_ULOG_TIME_USING_TIMESTAMP is not set
558+
CONFIG_ULOG_OUTPUT_LEVEL=y
559+
CONFIG_ULOG_OUTPUT_TAG=y
560+
# CONFIG_ULOG_OUTPUT_THREAD_NAME is not set
561+
# end of log format
562+
563+
CONFIG_ULOG_BACKEND_USING_CONSOLE=y
564+
# CONFIG_ULOG_BACKEND_USING_FILE is not set
565+
# CONFIG_ULOG_USING_FILTER is not set
566+
# CONFIG_ULOG_USING_SYSLOG is not set
567+
CONFIG_RT_USING_UTEST=y
568+
CONFIG_UTEST_THR_STACK_SIZE=4096
569+
CONFIG_UTEST_THR_PRIORITY=20
570+
# CONFIG_RT_UTEST_USING_AUTO_RUN is not set
525571
# CONFIG_RT_USING_VAR_EXPORT is not set
526572
CONFIG_RT_USING_RESOURCE_ID=y
527573
CONFIG_RT_USING_ADT=y
@@ -579,7 +625,99 @@ CONFIG_RT_USING_VDSO=y
579625
#
580626
# RT-Thread Utestcases
581627
#
582-
# CONFIG_RT_USING_UTESTCASES is not set
628+
CONFIG_RT_USING_UTESTCASES=y
629+
630+
#
631+
# Utest Self Testcase
632+
#
633+
# CONFIG_UTEST_SELF_PASS_TC is not set
634+
# end of Utest Self Testcase
635+
636+
#
637+
# Kernel Testcase
638+
#
639+
# CONFIG_UTEST_OBJECT_TC is not set
640+
# CONFIG_UTEST_SLAB_TC is not set
641+
# CONFIG_UTEST_IRQ_TC is not set
642+
# CONFIG_UTEST_SEMAPHORE_TC is not set
643+
# CONFIG_UTEST_EVENT_TC is not set
644+
# CONFIG_UTEST_TIMER_TC is not set
645+
# CONFIG_UTEST_MESSAGEQUEUE_TC is not set
646+
# CONFIG_UTEST_SIGNAL_TC is not set
647+
# CONFIG_UTEST_MUTEX_TC is not set
648+
# CONFIG_UTEST_MAILBOX_TC is not set
649+
# CONFIG_UTEST_THREAD_TC is not set
650+
# CONFIG_UTEST_ATOMIC_TC is not set
651+
# CONFIG_UTEST_HOOKLIST_TC is not set
652+
# CONFIG_UTEST_MTSAFE_KPRINT_TC is not set
653+
# CONFIG_UTEST_SCHEDULER_TC is not set
654+
# CONFIG_UTEST_MEMPOOL_TC is not set
655+
# CONFIG_RT_UTEST_SYS_PERF is not set
656+
# end of Kernel Testcase
657+
658+
#
659+
# CPP11 Testcase
660+
#
661+
# CONFIG_UTEST_CPP11_THREAD_TC is not set
662+
# end of CPP11 Testcase
663+
664+
#
665+
# RTT Posix Testcase
666+
#
667+
# CONFIG_RTT_POSIX_TESTCASE is not set
668+
# end of RTT Posix Testcase
669+
670+
#
671+
# Memory Management Subsytem Testcase
672+
#
673+
# CONFIG_UTEST_MM_API_TC is not set
674+
# CONFIG_UTEST_MM_LWP_TC is not set
675+
# end of Memory Management Subsytem Testcase
676+
677+
#
678+
# Tmpfs Testcase
679+
#
680+
# CONFIG_UTEST_TMPFS_CP is not set
681+
# end of Tmpfs Testcase
682+
683+
# CONFIG_RT_UTEST_TC_USING_KLIBC is not set
684+
CONFIG_RT_UTEST_DRIVERS_CORE=y
685+
686+
#
687+
# IPC Unit Testcases
688+
#
689+
# CONFIG_RT_UTEST_COMPLETION is not set
690+
# CONFIG_RT_UTEST_WORKQUEUE is not set
691+
# end of IPC Unit Testcases
692+
693+
#
694+
# Serial Unit Testcases
695+
#
696+
# CONFIG_UTEST_SERIAL_BYPASS is not set
697+
# end of Serial Unit Testcases
698+
699+
#
700+
# SMP-Call Unit Testcases
701+
#
702+
# end of SMP-Call Unit Testcases
703+
704+
#
705+
# File System Unit Testcase
706+
#
707+
# CONFIG_RT_UTEST_TC_USING_DFS_API is not set
708+
# end of File System Unit Testcase
709+
710+
#
711+
# LwIP Network Unit Testcase
712+
#
713+
# CONFIG_RT_UTEST_TC_USING_LWIP is not set
714+
# end of LwIP Network Unit Testcase
715+
716+
#
717+
# Netdev Network Unit Testcase
718+
#
719+
# CONFIG_RT_UTEST_TC_USING_NETDEV is not set
720+
# end of Netdev Network Unit Testcase
583721
# end of RT-Thread Utestcases
584722

585723
#
@@ -941,6 +1079,7 @@ CONFIG_RT_USING_VDSO=y
9411079
# CONFIG_PKG_USING_R_RHEALSTONE is not set
9421080
# CONFIG_PKG_USING_HEARTBEAT is not set
9431081
# CONFIG_PKG_USING_MICRO_ROS_RTTHREAD_PACKAGE is not set
1082+
# CONFIG_PKG_USING_CHERRYECAT is not set
9441083
# end of system packages
9451084

9461085
#
@@ -1098,6 +1237,12 @@ CONFIG_RT_USING_VDSO=y
10981237
# CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set
10991238
# CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set
11001239
# end of GD32 Drivers
1240+
1241+
#
1242+
# HPMicro SDK
1243+
#
1244+
# CONFIG_PKG_USING_HPM_SDK is not set
1245+
# end of HPMicro SDK
11011246
# end of HAL & SDK Drivers
11021247

11031248
#
@@ -1617,6 +1762,12 @@ CONFIG_PKG_ZLIB_VER="latest"
16171762
#
16181763
# Drivers Configuration
16191764
#
1765+
CONFIG_BSP_USING_QSPI=y
1766+
CONFIG_RT_USING_OSPI=y
1767+
# CONFIG_RT_USING_QSPI0 is not set
1768+
# CONFIG_RT_USING_QSPI1 is not set
1769+
CONFIG_RT_USING_QSPI_XFER_LIMIT=y
1770+
CONFIG_RT_QSPI_MAX_XFER_SIZE=4095
16201771
# CONFIG_BSP_USING_RTC is not set
16211772
# CONFIG_BSP_USING_ADC is not set
16221773
# CONFIG_BSP_USING_TS is not set
@@ -1636,9 +1787,11 @@ CONFIG_BSP_USING_SDIO0=y
16361787
# CONFIG_BSP_USING_SDIO1 is not set
16371788
CONFIG_BSP_SD_MNT_DEVNAME="sd0p1"
16381789
# CONFIG_BSP_USING_TIMERS is not set
1639-
# CONFIG_BSP_USING_WDT is not set
1790+
CONFIG_BSP_USING_WDT=y
1791+
CONFIG_BSP_USING_WDT0=y
1792+
# CONFIG_BSP_USING_WDT1 is not set
16401793
# CONFIG_BSP_USING_PDMA is not set
1641-
# CONFIG_BSP_UTEST_DRIVERS is not set
1794+
CONFIG_BSP_UTEST_DRIVERS=y
16421795
# end of Drivers Configuration
16431796

16441797
CONFIG_BOARD_C908=y

bsp/k230/board/Kconfig

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
menu "Drivers Configuration"
22

3+
menuconfig BSP_USING_QSPI
4+
bool "Enable QSPI"
5+
select RT_USING_QSPI
6+
default n
7+
8+
if BSP_USING_QSPI
9+
config RT_USING_OSPI
10+
bool "Enable OSPI"
11+
default n
12+
13+
config RT_USING_QSPI0
14+
bool "Enable QSPI0"
15+
default n
16+
17+
config RT_USING_QSPI1
18+
bool "Enable QSPI1"
19+
default n
20+
21+
config RT_USING_QSPI_XFER_LIMIT
22+
bool "Enable maximum transfer length limit"
23+
default y
24+
help
25+
Enable a safety limit on the maximum data length per QSPI transfer
26+
to prevent infinite loops or excessive resource usage.
27+
28+
if RT_USING_QSPI_XFER_LIMIT
29+
config RT_QSPI_MAX_XFER_SIZE
30+
int "Maximum QSPI transfer size (in bytes)"
31+
default 4095
32+
range 1 65535
33+
help
34+
The upper limit (in bytes) for a standard SPI transfer.
35+
Transfers larger than this will be truncated or return error.
36+
Default: 4095 bytes (0xFFF)
37+
endif
38+
endif
39+
340
config BSP_USING_RTC
441
bool "Enable RTC"
542
select RT_USING_RTC
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RT-Thread building script for SPI component
2+
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Glob('*.c')
7+
CPPPATH = [cwd]
8+
9+
group = DefineGroup('QSPI', src, depend = ['BSP_USING_QSPI'], CPPPATH = CPPPATH)
10+
11+
Return('group')

0 commit comments

Comments
 (0)