Merge pull request #1101 from BernardXiong/master

[Kernel] Use rt_object_get_information to get object chain
This commit is contained in:
Bernard Xiong 2017-12-13 14:14:40 +08:00 committed by GitHub
commit 6962bd1f1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 368 additions and 239 deletions

View File

@ -26,11 +26,6 @@
/*@{*/ /*@{*/
extern int rt_application_init(void); extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
/******************************************************************************* /*******************************************************************************
* Function Name : assert_failed * Function Name : assert_failed
@ -87,8 +82,7 @@ void rtthread_startup(void)
rt_thread_idle_init(); rt_thread_idle_init();
/* start scheduler */ /* start scheduler */
rt_system_scheduler_start();
rt_system_scheduler_start();
/* never reach here */ /* never reach here */
return ; return ;

View File

@ -164,15 +164,15 @@ rt_module_t rt_module_find(const char *name)
struct rt_object *object; struct rt_object *object;
struct rt_list_node *node; struct rt_list_node *node;
extern struct rt_object_information rt_object_container[];
RT_DEBUG_NOT_IN_INTERRUPT; RT_DEBUG_NOT_IN_INTERRUPT;
/* enter critical */ /* enter critical */
rt_enter_critical(); rt_enter_critical();
/* try to find device object */ /* try to find device object */
information = &rt_object_container[RT_Object_Class_Module]; information = rt_object_get_information(RT_Object_Class_Module);
RT_ASSERT(information != RT_NULL);
for (node = information->object_list.next; for (node = information->object_list.next;
node != &(information->object_list); node != &(information->object_list);
node = node->next) node = node->next)

View File

@ -85,6 +85,7 @@ CONFIG_FINSH_USING_MSH_DEFAULT=y
CONFIG_RT_USING_DFS=y CONFIG_RT_USING_DFS=y
CONFIG_DFS_USING_WORKDIR=y CONFIG_DFS_USING_WORKDIR=y
CONFIG_DFS_FILESYSTEMS_MAX=4 CONFIG_DFS_FILESYSTEMS_MAX=4
CONFIG_DFS_FILESYSTEM_TYPES_MAX=2
CONFIG_DFS_FD_MAX=4 CONFIG_DFS_FD_MAX=4
CONFIG_RT_USING_DFS_ELMFAT=y CONFIG_RT_USING_DFS_ELMFAT=y
@ -108,6 +109,7 @@ CONFIG_RT_USING_DFS_DEVFS=y
# CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_ROMFS is not set
# CONFIG_RT_USING_DFS_RAMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_UFFS is not set # CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_NFS is not set
# #
# Device Drivers # Device Drivers
@ -116,14 +118,20 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_USING_SERIAL=y CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_USING_CAN is not set # CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set # CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_I2C is not set CONFIG_RT_USING_I2C=y
CONFIG_RT_USING_I2C_BITOPS=y
CONFIG_RT_USING_PIN=y CONFIG_RT_USING_PIN=y
CONFIG_RT_USING_MTD_NOR=y CONFIG_RT_USING_MTD_NOR=y
# CONFIG_RT_USING_MTD_NAND is not set # CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_RTC is not set # CONFIG_RT_USING_RTC is not set
# CONFIG_RT_USING_SDIO is not set CONFIG_RT_USING_SDIO=y
# CONFIG_RT_USING_SPI is not set # CONFIG_RT_USING_SPI is not set
# CONFIG_RT_USING_WDT is not set # CONFIG_RT_USING_WDT is not set
# CONFIG_RT_USING_WIFI is not set
#
# Using USB
#
# CONFIG_RT_USING_USB_HOST is not set # CONFIG_RT_USING_USB_HOST is not set
# CONFIG_RT_USING_USB_DEVICE is not set # CONFIG_RT_USING_USB_DEVICE is not set
@ -131,10 +139,8 @@ CONFIG_RT_USING_MTD_NOR=y
# POSIX layer and C standard library # POSIX layer and C standard library
# #
CONFIG_RT_USING_LIBC=y CONFIG_RT_USING_LIBC=y
# CONFIG_RT_USING_PTHREADS is not set CONFIG_RT_USING_PTHREADS=y
CONFIG_RT_USING_POSIX=y # CONFIG_RT_USING_POSIX is not set
# CONFIG_RT_USING_POSIX_MMAP is not set
# CONFIG_RT_USING_POSIX_TERMIOS is not set
# #
# Network stack # Network stack
@ -143,23 +149,96 @@ CONFIG_RT_USING_POSIX=y
# #
# light weight TCP/IP stack # light weight TCP/IP stack
# #
# CONFIG_RT_USING_LWIP is not set CONFIG_RT_USING_LWIP=y
# CONFIG_RT_USING_LWIP141 is not set
CONFIG_RT_USING_LWIP202=y
# CONFIG_RT_USING_LWIP_IPV6 is not set
# CONFIG_RT_LWIP_IGMP is not set
CONFIG_RT_LWIP_ICMP=y
# CONFIG_RT_LWIP_SNMP is not set
CONFIG_RT_LWIP_DNS=y
CONFIG_RT_LWIP_DHCP=y
CONFIG_IP_SOF_BROADCAST=1
CONFIG_IP_SOF_BROADCAST_RECV=1
#
# Static IPv4 Address
#
CONFIG_RT_LWIP_IPADDR="192.168.1.30"
CONFIG_RT_LWIP_GWADDR="192.168.1.1"
CONFIG_RT_LWIP_MSKADDR="255.255.255.0"
CONFIG_RT_LWIP_UDP=y
CONFIG_RT_LWIP_TCP=y
# CONFIG_RT_LWIP_RAW is not set
# CONFIG_RT_LWIP_PPP is not set
CONFIG_RT_MEMP_NUM_NETCONN=8
CONFIG_RT_LWIP_PBUF_NUM=16
CONFIG_RT_LWIP_RAW_PCB_NUM=4
CONFIG_RT_LWIP_UDP_PCB_NUM=4
CONFIG_RT_LWIP_TCP_PCB_NUM=4
CONFIG_RT_LWIP_TCP_SEG_NUM=40
CONFIG_RT_LWIP_TCP_SND_BUF=8196
CONFIG_RT_LWIP_TCP_WND=8196
CONFIG_RT_LWIP_TCPTHREAD_PRIORITY=10
CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=8
CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE=2048
CONFIG_RT_LWIP_ETHTHREAD_PRIORITY=12
CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=1024
CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=8
CONFIG_RT_LWIP_REASSEMBLY_FRAG=y
CONFIG_LWIP_NETIF_STATUS_CALLBACK=1
CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1
# #
# Modbus master and slave stack # Modbus master and slave stack
# #
# CONFIG_RT_USING_MODBUS is not set # CONFIG_RT_USING_MODBUS is not set
# CONFIG_LWIP_USING_DHCPD is not set
# CONFIG_RT_USING_NETUTILS is not set
# #
# RT-Thread UI Engine # RT-Thread UI Engine
# #
# CONFIG_RT_USING_GUIENGINE is not set CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
# CONFIG_RTGUI_USING_TTF is not set
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
CONFIG_RTGUI_IMAGE_JPEG_NONE=y
# CONFIG_RTGUI_IMAGE_JPEG is not set
# CONFIG_RTGUI_IMAGE_TJPGD is not set
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
CONFIG_RTGUI_USING_DEMO=y
# #
# VBUS(Virtual Software BUS) # VBUS(Virtual Software BUS)
# #
# CONFIG_RT_USING_VBUS is not set # CONFIG_RT_USING_VBUS is not set
#
# Utilities
#
# CONFIG_RT_USING_LOGTRACE is not set
# CONFIG_RT_USING_RYM is not set
#
# RT-Thread Senior Membership Packages
#
#
# system packages
#
# CONFIG_PKG_USING_FTL_SRC is not set
# #
# RT-Thread online packages # RT-Thread online packages
# #
@ -168,7 +247,9 @@ CONFIG_RT_USING_POSIX=y
# system packages # system packages
# #
# CONFIG_PKG_USING_PARTITION is not set # CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_PERSIMMON is not set
# CONFIG_PKG_USING_SQLITE is not set # CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
# #
# IoT - internet of things # IoT - internet of things
@ -179,26 +260,25 @@ CONFIG_RT_USING_POSIX=y
# CONFIG_PKG_USING_WEBTERMINAL is not set # CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set # CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_EZXML is not set # CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
# Marvell WiFi
#
# CONFIG_PKG_USING_MARVELLWIFI is not set
# #
# security packages # security packages
# #
# CONFIG_PKG_USING_MBEDTLS is not set # CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_libsodium is not set
# CONFIG_PKG_USING_TINYCRYPT is not set
# #
# language packages # language packages
# #
# CONFIG_PKG_USING_JERRYSCRIPT is not set # CONFIG_PKG_USING_JERRYSCRIPT is not set
# CONFIG_PKG_USING_MICROPYTHON is not set
# #
# multimedia packages # multimedia packages
# #
# CONFIG_PKG_USING_FASTLZ is not set # CONFIG_PKG_USING_OPENMV is not set
# #
# tools packages # tools packages
@ -206,10 +286,17 @@ CONFIG_RT_USING_POSIX=y
# CONFIG_PKG_USING_CMBACKTRACE is not set # CONFIG_PKG_USING_CMBACKTRACE is not set
# CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_EASYLOGGER is not set
# CONFIG_PKG_USING_SYSTEMVIEW is not set # CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_IPERF is not set
# #
# miscellaneous packages # miscellaneous packages
# #
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
#
# example package: hello
#
# CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_HELLO is not set
CONFIG_BOARD_X1000_REALBOARD=y CONFIG_BOARD_X1000_REALBOARD=y
# CONFIG_RT_USING_HARD_FLOAT is not set # CONFIG_RT_USING_HARD_FLOAT is not set
@ -221,5 +308,23 @@ CONFIG_BOARD_HALLEY2_REALBOARD_V2=y
# CONFIG_RT_USING_UART0 is not set # CONFIG_RT_USING_UART0 is not set
# CONFIG_RT_USING_UART1 is not set # CONFIG_RT_USING_UART1 is not set
CONFIG_RT_USING_UART2=y CONFIG_RT_USING_UART2=y
CONFIG_RT_USING_MSC0=y
CONFIG_RT_USING_MSC1=y
CONFIG_RT_MMCSD_STACK_SIZE=2048
CONFIG_RT_USING_I2C0=y
# CONFIG_RT_USING_I2C1 is not set
# CONFIG_RT_USING_I2C2 is not set
CONFIG_RT_USING_SLCD=y
CONFIG_RT_USING_ILI9488=y
# CONFIG_RT_USING_ILI9341 is not set
# CONFIG_RT_USING_OTM4802 is not set
# CONFIG_RT_USING_TRULY_TFT240240 is not set
CONFIG_RT_USING_TOUCH=y
CONFIG_RT_USING_GT9XX=y
# CONFIG_RT_USING_FT6x06 is not set
CONFIG_RT_TOUCH_THREAD_PRIORITY=10
CONFIG_RT_USING_AUDIO=y CONFIG_RT_USING_AUDIO=y
CONFIG_RT_USING_ICODEC=y
CONFIG_RT_USING_CPU_FFS=y CONFIG_RT_USING_CPU_FFS=y
# CONFIG_WIFI_USING_AP6212 is not set
# CONFIG_WIFI_USING_AP6181 is not set

View File

@ -1,154 +0,0 @@
/*
* File : rtgui_demo.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2008 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2017-11-8 Tangyuxin first version
*/
#include <rtthread.h>
// #define DEBUG
#ifdef DEBUG
#define DEBUG_PRINTF(...) rt_kprintf(__VA_ARGS__)
#else
#define DEBUG_PRINTF(...)
#endif
#ifdef RT_USING_GUIENGINE
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_app.h>
#include <rtgui/widgets/window.h>
#include <rtgui/dc.h>
struct rtgui_win *main_win;
rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event);
static void rt_gui_demo_entry(void *parameter)
{
struct rtgui_app *app;
DEBUG_PRINTF("gui demo entry\n");
/* create gui app */
app = rtgui_app_create("gui_demo");
if (app == RT_NULL)
{
DEBUG_PRINTF("rtgui_app_create faild\n");
return;
}
/* create main window */
main_win = rtgui_mainwin_create(RT_NULL,
"UiWindow", RTGUI_WIN_STYLE_NO_TITLE | RTGUI_WIN_STYLE_NO_BORDER);
if (main_win == RT_NULL)
{
DEBUG_PRINTF("main_win is null\n");
rtgui_app_destroy(app);
return;
}
rtgui_object_set_event_handler(RTGUI_OBJECT(main_win), dc_event_handler);
DEBUG_PRINTF("rtgui_win_show\n");
rtgui_win_show(main_win, RT_FALSE);
DEBUG_PRINTF("rtgui_app_run\n");
rtgui_app_run(app);
DEBUG_PRINTF("rtgui_win_destroy\n");
rtgui_win_destroy(main_win);
DEBUG_PRINTF("rtgui_app_destroy\n");
rtgui_app_destroy(app);
}
rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event)
{
struct rtgui_widget *widget = RTGUI_WIDGET(object);
if (event->type == RTGUI_EVENT_PAINT)
{
struct rtgui_dc *dc;
rtgui_rect_t rect;
DEBUG_PRINTF("\r\n RTGUI_EVENT_PAINT \r\n");
rtgui_win_event_handler(RTGUI_OBJECT(widget), event);
rtgui_widget_get_rect(widget, &rect);
DEBUG_PRINTF("widget react x1: %d, y1: %d, x2: %d, y2: %d\r\n",
rect.x1, rect.y1, rect.x2, rect.y2);
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL)
{
DEBUG_PRINTF("\r\n dc is null \r\n");
return RT_FALSE;
}
rtgui_dc_draw_line(dc, rect.x1, rect.y1, rect.x2, rect.y2);
rtgui_dc_draw_line(dc, rect.x1, rect.y2, rect.x2, rect.y1);
rect.x1 += (rect.x2 - rect.x1) / 2;
rect.y1 += (rect.y2 - rect.y1) / 2;
rtgui_dc_draw_text_stroke(dc, __DATE__"--"__TIME__, &rect, HIGH_LIGHT, BLUE);
rtgui_dc_end_drawing(dc,RT_TRUE);
}
return RT_FALSE;
}
int rt_gui_demo_init(void)
{
rt_thread_t tid;
rt_device_t device;
rt_err_t err;
device = rt_device_find("lcd");
if (device == RT_NULL)
{
rt_kprintf("Not found LCD driver\n");
return RT_ERROR;
}
err = rt_device_open(device, RT_DEVICE_OFLAG_RDWR);
if (err != RT_EOK)
{
rt_kprintf("Open LCD driver fail\n");
return RT_ERROR;
}
/* set graphic device */
rtgui_graphic_set_device(device);
tid = rt_thread_create("mygui",
rt_gui_demo_entry, RT_NULL,
2048, 25, 10);
if (tid != RT_NULL)
rt_thread_startup(tid);
return 0;
}
INIT_APP_EXPORT(rt_gui_demo_init);
#endif /* RT_USING_GUIENGINE */

