Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
RT-Thread
rt-thread
提交
98c8a23e
R
rt-thread
项目概览
RT-Thread
/
rt-thread
大约 1 年 前同步成功
通知
777
Star
8911
Fork
4735
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
98c8a23e
编写于
6月 23, 2013
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add component initialization.
上级
c5927f51
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
105 addition
and
86 deletion
+105
-86
bsp/lpc176x/drivers/emac.c
bsp/lpc176x/drivers/emac.c
+3
-1
bsp/lpc176x/drivers/emac.h
bsp/lpc176x/drivers/emac.h
+1
-1
components/dfs/filesystems/devfs/devfs.c
components/dfs/filesystems/devfs/devfs.c
+1
-0
components/dfs/filesystems/elmfat/dfs_elm.c
components/dfs/filesystems/elmfat/dfs_elm.c
+1
-0
components/dfs/filesystems/jffs2/dfs_jffs2.c
components/dfs/filesystems/jffs2/dfs_jffs2.c
+2
-0
components/dfs/filesystems/nfs/dfs_nfs.c
components/dfs/filesystems/nfs/dfs_nfs.c
+1
-0
components/dfs/filesystems/romfs/dfs_romfs.c
components/dfs/filesystems/romfs/dfs_romfs.c
+1
-0
components/dfs/filesystems/uffs/dfs_uffs.c
components/dfs/filesystems/uffs/dfs_uffs.c
+1
-0
components/dfs/src/dfs.c
components/dfs/src/dfs.c
+2
-1
components/dfs/src/dfs_posix.c
components/dfs/src/dfs_posix.c
+1
-1
components/drivers/usb/usbhost/core/usbhost.c
components/drivers/usb/usbhost/core/usbhost.c
+1
-1
components/finsh/shell.c
components/finsh/shell.c
+5
-2
components/finsh/shell.h
components/finsh/shell.h
+1
-1
components/init/components.c
components/init/components.c
+52
-67
components/init/components.h
components/init/components.h
+6
-1
components/net/lwip-1.4.1/src/arch/sys_arch.c
components/net/lwip-1.4.1/src/arch/sys_arch.c
+6
-1
components/net/lwip-1.4.1/src/lwipopts.h
components/net/lwip-1.4.1/src/lwipopts.h
+4
-4
components/net/lwip-1.4.1/src/netif/ethernetif.c
components/net/lwip-1.4.1/src/netif/ethernetif.c
+1
-0
components/net/lwip/src/arch/sys_arch.c
components/net/lwip/src/arch/sys_arch.c
+5
-3
components/net/lwip/src/include/netif/ethernetif.h
components/net/lwip/src/include/netif/ethernetif.h
+1
-1
components/net/lwip/src/netif/ethernetif.c
components/net/lwip/src/netif/ethernetif.c
+4
-1
include/rtdef.h
include/rtdef.h
+4
-0
src/module.c
src/module.c
+1
-0
未找到文件。
bsp/lpc176x/drivers/emac.c
浏览文件 @
98c8a23e
...
...
@@ -458,7 +458,7 @@ struct pbuf *lpc17xx_emac_rx(rt_device_t dev)
return
p
;
}
void
lpc17xx_emac_hw_init
(
void
)
int
lpc17xx_emac_hw_init
(
void
)
{
rt_event_init
(
&
tx_event
,
"tx_event"
,
RT_IPC_FLAG_FIFO
);
rt_sem_init
(
&
sem_lock
,
"eth_lock"
,
1
,
RT_IPC_FLAG_FIFO
);
...
...
@@ -487,4 +487,6 @@ void lpc17xx_emac_hw_init(void)
lpc17xx_emac_device
.
parent
.
eth_tx
=
lpc17xx_emac_tx
;
eth_device_init
(
&
(
lpc17xx_emac_device
.
parent
),
"e0"
);
return
0
;
}
INIT_DEVICE_EXPORT
(
lpc17xx_emac_hw_init
);
bsp/lpc176x/drivers/emac.h
浏览文件 @
98c8a23e
...
...
@@ -290,6 +290,6 @@
#define DP83848C_DEF_ADR 0x0100
/* Default PHY device address */
#define DP83848C_ID 0x20005C90
/* PHY Identifier */
void
lpc17xx_emac_hw_init
(
void
);
int
lpc17xx_emac_hw_init
(
void
);
#endif
components/dfs/filesystems/devfs/devfs.c
浏览文件 @
98c8a23e
...
...
@@ -277,4 +277,5 @@ int devfs_init(void)
return
0
;
}
INIT_FS_EXPORT
(
devfs_init
);
components/dfs/filesystems/elmfat/dfs_elm.c
浏览文件 @
98c8a23e
...
...
@@ -783,6 +783,7 @@ int elm_init(void)
return
0
;
}
INIT_FS_EXPORT
(
elm_init
);
/*
* RT-Thread Device Interface for ELM FatFs
...
...
components/dfs/filesystems/jffs2/dfs_jffs2.c
浏览文件 @
98c8a23e
...
...
@@ -726,3 +726,5 @@ int dfs_jffs2_init(void)
rt_kprintf
(
"init jffs2 lock mutex okay
\n
"
);
return
0
;
}
INIT_FS_EXPORT
(
dfs_jffs2_init
);
components/dfs/filesystems/nfs/dfs_nfs.c
浏览文件 @
98c8a23e
...
...
@@ -1106,3 +1106,4 @@ int nfs_init(void)
return
RT_EOK
;
}
INIT_FS_EXPORT
(
nfs_init
);
components/dfs/filesystems/romfs/dfs_romfs.c
浏览文件 @
98c8a23e
...
...
@@ -289,4 +289,5 @@ int dfs_romfs_init(void)
dfs_register
(
&
_romfs
);
return
0
;
}
INIT_FS_EXPORT
(
dfs_romfs_init
);
components/dfs/filesystems/uffs/dfs_uffs.c
浏览文件 @
98c8a23e
...
...
@@ -654,3 +654,4 @@ int dfs_uffs_init(void)
}
return
-
RT_ERROR
;
}
INIT_FS_EXPORT
(
dfs_uffs_init
);
components/dfs/src/dfs.c
浏览文件 @
98c8a23e
...
...
@@ -16,7 +16,7 @@
#include <dfs_fs.h>
#include <dfs_file.h>
#define NO_WORKING_DIR "system does not support working dir\n"
#define NO_WORKING_DIR "system does not support working dir
ectory
\n"
/* Global variables */
const
struct
dfs_filesystem_operation
*
filesystem_operation_table
[
DFS_FILESYSTEM_TYPES_MAX
];
...
...
@@ -62,6 +62,7 @@ void dfs_init(void)
working_directory
[
0
]
=
'/'
;
#endif
}
INIT_COMPONENT_EXPORT
(
dfs_init
);
/**
* this function will lock device file system.
...
...
components/dfs/src/dfs_posix.c
浏览文件 @
98c8a23e
...
...
@@ -757,7 +757,7 @@ char *getcwd(char *buf, size_t size)
rt_strncpy
(
buf
,
working_directory
,
size
);
rt_exit_critical
();
#else
rt_kprintf
(
"WARNING: not support working directory
\n
"
);
rt_kprintf
(
NO_WORKING_DIR
);
#endif
return
buf
;
...
...
components/drivers/usb/usbhost/core/usbhost.c
浏览文件 @
98c8a23e
...
...
@@ -71,4 +71,4 @@ void rt_usb_host_init(void)
drv
=
rt_usb_class_driver_hub
();
rt_usb_class_driver_register
(
drv
);
}
INIT_COMPONENT_EXPORT
(
rt_usb_host_init
);
components/finsh/shell.c
浏览文件 @
98c8a23e
...
...
@@ -511,7 +511,7 @@ __declspec(allocate("FSymTab$z")) const struct finsh_syscall __fsym_end =
*
* This function will initialize finsh shell
*/
void
finsh_system_init
(
void
)
int
finsh_system_init
(
void
)
{
rt_err_t
result
;
...
...
@@ -561,7 +561,7 @@ void finsh_system_init(void)
if
(
shell
==
RT_NULL
)
{
rt_kprintf
(
"no memory for shell
\n
"
);
return
;
return
-
1
;
}
memset
(
shell
,
0
,
sizeof
(
struct
finsh_shell
));
...
...
@@ -575,4 +575,7 @@ void finsh_system_init(void)
if
(
result
==
RT_EOK
)
rt_thread_startup
(
&
finsh_thread
);
return
0
;
}
INIT_COMPONENT_EXPORT
(
finsh_system_init
);
components/finsh/shell.h
浏览文件 @
98c8a23e
...
...
@@ -89,7 +89,7 @@ struct finsh_shell
void
finsh_set_echo
(
rt_uint32_t
echo
);
rt_uint32_t
finsh_get_echo
(
void
);
void
finsh_system_init
(
void
);
int
finsh_system_init
(
void
);
void
finsh_set_device
(
const
char
*
device_name
);
const
char
*
finsh_get_device
(
void
);
...
...
components/init/components.c
浏览文件 @
98c8a23e
...
...
@@ -12,86 +12,71 @@
* 2012-09-20 Bernard Change the name to components.c
* And all components related header files.
* 2012-12-23 Bernard fix the pthread initialization issue.
* 2013-06-23 Bernard Add the init_call for components initialization.
*/
#include "components.h"
/**
* RT-Thread Components Initialization
*/
void
rt_components_init
(
void
)
static
int
rti_start
(
void
)
{
#ifdef RT_USING_MODULE
rt_system_module_init
();
#endif
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init
();
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#ifdef RT_USING_LWIP
/* initialize lwip stack */
/* register ethernetif device */
eth_system_device_init
();
/* initialize lwip system */
lwip_system_init
();
rt_kprintf
(
"TCP/IP initialized!
\n
"
);
#endif
#ifdef RT_USING_DFS
/* initialize the device file system */
dfs_init
();
#ifdef RT_USING_DFS_ELMFAT
/* initialize the elm chan FatFS file system*/
elm_init
();
#endif
#if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP)
/* initialize NFSv3 client file system */
nfs_init
();
#endif
#ifdef RT_USING_DFS_YAFFS2
dfs_yaffs2_init
();
#endif
return
0
;
}
INIT_EXPORT
(
rti_start
,
"0"
);
#ifdef RT_USING_DFS_UFFS
dfs_uffs_init
();
#endif
static
int
rti_board_end
(
void
)
{
return
0
;
}
INIT_EXPORT
(
rti_board_end
,
"1.post"
);
#ifdef RT_USING_DFS_JFFS2
dfs_jffs2_init
();
#endif
static
int
rti_end
(
void
)
{
return
0
;
}
INIT_EXPORT
(
rti_end
,
"7"
);
#ifdef RT_USING_DFS_ROMFS
dfs_romfs_init
();
#endif
#if defined(_MSC_VER) || (defined(__GNUC__) && defined(__x86_64__))
/* fixed for MSC_VC and x86_64 in GNU GCC */
#define NEXT_COMPONENT_FN(fn_ptr, end) fn_ptr = _next_component_fn(fn_ptr, end)
#ifdef RT_USING_DFS_DEVFS
devfs_init
();
#endif
#endif
/* end of RT_USING_DFS */
const
init_fn_t
*
_next_component_fn
(
const
init_fn_t
*
fn
,
const
init_fn_t
*
end
)
{
unsigned
int
*
ptr
;
ptr
=
(
unsigned
int
*
)
(
fn
+
1
);
while
((
*
ptr
==
0
)
&&
((
unsigned
int
*
)
ptr
<
(
unsigned
int
*
)
end
))
ptr
++
;
#ifdef RT_USING_NEWLIB
libc_system_init
(
RT_CONSOLE_DEVICE_NAME
);
return
(
const
init_fn_t
*
)
ptr
;
}
#else
/* the pthread system initialization will be initiallized in libc */
#ifdef RT_USING_PTHREADS
pthread_system_init
();
#endif
#define NEXT_COMPONENT_FN(fn_ptr, end) fn_ptr++
#endif
#ifdef RT_USING_RTGUI
rtgui_system_server_init
();
#endif
/**
* RT-Thread Components Initialization for board
*/
void
rt_components_board_init
(
void
)
{
const
init_fn_t
*
fn_ptr
;
#ifdef RT_USING_USB_HOST
rt_usb_host_init
();
#endif
for
(
fn_ptr
=
&
__rt_init_rti_start
;
fn_ptr
<
&
__rt_init_rti_board_end
;
)
{
(
*
fn_ptr
)();
NEXT_COMPONENT_FN
(
fn_ptr
,
__rt_init_rti_board_end
);
}
}
/**
* RT-Thread Components Initialization
*/
void
rt_components_init
(
void
)
{
const
init_fn_t
*
fn_ptr
;
return
;
for
(
fn_ptr
=
&
__rt_init_rti_board_end
;
fn_ptr
<
&
__rt_init_rti_end
;
)
{
(
*
fn_ptr
)();
NEXT_COMPONENT_FN
(
fn_ptr
,
__rt_init_rti_end
);
}
}
components/init/components.h
浏览文件 @
98c8a23e
...
...
@@ -77,9 +77,14 @@ extern void lwip_system_init(void);
extern
"C"
{
#endif
/**
* Initializes board routine in RT-Thread.
*/
void
rt_components_board_init
(
void
);
/**
* Initializes components in RT-Thread
* notes: this function must be invoked in
t
hread
* notes: this function must be invoked in
Init T
hread
*/
void
rt_components_init
(
void
);
...
...
components/net/lwip-1.4.1/src/arch/sys_arch.c
浏览文件 @
98c8a23e
...
...
@@ -25,6 +25,7 @@
#include "lwip/tcpip.h"
#include "netif/ethernetif.h"
#include "lwip/sio.h"
#include <lwip/init.h>
#include <string.h>
...
...
@@ -124,7 +125,7 @@ static void tcpip_init_done_callback(void *arg)
/**
* LwIP system initialization
*/
void
lwip_system_init
(
void
)
int
lwip_system_init
(
void
)
{
rt_err_t
rc
;
struct
rt_semaphore
done_sem
;
...
...
@@ -165,7 +166,11 @@ void lwip_system_init(void)
netifapi_netif_set_addr
(
netif_default
,
&
ipaddr
,
&
netmask
,
&
gw
);
}
#endif
rt_kprintf
(
"lwIP-%d.%d.%d initialized!
\n
"
,
LWIP_VERSION_MAJOR
,
LWIP_VERSION_MINOR
,
LWIP_VERSION_REVISION
);
return
0
;
}
INIT_COMPONENT_EXPORT
(
lwip_system_init
);
void
sys_init
(
void
)
{
...
...
components/net/lwip-1.4.1/src/lwipopts.h
浏览文件 @
98c8a23e
...
...
@@ -82,11 +82,7 @@
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
/* ---------- Memory options ---------- */
#ifdef RT_LWIP_ALIGN_SIZE
#define MEM_ALIGNMENT RT_LWIP_ALIGN_SIZE
#else
#define MEM_ALIGNMENT 4
#endif
#define MEM_LIBC_MALLOC 1
#define mem_malloc rt_malloc
...
...
@@ -179,7 +175,11 @@
#define TCP_MSS 1460
/* TCP sender buffer space (bytes). */
#ifdef RT_LWIP_TCP_SND_BUF
#define TCP_SND_BUF RT_LWIP_TCP_SND_BUF
#else
#define TCP_SND_BUF (TCP_MSS * 2)
#endif
/* TCP sender buffer space (pbufs). This must be at least = 2 *
TCP_SND_BUF/TCP_MSS for things to work. */
...
...
components/net/lwip-1.4.1/src/netif/ethernetif.c
浏览文件 @
98c8a23e
...
...
@@ -383,6 +383,7 @@ void eth_system_device_init()
result
=
rt_thread_startup
(
&
eth_tx_thread
);
RT_ASSERT
(
result
==
RT_EOK
);
}
INIT_DEVICE_EXPORT
(
eth_system_device_init
);
#ifdef RT_USING_FINSH
#include <finsh.h>
...
...
components/net/lwip/src/arch/sys_arch.c
浏览文件 @
98c8a23e
...
...
@@ -124,7 +124,7 @@ static void tcpip_init_done_callback(void *arg)
/**
* LwIP system initialization
*/
void
lwip_system_init
(
void
)
int
lwip_system_init
(
void
)
{
rt_err_t
rc
;
struct
rt_semaphore
done_sem
;
...
...
@@ -138,7 +138,7 @@ void lwip_system_init(void)
{
LWIP_ASSERT
(
"Failed to create semaphore"
,
0
);
return
;
return
-
1
;
}
tcpip_init
(
tcpip_init_done_callback
,
(
void
*
)
&
done_sem
);
...
...
@@ -148,7 +148,7 @@ void lwip_system_init(void)
{
rt_sem_detach
(
&
done_sem
);
return
;
return
-
1
;
}
rt_sem_detach
(
&
done_sem
);
...
...
@@ -165,7 +165,9 @@ void lwip_system_init(void)
netifapi_netif_set_addr
(
netif_default
,
&
ipaddr
,
&
netmask
,
&
gw
);
}
#endif
return
0
;
}
INIT_COMPONENT_EXPORT
(
lwip_system_init
);
void
sys_init
(
void
)
{
...
...
components/net/lwip/src/include/netif/ethernetif.h
浏览文件 @
98c8a23e
...
...
@@ -30,6 +30,6 @@ rt_err_t eth_device_init(struct eth_device * dev, char *name);
rt_err_t
eth_device_init_with_flag
(
struct
eth_device
*
dev
,
char
*
name
,
rt_uint8_t
flag
);
rt_err_t
eth_device_linkchange
(
struct
eth_device
*
dev
,
rt_bool_t
up
);
void
eth_system_device_init
(
void
);
int
eth_system_device_init
(
void
);
#endif
/* __NETIF_ETHERNETIF_H__ */
components/net/lwip/src/netif/ethernetif.c
浏览文件 @
98c8a23e
...
...
@@ -350,7 +350,7 @@ static void eth_rx_thread_entry(void* parameter)
}
}
void
eth_system_device_init
(
)
int
eth_system_device_init
(
void
)
{
rt_err_t
result
=
RT_EOK
;
...
...
@@ -382,7 +382,10 @@ void eth_system_device_init()
result
=
rt_thread_startup
(
&
eth_tx_thread
);
RT_ASSERT
(
result
==
RT_EOK
);
return
0
;
}
INIT_DEVICE_EXPORT
(
eth_system_device_init
);
#ifdef RT_USING_FINSH
#include <finsh.h>
...
...
include/rtdef.h
浏览文件 @
98c8a23e
...
...
@@ -97,6 +97,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#include <stdarg.h>
#define SECTION(x) @ x
#define UNUSED
#define USED
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) PRAGMA(data_alignment=n)
#define rt_inline static inline
...
...
@@ -137,6 +138,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#include <stdarg.h>
#define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused))
#define USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define rt_inline static inline
#define RTT_API
...
...
@@ -144,6 +146,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#include <stdarg.h>
#define SECTION(x)
#define UNUSED
#define USED
#define ALIGN(n) __declspec(align(n))
#define rt_inline static __inline
#define RTT_API
...
...
@@ -153,6 +156,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
* details. */
#define SECTION(x)
#define UNUSED
#define USED
#define ALIGN(n)
#define rt_inline static inline
#define RTT_API
...
...
src/module.c
浏览文件 @
98c8a23e
...
...
@@ -91,6 +91,7 @@ void rt_system_module_init(void)
rt_sem_init
(
&
mod_sem
,
"module"
,
1
,
RT_IPC_FLAG_FIFO
);
#endif
}
INIT_COMPONENT_EXPORT
(
rt_system_module_init
);
static
rt_uint32_t
rt_module_symbol_find
(
const
char
*
sym_str
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录