Compare commits

...

77 Commits

Author SHA1 Message Date
wlyu 4edf73254e support i2c and fixed no shell bug 3 months ago
wlyu 9b83bc586e support hc32 irq and spi and spi flash 4 months ago
xuedongliang e5bf0cee41 Add camera driver and examples for edu-riscv64 from Wu_zheng 4 months ago
xuedongliang d845bd61b6 feat support control_framework from Liu_Weichao 4 months ago
wuzheng 334d5f1eee Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into prepare_for_master 4 months ago
wuzheng 22e35a70aa adapt wifi framework and fix 'strncat' problem 4 months ago
Liu_Weichao 8583ea25b6 feat add control_framework, support fins protocol OK 4 months ago
Liu_Weichao ba31c9e0f8 feat add control_framework, socket connect OK and delete useless printf 4 months ago
Liu_Weichao f4b21208e8 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into control_framework 4 months ago
xuedongliang 2a01ff712d add w5500 support to xidatong-riscv64 and edu-riscv64 from Tu_Yuyang 4 months ago
Liu_Weichao bc47ae644f feat add control_framework, read json file OK 4 months ago
TXuian 1061ce4dff Merge remote-tracking branch 'upstream/prepare_for_master' into prepare_for_master 4 months ago
wuzheng c1976c8d92 fix errors of naming function 4 months ago
TXuian 0d93a91829 add support to edu. 4 months ago
TXuian 7145cd6920 update w5500 functions. 4 months ago
Liu_Weichao 2a8a11849d feat add control_framework, support fins protocol, add control_io.c and function descriptions 4 months ago
wuzheng 49df162734 add softspi in xidatong-riscv64 4 months ago
Liu_Weichao 5560fc5318 feat add control_framework, support fins protocol, compile OK 4 months ago
wuzheng 987fd6c798 fit touch postion for lvgl 4 months ago
wuzheng ebc61431bd fit touch position for lcd 4 months ago
wuzheng 7c252bda56 fix touch address error 4 months ago
wuzheng e31199a104 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into prepare_for_master 4 months ago
wuzheng 68cdcbdcce improve dvp driver by add one effective mode 4 months ago
wuzheng 06ed03337a add camera driver and examples for edu-riscv64 4 months ago
Liu_Weichao 72e09d82e7 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into control_framework 4 months ago
xuedongliang 164614a75a add touch for edu-riscv64 board from Wang_weigen 4 months ago
xuedongliang 75259c4006 1、support musl libc on nuttx and add test case on xidatong-arm32 2、register lcd device on xidatong-riscv64 on nuttx 4 months ago
xuedongliang 992b8f62ab soft-SPI driver for edu-riscv64,which mainly for SDcard. edu-riscv64 examples including filesystem/RS485/gpio/loraE220/RTC from Wu_zheng 4 months ago
xuedongliang afc27bce65 1、support SDIO driver and mount FAT-FS; 2、support SPI driver; 3、support SPI-LoRa driver; 4、fix heap memory error : start from _bss_end and conflict with stack segment 4 months ago
Wang_Weigen 96baeb9482 add new files for armv7-a 4 months ago
TXuian 2a07e463f6 add w5500 support 4 months ago
TXuian 629e8893e3 add w5500 support. 4 months ago
wuzheng f22fbc3c94 example for edu-riscv64:watchdog,lcd and timer 4 months ago
Wang_Weigen 14f0e442ad fix compile error 4 months ago
Liu_Weichao 32c8701391 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into control_framework 4 months ago
Liu_Weichao 452699ac02 feat add third_party_driver/usb for hc32f4a0 board, support Mount file-system 4 months ago
wgzAIIT 77bae67322 Merge pull request 'merge code' (#20) from develop into prepare_for_master 4 months ago
wgzAIIT 02cbcf2b23 fix touch problem 4 months ago
wgzAIIT 2bfd6c9aaa Merge pull request 'merge code' (#18) from develop into prepare_for_master 4 months ago
wgzAIIT 8bb59ddf3a Resolve kconfig warnning 4 months ago
wuzheng 8c929ba701 rs485 test example 4 months ago
wuzheng e7175c2745 add edu-riscv64 RTC test example 4 months ago
wuzheng e746639f8a add edu-riscv64 lora example and fix name problem 4 months ago
Wang_Weigen d89e018d33 add touch for edu-riscv64 board 4 months ago
wgzAIIT c7c7e700ca Merge pull request 'merge code' (#16) from develop into prepare_for_master 4 months ago
wgzAIIT 5d6aa56f29 support can and add test case for xidatong-riscv64 on nuttx 4 months ago
wuzheng 00b39cdd55 gpio test sample for edu-riscv64 4 months ago
wuzheng b8cf052d49 test framework 4 months ago
wuzheng d3836f1a6f softspi driver and its app test 4 months ago
wgzAIIT 33984d8872 Merge pull request 'merge code' (#15) from develop into prepare_for_master 4 months ago
wgzAIIT 2bc1de068c change ch376_demo.c 4 months ago
wgzAIIT 4f15f1e70b add usbnsh/defconfig and sdnsh/defconfig 4 months ago
wgzAIIT d6495c03d2 Merge pull request 'merge code' (#14) from develop into prepare_for_master 5 months ago
Liu_Weichao 696c9f6fe0 fix MountUsb function error 5 months ago
Liu_Weichao 9a818b1ef4 feat add third_party_driver/usb for hc32f4a0 board, compile OK 5 months ago
wgzAIIT b5e08c5d43 support musl libc on nuttx and add test case 5 months ago
Liu_Weichao 636f803b7b modify usb init position into board.c from init.c 5 months ago
wgzAIIT 51ebd8f604 register lcd device on xidatong-riscv64 on nuttx 5 months ago
Liu_Weichao 5f4922866e modify hc32f4a0 console usart as usart3 5 months ago
Liu_Weichao d0e42a9b51 feat add third_party_driver/spi/lora for hc32f4a0 board, send and receive function OK 5 months ago
Liu_Weichao 107913cb61 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into hc32f4a0_driver 5 months ago
wgzAIIT 7361d1c65f Merge pull request 'merge code' (#10) from develop into prepare_for_master 5 months ago
wgzAIIT 9965ce4c43 register lcd device on riscv64 on nuttx 5 months ago
wgzAIIT a39bc41597 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into prepare_for_master 5 months ago
wgzAIIT 3352d4be6b add hc32 dir 5 months ago
wgzAIIT 485555b3a2 Merge branch 'prepare_for_master' of https://gitlink.org.cn/wgzAIIT/xiuos into prepare_for_master 5 months ago
wgzAIIT 0bb057c642 register_driver lcd device on riscv64 on nuttx 5 months ago
Liu_Weichao 0504cf0e48 feat add third_party_driver/spi/lora for hc32f4a0 board, init function OK 5 months ago
Liu_Weichao 234f4fc2ed Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into hc32f4a0_driver 5 months ago
Liu_Weichao 2d7d5d121d feat add third_party_driver/spi for hc32f4a0 board, write and read function OK 5 months ago
Liu_Weichao 7a8766a74d Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into hc32f4a0_driver 5 months ago
Liu_Weichao e26c93a666 fix heap memory error : start from _bss_end and conflict with stack segment 5 months ago
Liu_Weichao 9802c89fd6 feat add third_party_driver/sdio for hc32f4a0 board 5 months ago
Liu_Weichao 700a07bc84 feat add third_party_driver/spi for hc32f4a0 board, compile OK 5 months ago
Liu_Weichao 37bdc4a33f fix spi CS init param error on aiit-riscv64\K210-emulator\kd233 board 5 months ago
Liu_Weichao c612502cdc Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into control_framework 5 months ago
Liu_Weichao 012fc146cc fix hifive1-emulator compile error : enable work_queen 6 months ago
  1. 1
      APP_Framework/Applications/Make.defs
  2. 4
      APP_Framework/Applications/Makefile
  3. 160
      APP_Framework/Applications/app_test/Kconfig
  4. 52
      APP_Framework/Applications/app_test/Makefile
  5. 2
      APP_Framework/Applications/app_test/test_adc.c
  6. 108
      APP_Framework/Applications/app_test/test_camera.c
  7. 62
      APP_Framework/Applications/app_test/test_fs.c
  8. 73
      APP_Framework/Applications/app_test/test_gpio.c
  9. 53
      APP_Framework/Applications/app_test/test_hwtimer.c
  10. 50
      APP_Framework/Applications/app_test/test_i2c.c
  11. 109
      APP_Framework/Applications/app_test/test_lcd.c
  12. 50
      APP_Framework/Applications/app_test/test_lcd_edu.c
  13. 147
      APP_Framework/Applications/app_test/test_loraE220.c
  14. 103
      APP_Framework/Applications/app_test/test_musl.c
  15. 86
      APP_Framework/Applications/app_test/test_rs485.c
  16. 38
      APP_Framework/Applications/app_test/test_rtc.c
  17. 111
      APP_Framework/Applications/app_test/test_touch.c
  18. 45
      APP_Framework/Applications/app_test/test_wdt.c
  19. 4
      APP_Framework/Applications/connection_app/socket_demo/lwip_tcp_socket_demo.c
  20. 4
      APP_Framework/Applications/connection_app/socket_demo/lwip_udp_socket_demo.c
  21. 26
      APP_Framework/Applications/control_app/plc_demo/omron/omron_cj2m.c
  22. 2
      APP_Framework/Applications/general_functions/Makefile
  23. 11
      APP_Framework/Applications/general_functions/circular_area/Makefile
  24. 11
      APP_Framework/Applications/general_functions/circular_area/SConscript
  25. 281
      APP_Framework/Applications/general_functions/circular_area/circular_area_app.c
  26. 100
      APP_Framework/Applications/general_functions/circular_area/circular_area_app.h
  27. 4
      APP_Framework/Applications/sensor_app/humidity_hs300x.c
  28. 4
      APP_Framework/Applications/sensor_app/temperature_hs300x.c
  29. 1
      APP_Framework/Framework/Makefile
  30. 5
      APP_Framework/Framework/connection/adapter.c
  31. 4
      APP_Framework/Framework/connection/wifi/Makefile
  32. 6
      APP_Framework/Framework/connection/wifi/esp8285_wifi/Kconfig
  33. 5
      APP_Framework/Framework/connection/wifi/esp8285_wifi/Makefile
  34. 106
      APP_Framework/Framework/connection/wifi/esp8285_wifi/esp8285_wifi.c
  35. 24
      APP_Framework/Framework/control/Kconfig
  36. 10
      APP_Framework/Framework/control/Makefile
  37. 6
      APP_Framework/Framework/control/ipc_protocol/Kconfig
  38. 8
      APP_Framework/Framework/control/ipc_protocol/Makefile
  39. 365
      APP_Framework/Framework/control/plc/interoperability/socket/plc_socket.c
  40. 13
      APP_Framework/Framework/control/plc_protocol/Kconfig
  41. 17
      APP_Framework/Framework/control/plc_protocol/Makefile
  42. 2
      APP_Framework/Framework/control/plc_protocol/fins/Makefile
  43. 436
      APP_Framework/Framework/control/plc_protocol/fins/fins.c
  44. 331
      APP_Framework/Framework/control/plc_protocol/fins/test_recipe_fins.json
  45. 86
      APP_Framework/Framework/control/plc_protocol/include/fins.h
  46. 10
      APP_Framework/Framework/control/plc_protocol/include/melsec.h
  47. 15
      APP_Framework/Framework/control/plc_protocol/include/opcua.h
  48. 19
      APP_Framework/Framework/control/plc_protocol/include/s7.h
  49. 6
      APP_Framework/Framework/control/shared/Makefile
  50. 38
      APP_Framework/Framework/control/shared/config.json
  51. 268
      APP_Framework/Framework/control/shared/control.c
  52. 88
      APP_Framework/Framework/control/shared/control.h
  53. 446
      APP_Framework/Framework/control/shared/control_def.c
  54. 161
      APP_Framework/Framework/control/shared/control_def.h
  55. 52
      APP_Framework/Framework/control/shared/control_io.c
  56. 51
      APP_Framework/Framework/control/shared/control_io.h
  57. 9
      APP_Framework/Framework/framework_init.c
  58. 6
      APP_Framework/Framework/sensor/Makefile
  59. 19
      APP_Framework/Framework/transform_layer/nuttx/transform.h
  60. 2
      APP_Framework/Framework/transform_layer/xizi/transform.c
  61. 34
      APP_Framework/Framework/transform_layer/xizi/transform.h
  62. 189
      APP_Framework/lib/lvgl/examples/porting/lv_port_indev_template.c
  63. 6
      APP_Framework/lib/lvgl/lvgl.mk
  64. 3
      APP_Framework/lib/lvgl/porting/lv_port_indev_template.c
  65. 23
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/Kconfig
  66. 46
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/include/board.h
  67. 2
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/kernel/Makefile
  68. 2
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/kernel/hc32_userspace.c
  69. 2
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/scripts/gnu-elf.ld
  70. 2
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/scripts/kernel-space.ld
  71. 14
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/scripts/memory.ld
  72. 10
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/scripts/user-space.ld
  73. 4
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/src/Make.defs
  74. 103
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/src/hc32_boot.c
  75. 24
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/src/hc32_bringup.c
  76. 76
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/src/hc32_romfs.h
  77. 158
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/hc32f4a0/src/hc32_romfs_initialize.c
  78. 74
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-arm32/configs/muslnsh/defconfig
  79. 6
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/Kconfig
  80. 73
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/configs/cannsh/defconfig
  81. 7
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/include/board.h
  82. 4
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/Makefile
  83. 147
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/can_demo.c
  84. 2
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/ch376_demo.c
  85. 30
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/k210_bringup.c
  86. 6
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/k210_ch438.h
  87. 167
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/k210_lcd.c
  88. 11
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/k210_leds.c
  89. 156
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/k210_touch.c
  90. 23
      Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong-riscv64/src/k210_touch.h
  91. 8
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/Kconfig
  92. 7
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh.h
  93. 24
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_Applicationscmd.c
  94. 8
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_command.c
  95. 4
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/arm/include/hc32/irq.h
  96. 40
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/arm/src/hc32/Kconfig
  97. 12
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/arm/src/hc32/Make.defs
  98. 4
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/arm/src/hc32/ddl_config.h
  99. 8
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/arm/src/hc32/hc32_allocateheap.c
  100. 9
      Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/nuttx/arch/arm/src/hc32/hc32_common.h

1
APP_Framework/Applications/Make.defs

@ -2,7 +2,6 @@
# APP_Framework/Applications/Make.defs
############################################################################
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications/app_test
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Applications/general_functions/list
include $(wildcard $(APPDIR)/../../../APP_Framework/Applications/*/Make.defs)

4
APP_Framework/Applications/Makefile

@ -2,7 +2,7 @@ include $(KERNEL_ROOT)/.config
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
include $(APPDIR)/Make.defs
CSRCS += framework_init.c
CSRCS +=
include $(APPDIR)/Application.mk
endif
@ -10,7 +10,7 @@ endif
ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
SRC_DIR := general_functions app_test
SRC_FILES := main.c framework_init.c
SRC_FILES := main.c
ifeq ($(CONFIG_LIB_LV),y)
SRC_DIR += lv_app
endif

160
APP_Framework/Applications/app_test/Kconfig

@ -26,6 +26,164 @@ menu "test app"
endif
endif
menuconfig USER_TEST_FS
bool "Config test fs with sd or usb"
default n
if USER_TEST_FS
if ADD_XIZI_FETURES
config FPATH
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_LORA
select BSP_USING_UART
select BSP_USING_GPIO
select RESOURCES_PIN
select BSP_USING_UART2
select BSP_USING_LORA
bool "Config test uart(loraE220)"
default n
if USER_TEST_LORA
if ADD_XIZI_FETURES
config LORA_UART_DEV_DRIVER
string "Set uart dev path"
default "/dev/uart2_dev2"
config LORA_PIN_DEV_DRIVER
string "Set pin dev path"
default "/dev/pin_dev"
endif
endif
menuconfig USER_TEST_RS485
select BSP_USING_UART
select BSP_USING_GPIO
select RESOURCES_PIN
select BSP_USING_UART1
bool "Config test uart(RS485)"
default n
if USER_TEST_RS485
if ADD_XIZI_FETURES
config RS485_UART_DEV_DRIVER
string "Set uart dev path"
default "/dev/uart1_dev1"
config RS485_PIN_DEV_DRIVER
string "Set pin dev path"
default "/dev/pin_dev"
endif
endif
menuconfig USER_TEST_RTC
select BSP_USING_RTC
bool "Config test rtc"
default n
if USER_TEST_RTC
if ADD_XIZI_FETURES
config RTC_DEV_DRIVER
string "Set rtc dev path"
default "/dev/rtc_dev"
endif
endif
menuconfig USER_TEST_HWTIMER
select BSP_USING_HWTIMER
select BSP_USING_GPIO
select RESOURCES_PIN
select BSP_USING_LED
bool "Config test hwtimer"
default n
if USER_TEST_HWTIMER
if ADD_XIZI_FETURES
config HWTIMER_PIN_DEV_DRIVER
string "Set pin dev path"
default "/dev/pin_dev"
endif
endif
menuconfig USER_TEST_WDT
select BSP_USING_WDT0
bool "Config test watchdog"
default n
if USER_TEST_WDT
if ADD_XIZI_FETURES
config WDT0_DEV_DRIVER
string "Set wdt dev path"
default "/dev/wdt0_dev0"
endif
endif
menuconfig USER_TEST_LCD_EDU
select BSP_USING_LCD
bool "Config test lcd in PrivOpen"
default n
if USER_TEST_LCD_EDU
if ADD_XIZI_FETURES
config EDU_LCD_DEV_DRIVER
string "Set lcd dev path"
default "/dev/lcd_dev"
endif
endif
menuconfig USER_TEST_TOUCH
select BSP_USING_TOUCH
bool "Config test touch"
default n
if USER_TEST_TOUCH
if ADD_XIZI_FETURES
config TOUCH_DEV_DRIVER
string "Set touch dev path"
default "/dev/touch_dev"
config TOUCH_LCD_DEV_DRIVER
string "Set lcd dev path"
default "/dev/lcd_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/i2c1_dev0"
endif
endif
menuconfig USER_TEST_CAMERA
select BSP_USING_CAMERA
select BSP_USING_LCD
bool "Config test camera with lcd"
default n
if USER_TEST_CAMERA
if ADD_XIZI_FETURES
config CAMERA_DEV_DRIVER
string "Set camera dev path"
default "/dev/camera_dev"
config CAMERA_LCD_DEV_DRIVER
string "Set lcd dev path"
default "/dev/lcd_dev"
endif
endif
config USER_TEST_SEMC
bool "Config test semc sdram"
default n
@ -33,5 +191,7 @@ menu "test app"
config USER_TEST_LCD
bool "Config test lcd device"
default n
endif
endmenu

52
APP_Framework/Applications/app_test/Makefile

@ -10,6 +10,14 @@ ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
CSRCS += test_lcd.c
endif
ifeq ($(CONFIG_BSP_USING_TOUCH),y)
CSRCS += test_touch.c
endif
ifeq ($(CONFIG_MUSL_LIBC),y)
CSRCS += test_musl.c
endif
include $(APPDIR)/Application.mk
endif
@ -25,6 +33,10 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
SRC_FILES += test_dac.c
endif
ifeq ($(CONFIG_USER_TEST_FS),y)
SRC_FILES += test_fs.c
endif
ifeq ($(CONFIG_USER_TEST_SEMC),y)
SRC_FILES += test_extsram.c
endif
@ -33,5 +45,45 @@ 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
ifeq ($(CONFIG_USER_TEST_LORA),y)
SRC_FILES += test_loraE220.c
endif
ifeq ($(CONFIG_USER_TEST_RTC),y)
SRC_FILES += test_rtc.c
endif
ifeq ($(CONFIG_USER_TEST_RS485),y)
SRC_FILES += test_rs485.c
endif
ifeq ($(CONFIG_USER_TEST_HWTIMER),y)
SRC_FILES += test_hwtimer.c
endif
ifeq ($(CONFIG_USER_TEST_LCD_EDU),y)
SRC_FILES += test_lcd_edu.c
endif
ifeq ($(CONFIG_USER_TEST_WDT),y)
SRC_FILES += test_wdt.c
endif
ifeq ($(CONFIG_USER_TEST_TOUCH),y)
SRC_FILES += test_touch.c
endif
ifeq ($(CONFIG_USER_TEST_CAMERA),y)
SRC_FILES += test_camera.c
endif
include $(KERNEL_ROOT)/compiler.mk
endif

2
APP_Framework/Applications/app_test/test_adc.c

@ -56,4 +56,4 @@ void TestAdc(void)
return;
}
PRIV_SHELL_CMD_FUNCTION(TestAdc, a adc test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestAdc, a adc test sample, PRIV_SHELL_CMD_MAIN_ATTR);

108
APP_Framework/Applications/app_test/test_camera.c

@ -0,0 +1,108 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define NULL_PARAMETER 0
#define DVP_INIT 0x00U
#define REG_SCCB_READ 0x12U
#define REG_SCCB_WRITE 0x13U
#define OUTPUT_CONFIG 0x20U
#define LCD_STRING_TYPE 0
#define LCD_DOT_TYPE 1
#define LCD_SIZE 320
static uint16_t image_buff[384000];
void TestCamera(int argc, char *argv[])
{
int frame_counter = 10000;
if (argc > 1)
{
frame_counter = atoi(argv[1]);
}
printf("This test will refresh %d frames\n", frame_counter);
int camera_fd = PrivOpen(CAMERA_DEV_DRIVER, O_RDWR);
if (camera_fd < 0)
{
printf("open camera fd error:%d\n", camera_fd);
return;
}
int lcd_fd = PrivOpen(CAMERA_LCD_DEV_DRIVER, O_RDWR);
if (lcd_fd < 0)
{
printf("open lcd fd error:%d\n", lcd_fd);
return;
}
//configure the camera's output address
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = CAMERA_TYPE;
struct CameraCfg camera_cfg ={
.gain_manu_enable = 0,
.gain = 0xFF,
.window_w = 800,
.window_h = 600,
.output_w = IMAGE_WIDTH,
.output_h = IMAGE_HEIGHT,
.window_xoffset = 0,
.window_yoffset = 0
};
ioctl_cfg.args = &camera_cfg;
if (0 != PrivIoctl(camera_fd, OPE_CFG, &ioctl_cfg))
{
printf("camera pin fd error %d\n", camera_fd);
PrivClose(camera_fd);
return;
}
ioctl_cfg.args = (void *)image_buff;
if (0 != PrivRead(camera_fd, image_buff, NULL_PARAMETER))
{
printf("camera pin fd error %d\n", camera_fd);
PrivClose(camera_fd);
return;
}
printf("address buff is %x\n", image_buff);
LcdWriteParam graph_param;
graph_param.type = LCD_DOT_TYPE;
//clear the LCD
uint16_t back_color[LCD_SIZE];
memset(back_color,0,sizeof(back_color));
for (int i = 0; i < LCD_SIZE; i++)
{
graph_param.pixel_info.pixel_color = &back_color;
graph_param.pixel_info.x_startpos = 0;
graph_param.pixel_info.y_startpos = i;
graph_param.pixel_info.x_endpos = LCD_SIZE -1;
graph_param.pixel_info.y_endpos = i;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
}
//refresh the LCD using photo of camera
while (frame_counter--)
{
for (int i = 0; i < IMAGE_HEIGHT; i++)
{
graph_param.pixel_info.pixel_color = image_buff + i * IMAGE_WIDTH;
graph_param.pixel_info.x_startpos = 0;
graph_param.pixel_info.y_startpos = i + (LCD_SIZE - IMAGE_HEIGHT) / 2;
graph_param.pixel_info.x_endpos = IMAGE_WIDTH - 1;
graph_param.pixel_info.y_endpos = i + (LCD_SIZE - IMAGE_HEIGHT) / 2;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
}
}
// close test
PrivClose(lcd_fd);
PrivClose(camera_fd);
printf("The camera test is finished successfully\n");
}
PRIV_SHELL_CMD_FUNCTION(TestCamera, a camera test sample, PRIV_SHELL_CMD_MAIN_ATTR);

62
APP_Framework/Applications/app_test/test_fs.c

@ -0,0 +1,62 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define MAX_READ_LENGTH 1000
// sd card here is loaded as "/"
void TestFs(void)
{
//open the file in sdcard
int fd = open(FPATH,O_RDWR|O_CREAT);
if(fd<0){
printf("fs fd open error:%d\n",fd);
return;
}
char filewords[MAX_READ_LENGTH];
memset(filewords,0,MAX_READ_LENGTH);
const char *input_words = "these words are going to write in fs\n";
//read and write then close file
int err_flag = read(fd,filewords,MAX_READ_LENGTH);
if(err_flag<0){
printf("read failed,error:%d\n",err_flag);
return;
}
printf("read data is \n%s\n",filewords);
err_flag = write(fd,input_words,strlen(input_words));
if(err_flag<0){
printf("write failed,error:%d\n",err_flag);
return;
}
err_flag = close(fd);
if(err_flag<0){
printf("close failed,error %d\n",err_flag);
return ;
}
//re-open the file and re-read the file
fd = open(FPATH,O_RDWR);
if(fd<0){
printf("fs fd open error:%d\n",fd);
return;
}
err_flag = read(fd,filewords,MAX_READ_LENGTH);
if(err_flag<0){
printf("read failed,error:%d\n",err_flag);
return;
}
printf("read data is \n%s\n",filewords);
err_flag = close(fd);
if(err_flag<0){
printf("close failed,error:%d\n",err_flag);
return;
}
return;
}
PRIV_SHELL_CMD_FUNCTION(TestFs, a sd or usb filesystem test sample, PRIV_SHELL_CMD_MAIN_ATTR);

73
APP_Framework/Applications/app_test/test_gpio.c

@ -0,0 +1,73 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define BSP_LED_PIN 29
#define BSP_KEY_PIN 31
#define NULL_PARAMETER 0
void TestGpio(void)
{
int pin_fd = PrivOpen(GPIO_DEV_DRIVER, O_RDWR);
if(pin_fd<0){
printf("open pin fd error:%d\n",pin_fd);
return;
}
//config led pin in board
struct PinParam parameter;
parameter.cmd = GPIO_CONFIG_MODE;
parameter.pin = BSP_LED_PIN;
parameter.mode = GPIO_CFG_OUTPUT;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = PIN_TYPE;
ioctl_cfg.args = (void *)&parameter;
if (0 != PrivIoctl(pin_fd, OPE_CFG, &ioctl_cfg)) {
printf("ioctl pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
//config key pin in board
parameter.pin = BSP_KEY_PIN;
parameter.mode = GPIO_CFG_INPUT;
if (0 != PrivIoctl(pin_fd, OPE_CFG, &ioctl_cfg)) {
printf("ioctl pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
struct PinStat pin_led;
struct PinStat pin_key;
pin_led.pin = BSP_LED_PIN;
pin_key.pin = BSP_KEY_PIN;
//recycle read pin and write pin until key break
while(1){
if(0>PrivRead(pin_fd,&pin_key,NULL_PARAMETER)){
printf("read pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
//led on if key pressed,or led off
if(pin_key.val){
pin_led.val = GPIO_HIGH;
}else{
pin_led.val = GPIO_LOW;
}
if(0>PrivWrite(pin_fd,&pin_led,NULL_PARAMETER)){
printf("write pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
}
}
PRIV_SHELL_CMD_FUNCTION(TestGpio, a gpio test sample, PRIV_SHELL_CMD_MAIN_ATTR);

53
APP_Framework/Applications/app_test/test_hwtimer.c

@ -0,0 +1,53 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define BSP_LED_PIN 29
#define NULL_PARAMETER 0
static uint16_t pinval=0;
static uint16_t pin_fd=0;
void ledflip(void *parameter)
{
struct PinStat pin_led;
pin_led.pin = BSP_LED_PIN;
pin_led.val = !pinval;
pinval = !pinval;
PrivWrite(pin_fd,&pin_led,NULL_PARAMETER);
// printf("Timer has callback once:%d\n",pinval);
}
void TestHwTimer(void)
{
x_ticks_t period = 100;//uint:10ms
pin_fd = PrivOpen(HWTIMER_PIN_DEV_DRIVER, O_RDWR);
if(pin_fd<0){
printf("open pin fd error:%d\n",pin_fd);
return;
}
//config led pin in board
struct PinParam parameter;
parameter.cmd = GPIO_CONFIG_MODE;
parameter.pin = BSP_LED_PIN;
parameter.mode = GPIO_CFG_OUTPUT;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = PIN_TYPE;
ioctl_cfg.args = (void *)&parameter;
if (0 != PrivIoctl(pin_fd, OPE_CFG, &ioctl_cfg)) {
printf("ioctl pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
int32 timer_handle = KCreateTimer("LED on and off by 1s",&ledflip,&pin_fd,period,TIMER_TRIGGER_PERIODIC);
KTimerStartRun(timer_handle);
}
PRIV_SHELL_CMD_FUNCTION(TestHwTimer, a timer test sample, PRIV_SHELL_CMD_MAIN_ATTR);

50
APP_Framework/Applications/app_test/test_i2c.c

@ -0,0 +1,50 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define I2C_SLAVE_ADDRESS 0x0012U
void TestI2C(void)
{
// config IIC pin(SCL:34.SDA:35) in menuconfig
int iic_fd = PrivOpen(I2C_DEV_DRIVER, O_RDWR);
if (iic_fd < 0)
{
printf("open iic_fd fd error:%d\n", iic_fd);
return;
}
printf("IIC open successful!\n");
// init iic
uint16 iic_address = I2C_SLAVE_ADDRESS;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = I2C_TYPE;
ioctl_cfg.args = (void *)&iic_address;
if (0 != PrivIoctl(iic_fd, OPE_INT, &ioctl_cfg))
{
printf("ioctl iic fd error %d\n", iic_fd);
PrivClose(iic_fd);
return;
}
printf("IIC configure successful!\n");
// I2C read and write
char tmp_buff[100];
while (1)
{
PrivTaskDelay(1000);
PrivWrite(iic_fd, "Hello World!\n", sizeof("Hello World!\n"));
printf("msg send:%s\n", "Hello World!\n");
PrivTaskDelay(1000);
memset(tmp_buff, 0, sizeof(tmp_buff));
PrivRead(iic_fd, tmp_buff, sizeof(tmp_buff));
printf("msg recv:%s\n", tmp_buff);
}
PrivClose(iic_fd);
return;
}
PRIV_SHELL_CMD_FUNCTION(TestI2C, a iic test sample, PRIV_SHELL_CMD_MAIN_ATTR);

109
APP_Framework/Applications/app_test/test_lcd.c

@ -1,26 +1,22 @@
/****************************************************************************
* apps/examples/fb/fb_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_lcd.c
* @brief: a application of dac function
* @version: 2.0
* @author: AIIT XUOS Lab
* @date: 2022/1/11
*/
#include <transform.h>
@ -29,40 +25,39 @@
#ifdef CONFIG_K210_LCD
void LcdDemo(void)
{
int x1 = 50, y1 = 50, x2 = LCD_XSIZE_TFT - 50, y2 = LCD_YSIZE_TFT - 50;
Main_Image_Start_Address(LCD_START_ADDR);
Main_Image_Width(LCD_XSIZE_TFT);
Main_Window_Start_XY(0, 0);
Canvas_Image_Start_address(LCD_START_ADDR);
Canvas_image_width(LCD_XSIZE_TFT);
Active_Window_XY(0, 0);
Active_Window_WH(LCD_XSIZE_TFT, LCD_YSIZE_TFT);
up_mdelay(10);
Canvas_Image_Start_address(LCD_START_ADDR);
for(int i = 0; i < 3; i++)
{
x1 = 50;
y1 = 50;
x2 = LCD_XSIZE_TFT - 50;
y2 = LCD_YSIZE_TFT - 50;
syslog(LOG_NOTICE, "Disp_demo %d (%d,%d - %d,%d)\n", i, x1, y1, x2, y2);
LT768_DrawSquare_Fill(x1, y1, x2, y2, Red);
up_mdelay(2000);
x1 += 20;
y1 += 20;
x2 -= 20;
y2 -= 20;
LT768_DrawSquare_Fill(x1, y1, x2, y2, Green);
up_mdelay(2000);
x1 += 20;
y1 += 20;
x2 -= 20;
y2 -= 20;
LT768_DrawSquare_Fill(x1, y1, x2, y2, Blue);
up_mdelay(2000);
}
int lcd_fd = PrivOpen("/dev/lcd_dev",O_RDWR);
LcdWriteParam disp_info;
disp_info.type = 0;
disp_info.string_info.x_pos = 80;
disp_info.string_info.y_pos = 80;
disp_info.string_info.width = 250;
disp_info.string_info.height = 24;
disp_info.string_info.font_size = 24;
disp_info.string_info.addr = "wecome test lcd";
disp_info.string_info.font_color = GREEN;
disp_info.string_info.back_color = BLUE;
PrivWrite(lcd_fd, &disp_info, sizeof(LcdWriteParam));
PrivTaskDelay(2000);
disp_info.type = 1;
lv_color_t redcolor = {
.ch = {
.red = 0b11111,
.green = 0,
.blue = 0
}
};
disp_info.pixel_info.x_startpos = 0;
disp_info.pixel_info.x_endpos = 50;
disp_info.pixel_info.y_startpos = 0;
disp_info.pixel_info.y_endpos = 50;
disp_info.pixel_info.pixel_color = &redcolor;
PrivWrite(lcd_fd, &disp_info, sizeof(LcdWriteParam));
PrivTaskDelay(2000);
disp_info.type = SHOW_TRIANGLE;
PrivWrite(lcd_fd, &disp_info, sizeof(LcdWriteParam));
}
#else

50
APP_Framework/Applications/app_test/test_lcd_edu.c

@ -0,0 +1,50 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define GRAPHIC_CTRL_RECT_UPDATE 0x00
#define LCD_STRING_TYPE 0
#define LCD_DOT_TYPE 1
#define LCD_FONT_RECT_WIDTH 150
#define LCD_FONT_RECT_HEIGHT 50
#define NULL_PARAMETER 0
void TestLcd(void)
{
int lcd_fd = PrivOpen(EDU_LCD_DEV_DRIVER, O_RDWR);
if (lcd_fd < 0)
{
printf("open lcd fd error:%d\n", lcd_fd);
return;
}
// draw text
LcdWriteParam graph_param;
graph_param.type = LCD_STRING_TYPE;
graph_param.string_info.x_pos = 0;
graph_param.string_info.y_pos = 0;
graph_param.string_info.width = 250;
graph_param.string_info.height = 24;
graph_param.string_info.font_size = 24;
graph_param.string_info.back_color = 0xFFFF;
graph_param.string_info.font_color = 0x0000;
graph_param.string_info.addr = "hello_world!";
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
uint16 color_select = 0xF800;
for (int i = 0; i < 5; i++)
{
graph_param.type = LCD_DOT_TYPE;
graph_param.pixel_info.x_startpos = 0;
graph_param.pixel_info.y_startpos = 50 * i;
graph_param.pixel_info.x_endpos = 320;
graph_param.pixel_info.y_endpos = 50 * i;
graph_param.pixel_info.pixel_color = &color_select;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
}
PrivClose(lcd_fd);
}
PRIV_SHELL_CMD_FUNCTION(TestLcd, a lcd test sample, PRIV_SHELL_CMD_MAIN_ATTR);

147
APP_Framework/Applications/app_test/test_loraE220.c

@ -0,0 +1,147 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define NULL_PARAMETER 0
#define E220_CFG_LENGTH
#define GPIOSET(fd, buf, bit) \
{ \
buf.val = bit; \
if (0 > PrivWrite(fd, &buf, NULL_PARAMETER)) \
{ \
printf("write pin fd error %d\n", fd); \
PrivClose(fd); \
return; \
} \
}
#define BSP_E220_M0_PIN 32
#define BSP_E220_M1_PIN 33
void TestLora(int argc, char *argv[])
{
char uart_recvbuff[100];
memset(uart_recvbuff, 0, sizeof(uart_recvbuff));
int pin_fd = PrivOpen(LORA_PIN_DEV_DRIVER, O_RDWR);
if (pin_fd < 0)
{
printf("open pin fd error:%d\n", pin_fd);
return;
}
int uart_fd = PrivOpen(LORA_UART_DEV_DRIVER, O_RDWR);
if (uart_fd < 0)
{
printf("open pin fd error:%d\n", uart_fd);
return;
}
printf("uart and pin fopen success\n");
struct PinStat pin_m0;
struct PinStat pin_m1;
pin_m0.pin = BSP_E220_M0_PIN;
pin_m1.pin = BSP_E220_M1_PIN;
// config led pin in board
struct PrivIoctlCfg ioctl_cfg;
struct PinParam pin_param;
pin_param.cmd = GPIO_CONFIG_MODE;
pin_param.mode = GPIO_CFG_OUTPUT;
pin_param.pin = BSP_E220_M0_PIN;
ioctl_cfg.ioctl_driver_type = PIN_TYPE;
ioctl_cfg.args = &pin_param;
if (0 != PrivIoctl(pin_fd, OPE_CFG, &ioctl_cfg))
{
printf("ioctl pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
pin_param.pin = BSP_E220_M1_PIN;
if (0 != PrivIoctl(pin_fd, OPE_CFG, &ioctl_cfg))
{
printf("ioctl pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
printf("pin configure success\n");
struct SerialDataCfg uart_cfg;
memset(&uart_cfg, 0, sizeof(struct SerialDataCfg));
// loraE220 support only 9600bps with 8N1 during initializing
uart_cfg.serial_baud_rate = BAUD_RATE_9600;
uart_cfg.serial_data_bits = DATA_BITS_8;
uart_cfg.serial_stop_bits = STOP_BITS_1;
uart_cfg.serial_parity_mode = PARITY_NONE;
uart_cfg.serial_bit_order = BIT_ORDER_LSB;
uart_cfg.serial_invert_mode = NRZ_NORMAL;
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
uart_cfg.serial_timeout = 1000;
uart_cfg.is_ext_uart = 0;
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
ioctl_cfg.args = (void *)&uart_cfg;
if (0 != PrivIoctl(uart_fd, OPE_INT, &ioctl_cfg))
{
printf("ioctl uart fd error %d\n", uart_fd);
PrivClose(uart_fd);
return;
}
printf("uart configure success\n");
GPIOSET(pin_fd, pin_m0, GPIO_HIGH);
GPIOSET(pin_fd, pin_m1, GPIO_HIGH);
printf("lora configure into sleep(configure) mode\n");
// send configure data, and receive the same length of data
char sendbuff[] = {0xC0, 0x00, 0x05, 0x19, 0x49, 0xE6, 0x00, 0x17}; // config as address 1949 CH17 36.8kps
PrivTaskDelay(2000);
printf("Sending lora configure information(SIZE:%d)\n", sizeof(sendbuff));
PrivWrite(uart_fd, sendbuff, sizeof(sendbuff));
printf("lora configure information send\n");
PrivTaskDelay(2000);
PrivRead(uart_fd, uart_recvbuff, sizeof(sendbuff));
printf("%x %x %x %x", uart_recvbuff[0], uart_recvbuff[1], uart_recvbuff[2], uart_recvbuff[3]);
printf("lora configure success\n");
// error when all bytes are 0xff
if (0xFF == (uart_recvbuff[0] & uart_recvbuff[1] & uart_recvbuff[2]))
{
printf("from lora receive error:%d\n", 0xff);
return;
}
uart_cfg.serial_baud_rate = BAUD_RATE_115200;
if (0 != PrivIoctl(uart_fd, OPE_INT, &ioctl_cfg))
{
printf("ioctl uart fd error %d\n", uart_fd);
PrivClose(uart_fd);
return;
}
// into transparent transmission mode
GPIOSET(pin_fd, pin_m0, GPIO_LOW);
GPIOSET(pin_fd, pin_m1, GPIO_LOW);
// receive and send "Hello World"
while (1)
{
PrivTaskDelay(500);
PrivWrite(uart_fd, "Hello_World!", sizeof("Hello_World!"));
printf("Data Send:\n%s\n", "Hello_World!");
PrivTaskDelay(500);
memset(uart_recvbuff, 0, sizeof(uart_recvbuff));
PrivRead(uart_fd, uart_recvbuff, sizeof(uart_recvbuff));
printf("Receive Data is :\n%s\n", uart_recvbuff);
}
PrivClose(pin_fd);
PrivClose(uart_fd);
}
PRIV_SHELL_CMD_FUNCTION(TestLora, a lora test sample, PRIV_SHELL_CMD_MAIN_ATTR);

103
APP_Framework/Applications/app_test/test_musl.c

@ -0,0 +1,103 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_musl.c
* @brief: a application of musl test function
* @version: 2.0
* @author: AIIT XUOS Lab
* @date: 2022/11/8
*/
#include <transform.h>
#ifdef ADD_NUTTX_FETURES
#if defined(CONFIG_MUSL_LIBC) && defined(CONFIG_FS_AUTOMOUNTER)
static void file_read_and_write(void)
{
FILE *p;
char s[] = "good luck to you!";
char buffer[20];
if((p = fopen("/mnt/sdcard/test.txt","w+")) == NULL)
{
printf("Can not open file!\n");
}
fwrite(s, sizeof(s) + 1, 1, p);
fseek(p, SEEK_SET, 0);
fread(buffer, sizeof(buffer) + 1, 1, p);
printf("read string is: %s\n", buffer);
fclose(p);
}
static void file_operations(void)
{
int ret;
FILE *fp;
char filename1[] = "/mnt/sdcard/file1.txt";
char filename2[] = "/mnt/sdcard/file2.txt";
fp = fopen(filename1, "w");
fprintf(fp, "%s", "this is runoob.com");
fclose(fp);
ret = remove(filename1);
if(ret == 0)
{
printf("remove file1 success!\n");
}
else
{
printf("error,can not remove file1!\n");
}
ret = remove(filename2);
if(ret == 0)
{
printf("remove file2 success!\n");
}
else
{
printf("error,can not remove file2!\n");
}
}
static void malloc_and_free(void)
{
int *p;
int len;
for(int i = 0; i < 100; i++)
{
len = 1024*(i+1);
p = malloc(len);
if(p)
{
printf("malloc %d bytes success!\n",len);
free(p);
}
}
}
void Testmusl(void)
{
printf("--------start test file read and write!--------\n");
file_read_and_write();
printf("----------start test file operationsn!---------\n");
file_operations();
printf("---------start test malloc and free!-----------\n");
malloc_and_free();
}
#endif
#endif

86
APP_Framework/Applications/app_test/test_rs485.c

@ -0,0 +1,86 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define BSP_485_DIR_PIN 24
void Test485(void)
{
int pin_fd = PrivOpen(RS485_PIN_DEV_DRIVER, O_RDWR);
if (pin_fd < 0)
{
printf("open pin fd error:%d\n", pin_fd);
return;
}
int uart_fd = PrivOpen(RS485_UART_DEV_DRIVER, O_RDWR);
if (uart_fd < 0)
{
printf("open pin fd error:%d\n", uart_fd);
return;
}
printf("uart and pin fopen success\n");
//config led pin in board
struct PinParam pin_parameter;
memset(&pin_parameter, 0, sizeof(struct PinParam));
pin_parameter.cmd = GPIO_CONFIG_MODE;
pin_parameter.pin = BSP_485_DIR_PIN;
pin_parameter.mode = GPIO_CFG_OUTPUT;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = PIN_TYPE;
ioctl_cfg.args = (void *)&pin_parameter;
if (0 != PrivIoctl(pin_fd, OPE_CFG, &ioctl_cfg)) {
printf("ioctl pin fd error %d\n", pin_fd);
PrivClose(pin_fd);
return;
}
struct SerialDataCfg uart_cfg;
memset(&uart_cfg, 0, sizeof(struct SerialDataCfg));
uart_cfg.serial_baud_rate = BAUD_RATE_115200;
uart_cfg.serial_data_bits = DATA_BITS_8;
uart_cfg.serial_stop_bits = STOP_BITS_1;
uart_cfg.serial_parity_mode = PARITY_NONE;
uart_cfg.serial_bit_order = BIT_ORDER_LSB;
uart_cfg.serial_invert_mode = NRZ_NORMAL;
uart_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
uart_cfg.serial_timeout = 1000;
uart_cfg.is_ext_uart = 0;
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
ioctl_cfg.args = (void *)&uart_cfg;
if (0 != PrivIoctl(uart_fd, OPE_INT, &ioctl_cfg))
{
printf("ioctl uart fd error %d\n", uart_fd);
PrivClose(uart_fd);
return;
}
struct PinStat pin_dir;
pin_dir.pin = BSP_485_DIR_PIN;
while (1)
{
pin_dir.val = GPIO_HIGH;
PrivWrite(pin_fd,&pin_dir,0);
PrivWrite(uart_fd,"Hello world!\n",sizeof("Hello world!\n"));
PrivTaskDelay(100);
pin_dir.val = GPIO_LOW;
PrivWrite(pin_fd,&pin_dir,0);
char recv_buff[100];
memset(recv_buff,0,sizeof(recv_buff));
PrivRead(uart_fd,recv_buff,20);
printf("%s",recv_buff);
PrivTaskDelay(100);
}
PrivClose(pin_fd);
PrivClose(uart_fd);
return;
}
PRIV_SHELL_CMD_FUNCTION(Test485, a RS485 test sample, PRIV_SHELL_CMD_MAIN_ATTR);

38
APP_Framework/Applications/app_test/test_rtc.c

@ -0,0 +1,38 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
void TestRTC(int argc,char *argv[])
{
int rtc_fd = PrivOpen(RTC_DEV_DRIVER, O_RDWR);
if(rtc_fd<0){
printf("open rtc fd error:%d\n",rtc_fd);
return;
}
if(argc>1){
int times = atoi(argv[1]);
printf("Time will be printf %d times\n",times);
struct RtcDrvConfigureParam rtc_para;
rtc_para.rtc_operation_cmd = OPER_RTC_SET_TIME;
*(rtc_para.time) = 0;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = RTC_TYPE;
ioctl_cfg.args = (void *)&rtc_para;
PrivIoctl(rtc_fd,0,&ioctl_cfg);
rtc_para.rtc_operation_cmd = OPER_RTC_GET_TIME;
for(size_t i=0;i<times;i++){
PrivIoctl(rtc_fd,0,&ioctl_cfg);
printf("The time now is %d\n",*(rtc_para.time));
PrivTaskDelay(5000);
}
}
PrivClose(rtc_fd);
return;
}
PRIV_SHELL_CMD_FUNCTION(TestRTC, a rtc test sample, PRIV_SHELL_CMD_MAIN_ATTR);

111
APP_Framework/Applications/app_test/test_touch.c

@ -0,0 +1,111 @@
/****************************************************************************
* apps/examples/fb/fb_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <transform.h>
#ifdef ADD_NUTTX_FETURES
#ifdef CONFIG_BSP_USING_TOUCH
void TestTouch(void)
{
int fd;
TouchDataParam point = {0, 0, 0};
fd = PrivOpen("/dev/touch_dev", O_RDWR);
while(1)
{
PrivRead(fd,&point,1);
printf("Now touch point:(%d,%d)\n",point.x,point.y);
}
}
#endif
#endif
#include <stdio.h>
#include <string.h>
#include <transform.h>
#define NULL_PARAMETER 0
#define LCD_DOT_TYPE 1
#define LCD_SIZE 320
void TestTouch(void)
{
int touch_fd = PrivOpen(TOUCH_DEV_DRIVER, O_RDWR);
if (touch_fd < 0)
{
printf("open touch fd error:%d\n", touch_fd);
return;
}
int lcd_fd = PrivOpen(TOUCH_LCD_DEV_DRIVER, O_RDWR);
if (lcd_fd < 0)
{
printf("open lcd fd error:%d\n", lcd_fd);
return;
}
// draw text
struct TouchDataStandard touch_pixel;
memset(&touch_pixel,0,sizeof(touch_pixel));
LcdWriteParam graph_param;
graph_param.type = LCD_DOT_TYPE;
uint16_t back_color[LCD_SIZE];
memset(back_color,0x00,sizeof(back_color));
for (int i = 0; i < LCD_SIZE; i++)
{
graph_param.pixel_info.pixel_color = &back_color;
graph_param.pixel_info.x_startpos = 0;
graph_param.pixel_info.y_startpos = i;
graph_param.pixel_info.x_endpos = LCD_SIZE -1;
graph_param.pixel_info.y_endpos = i;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
}
uint16 color_select[LCD_SIZE];
memset(color_select,0xff,sizeof(color_select));
graph_param.pixel_info.pixel_color = &color_select;
while(1){
if(0 > PrivRead(touch_fd, &touch_pixel, NULL_PARAMETER)){
printf("read touch error\n");
return;
}
printf("touch pixel position x:%d,y:%d\n",touch_pixel.x,touch_pixel.y);
graph_param.pixel_info.x_startpos = touch_pixel.x-10>0?touch_pixel.x-10:0;
graph_param.pixel_info.y_startpos = touch_pixel.y;
graph_param.pixel_info.x_endpos = touch_pixel.x+10;
graph_param.pixel_info.y_endpos = touch_pixel.y;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
graph_param.pixel_info.x_startpos = touch_pixel.x;
graph_param.pixel_info.y_startpos = touch_pixel.y-10>0?touch_pixel.y-10:0;
graph_param.pixel_info.x_endpos = touch_pixel.x;
graph_param.pixel_info.y_endpos = touch_pixel.y+10;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
}
PrivClose(touch_fd);
}
PRIV_SHELL_CMD_FUNCTION(TestTouch, a touch test sample, PRIV_SHELL_CMD_MAIN_ATTR);

45
APP_Framework/Applications/app_test/test_wdt.c

@ -0,0 +1,45 @@
#include <stdio.h>
#include <string.h>
#include <transform.h>
void TestWDT(int argc, char *agrv[])
{
int wdt_fd = PrivOpen(WDT0_DEV_DRIVER, O_RDWR);
if (wdt_fd < 0)
{
printf("open wdt_fd fd error:%d\n", wdt_fd);
return;
}
printf("hw watchdog open!\n");
// init watchdog
int wdt_time = 1000;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = WDT_TYPE;
ioctl_cfg.args = (void *)&wdt_time;
if (0 != PrivIoctl(wdt_fd, OPER_WDT_SET_TIMEOUT, &ioctl_cfg))
{
printf("ioctl wdt fd error %d\n", wdt_fd);
PrivClose(wdt_fd);
return;
}
int test_counter = 100;
// wdt feed or not according to argc,if argc!=1 then dog won't be feed
while (test_counter--)
{
if (1 == argc)
{
printf("dog is feed\n");
PrivIoctl(wdt_fd, OPER_WDT_KEEPALIVE, &ioctl_cfg); // feed dog
}
PrivTaskDelay(100);
}
PrivClose(wdt_fd);
return;
}
PRIV_SHELL_CMD_FUNCTION(TestWDT, a wdt test sample, PRIV_SHELL_CMD_MAIN_ATTR);

4
APP_Framework/Applications/connection_app/socket_demo/lwip_tcp_socket_demo.c

@ -164,7 +164,7 @@ void TcpSocketRecvTest(int argc, char *argv[])
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, tcp_socket_ip);
lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, tcp_socket_ip);
sys_thread_new("TcpSocketRecvTask", TcpSocketRecvTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
#endif</