View File

@ -0,0 +1,11 @@
#include <rtthread.h>
#ifdef RT_USING_WIFI
#include "wlan_wiced.h"
int wifi_init(void)
{
wifi_hw_init();
}
INIT_ENV_EXPORT(wifi_init);
#endif

View File

@ -109,16 +109,31 @@ if RT_USING_GUIENGINE
endif endif
endif endif
config RT_USING_ICODEC
default n
config RT_USING_AUDIO config RT_USING_AUDIO
bool "Using audio" bool "Using audio"
select RT_USING_ICODEC select RT_USING_ICODEC
default n default n
if RT_USING_AUDIO
config RT_USING_ICODEC
bool "Using internal codec for audio"
default y if BOARD_HALLEY2_REALBOARD_V2
default n
endif
config RT_USING_CPU_FFS config RT_USING_CPU_FFS
bool "Using CPU FFS" bool "Using CPU FFS"
default y default y
if PKG_USING_WLAN_WICED
choice
prompt "Broadcom Wi-Fi module"
default WIFI_USING_AP6212
config WIFI_USING_AP6212
bool "AP6212A module(bcm43438)"
config WIFI_USING_AP6181
bool "AP6181 module(bcm43362)"
endchoice
endif

View File

@ -53,6 +53,33 @@ int cplusplus_system_init(void)
} }
#endif #endif
#ifdef RT_USING_GUIENGINE
#include <rtgui/driver.h>
int lcd_hw_init(void)
{
rt_device_t device;
rt_err_t err;
device = rt_device_find("lcd");
if (device == RT_NULL)
{
rt_kprintf("Not found LCD driver\n");
return RT_ERROR;
}
err = rt_device_open(device, RT_DEVICE_OFLAG_RDWR);
if (err != RT_EOK)
{
rt_kprintf("Open LCD driver fail\n");
return RT_ERROR;
}
/* set graphic device */
rtgui_graphic_set_device(device);
}
INIT_ENV_EXPORT(lcd_hw_init);
#endif
void rt_hw_board_init(void) void rt_hw_board_init(void)
{ {
memcpy((void*)&_iramstart, (void*)&_iramcopy, (rt_uint32_t)&_iramend - (rt_uint32_t)&_iramstart); memcpy((void*)&_iramstart, (void*)&_iramcopy, (rt_uint32_t)&_iramend - (rt_uint32_t)&_iramstart);

View File

@ -78,6 +78,7 @@
#define RT_USING_DFS #define RT_USING_DFS
#define DFS_USING_WORKDIR #define DFS_USING_WORKDIR
#define DFS_FILESYSTEMS_MAX 4 #define DFS_FILESYSTEMS_MAX 4
#define DFS_FILESYSTEM_TYPES_MAX 2
#define DFS_FD_MAX 4 #define DFS_FD_MAX 4
#define RT_USING_DFS_ELMFAT #define RT_USING_DFS_ELMFAT
@ -100,6 +101,7 @@
/* RT_USING_DFS_ROMFS is not set */ /* RT_USING_DFS_ROMFS is not set */
/* RT_USING_DFS_RAMFS is not set */ /* RT_USING_DFS_RAMFS is not set */
/* RT_USING_DFS_UFFS is not set */ /* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_NFS is not set */
/* Device Drivers */ /* Device Drivers */
@ -107,49 +109,122 @@
#define RT_USING_SERIAL #define RT_USING_SERIAL
/* RT_USING_CAN is not set */ /* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */ /* RT_USING_HWTIMER is not set */
/* RT_USING_I2C is not set */ #define RT_USING_I2C
#define RT_USING_I2C_BITOPS
#define RT_USING_PIN #define RT_USING_PIN
#define RT_USING_MTD_NOR #define RT_USING_MTD_NOR
/* RT_USING_MTD_NAND is not set */ /* RT_USING_MTD_NAND is not set */
/* RT_USING_RTC is not set */ /* RT_USING_RTC is not set */
/* RT_USING_SDIO is not set */ #define RT_USING_SDIO
/* RT_USING_SPI is not set */ /* RT_USING_SPI is not set */
/* RT_USING_WDT is not set */ /* RT_USING_WDT is not set */
/* RT_USING_WIFI is not set */
/* Using USB */
/* RT_USING_USB_HOST is not set */ /* RT_USING_USB_HOST is not set */
/* RT_USING_USB_DEVICE is not set */ /* RT_USING_USB_DEVICE is not set */
/* POSIX layer and C standard library */ /* POSIX layer and C standard library */
#define RT_USING_LIBC #define RT_USING_LIBC
/* RT_USING_PTHREADS is not set */ #define RT_USING_PTHREADS
#define RT_USING_POSIX /* RT_USING_POSIX is not set */
/* RT_USING_POSIX_MMAP is not set */
/* RT_USING_POSIX_TERMIOS is not set */
/* Network stack */ /* Network stack */
/* light weight TCP/IP stack */ /* light weight TCP/IP stack */
/* RT_USING_LWIP is not set */ #define RT_USING_LWIP
/* RT_USING_LWIP141 is not set */
#define RT_USING_LWIP202
/* RT_USING_LWIP_IPV6 is not set */
/* RT_LWIP_IGMP is not set */
#define RT_LWIP_ICMP
/* RT_LWIP_SNMP is not set */
#define RT_LWIP_DNS
#define RT_LWIP_DHCP
#define IP_SOF_BROADCAST 1
#define IP_SOF_BROADCAST_RECV 1
/* Static IPv4 Address */
#define RT_LWIP_IPADDR "192.168.1.30"
#define RT_LWIP_GWADDR "192.168.1.1"
#define RT_LWIP_MSKADDR "255.255.255.0"
#define RT_LWIP_UDP
#define RT_LWIP_TCP
/* RT_LWIP_RAW is not set */
/* RT_LWIP_PPP is not set */
#define RT_MEMP_NUM_NETCONN 8
#define RT_LWIP_PBUF_NUM 16
#define RT_LWIP_RAW_PCB_NUM 4
#define RT_LWIP_UDP_PCB_NUM 4
#define RT_LWIP_TCP_PCB_NUM 4
#define RT_LWIP_TCP_SEG_NUM 40
#define RT_LWIP_TCP_SND_BUF 8196
#define RT_LWIP_TCP_WND 8196
#define RT_LWIP_TCPTHREAD_PRIORITY 10
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
#define RT_LWIP_TCPTHREAD_STACKSIZE 2048
#define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
#define RT_LWIP_REASSEMBLY_FRAG
#define LWIP_NETIF_STATUS_CALLBACK 1
#define SO_REUSE 1
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1
/* Modbus master and slave stack */ /* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */ /* RT_USING_MODBUS is not set */
/* LWIP_USING_DHCPD is not set */
/* RT_USING_NETUTILS is not set */
/* RT-Thread UI Engine */ /* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */ #define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
/* RTGUI_USING_TTF is not set */
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
#define RTGUI_IMAGE_JPEG_NONE
/* RTGUI_IMAGE_JPEG is not set */
/* RTGUI_IMAGE_TJPGD is not set */
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
#define RTGUI_USING_DEMO
/* VBUS(Virtual Software BUS) */ /* VBUS(Virtual Software BUS) */
/* RT_USING_VBUS is not set */ /* RT_USING_VBUS is not set */
/* Utilities */
/* RT_USING_LOGTRACE is not set */
/* RT_USING_RYM is not set */
/* RT-Thread Senior Membership Packages */
/* system packages */
/* PKG_USING_FTL_SRC is not set */
/* RT-Thread online packages */ /* RT-Thread online packages */
/* system packages */ /* system packages */
/* PKG_USING_PARTITION is not set */ /* PKG_USING_PARTITION is not set */
/* PKG_USING_PERSIMMON is not set */
/* PKG_USING_SQLITE is not set */ /* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */
/* IoT - internet of things */ /* IoT - internet of things */
@ -159,31 +234,37 @@
/* PKG_USING_WEBTERMINAL is not set */ /* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */ /* PKG_USING_CJSON is not set */
/* PKG_USING_EZXML is not set */ /* PKG_USING_EZXML is not set */
/* PKG_USING_NANOPB is not set */
/* Marvell WiFi */
/* PKG_USING_MARVELLWIFI is not set */
/* security packages */ /* security packages */
/* PKG_USING_MBEDTLS is not set */ /* PKG_USING_MBEDTLS is not set */
/* PKG_USING_libsodium is not set */
/* PKG_USING_TINYCRYPT is not set */
/* language packages */ /* language packages */
/* PKG_USING_JERRYSCRIPT is not set */ /* PKG_USING_JERRYSCRIPT is not set */
/* PKG_USING_MICROPYTHON is not set */
/* multimedia packages */ /* multimedia packages */
/* PKG_USING_FASTLZ is not set */ /* PKG_USING_OPENMV is not set */
/* tools packages */ /* tools packages */
/* PKG_USING_CMBACKTRACE is not set */ /* PKG_USING_CMBACKTRACE is not set */
/* PKG_USING_EASYLOGGER is not set */ /* PKG_USING_EASYLOGGER is not set */
/* PKG_USING_SYSTEMVIEW is not set */ /* PKG_USING_SYSTEMVIEW is not set */
/* PKG_USING_IPERF is not set */
/* miscellaneous packages */ /* miscellaneous packages */
/* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */
/* example package: hello */
/* PKG_USING_HELLO is not set */ /* PKG_USING_HELLO is not set */
#define BOARD_X1000_REALBOARD #define BOARD_X1000_REALBOARD
/* RT_USING_HARD_FLOAT is not set */ /* RT_USING_HARD_FLOAT is not set */
@ -195,7 +276,25 @@
/* RT_USING_UART0 is not set */ /* RT_USING_UART0 is not set */
/* RT_USING_UART1 is not set */ /* RT_USING_UART1 is not set */
#define RT_USING_UART2 #define RT_USING_UART2
#define RT_USING_MSC0
#define RT_USING_MSC1
#define RT_MMCSD_STACK_SIZE 2048
#define RT_USING_I2C0
/* RT_USING_I2C1 is not set */
/* RT_USING_I2C2 is not set */
#define RT_USING_SLCD
#define RT_USING_ILI9488
/* RT_USING_ILI9341 is not set */
/* RT_USING_OTM4802 is not set */
/* RT_USING_TRULY_TFT240240 is not set */
#define RT_USING_TOUCH
#define RT_USING_GT9XX
/* RT_USING_FT6x06 is not set */
#define RT_TOUCH_THREAD_PRIORITY 10
#define RT_USING_AUDIO #define RT_USING_AUDIO
#define RT_USING_ICODEC
#define RT_USING_CPU_FFS #define RT_USING_CPU_FFS
/* WIFI_USING_AP6212 is not set */
/* WIFI_USING_AP6181 is not set */
#endif #endif

View File

@ -150,13 +150,12 @@ int dfs_device_fs_open(struct dfs_fd *file)
struct device_dirent *root_dirent; struct device_dirent *root_dirent;
rt_uint32_t count = 0; rt_uint32_t count = 0;
extern struct rt_object_information rt_object_container[];
/* lock scheduler */ /* lock scheduler */
rt_enter_critical(); rt_enter_critical();
/* traverse device object */ /* traverse device object */
information = &rt_object_container[RT_Object_Class_Device]; information = rt_object_get_information(RT_Object_Class_Device);
RT_ASSERT(information != RT_NULL);
for (node = information->object_list.next; node != &(information->object_list); node = node->next) for (node = information->object_list.next; node != &(information->object_list); node = node->next)
{ {
count ++; count ++;

View File

@ -20,6 +20,7 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2005-02-22 Bernard The first version. * 2005-02-22 Bernard The first version.
* 2017-12-11 Bernard Use rt_free to instead of free in fd_is_open().
*/ */
#include <dfs.h> #include <dfs.h>
@ -219,7 +220,7 @@ int fd_is_open(const char *pathname)
if (fs == NULL) if (fs == NULL)
{ {
/* can't find mounted file system */ /* can't find mounted file system */
free(fullpath); rt_free(fullpath);
return -1; return -1;
} }

View File

@ -67,8 +67,6 @@ long version(void)
FINSH_FUNCTION_EXPORT(version, show RT-Thread version information); FINSH_FUNCTION_EXPORT(version, show RT-Thread version information);
MSH_CMD_EXPORT(version, show RT-Thread version information); MSH_CMD_EXPORT(version, show RT-Thread version information);
extern struct rt_object_information rt_object_container[];
static int object_name_maxlen(struct rt_list_node *list) static int object_name_maxlen(struct rt_list_node *list)
{ {
struct rt_list_node *node; struct rt_list_node *node;
@ -135,7 +133,10 @@ static long _list_thread(struct rt_list_node *list)
long list_thread(void) long list_thread(void)
{ {
return _list_thread(&rt_object_container[RT_Object_Class_Thread].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_Thread);
return _list_thread(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_thread, list thread); FINSH_FUNCTION_EXPORT(list_thread, list thread);
MSH_CMD_EXPORT(list_thread, list thread); MSH_CMD_EXPORT(list_thread, list thread);
@ -195,7 +196,11 @@ static long _list_sem(struct rt_list_node *list)
long list_sem(void) long list_sem(void)
{ {
return _list_sem(&rt_object_container[RT_Object_Class_Semaphore].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_Semaphore);
return _list_sem(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_sem, list semaphone in system); FINSH_FUNCTION_EXPORT(list_sem, list semaphone in system);
MSH_CMD_EXPORT(list_sem, list semaphore in system); MSH_CMD_EXPORT(list_sem, list semaphore in system);
@ -237,7 +242,10 @@ static long _list_event(struct rt_list_node *list)
long list_event(void) long list_event(void)
{ {
return _list_event(&rt_object_container[RT_Object_Class_Event].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_Event);
return _list_event(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_event, list event in system); FINSH_FUNCTION_EXPORT(list_event, list event in system);
MSH_CMD_EXPORT(list_event, list event in system); MSH_CMD_EXPORT(list_event, list event in system);
@ -270,7 +278,11 @@ static long _list_mutex(struct rt_list_node *list)
long list_mutex(void) long list_mutex(void)
{ {
return _list_mutex(&rt_object_container[RT_Object_Class_Mutex].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_Mutex);
return _list_mutex(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system); FINSH_FUNCTION_EXPORT(list_mutex, list mutex in system);
MSH_CMD_EXPORT(list_mutex, list mutex in system); MSH_CMD_EXPORT(list_mutex, list mutex in system);
@ -321,7 +333,10 @@ static long _list_mailbox(struct rt_list_node *list)
long list_mailbox(void) long list_mailbox(void)
{ {
return _list_mailbox(&rt_object_container[RT_Object_Class_MailBox].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_MailBox);
return _list_mailbox(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system); FINSH_FUNCTION_EXPORT(list_mailbox, list mail box in system);
MSH_CMD_EXPORT(list_mailbox, list mail box in system); MSH_CMD_EXPORT(list_mailbox, list mail box in system);
@ -370,7 +385,10 @@ static long _list_msgqueue(struct rt_list_node *list)
long list_msgqueue(void) long list_msgqueue(void)
{ {
return _list_msgqueue(&rt_object_container[RT_Object_Class_MessageQueue].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_MessageQueue);
return _list_msgqueue(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system); FINSH_FUNCTION_EXPORT(list_msgqueue, list message queue in system);
MSH_CMD_EXPORT(list_msgqueue, list message queue in system); MSH_CMD_EXPORT(list_msgqueue, list message queue in system);
@ -404,7 +422,10 @@ static long _list_memheap(struct rt_list_node *list)
long list_memheap(void) long list_memheap(void)
{ {
return _list_memheap(&rt_object_container[RT_Object_Class_MemHeap].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_MemHeap);
return _list_memheap(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_memheap, list memory heap in system); FINSH_FUNCTION_EXPORT(list_memheap, list memory heap in system);
MSH_CMD_EXPORT(list_memheap, list memory heap in system); MSH_CMD_EXPORT(list_memheap, list memory heap in system);
@ -453,7 +474,10 @@ static long _list_mempool(struct rt_list_node *list)
long list_mempool(void) long list_mempool(void)
{ {
return _list_mempool(&rt_object_container[RT_Object_Class_MemPool].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_MemPool);
return _list_mempool(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system) FINSH_FUNCTION_EXPORT(list_mempool, list memory pool in system)
MSH_CMD_EXPORT(list_mempool, list memory pool in system); MSH_CMD_EXPORT(list_mempool, list memory pool in system);
@ -490,7 +514,10 @@ static long _list_timer(struct rt_list_node *list)
long list_timer(void) long list_timer(void)
{ {
return _list_timer(&rt_object_container[RT_Object_Class_Timer].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_Timer);
return _list_timer(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_timer, list timer in system); FINSH_FUNCTION_EXPORT(list_timer, list timer in system);
MSH_CMD_EXPORT(list_timer, list timer in system); MSH_CMD_EXPORT(list_timer, list timer in system);
@ -550,7 +577,10 @@ static long _list_device(struct rt_list_node *list)
long list_device(void) long list_device(void)
{ {
return _list_device(&rt_object_container[RT_Object_Class_Device].object_list); struct rt_object_information *info;
info = rt_object_get_information(RT_Object_Class_Device);
return _list_device(&info->object_list);
} }
FINSH_FUNCTION_EXPORT(list_device, list device in system); FINSH_FUNCTION_EXPORT(list_device, list device in system);
MSH_CMD_EXPORT(list_device, list device in system); MSH_CMD_EXPORT(list_device, list device in system);
@ -564,8 +594,10 @@ int list_module(void)
int maxlen; int maxlen;
struct rt_module *module; struct rt_module *module;
struct rt_list_node *list, *node; struct rt_list_node *list, *node;
struct rt_object_information *info;
list = &rt_object_container[RT_Object_Class_Module].object_list; info = rt_object_get_information(RT_Object_Class_Module);
list = &info->object_list;
maxlen = object_name_maxlen(list); maxlen = object_name_maxlen(list);

View File

@ -55,10 +55,6 @@ config RT_USING_LWIP
config IP_SOF_BROADCAST_RECV config IP_SOF_BROADCAST_RECV
int "SOF broadcast recv" int "SOF broadcast recv"
default 1 default 1
config LWIP_USING_DHCPD
bool "Enable DHCP server"
default n
endif endif
menu "Static IPv4 Address" menu "Static IPv4 Address"
@ -91,14 +87,16 @@ config RT_USING_LWIP
bool "PPP protocol" bool "PPP protocol"
default n default n
config RT_LWIP_PPPOE if RT_LWIP_PPP
bool "PPPoE protocol" config RT_LWIP_PPPOE
default n bool "PPPoE protocol"
default n
config RT_LWIP_PPPOS
bool "PPPoS protocol" config RT_LWIP_PPPOS
default n bool "PPPoS protocol"
default n
endif
config RT_MEMP_NUM_NETCONN config RT_MEMP_NUM_NETCONN
int "the number of struct netconns" int "the number of struct netconns"
default 8 default 8
@ -187,6 +185,11 @@ endmenu
source "$RTT_DIR/components/net/freemodbus/Kconfig" source "$RTT_DIR/components/net/freemodbus/Kconfig"
if RT_USING_LWIP if RT_USING_LWIP
config LWIP_USING_DHCPD
bool "Enable DHCP server"
default n
config RT_USING_NETUTILS config RT_USING_NETUTILS
bool "Enable net utils" bool "Enable net utils"
default n default n

View File

@ -41,8 +41,6 @@ static void tcpip_init_done_callback(void *arg)
struct rt_object* object; struct rt_object* object;
struct rt_object_information *information; struct rt_object_information *information;
extern struct rt_object_information rt_object_container[];
LWIP_ASSERT("invalid arg.\n",arg); LWIP_ASSERT("invalid arg.\n",arg);
IP4_ADDR(&gw, 0,0,0,0); IP4_ADDR(&gw, 0,0,0,0);
@ -53,7 +51,9 @@ static void tcpip_init_done_callback(void *arg)
rt_enter_critical(); rt_enter_critical();
/* for each network interfaces */ /* for each network interfaces */
information = &rt_object_container[RT_Object_Class_Device]; information = rt_object_get_information(RT_Object_Class_Device);
RT_ASSERT(information != RT_NULL);
for (node = information->object_list.next; node != &(information->object_list); node = node->next) for (node = information->object_list.next; node != &(information->object_list); node = node->next)
{ {
object = rt_list_entry(node, struct rt_object, list); object = rt_list_entry(node, struct rt_object, list);

View File

@ -72,8 +72,6 @@ static void tcpip_init_done_callback(void *arg)
struct rt_object* object; struct rt_object* object;
struct rt_object_information *information; struct rt_object_information *information;
extern struct rt_object_information rt_object_container[];
LWIP_ASSERT("invalid arg.\n",arg); LWIP_ASSERT("invalid arg.\n",arg);
IP4_ADDR(&gw, 0,0,0,0); IP4_ADDR(&gw, 0,0,0,0);
@ -84,7 +82,8 @@ static void tcpip_init_done_callback(void *arg)
rt_enter_critical(); rt_enter_critical();
/* for each network interfaces */ /* for each network interfaces */
information = &rt_object_container[RT_Object_Class_Device]; information = rt_object_get_information(RT_Object_Class_Device);
RT_ASSERT(information != RT_NULL);
for (node = information->object_list.next; for (node = information->object_list.next;
node != &(information->object_list); node != &(information->object_list);
node = node->next) node = node->next)

View File

@ -74,8 +74,6 @@ static void tcpip_init_done_callback(void *arg)
struct rt_object* object; struct rt_object* object;
struct rt_object_information *information; struct rt_object_information *information;
extern struct rt_object_information rt_object_container[];
LWIP_ASSERT("invalid arg.\n",arg); LWIP_ASSERT("invalid arg.\n",arg);
IP4_ADDR(&gw, 0,0,0,0); IP4_ADDR(&gw, 0,0,0,0);
@ -86,7 +84,8 @@ static void tcpip_init_done_callback(void *arg)
rt_enter_critical(); rt_enter_critical();
/* for each network interfaces */ /* for each network interfaces */
information = &rt_object_container[RT_Object_Class_Device]; information = rt_object_get_information(RT_Object_Class_Device);
RT_ASSERT(information != RT_NULL);
for (node = information->object_list.next; for (node = information->object_list.next;
node != &(information->object_list); node != &(information->object_list);
node = node->next) node = node->next)

View File

@ -620,10 +620,10 @@ void *rt_malloc(rt_size_t size)
struct rt_list_node *node; struct rt_list_node *node;
struct rt_memheap *heap; struct rt_memheap *heap;
struct rt_object_information *information; struct rt_object_information *information;
extern struct rt_object_information rt_object_container[];
/* try to allocate on other memory heap */ /* try to allocate on other memory heap */
information = &rt_object_container[RT_Object_Class_MemHeap]; information = rt_object_get_information(RT_Object_Class_MemHeap);
RT_ASSERT(information != RT_NULL);
for (node = information->object_list.next; for (node = information->object_list.next;
node != &(information->object_list); node != &(information->object_list);
node = node->next) node = node->next)

View File

@ -750,14 +750,13 @@ rt_thread_t rt_thread_find(char *name)
struct rt_object *object; struct rt_object *object;
struct rt_list_node *node; struct rt_list_node *node;
extern struct rt_object_information rt_object_container[];
/* enter critical */ /* enter critical */
if (rt_thread_self() != RT_NULL) if (rt_thread_self() != RT_NULL)
rt_enter_critical(); rt_enter_critical();
/* try to find device object */ /* try to find device object */
information = &rt_object_container[RT_Object_Class_Thread]; information = rt_object_get_information(RT_Object_Class_Thread);
RT_ASSERT(information != RT_NULL);
for (node = information->object_list.next; for (node = information->object_list.next;
node != &(information->object_list); node != &(information->object_list);
node = node->next) node = node->next)