forked from xuos/xiuos
feat support webserver for edu-arm32 board
This commit is contained in:
parent
9e962d2cf2
commit
87c4c585d9
|
@ -20,5 +20,5 @@ menu "Applications"
|
||||||
source "$APP_DIR/Applications/sensor_app/Kconfig"
|
source "$APP_DIR/Applications/sensor_app/Kconfig"
|
||||||
source "$APP_DIR/Applications/embedded_database_app/Kconfig"
|
source "$APP_DIR/Applications/embedded_database_app/Kconfig"
|
||||||
source "$APP_DIR/Applications/webnet/Kconfig"
|
source "$APP_DIR/Applications/webnet/Kconfig"
|
||||||
source "$APP_DIR/Applications/mongoose/Kconfig"
|
source "$APP_DIR/Applications/webserver/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -40,8 +40,8 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
|
||||||
SRC_DIR += webnet
|
SRC_DIR += webnet
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USE_MONGOOSE),y)
|
ifeq ($(CONFIG_APPLICATION_WEBSERVER),y)
|
||||||
SRC_DIR += mongoose
|
SRC_DIR += webserver
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
|
@ -22,7 +22,7 @@ extern void ApplicationOtaTaskInit(void);
|
||||||
extern int OtaTask(void);
|
extern int OtaTask(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MONGOOSE
|
#ifdef APPLICATION_WEBSERVER
|
||||||
extern int webserver(void);
|
extern int webserver(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ int main(void)
|
||||||
OtaTask();
|
OtaTask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MONGOOSE
|
#ifdef APPLICATION_WEBSERVER
|
||||||
webserver();
|
webserver();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
menuconfig USE_MONGOOSE
|
|
||||||
bool "Use mongoose as webserver"
|
|
||||||
default n
|
|
||||||
select BSP_USING_SDIO
|
|
||||||
select BSP_USING_W5500
|
|
||||||
select BSP_USING_ETHERNET
|
|
||||||
select SUPPORT_CONNECTION_FRAMEWORK
|
|
||||||
select CONNECTION_ADAPTER_4G
|
|
||||||
select ADAPTER_EC200A
|
|
||||||
select LIB_USING_LORAWAN
|
|
||||||
select LIB_USING_LORA_RADIO
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
menuconfig APPLICATION_WEBSERVER
|
||||||
|
bool "Application webserver using mongoose"
|
||||||
|
default n
|
||||||
|
|
||||||
|
if APPLICATION_WEBSERVER
|
||||||
|
choice
|
||||||
|
prompt "choose board for webserver"
|
||||||
|
default APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
|
|
||||||
|
config APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
|
bool "board select xishutong-4g, support dual ethernet port and 4G"
|
||||||
|
select BSP_USING_SDIO
|
||||||
|
select BSP_USING_W5500
|
||||||
|
select BSP_USING_ETHERNET
|
||||||
|
select SUPPORT_CONNECTION_FRAMEWORK
|
||||||
|
select CONNECTION_ADAPTER_4G
|
||||||
|
select ADAPTER_EC200A
|
||||||
|
select LIB_USING_LORAWAN
|
||||||
|
select LIB_USING_LORA_RADIO
|
||||||
|
|
||||||
|
config APPLICATION_WEBSERVER_XISHUTONG
|
||||||
|
bool "board select xishutong, support single ethernet port"
|
||||||
|
select BSP_USING_SDIO
|
||||||
|
select BSP_USING_LWIP
|
||||||
|
select LIB_USING_LORAWAN
|
||||||
|
select LIB_USING_LORA_RADIO
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
|
@ -25,6 +25,11 @@ History:
|
||||||
Author: AIIT XUOS Lab
|
Author: AIIT XUOS Lab
|
||||||
Modification:
|
Modification:
|
||||||
1、support xishutong-arm32 board, using W5500 to support webserver.
|
1、support xishutong-arm32 board, using W5500 to support webserver.
|
||||||
|
|
||||||
|
2. Date: 2024-1-3
|
||||||
|
Author: AIIT XUOS Lab
|
||||||
|
Modification:
|
||||||
|
1、support xishutong board(single ethernet port), using MAC to support webserver
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +39,9 @@ Modification:
|
||||||
#include <sys_arch.h>
|
#include <sys_arch.h>
|
||||||
#include <lwip/sockets.h>
|
#include <lwip/sockets.h>
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
#include <adapter.h>
|
#include <adapter.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Local variable definitions ('static')
|
* Local variable definitions ('static')
|
||||||
|
@ -72,9 +79,17 @@ static unsigned int status = 0;
|
||||||
static pthread_t wb_event_task;
|
static pthread_t wb_event_task;
|
||||||
|
|
||||||
/*define device info*/
|
/*define device info*/
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
static const char* device_name = "矽数通4G";
|
static const char* device_name = "矽数通4G";
|
||||||
static const char* device_type = "xishutong-arm32";
|
static const char* device_type = "xishutong-arm32";
|
||||||
static const char* device_serial_num = "123456789";
|
static const char* device_serial_num = "123456789";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG
|
||||||
|
static const char* device_name = "矽数通";
|
||||||
|
static const char* device_type = "xishutong-arm32";
|
||||||
|
static const char* device_serial_num = "123456789";
|
||||||
|
#endif
|
||||||
|
|
||||||
/*define webserver info*/
|
/*define webserver info*/
|
||||||
static struct webserver_config {
|
static struct webserver_config {
|
||||||
|
@ -231,6 +246,7 @@ static void Rs485Configure(int baud_rate, int data_bit, int stop_bit, int parity
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Function implementation - define net 4G info
|
* Function implementation - define net 4G info
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
static void Net4gGetInfo(char *ip, char *operator, char *signal_strength)
|
static void Net4gGetInfo(char *ip, char *operator, char *signal_strength)
|
||||||
{
|
{
|
||||||
//to do
|
//to do
|
||||||
|
@ -265,6 +281,7 @@ static void NetMqttDisconnect(void)
|
||||||
{
|
{
|
||||||
//to do
|
//to do
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Function implementation - define net LoRa info
|
* Function implementation - define net LoRa info
|
||||||
|
@ -295,6 +312,7 @@ static void NetLoraDisconnect(void)
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Function implementation - define net Ethernet info
|
* Function implementation - define net Ethernet info
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
static void TcpClientConnect(void)
|
static void TcpClientConnect(void)
|
||||||
{
|
{
|
||||||
int cnt = 20;
|
int cnt = 20;
|
||||||
|
@ -372,6 +390,7 @@ static void TcpClientDisconnect(void)
|
||||||
closesocket(socket_fd);
|
closesocket(socket_fd);
|
||||||
net_ethernet_info.connect_status = 0;
|
net_ethernet_info.connect_status = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Function implementation - define plc info
|
* Function implementation - define plc info
|
||||||
|
@ -403,6 +422,7 @@ static void *WebserverEventTask(void *arg)
|
||||||
while(1) {
|
while(1) {
|
||||||
if (0 == PrivEventProcess(wb_event, WB_EVENT_ALL, EVENT_OR | EVENT_AUTOCLEAN, 0, &status)) {
|
if (0 == PrivEventProcess(wb_event, WB_EVENT_ALL, EVENT_OR | EVENT_AUTOCLEAN, 0, &status)) {
|
||||||
switch( status ) {
|
switch( status ) {
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
case WB_4G_CONNECT:
|
case WB_4G_CONNECT:
|
||||||
Net4gConnect();
|
Net4gConnect();
|
||||||
break;
|
break;
|
||||||
|
@ -415,18 +435,21 @@ static void *WebserverEventTask(void *arg)
|
||||||
case WB_MQTT_DISCONNECT:
|
case WB_MQTT_DISCONNECT:
|
||||||
NetMqttDisconnect();
|
NetMqttDisconnect();
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case WB_LORA_CONNECT:
|
case WB_LORA_CONNECT:
|
||||||
NetLoraConnect();
|
NetLoraConnect();
|
||||||
break;
|
break;
|
||||||
case WB_LORA_DISCONNECT:
|
case WB_LORA_DISCONNECT:
|
||||||
NetLoraDisconnect();
|
NetLoraDisconnect();
|
||||||
break;
|
break;
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
case WB_ETHERNET_CONNECT:
|
case WB_ETHERNET_CONNECT:
|
||||||
TcpClientConnect();
|
TcpClientConnect();
|
||||||
break;
|
break;
|
||||||
case WB_ETHERNET_DISCONNECT:
|
case WB_ETHERNET_DISCONNECT:
|
||||||
TcpClientDisconnect();
|
TcpClientDisconnect();
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,6 +545,7 @@ static void fn(struct mg_connection* c, int ev, void* ev_data, void* fn_data)
|
||||||
Rs485Configure(rs485_config.baud_rate, rs485_config.data_bit, rs485_config.stop_bit, rs485_config.parity);
|
Rs485Configure(rs485_config.baud_rate, rs485_config.data_bit, rs485_config.stop_bit, rs485_config.parity);
|
||||||
}
|
}
|
||||||
/*define net 4G info*/
|
/*define net 4G info*/
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
else if (mg_http_match_uri(hm, "/net/get4gInfo")) {
|
else if (mg_http_match_uri(hm, "/net/get4gInfo")) {
|
||||||
|
|
||||||
Net4gGetInfo(net_4g_info.map_ip, net_4g_info.operator, net_4g_info.signal_strength);
|
Net4gGetInfo(net_4g_info.map_ip, net_4g_info.operator, net_4g_info.signal_strength);
|
||||||
|
@ -569,6 +593,7 @@ static void fn(struct mg_connection* c, int ev, void* ev_data, void* fn_data)
|
||||||
PrivEvenTrigger(wb_event, WB_MQTT_DISCONNECT);
|
PrivEvenTrigger(wb_event, WB_MQTT_DISCONNECT);
|
||||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{\"status\":\"success\"}\r\n");
|
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{\"status\":\"success\"}\r\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/*define net LoRa info*/
|
/*define net LoRa info*/
|
||||||
else if (mg_http_match_uri(hm, "/net/getLoraInfo")) {
|
else if (mg_http_match_uri(hm, "/net/getLoraInfo")) {
|
||||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n",
|
mg_http_reply(c, 200, "Content-Type: application/json\r\n",
|
||||||
|
@ -599,6 +624,7 @@ static void fn(struct mg_connection* c, int ev, void* ev_data, void* fn_data)
|
||||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{\"status\":\"success\"}\r\n");
|
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{\"status\":\"success\"}\r\n");
|
||||||
}
|
}
|
||||||
/*define net Ethernet info*/
|
/*define net Ethernet info*/
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
else if (mg_http_match_uri(hm, "/net/getEthernetInfo")) {
|
else if (mg_http_match_uri(hm, "/net/getEthernetInfo")) {
|
||||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n",
|
mg_http_reply(c, 200, "Content-Type: application/json\r\n",
|
||||||
"{%m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%d}\n",
|
"{%m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%m, %m:%d}\n",
|
||||||
|
@ -646,6 +672,7 @@ static void fn(struct mg_connection* c, int ev, void* ev_data, void* fn_data)
|
||||||
PrivEvenTrigger(wb_event, WB_ETHERNET_DISCONNECT);
|
PrivEvenTrigger(wb_event, WB_ETHERNET_DISCONNECT);
|
||||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{\"status\":\"success\"}\r\n");
|
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{\"status\":\"success\"}\r\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/*define plc info*/
|
/*define plc info*/
|
||||||
else if (mg_http_match_uri(hm, "/control/setPLCInfo")) {
|
else if (mg_http_match_uri(hm, "/control/setPLCInfo")) {
|
||||||
struct mg_str json = hm->body;
|
struct mg_str json = hm->body;
|
||||||
|
@ -670,23 +697,41 @@ static void fn(struct mg_connection* c, int ev, void* ev_data, void* fn_data)
|
||||||
|
|
||||||
static void* do_webserver(void* args)
|
static void* do_webserver(void* args)
|
||||||
{
|
{
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
p_netdev_webserver = netdev_get_by_name("wz");
|
p_netdev_webserver = netdev_get_by_name("wz");
|
||||||
if (p_netdev_webserver == NULL) {
|
if (p_netdev_webserver == NULL) {
|
||||||
MG_INFO(("Did not find wz netdev, use default.\n"));
|
MG_INFO(("Did not find wz netdev, use default.\n"));
|
||||||
p_netdev_webserver = NETDEV_DEFAULT;
|
p_netdev_webserver = NETDEV_DEFAULT;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG
|
||||||
|
p_netdev_webserver = netdev_get_by_name("hd");
|
||||||
|
if (p_netdev_webserver == NULL) {
|
||||||
|
MG_INFO(("Did not find hd netdev, use default.\n"));
|
||||||
|
p_netdev_webserver = NETDEV_DEFAULT;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
MG_INFO(("Webserver Use Netdev %s", p_netdev_webserver->name));
|
MG_INFO(("Webserver Use Netdev %s", p_netdev_webserver->name));
|
||||||
webserver_config.ip = strdup(inet_ntoa(*p_netdev_webserver->ip_addr));
|
webserver_config.ip = strdup(inet_ntoa(*p_netdev_webserver->ip_addr));
|
||||||
webserver_config.mask = strdup(inet_ntoa(*p_netdev_webserver->netmask));
|
webserver_config.mask = strdup(inet_ntoa(*p_netdev_webserver->netmask));
|
||||||
webserver_config.gw = strdup(inet_ntoa(*p_netdev_webserver->gw));
|
webserver_config.gw = strdup(inet_ntoa(*p_netdev_webserver->gw));
|
||||||
webserver_config.dns = strdup(inet_ntoa(p_netdev_webserver->dns_servers[0]));
|
webserver_config.dns = strdup(inet_ntoa(p_netdev_webserver->dns_servers[0]));
|
||||||
|
|
||||||
|
|
||||||
#ifdef BSP_USING_RS485
|
#ifdef BSP_USING_RS485
|
||||||
Rs485InitConfigure();
|
Rs485InitConfigure();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
adapter = AdapterDeviceFindByName(ADAPTER_4G_NAME);
|
adapter = AdapterDeviceFindByName(ADAPTER_4G_NAME);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//lora init param
|
||||||
|
net_lora_info.bw = 2;//bw 0:125 kHz 1:250 kHz 2:500 kHz,
|
||||||
|
net_lora_info.sf = 12;//sf12
|
||||||
net_lora_info.lora_init_flag = 0;
|
net_lora_info.lora_init_flag = 0;
|
||||||
|
|
||||||
WbEventInit();
|
WbEventInit();
|
||||||
|
|
||||||
struct mg_mgr mgr; // Event manager
|
struct mg_mgr mgr; // Event manager
|
||||||
|
@ -702,9 +747,22 @@ static void* do_webserver(void* args)
|
||||||
|
|
||||||
int webserver(void)
|
int webserver(void)
|
||||||
{
|
{
|
||||||
char* params[2] = {"LwipNetworkActive", "-a"};
|
|
||||||
extern void LwipNetworkActive(int argc, char* argv[]);
|
extern void LwipNetworkActive(int argc, char* argv[]);
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG_4G
|
||||||
|
char* params[2] = {"LwipNetworkActive", "-a"};
|
||||||
LwipNetworkActive(2, params);
|
LwipNetworkActive(2, params);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef APPLICATION_WEBSERVER_XISHUTONG
|
||||||
|
char* params[3] = {"LwipNetworkActive", "-e", "0"};
|
||||||
|
LwipNetworkActive(3, params);
|
||||||
|
|
||||||
|
extern void LwipSetNetwork(int argc, char* argv[]);
|
||||||
|
char* ip_params[5] = {"LwipSetNetwork", "-d", "hd", "-i", "192.168.131.88"};
|
||||||
|
LwipSetNetwork(5, ip_params);
|
||||||
|
char* gw_params[5] = {"LwipSetNetwork", "-d", "hd", "-g", "192.168.131.1"};
|
||||||
|
LwipSetNetwork(5, gw_params);
|
||||||
|
#endif
|
||||||
|
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
attr.schedparam.sched_priority = 30;
|
attr.schedparam.sched_priority = 30;
|
|
@ -50,7 +50,7 @@ export SRC_DIR:= $(SRC_APP_DIR) $(SRC_KERNEL_DIR)
|
||||||
export LIBCC
|
export LIBCC
|
||||||
export MUSL_DIR := $(KERNEL_ROOT)/lib/musllib
|
export MUSL_DIR := $(KERNEL_ROOT)/lib/musllib
|
||||||
export LWIP_DIR := $(KERNEL_ROOT)/resources/ethernet
|
export LWIP_DIR := $(KERNEL_ROOT)/resources/ethernet
|
||||||
export MONGOOSE_DIR := $(KERNEL_ROOT)/../../APP_Framework/Applications/mongoose/lib
|
export MONGOOSE_DIR := $(KERNEL_ROOT)/../../APP_Framework/Applications/webserver/lib
|
||||||
|
|
||||||
PART:=
|
PART:=
|
||||||
|
|
||||||
|
@ -75,10 +75,6 @@ ifeq ($(CONFIG_RESOURCES_LWIP), y)
|
||||||
PART += COMPILE_LWIP
|
PART += COMPILE_LWIP
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USE_MONGOOSE), y)
|
|
||||||
# PART += COMPILE_MONGOOSE
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_MCUBOOT_BOOTLOADER), y)
|
ifeq ($(CONFIG_MCUBOOT_BOOTLOADER), y)
|
||||||
PART += COMPILE_BOOTLOADER
|
PART += COMPILE_BOOTLOADER
|
||||||
else ifeq ($(CONFIG_MCUBOOT_APPLICATION), y)
|
else ifeq ($(CONFIG_MCUBOOT_APPLICATION), y)
|
||||||
|
@ -141,7 +137,7 @@ COMPILE_MONGOOSE:
|
||||||
done
|
done
|
||||||
@cp link_mongoose.mk build/Makefile
|
@cp link_mongoose.mk build/Makefile
|
||||||
@$(MAKE) -C build TARGET=mongoose.a LINK_FLAGS=LFLAGS
|
@$(MAKE) -C build TARGET=mongoose.a LINK_FLAGS=LFLAGS
|
||||||
@cp build/mongoose.a $(KERNEL_ROOT)/../../APP_Framework/Applications/mongoose/mongoose.a
|
@cp build/mongoose.a $(KERNEL_ROOT)/../../APP_Framework/Applications/webserver/mongoose.a
|
||||||
@rm build/Makefile build/make.obj
|
@rm build/Makefile build/make.obj
|
||||||
|
|
||||||
COMPILE_KERNEL:
|
COMPILE_KERNEL:
|
||||||
|
|
|
@ -211,7 +211,7 @@ CONFIG_ADD_XIZI_FEATURES=y
|
||||||
#
|
#
|
||||||
# config stack size and priority of main task
|
# config stack size and priority of main task
|
||||||
#
|
#
|
||||||
CONFIG_MAIN_KTASK_STACK_SIZE=1024
|
CONFIG_MAIN_KTASK_STACK_SIZE=2048
|
||||||
CONFIG_MAIN_KTASK_PRIORITY=16
|
CONFIG_MAIN_KTASK_PRIORITY=16
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -15,4 +15,8 @@ ifeq ($(CONFIG_RESOURCES_LWIP), y)
|
||||||
export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a
|
export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_APPLICATION_WEBSERVER), y)
|
||||||
|
export LINK_MONGOOSE := $(KERNEL_ROOT)/../../APP_Framework/Applications/webserver/mongoose.a
|
||||||
|
endif
|
||||||
|
|
||||||
export ARCH = arm
|
export ARCH = arm
|
||||||
|
|
|
@ -75,6 +75,7 @@ Modification:
|
||||||
|
|
||||||
static stc_sd_handle_t gSdHandle;
|
static stc_sd_handle_t gSdHandle;
|
||||||
static int sd_lock = -1;
|
static int sd_lock = -1;
|
||||||
|
static int is_mount_ok = 0;
|
||||||
|
|
||||||
static void SdCardConfig(void)
|
static void SdCardConfig(void)
|
||||||
{
|
{
|
||||||
|
@ -214,11 +215,13 @@ static struct SdioDevDone dev_done =
|
||||||
*/
|
*/
|
||||||
static int MountSDCardFs(enum FilesystemType fs_type)
|
static int MountSDCardFs(enum FilesystemType fs_type)
|
||||||
{
|
{
|
||||||
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, fs_type, "/") == 0)
|
if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, fs_type, "/") == 0) {
|
||||||
KPrintf("Sd card mount to '/'");
|
KPrintf("Sd card mount to '/'");
|
||||||
else
|
is_mount_ok = 1;
|
||||||
|
} else {
|
||||||
KPrintf("Sd card mount to '/' failed!");
|
KPrintf("Sd card mount to '/' failed!");
|
||||||
|
is_mount_ok = 0;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -253,9 +256,17 @@ static void SdCardDetach(void)
|
||||||
|
|
||||||
#ifdef MOUNT_SDCARD_FS
|
#ifdef MOUNT_SDCARD_FS
|
||||||
UnmountFileSystem("/");
|
UnmountFileSystem("/");
|
||||||
|
is_mount_ok = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetSdMountStatus(void)
|
||||||
|
{
|
||||||
|
if(!is_mount_ok)
|
||||||
|
KPrintf("SD card is not inserted or failed to mount, please check!\r\n");
|
||||||
|
return is_mount_ok;
|
||||||
|
}
|
||||||
|
|
||||||
static uint8 SdCardReadCd(void)
|
static uint8 SdCardReadCd(void)
|
||||||
{
|
{
|
||||||
en_pin_state_t sd_cd_state = GPIO_ReadInputPins(SDIOC_CD_PORT, SDIOC_CD_PIN);
|
en_pin_state_t sd_cd_state = GPIO_ReadInputPins(SDIOC_CD_PORT, SDIOC_CD_PIN);
|
||||||
|
|
|
@ -16,6 +16,7 @@ menuconfig BSP_USING_UART3
|
||||||
menuconfig BSP_USING_UART4
|
menuconfig BSP_USING_UART4
|
||||||
bool "Enable USART4 for RS485"
|
bool "Enable USART4 for RS485"
|
||||||
default y
|
default y
|
||||||
|
select BSP_USING_RS485
|
||||||
if BSP_USING_UART4
|
if BSP_USING_UART4
|
||||||
config SERIAL_BUS_NAME_4
|
config SERIAL_BUS_NAME_4
|
||||||
string "serial bus 4 name"
|
string "serial bus 4 name"
|
||||||
|
@ -28,6 +29,10 @@ menuconfig BSP_USING_UART4
|
||||||
default "usart4_dev4"
|
default "usart4_dev4"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_RS485
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
menuconfig BSP_USING_UART6
|
menuconfig BSP_USING_UART6
|
||||||
bool "Enable USART6"
|
bool "Enable USART6"
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -15,8 +15,8 @@ ifeq ($(CONFIG_RESOURCES_LWIP), y)
|
||||||
export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a
|
export LINK_LWIP := $(KERNEL_ROOT)/resources/ethernet/LwIP/liblwip.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USE_MONGOOSE), y)
|
ifeq ($(CONFIG_APPLICATION_WEBSERVER), y)
|
||||||
export LINK_MONGOOSE := $(KERNEL_ROOT)/../../APP_Framework/Applications/mongoose/mongoose.a
|
export LINK_MONGOOSE := $(KERNEL_ROOT)/../../APP_Framework/Applications/webserver/mongoose.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export ARCH = arm
|
export ARCH = arm
|
||||||
|
|
|
@ -39,7 +39,7 @@ ifeq ($(CONFIG_CRYPTO), y)
|
||||||
APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/security/crypto/include #
|
APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/security/crypto/include #
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_USE_MONGOOSE),y)
|
ifeq ($(CONFIG_APPLICATION_WEBSERVER),y)
|
||||||
APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/mongoose #
|
APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/mongoose #
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue