support webnet and add netdev for XiUOS
This commit is contained in:
parent
5f42111c38
commit
097118ba3b
|
@ -35,5 +35,9 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
|
||||||
SRC_DIR += control_app
|
SRC_DIR += control_app
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_APP_USING_WEBNET),y)
|
||||||
|
SRC_DIR += webnet
|
||||||
|
endif
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
endif
|
endif
|
|
@ -1,5 +1,5 @@
|
||||||
menuconfig APP_USING_WEBNET
|
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
|
default n
|
||||||
if APP_USING_WEBNET
|
if APP_USING_WEBNET
|
||||||
|
|
||||||
|
@ -25,31 +25,31 @@ if APP_USING_WEBNET
|
||||||
|
|
||||||
config WEBNET_USING_LOG
|
config WEBNET_USING_LOG
|
||||||
bool "LOG: Enable output log support"
|
bool "LOG: Enable output log support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_AUTH
|
config WEBNET_USING_AUTH
|
||||||
bool "AUTH: Enable basic HTTP authentication support"
|
bool "AUTH: Enable basic HTTP authentication support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_CGI
|
config WEBNET_USING_CGI
|
||||||
bool "CGI: Enable Common Gateway Interface support"
|
bool "CGI: Enable Common Gateway Interface support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_ASP
|
config WEBNET_USING_ASP
|
||||||
bool "ASP: Enable Active Server Pages support"
|
bool "ASP: Enable Active Server Pages support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_SSI
|
config WEBNET_USING_SSI
|
||||||
bool "SSI: Enable Server Side Includes support"
|
bool "SSI: Enable Server Side Includes support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_INDEX
|
config WEBNET_USING_INDEX
|
||||||
bool "INDEX: Enable list all the file in the directory support"
|
bool "INDEX: Enable list all the file in the directory support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_ALIAS
|
config WEBNET_USING_ALIAS
|
||||||
bool "ALIAS: Enable alias support"
|
bool "ALIAS: Enable alias support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_DAV
|
config WEBNET_USING_DAV
|
||||||
bool "DAV: Enable Web-based Distributed Authoring and Versioning support"
|
bool "DAV: Enable Web-based Distributed Authoring and Versioning support"
|
||||||
|
@ -57,7 +57,7 @@ if APP_USING_WEBNET
|
||||||
|
|
||||||
config WEBNET_USING_UPLOAD
|
config WEBNET_USING_UPLOAD
|
||||||
bool "UPLOAD: Enable upload file support"
|
bool "UPLOAD: Enable upload file support"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config WEBNET_USING_GZIP
|
config WEBNET_USING_GZIP
|
||||||
bool "GZIP: Enable compressed file support by GZIP"
|
bool "GZIP: Enable compressed file support by GZIP"
|
||||||
|
@ -65,11 +65,10 @@ if APP_USING_WEBNET
|
||||||
|
|
||||||
config WEBNET_CACHE_LEVEL
|
config WEBNET_CACHE_LEVEL
|
||||||
int "CACHE: Configure cache level(0:disable 1:use Last-Modified 2:use Cache-Control)"
|
int "CACHE: Configure cache level(0:disable 1:use Last-Modified 2:use Cache-Control)"
|
||||||
default 0
|
default 2
|
||||||
range 0 2
|
range 0 2
|
||||||
|
|
||||||
if WEBNET_CACHE_LEVEL = 2
|
if WEBNET_CACHE_LEVEL = 2
|
||||||
|
|
||||||
config WEBNET_CACHE_MAX_AGE
|
config WEBNET_CACHE_MAX_AGE
|
||||||
int "Cache-Control time in seconds"
|
int "Cache-Control time in seconds"
|
||||||
default 1800
|
default 1800
|
||||||
|
@ -80,7 +79,7 @@ if APP_USING_WEBNET
|
||||||
|
|
||||||
config WEBNET_USING_SAMPLES
|
config WEBNET_USING_SAMPLES
|
||||||
bool "Enable webnet samples"
|
bool "Enable webnet samples"
|
||||||
default n
|
default y
|
||||||
select WEBNET_USING_ASP
|
select WEBNET_USING_ASP
|
||||||
select WEBNET_USING_AUTH
|
select WEBNET_USING_AUTH
|
||||||
select WEBNET_USING_CGI
|
select WEBNET_USING_CGI
|
||||||
|
|
|
@ -237,3 +237,10 @@ void PrivTaskexitCritical()
|
||||||
{
|
{
|
||||||
rt_exit_critical();
|
rt_exit_critical();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************tick**********************/
|
||||||
|
#ifdef APP_USING_WEBNET
|
||||||
|
int GetTick(){
|
||||||
|
return rt_tick_get()/RT_TICK_PER_SECOND;
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -222,6 +222,10 @@ void PrivTaskenterCritical();
|
||||||
void PrivTaskexitCritical();
|
void PrivTaskexitCritical();
|
||||||
|
|
||||||
|
|
||||||
|
/*********************tick**********************/
|
||||||
|
#ifdef APP_USING_WEBNET
|
||||||
|
int GetTick();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,3 +202,24 @@ void PrivFree(void *pointer)
|
||||||
UserFree(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;
|
||||||
|
}
|
|
@ -28,6 +28,16 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <user_api.h>
|
#include <user_api.h>
|
||||||
|
#include <mqueue.h>
|
||||||
|
|
||||||
|
#ifdef APP_USING_WEBNET
|
||||||
|
#include "sys_arch.h"
|
||||||
|
#include <lwip/sockets.h>
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <iot-vfs_posix.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -92,6 +102,14 @@ extern "C" {
|
||||||
#define SERIAL_RB_BUFSZ 128
|
#define SERIAL_RB_BUFSZ 128
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef APP_USING_WEBNET
|
||||||
|
|
||||||
|
#define bool _Bool
|
||||||
|
#define FALSE 0
|
||||||
|
#define TRUE 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
struct PinDevIrq
|
struct PinDevIrq
|
||||||
{
|
{
|
||||||
int irq_mode;//< RISING/FALLING/HIGH/LOW
|
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 *PrivCalloc(size_t count, size_t size);
|
||||||
void PrivFree(void *pointer);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,19 @@ typedef int pid_t;
|
||||||
#define SCHED_RR 2
|
#define SCHED_RR 2
|
||||||
#define SCHED_IDLE 5
|
#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 */
|
/* function in pthread.c */
|
||||||
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
|
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
|
||||||
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
||||||
|
|
|
@ -21,6 +21,45 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "include/pthread.h"
|
#include "include/pthread.h"
|
||||||
|
#include <assert.h>
|
||||||
|
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,
|
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|
||||||
void *(*start_routine)(void *), void *arg)
|
void *(*start_routine)(void *), void *arg)
|
||||||
|
|
|
@ -61,6 +61,8 @@ MEMORY
|
||||||
m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x03FFDC00
|
m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x03FFDC00
|
||||||
m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000
|
m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000
|
||||||
m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00060000
|
m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00060000
|
||||||
|
m_sdram (RW) : ORIGIN = 0x80000000, LENGTH = 0x01E00000
|
||||||
|
m_nocache (RW) : ORIGIN = 0x81E00000, LENGTH = 0x00200000
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define output sections */
|
/* Define output sections */
|
||||||
|
|
|
@ -68,7 +68,7 @@ menuconfig BSP_USING_TOUCH
|
||||||
|
|
||||||
menuconfig BSP_USING_USB
|
menuconfig BSP_USING_USB
|
||||||
bool "Using USB device"
|
bool "Using USB device"
|
||||||
default n
|
default y
|
||||||
select RESOURCES_USB
|
select RESOURCES_USB
|
||||||
if BSP_USING_USB
|
if BSP_USING_USB
|
||||||
source "$BSP_DIR/third_party_driver/usb/Kconfig"
|
source "$BSP_DIR/third_party_driver/usb/Kconfig"
|
||||||
|
|
|
@ -1,180 +1,180 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2017 NXP
|
* Copyright 2017 NXP
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
#define EXAMPLE_SEMC_START_ADDRESS (0x80000000U)
|
#define EXAMPLE_SEMC_START_ADDRESS (0x80000000U)
|
||||||
|
|
||||||
#define SEMC_EXAMPLE_DATALEN (0x1000U)
|
#define SEMC_EXAMPLE_DATALEN (0x1000U)
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Prototypes
|
* Prototypes
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static void SEMC_SDRAMReadWrite32Bit(void);
|
static void SEMC_SDRAMReadWrite32Bit(void);
|
||||||
static void SEMC_SDRAMReadWrite16Bit(void);
|
static void SEMC_SDRAMReadWrite16Bit(void);
|
||||||
static void SEMC_SDRAMReadWrite8Bit(void);
|
static void SEMC_SDRAMReadWrite8Bit(void);
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Variables
|
* Variables
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
uint32_t sdram_writeBuffer[SEMC_EXAMPLE_DATALEN];
|
uint32_t sdram_writeBuffer[SEMC_EXAMPLE_DATALEN];
|
||||||
uint32_t sdram_readBuffer[SEMC_EXAMPLE_DATALEN];
|
uint32_t sdram_readBuffer[SEMC_EXAMPLE_DATALEN];
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Main function
|
* @brief Main function
|
||||||
*/
|
*/
|
||||||
int semc_externsram_test(void)
|
int semc_externsram_test(void)
|
||||||
{
|
{
|
||||||
KPrintf("\r\n SEMC SDRAM Example Start!\r\n");
|
KPrintf("\r\n SEMC SDRAM Example Start!\r\n");
|
||||||
|
|
||||||
/* 32Bit data read and write. */
|
/* 32Bit data read and write. */
|
||||||
SEMC_SDRAMReadWrite32Bit();
|
SEMC_SDRAMReadWrite32Bit();
|
||||||
/* 16Bit data read and write. */
|
/* 16Bit data read and write. */
|
||||||
SEMC_SDRAMReadWrite16Bit();
|
SEMC_SDRAMReadWrite16Bit();
|
||||||
/* 8Bit data read and write. */
|
/* 8Bit data read and write. */
|
||||||
SEMC_SDRAMReadWrite8Bit();
|
SEMC_SDRAMReadWrite8Bit();
|
||||||
|
|
||||||
KPrintf("\r\n SEMC SDRAM Example End.\r\n");
|
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 );
|
//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)
|
void SEMC_SDRAMReadWrite32Bit(void)
|
||||||
{
|
{
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t datalen = SEMC_EXAMPLE_DATALEN;
|
uint32_t datalen = SEMC_EXAMPLE_DATALEN;
|
||||||
uint32_t *sdram = (uint32_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */
|
uint32_t *sdram = (uint32_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
KPrintf("\r\n SEMC SDRAM Memory 32 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen);
|
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. */
|
/* Prepare data and write to SDRAM. */
|
||||||
for (index = 0; index < datalen; index++)
|
for (index = 0; index < datalen; index++)
|
||||||
{
|
{
|
||||||
sdram_writeBuffer[index] = index;
|
sdram_writeBuffer[index] = index;
|
||||||
sdram[index] = sdram_writeBuffer[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);
|
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. */
|
/* Read data from the SDRAM. */
|
||||||
for (index = 0; index < datalen; index++)
|
for (index = 0; index < datalen; index++)
|
||||||
{
|
{
|
||||||
sdram_readBuffer[index] = sdram[index];
|
sdram_readBuffer[index] = sdram[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Start!\r\n");
|
KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Start!\r\n");
|
||||||
/* Compare the two buffers. */
|
/* Compare the two buffers. */
|
||||||
while (datalen--)
|
while (datalen--)
|
||||||
{
|
{
|
||||||
if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen])
|
if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen])
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Failed!\r\n");
|
KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Failed!\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Succeed!\r\n");
|
KPrintf("\r\n SEMC SDRAM 32 bit Data Write and Read Compare Succeed!\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SEMC_SDRAMReadWrite16Bit(void)
|
static void SEMC_SDRAMReadWrite16Bit(void)
|
||||||
{
|
{
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t datalen = SEMC_EXAMPLE_DATALEN;
|
uint32_t datalen = SEMC_EXAMPLE_DATALEN;
|
||||||
uint16_t *sdram = (uint16_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */
|
uint16_t *sdram = (uint16_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
KPrintf("\r\n SEMC SDRAM Memory 16 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen);
|
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_writeBuffer, 0, sizeof(sdram_writeBuffer));
|
||||||
memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer));
|
memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer));
|
||||||
|
|
||||||
/* Prepare data and write to SDRAM. */
|
/* Prepare data and write to SDRAM. */
|
||||||
for (index = 0; index < datalen; index++)
|
for (index = 0; index < datalen; index++)
|
||||||
{
|
{
|
||||||
sdram_writeBuffer[index] = index % 0xFFFF;
|
sdram_writeBuffer[index] = index % 0xFFFF;
|
||||||
sdram[index] = sdram_writeBuffer[index];
|
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);
|
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. */
|
/* Read data from the SDRAM. */
|
||||||
for (index = 0; index < datalen; index++)
|
for (index = 0; index < datalen; index++)
|
||||||
{
|
{
|
||||||
sdram_readBuffer[index] = sdram[index];
|
sdram_readBuffer[index] = sdram[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Start!\r\n");
|
KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Start!\r\n");
|
||||||
/* Compare the two buffers. */
|
/* Compare the two buffers. */
|
||||||
while (datalen--)
|
while (datalen--)
|
||||||
{
|
{
|
||||||
if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen])
|
if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen])
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Failed!\r\n");
|
KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Failed!\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Succeed!\r\n");
|
KPrintf("\r\n SEMC SDRAM 16 bit Data Write and Read Compare Succeed!\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SEMC_SDRAMReadWrite8Bit(void)
|
static void SEMC_SDRAMReadWrite8Bit(void)
|
||||||
{
|
{
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t datalen = SEMC_EXAMPLE_DATALEN;
|
uint32_t datalen = SEMC_EXAMPLE_DATALEN;
|
||||||
uint8_t *sdram = (uint8_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */
|
uint8_t *sdram = (uint8_t *)EXAMPLE_SEMC_START_ADDRESS; /* SDRAM start address. */
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
KPrintf("\r\n SEMC SDRAM Memory 8 bit Write Start, Start Address 0x%x, Data Length %d !\r\n", sdram, datalen);
|
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_writeBuffer, 0, sizeof(sdram_writeBuffer));
|
||||||
memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer));
|
memset(sdram_readBuffer, 0, sizeof(sdram_readBuffer));
|
||||||
|
|
||||||
/* Prepare data and write to SDRAM. */
|
/* Prepare data and write to SDRAM. */
|
||||||
for (index = 0; index < datalen; index++)
|
for (index = 0; index < datalen; index++)
|
||||||
{
|
{
|
||||||
sdram_writeBuffer[index] = index % 0x100;
|
sdram_writeBuffer[index] = index % 0x100;
|
||||||
sdram[index] = sdram_writeBuffer[index];
|
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);
|
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. */
|
/* Read data from the SDRAM. */
|
||||||
for (index = 0; index < datalen; index++)
|
for (index = 0; index < datalen; index++)
|
||||||
{
|
{
|
||||||
sdram_readBuffer[index] = sdram[index];
|
sdram_readBuffer[index] = sdram[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Start!\r\n");
|
KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Start!\r\n");
|
||||||
/* Compare the two buffers. */
|
/* Compare the two buffers. */
|
||||||
while (datalen--)
|
while (datalen--)
|
||||||
{
|
{
|
||||||
if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen])
|
if (sdram_writeBuffer[datalen] != sdram_readBuffer[datalen])
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Failed!\r\n");
|
KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Failed!\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Succeed!\r\n");
|
KPrintf("\r\n SEMC SDRAM 8 bit Data Write and Read Compare Succeed!\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,6 +335,12 @@ KERNELPATHS += -I$(KERNEL_ROOT)/fs/devfs \
|
||||||
-I$(KERNEL_ROOT)/fs/shared/include #
|
-I$(KERNEL_ROOT)/fs/shared/include #
|
||||||
endif
|
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)
|
ifeq ($(CONFIG_FS_CH376), y)
|
||||||
KERNELPATHS +=-I$(KERNEL_ROOT)/fs/compatibility_ch376 #
|
KERNELPATHS +=-I$(KERNEL_ROOT)/fs/compatibility_ch376 #
|
||||||
endif
|
endif
|
||||||
|
@ -454,4 +460,3 @@ KERNELPATHS += -I$(KERNEL_ROOT)/kernel/include #
|
||||||
# @cp link.mk build/Makefile
|
# @cp link.mk build/Makefile
|
||||||
# @$(MAKE) -C build COMPILE_TYPE="_kernel" TARGET=XiZi-$(BOARD)_kernel.elf LINK_FLAGS=LFLAGS
|
# @$(MAKE) -C build COMPILE_TYPE="_kernel" TARGET=XiZi-$(BOARD)_kernel.elf LINK_FLAGS=LFLAGS
|
||||||
# @rm build/Makefile build/make.obj
|
# @rm build/Makefile build/make.obj
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,4 @@ LWIP_DIR += api
|
||||||
LWIP_DIR += arch
|
LWIP_DIR += arch
|
||||||
LWIP_DIR += core
|
LWIP_DIR += core
|
||||||
LWIP_DIR += netif
|
LWIP_DIR += netif
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
|
@ -663,7 +663,9 @@ int lwip_inet_pton(int af, const char *src, void *dst);
|
||||||
|
|
||||||
#if LWIP_POSIX_SOCKETS_IO_NAMES
|
#if LWIP_POSIX_SOCKETS_IO_NAMES
|
||||||
/** @ingroup socket */
|
/** @ingroup socket */
|
||||||
|
#ifndef APP_USING_WEBNET
|
||||||
#define read(s,mem,len) lwip_read(s,mem,len)
|
#define read(s,mem,len) lwip_read(s,mem,len)
|
||||||
|
#endif
|
||||||
/** @ingroup socket */
|
/** @ingroup socket */
|
||||||
#define readv(s,iov,iovcnt) lwip_readv(s,iov,iovcnt)
|
#define readv(s,iov,iovcnt) lwip_readv(s,iov,iovcnt)
|
||||||
/** @ingroup socket */
|
/** @ingroup socket */
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
SRC_DIR += cmd_lwip
|
SRC_DIR += cmd_lwip
|
||||||
|
SRC_DIR += netdev
|
||||||
LWIP_DIR := LwIP
|
LWIP_DIR := LwIP
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
Loading…
Reference in New Issue