test framework

This commit is contained in:
wuzheng 2022-11-09 20:45:44 +08:00
parent d3836f1a6f
commit b8cf052d49
9 changed files with 73 additions and 12 deletions

View File

@ -26,14 +26,42 @@ menu "test app"
endif
endif
menuconfig USER_TEST_SD
bool "Config test sd"
menuconfig USER_TEST_FS
bool "Config test fs with sd or usb"
default n
if USER_TEST_SD
if USER_TEST_FS
if ADD_XIZI_FETURES
config SD_FPATH
string "Set sd file path"
default "/sdcard_testfile"
string "Set test file path"
default "/test_file"
endif
endif
menuconfig USER_TEST_GPIO
select BSP_USING_GPIO
select RESOURCES_PIN
select BSP_USING_LED
select BSP_USING_KEY
bool "Config test gpio with led and key"
default n
if USER_TEST_GPIO
if ADD_XIZI_FETURES
config GPIO_DEV_DRIVER
string "Set gpio dev path"
default "/dev/pin_dev"
endif
endif
menuconfig USER_TEST_I2C
select BSP_USING_I2C
bool "Config test i2c"
default n
if USER_TEST_I2C
if ADD_XIZI_FETURES
config I2C_DEV_DRIVER
string "Set i2c dev path"
default "/dev/i2c_dev"
endif
endif

View File

@ -25,8 +25,8 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
SRC_FILES += test_dac.c
endif
ifeq ($(CONFIG_USER_TEST_SD),y)
SRC_FILES += test_softspi_sd.c
ifeq ($(CONFIG_USER_TEST_FS),y)
SRC_FILES += test_fs.c
endif
ifeq ($(CONFIG_USER_TEST_SEMC),y)
@ -37,5 +37,13 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
SRC_FILES +=
endif
ifeq ($(CONFIG_USER_TEST_I2C),y)
SRC_FILES += test_i2c.c
endif
ifeq ($(CONFIG_USER_TEST_GPIO),y)
SRC_FILES += test_gpio.c
endif
include $(KERNEL_ROOT)/compiler.mk
endif

View File

@ -15,7 +15,7 @@ void TestSD(void)
//read and write then close file
read(fd,filewords,MAX_READ_LENGTH);
printf("read data is \n%s\n",filewords);
const char *input_words = "these words are going to write in sdcard\n";
const char *input_words = "these words are going to write in fs\n";
write(fd,input_words,strlen(input_words));
close(fd);

View File

@ -0,0 +1,10 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
void TestGpio(void)
{
}

View File

@ -0,0 +1,9 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
void TestI2C(void)
{
}

View File

@ -97,12 +97,22 @@ static struct io_config
IOCONFIG(BSP_CH438_D6_PIN, HS_GPIO(FPIOA_CH438_D6)),
IOCONFIG(BSP_CH438_D7_PIN, HS_GPIO(FPIOA_CH438_D7)),
#endif
#ifdef BSP_USING_SOFT_SPI
IOCONFIG(BSP_SOFT_SPI_SCK_PIN, HS_GPIO(FPIOA_SOFT_SPI_SCK)),
IOCONFIG(BSP_SOFT_SPI_MIOS_PIN, HS_GPIO(FPIOA_SOFT_SPI_MIOS)),
IOCONFIG(BSP_SOFT_SPI_MSOI_PIN, HS_GPIO(FPIOA_SOFT_SPI_MSOI)),
IOCONFIG(BSP_SOFT_SPI_NCS_PIN, HS_GPIO(FPIOA_SOFT_SPI_NCS)),
#endif
#ifdef BSP_USING_LED
IOCONFIG(BSP_LED_PIN,FUNC_GPIO5);
#endif
#ifdef BSP_USING_KEY
IOCONFIG(BSP_KEY_PIN,FUNC_GPIO6);
#endif
};
static int PrintIoConfig()

View File

@ -38,10 +38,6 @@ if BSP_USING_SOFT_SPI
config SOFT_SPI_CLK_DELAY
int "clk in microsecond"
default 0
config SOFT_SPI_READ_DELAY
int "read after millisecond"
default 1
endif