From 097118ba3b1410c69329ce5242f91b09978793c6 Mon Sep 17 00:00:00 2001 From: zhaoyun1215 <58766762@qq.com> Date: Thu, 15 Sep 2022 00:25:42 -0700 Subject: [PATCH] support webnet and add netdev for XiUOS --- APP_Framework/Applications/Makefile | 4 + APP_Framework/Applications/webnet/Kconfig | 25 +- .../transform_layer/rtthread/transform.c | 7 + .../transform_layer/rtthread/transform.h | 4 + .../transform_layer/xizi/transform.c | 21 + .../transform_layer/xizi/transform.h | 28 ++ .../user_api/posix_support/include/pthread.h | 13 + .../xizi/user_api/posix_support/pthread.c | 39 ++ .../XiZi/board/xidatong-arm32/link-usb.lds | 2 + .../xidatong-arm32/third_party_driver/Kconfig | 2 +- .../semc/semc_externsdram_test.c | 360 +++++++++--------- Ubiquitous/XiZi/path_kernel.mk | 7 +- .../XiZi/resources/ethernet/LwIP/Makefile | 1 - .../ethernet/LwIP/include/lwip/sockets.h | 2 + Ubiquitous/XiZi/resources/ethernet/Makefile | 1 + 15 files changed, 320 insertions(+), 196 deletions(-) diff --git a/APP_Framework/Applications/Makefile b/APP_Framework/Applications/Makefile index 8c92833cd..b1c244996 100644 --- a/APP_Framework/Applications/Makefile +++ b/APP_Framework/Applications/Makefile @@ -35,5 +35,9 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y) SRC_DIR += control_app endif + ifeq ($(CONFIG_APP_USING_WEBNET),y) + SRC_DIR += webnet + endif + include $(KERNEL_ROOT)/compiler.mk endif \ No newline at end of file diff --git a/APP_Framework/Applications/webnet/Kconfig b/APP_Framework/Applications/webnet/Kconfig index 812518e11..692261c4e 100644 --- a/APP_Framework/Applications/webnet/Kconfig +++ b/APP_Framework/Applications/webnet/Kconfig @@ -1,5 +1,5 @@ menuconfig APP_USING_WEBNET - bool "WebNet: A lightweight, customizable, embeddable Web Server for RT-Thread" + bool "WebNet: A lightweight, customizable, embeddable Web Server for XiUOS" default n if APP_USING_WEBNET @@ -25,31 +25,31 @@ if APP_USING_WEBNET config WEBNET_USING_LOG bool "LOG: Enable output log support" - default n + default y config WEBNET_USING_AUTH bool "AUTH: Enable basic HTTP authentication support" - default n + default y config WEBNET_USING_CGI bool "CGI: Enable Common Gateway Interface support" - default n + default y config WEBNET_USING_ASP bool "ASP: Enable Active Server Pages support" - default n + default y config WEBNET_USING_SSI bool "SSI: Enable Server Side Includes support" - default n + default y config WEBNET_USING_INDEX bool "INDEX: Enable list all the file in the directory support" - default n + default y config WEBNET_USING_ALIAS bool "ALIAS: Enable alias support" - default n + default y config WEBNET_USING_DAV bool "DAV: Enable Web-based Distributed Authoring and Versioning support" @@ -57,7 +57,7 @@ if APP_USING_WEBNET config WEBNET_USING_UPLOAD bool "UPLOAD: Enable upload file support" - default n + default y config WEBNET_USING_GZIP bool "GZIP: Enable compressed file support by GZIP" @@ -65,11 +65,10 @@ if APP_USING_WEBNET config WEBNET_CACHE_LEVEL int "CACHE: Configure cache level(0:disable 1:use Last-Modified 2:use Cache-Control)" - default 0 + default 2 range 0 2 - if WEBNET_CACHE_LEVEL = 2 - + if WEBNET_CACHE_LEVEL = 2 config WEBNET_CACHE_MAX_AGE int "Cache-Control time in seconds" default 1800 @@ -80,7 +79,7 @@ if APP_USING_WEBNET config WEBNET_USING_SAMPLES bool "Enable webnet samples" - default n + default y select WEBNET_USING_ASP select WEBNET_USING_AUTH select WEBNET_USING_CGI diff --git a/APP_Framework/Framework/transform_layer/rtthread/transform.c b/APP_Framework/Framework/transform_layer/rtthread/transform.c index 42872041a..a053aede8 100644 --- a/APP_Framework/Framework/transform_layer/rtthread/transform.c +++ b/APP_Framework/Framework/transform_layer/rtthread/transform.c @@ -237,3 +237,10 @@ void PrivTaskexitCritical() { rt_exit_critical(); } + +/*********************tick**********************/ +#ifdef APP_USING_WEBNET +int GetTick(){ + return rt_tick_get()/RT_TICK_PER_SECOND; +} +#endif \ No newline at end of file diff --git a/APP_Framework/Framework/transform_layer/rtthread/transform.h b/APP_Framework/Framework/transform_layer/rtthread/transform.h index 5eb7fecee..75ec5279d 100644 --- a/APP_Framework/Framework/transform_layer/rtthread/transform.h +++ b/APP_Framework/Framework/transform_layer/rtthread/transform.h @@ -222,6 +222,10 @@ void PrivTaskenterCritical(); void PrivTaskexitCritical(); +/*********************tick**********************/ +#ifdef APP_USING_WEBNET +int GetTick(); +#endif #ifdef __cplusplus } diff --git a/APP_Framework/Framework/transform_layer/xizi/transform.c b/APP_Framework/Framework/transform_layer/xizi/transform.c index 62e226b35..06cbb6422 100644 --- a/APP_Framework/Framework/transform_layer/xizi/transform.c +++ b/APP_Framework/Framework/transform_layer/xizi/transform.c @@ -202,3 +202,24 @@ void PrivFree(void *pointer) UserFree(pointer); } + +/*********************massage queue***********************/ +mqd_t PrivMqueueSend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio) +{ + return mq_send(mqdes, msg_ptr, msg_len, msg_prio); +} + +mqd_t PrivMqueueCreate(const char *name, int oflag, mode_t mode, struct mq_attr *attr) +{ + return mq_open(name, oflag, mode, attr); +} + +int PrivMqueueReceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio) +{ + return mq_receive(mqdes, msg_ptr, msg_len, msg_prio); +} + +/*********************tick**********************/ +int GetTick(){ + return CurrentTicksGain() / TICK_PER_SECOND; +} \ No newline at end of file diff --git a/APP_Framework/Framework/transform_layer/xizi/transform.h b/APP_Framework/Framework/transform_layer/xizi/transform.h index f6ec84fb3..9bdfe0b61 100644 --- a/APP_Framework/Framework/transform_layer/xizi/transform.h +++ b/APP_Framework/Framework/transform_layer/xizi/transform.h @@ -28,6 +28,16 @@ #include #include #include +#include + +#ifdef APP_USING_WEBNET +#include "sys_arch.h" +#include +#include "lwip/sys.h" +#include +#include +#include +#endif #ifdef __cplusplus extern "C" { @@ -92,6 +102,14 @@ extern "C" { #define SERIAL_RB_BUFSZ 128 #endif +#ifdef APP_USING_WEBNET + +#define bool _Bool +#define FALSE 0 +#define TRUE 1 + +#endif + struct PinDevIrq { int irq_mode;//< RISING/FALLING/HIGH/LOW @@ -242,6 +260,16 @@ void *PrivRealloc(void *pointer, size_t size); void *PrivCalloc(size_t count, size_t size); void PrivFree(void *pointer); +/*********************massage queue***********************/ + +mqd_t PrivMqueueSend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio); +mqd_t PrivMqueueCreate(const char *name, int oflag, mode_t mode,struct mq_attr *attr); +int PrivMqueueReceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio); + + +/*********************tick**********************/ +int GetTick(); + #ifdef __cplusplus } diff --git a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h index efe995dc7..917b3fa66 100644 --- a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h +++ b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/include/pthread.h @@ -69,6 +69,19 @@ typedef int pid_t; #define SCHED_RR 2 #define SCHED_IDLE 5 +/*from rt added by zy*/ +#define DEFAULT_STACK_SIZE 4096 +#define DEFAULT_PRIORITY KTASK_PRIORITY_MAX / 2 +#define PTHREAD_CREATE_JOINABLE 0x00 +#define PTHREAD_INHERIT_SCHED 1 + +/* function in pthread.c */ +/*support webnet*/ +int pthread_attr_init(pthread_attr_t *attr); +int pthread_attr_setschedparam(pthread_attr_t *attr, + struct sched_param const *param); +int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size); + /* function in pthread.c */ int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)); int pthread_create(pthread_t *thread, const pthread_attr_t *attr, diff --git a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c index 3b8b170fd..ab254d93f 100644 --- a/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c +++ b/APP_Framework/Framework/transform_layer/xizi/user_api/posix_support/pthread.c @@ -21,6 +21,45 @@ #include #include #include "include/pthread.h" +#include +const pthread_attr_t pthread_default_attr = +{ + 0, /* stack base */ + 0, + DEFAULT_STACK_SIZE, /* stack size */ + 0, + PTHREAD_INHERIT_SCHED, /* Inherit parent prio/policy */ + SCHED_FIFO, /* scheduler policy */ + { + DEFAULT_PRIORITY, /* scheduler priority */ + }, + 4096, + PTHREAD_CREATE_JOINABLE, /* detach state */ +}; + + +int pthread_attr_init(pthread_attr_t *attr) +{ + assert(attr != NULL); + *attr = pthread_default_attr; + return 0; +} + +int pthread_attr_setschedparam(pthread_attr_t *attr, + struct sched_param const *param) +{ + assert(attr != NULL); + assert(param != NULL); + attr->schedparam.sched_priority = param->sched_priority; + return 0; +} + +int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size) +{ + assert(attr != NULL); + attr->stacksize = stack_size; + return 0; +} int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) diff --git a/Ubiquitous/XiZi/board/xidatong-arm32/link-usb.lds b/Ubiquitous/XiZi/board/xidatong-arm32/link-usb.lds index 79ad714ff..b7245b67c 100755 --- a/Ubiquitous/XiZi/board/xidatong-arm32/link-usb.lds +++ b/Ubiquitous/XiZi/board/xidatong-arm32/link-usb.lds @@ -61,6 +61,8 @@ MEMORY m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x03FFDC00 m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000 m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00060000 + m_sdram (RW) : ORIGIN = 0x80000000, LENGTH = 0x01E00000 + m_nocache (RW) : ORIGIN = 0x81E00000, LENGTH = 0x00200000 } /* Define output sections */ diff --git a/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/Kconfig b/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/Kconfig index 223f5e966..30303e157 100644 --- a/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/Kconfig +++ b/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/Kconfig @@ -68,7 +68,7 @@ menuconfig BSP_USING_TOUCH menuconfig BSP_USING_USB bool "Using USB device" - default n + default y select RESOURCES_USB if BSP_USING_USB source "$BSP_DIR/third_party_driver/usb/Kconfig" diff --git a/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/semc/semc_externsdram_test.c b/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/semc/semc_externsdram_test.c index c09b6dc27..ef6c2bd71 100644 --- a/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/semc/semc_externsdram_test.c +++ b/Ubiquitous/XiZi/board/xidatong-arm32/third_party_driver/semc/semc_externsdram_test.c @@ -1,180 +1,180 @@ -/* - * Copyright 2017 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -#include "board.h" - -#define EXAMPLE_SEMC_START_ADDRESS (0x80000000U) - -#define SEMC_EXAMPLE_DATALEN (0x1000U) - -/******************************************************************************* - * Prototypes - ******************************************************************************/ -static void SEMC_SDRAMReadWrite32Bit(void); -static void SEMC_SDRAMReadWrite16Bit(void); -static void SEMC_SDRAMReadWrite8Bit(void); -/******************************************************************************* - * Variables - ******************************************************************************/ - -uint32_t sdram_writeBuffer[SEMC_EXAMPLE_DATALEN]; -uint32_t sdram_readBuffer[SEMC_EXAMPLE_DATALEN]; - -/*! - * @brief Main function - */ -int semc_externsram_test(void) -{ - KPrintf("\r\n SEMC SDRAM Example Start!\r\n"); - - /* 32Bit data read and write. */ - SEMC_SDRAMReadWrite32Bit(); - /* 16Bit data read and write. */ - SEMC_SDRAMReadWrite16Bit(); - /* 8Bit data read and write. */ - SEMC_SDRAMReadWrite8Bit(); - - KPrintf("\r\n SEMC SDRAM Example End.\r\n"); - -} -SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),semc_externsram_test, semc_externsram_test, semc_externsram_test ); - -void SEMC_SDRAMReadWrite32Bit(void) -{ - uint32_t index; - uint32_t datalen = SEMC_EXAMPLE_DATALEN; - uint32_t *sdram = (uint32_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */ - int result = 0; - - KPrintf("\r\n SEMC SDRAM Memory 32 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); - /* Prepare data and write to SDRAM. */ - for (index = 0; index < datalen; index++) - { - sdram_writeBuffer[index] = index; - sdram[index] = sdram_writeBuffer[index]; - } - - KPrintf("\r\n SEMC SDRAM Read 32 bit Data Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); - /* Read data from the SDRAM. */ - for (index = 0; index < datalen; index++) - { - sdram_readBuffer[index] = sdram[index]; - } - - KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Start!\r\n"); - /* Compare the two buffers. */ - while (datalen--) - { - if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen]) - { - result = -1; - break; - } - } - - if (result < 0) - { - KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Failed!\r\n"); - } - else - { - KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Succeed!\r\n"); - } -} - -static void SEMC_SDRAMReadWrite16Bit(void) -{ - uint32_t index; - uint32_t datalen = SEMC_EXAMPLE_DATALEN; - uint16_t *sdram = (uint16_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */ - int result = 0; - - KPrintf("\r\n SEMC SDRAM Memory 16 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); - - memset(sdram_writeBuffer, 0, sizeof(sdram_writeBuffer)); - memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer)); - - /* Prepare data and write to SDRAM. */ - for (index = 0; index < datalen; index++) - { - sdram_writeBuffer[index] = index % 0xFFFF; - sdram[index] = sdram_writeBuffer[index]; - } - - KPrintf("\r\n SEMC SDRAM Read 16 bit Data Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); - /* Read data from the SDRAM. */ - for (index = 0; index < datalen; index++) - { - sdram_readBuffer[index] = sdram[index]; - } - - KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Start!\r\n"); - /* Compare the two buffers. */ - while (datalen--) - { - if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen]) - { - result = -1; - break; - } - } - - if (result < 0) - { - KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Failed!\r\n"); - } - else - { - KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Succeed!\r\n"); - } -} - -static void SEMC_SDRAMReadWrite8Bit(void) -{ - uint32_t index; - uint32_t datalen = SEMC_EXAMPLE_DATALEN; - uint8_t *sdram = (uint8_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */ - int result = 0; - - KPrintf("\r\n SEMC SDRAM Memory 8 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); - - memset(sdram_writeBuffer, 0, sizeof(sdram_writeBuffer)); - memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer)); - - /* Prepare data and write to SDRAM. */ - for (index = 0; index < datalen; index++) - { - sdram_writeBuffer[index] = index % 0x100; - sdram[index] = sdram_writeBuffer[index]; - } - - KPrintf("\r\n SEMC SDRAM Read 8 bit Data Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); - /* Read data from the SDRAM. */ - for (index = 0; index < datalen; index++) - { - sdram_readBuffer[index] = sdram[index]; - } - - KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Start!\r\n"); - /* Compare the two buffers. */ - while (datalen--) - { - if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen]) - { - result = -1; - break; - } - } - - if (result < 0) - { - KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Failed!\r\n"); - } - else - { - KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Succeed!\r\n"); - } -} +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include "board.h" + +#define EXAMPLE_SEMC_START_ADDRESS (0x80000000U) + +#define SEMC_EXAMPLE_DATALEN (0x1000U) + +/******************************************************************************* + * Prototypes + ******************************************************************************/ +static void SEMC_SDRAMReadWrite32Bit(void); +static void SEMC_SDRAMReadWrite16Bit(void); +static void SEMC_SDRAMReadWrite8Bit(void); +/******************************************************************************* + * Variables + ******************************************************************************/ + +uint32_t sdram_writeBuffer[SEMC_EXAMPLE_DATALEN]; +uint32_t sdram_readBuffer[SEMC_EXAMPLE_DATALEN]; + +/*! + * @brief Main function + */ +int semc_externsram_test(void) +{ + KPrintf("\r\n SEMC SDRAM Example Start!\r\n"); + + /* 32Bit data read and write. */ + SEMC_SDRAMReadWrite32Bit(); + /* 16Bit data read and write. */ + SEMC_SDRAMReadWrite16Bit(); + /* 8Bit data read and write. */ + SEMC_SDRAMReadWrite8Bit(); + + KPrintf("\r\n SEMC SDRAM Example End.\r\n"); + +} +//SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),semc_externsram_test, semc_externsram_test, semc_externsram_test ); + +void SEMC_SDRAMReadWrite32Bit(void) +{ + uint32_t index; + uint32_t datalen = SEMC_EXAMPLE_DATALEN; + uint32_t *sdram = (uint32_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */ + int result = 0; + + KPrintf("\r\n SEMC SDRAM Memory 32 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); + /* Prepare data and write to SDRAM. */ + for (index = 0; index < datalen; index++) + { + sdram_writeBuffer[index] = index; + sdram[index] = sdram_writeBuffer[index]; + } + + KPrintf("\r\n SEMC SDRAM Read 32 bit Data Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); + /* Read data from the SDRAM. */ + for (index = 0; index < datalen; index++) + { + sdram_readBuffer[index] = sdram[index]; + } + + KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Start!\r\n"); + /* Compare the two buffers. */ + while (datalen--) + { + if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen]) + { + result = -1; + break; + } + } + + if (result < 0) + { + KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Failed!\r\n"); + } + else + { + KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Succeed!\r\n"); + } +} + +static void SEMC_SDRAMReadWrite16Bit(void) +{ + uint32_t index; + uint32_t datalen = SEMC_EXAMPLE_DATALEN; + uint16_t *sdram = (uint16_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */ + int result = 0; + + KPrintf("\r\n SEMC SDRAM Memory 16 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); + + memset(sdram_writeBuffer, 0, sizeof(sdram_writeBuffer)); + memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer)); + + /* Prepare data and write to SDRAM. */ + for (index = 0; index < datalen; index++) + { + sdram_writeBuffer[index] = index % 0xFFFF; + sdram[index] = sdram_writeBuffer[index]; + } + + KPrintf("\r\n SEMC SDRAM Read 16 bit Data Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); + /* Read data from the SDRAM. */ + for (index = 0; index < datalen; index++) + { + sdram_readBuffer[index] = sdram[index]; + } + + KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Start!\r\n"); + /* Compare the two buffers. */ + while (datalen--) + { + if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen]) + { + result = -1; + break; + } + } + + if (result < 0) + { + KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Failed!\r\n"); + } + else + { + KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Succeed!\r\n"); + } +} + +static void SEMC_SDRAMReadWrite8Bit(void) +{ + uint32_t index; + uint32_t datalen = SEMC_EXAMPLE_DATALEN; + uint8_t *sdram = (uint8_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */ + int result = 0; + + KPrintf("\r\n SEMC SDRAM Memory 8 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); + + memset(sdram_writeBuffer, 0, sizeof(sdram_writeBuffer)); + memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer)); + + /* Prepare data and write to SDRAM. */ + for (index = 0; index < datalen; index++) + { + sdram_writeBuffer[index] = index % 0x100; + sdram[index] = sdram_writeBuffer[index]; + } + + KPrintf("\r\n SEMC SDRAM Read 8 bit Data Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen); + /* Read data from the SDRAM. */ + for (index = 0; index < datalen; index++) + { + sdram_readBuffer[index] = sdram[index]; + } + + KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Start!\r\n"); + /* Compare the two buffers. */ + while (datalen--) + { + if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen]) + { + result = -1; + break; + } + } + + if (result < 0) + { + KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Failed!\r\n"); + } + else + { + KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Succeed!\r\n"); + } +} diff --git a/Ubiquitous/XiZi/path_kernel.mk b/Ubiquitous/XiZi/path_kernel.mk index 7ffd27a20..e4417d44b 100755 --- a/Ubiquitous/XiZi/path_kernel.mk +++ b/Ubiquitous/XiZi/path_kernel.mk @@ -335,6 +335,12 @@ KERNELPATHS += -I$(KERNEL_ROOT)/fs/devfs \ -I$(KERNEL_ROOT)/fs/shared/include # endif +ifeq ($(CONFIG_APP_USING_WEBNET), y) +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/webnet/WebNet_XiUOS/inc \ + -I$(KERNEL_ROOT)/../../APP_Framework/lib/cJSON \ + -I$(KERNEL_ROOT)/../../Ubiquitous/XiZi/resources/ethernet/netdev/include # +endif + ifeq ($(CONFIG_FS_CH376), y) KERNELPATHS +=-I$(KERNEL_ROOT)/fs/compatibility_ch376 # endif @@ -454,4 +460,3 @@ KERNELPATHS += -I$(KERNEL_ROOT)/kernel/include # # @cp link.mk build/Makefile # @$(MAKE) -C build COMPILE_TYPE="_kernel" TARGET=XiZi-$(BOARD)_kernel.elf LINK_FLAGS=LFLAGS # @rm build/Makefile build/make.obj - diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile b/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile index 1c0cdf531..406f26dc2 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/Makefile @@ -7,5 +7,4 @@ LWIP_DIR += api LWIP_DIR += arch LWIP_DIR += core LWIP_DIR += netif - include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h index 2edab7be8..14ce7a9b1 100644 --- a/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h +++ b/Ubiquitous/XiZi/resources/ethernet/LwIP/include/lwip/sockets.h @@ -663,7 +663,9 @@ int lwip_inet_pton(int af, const char *src, void *dst); #if LWIP_POSIX_SOCKETS_IO_NAMES /** @ingroup socket */ +#ifndef APP_USING_WEBNET #define read(s,mem,len) lwip_read(s,mem,len) +#endif /** @ingroup socket */ #define readv(s,iov,iovcnt) lwip_readv(s,iov,iovcnt) /** @ingroup socket */ diff --git a/Ubiquitous/XiZi/resources/ethernet/Makefile b/Ubiquitous/XiZi/resources/ethernet/Makefile index 7de558d34..5954beab4 100644 --- a/Ubiquitous/XiZi/resources/ethernet/Makefile +++ b/Ubiquitous/XiZi/resources/ethernet/Makefile @@ -1,4 +1,5 @@ SRC_DIR += cmd_lwip +SRC_DIR += netdev LWIP_DIR := LwIP include $(KERNEL_ROOT)/compiler.mk