Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
29437da1
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
29437da1
编写于
7月 11, 2014
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #297 from hduffddybz/master
add some comments of lwip porting
上级
0f511fe2
6b75e537
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
1 deletion
+45
-1
components/net/lwip-1.4.1/src/arch/sys_arch.c
components/net/lwip-1.4.1/src/arch/sys_arch.c
+45
-1
未找到文件。
components/net/lwip-1.4.1/src/arch/sys_arch.c
浏览文件 @
29437da1
...
@@ -29,6 +29,11 @@
...
@@ -29,6 +29,11 @@
#include <string.h>
#include <string.h>
/*
* Initialize the network interface device
*
* @return the operation status, ERR_OK on OK, ERR_IF on error
*/
static
err_t
netif_device_init
(
struct
netif
*
netif
)
static
err_t
netif_device_init
(
struct
netif
*
netif
)
{
{
struct
eth_device
*
ethif
;
struct
eth_device
*
ethif
;
...
@@ -53,7 +58,9 @@ static err_t netif_device_init(struct netif *netif)
...
@@ -53,7 +58,9 @@ static err_t netif_device_init(struct netif *netif)
return
ERR_IF
;
return
ERR_IF
;
}
}
/*
* Initialize the ethernetif layer and set network interface device up
*/
static
void
tcpip_init_done_callback
(
void
*
arg
)
static
void
tcpip_init_done_callback
(
void
*
arg
)
{
{
rt_device_t
device
;
rt_device_t
device
;
...
@@ -182,6 +189,11 @@ void lwip_sys_init(void)
...
@@ -182,6 +189,11 @@ void lwip_sys_init(void)
lwip_system_init
();
lwip_system_init
();
}
}
/*
* Create a new semaphore
*
* @return the operation status, ERR_OK on OK; others on error
*/
err_t
sys_sem_new
(
sys_sem_t
*
sem
,
u8_t
count
)
err_t
sys_sem_new
(
sys_sem_t
*
sem
,
u8_t
count
)
{
{
static
unsigned
short
counter
=
0
;
static
unsigned
short
counter
=
0
;
...
@@ -204,17 +216,31 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count)
...
@@ -204,17 +216,31 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count)
}
}
}
}
/*
* Deallocate a semaphore
*/
void
sys_sem_free
(
sys_sem_t
*
sem
)
void
sys_sem_free
(
sys_sem_t
*
sem
)
{
{
RT_DEBUG_NOT_IN_INTERRUPT
;
RT_DEBUG_NOT_IN_INTERRUPT
;
rt_sem_delete
(
*
sem
);
rt_sem_delete
(
*
sem
);
}
}
/*
* Signal a semaphore
*/
void
sys_sem_signal
(
sys_sem_t
*
sem
)
void
sys_sem_signal
(
sys_sem_t
*
sem
)
{
{
rt_sem_release
(
*
sem
);
rt_sem_release
(
*
sem
);
}
}
/*
* Block the thread while waiting for the semaphore to be signaled
*
* @return If the timeout argument is non-zero, it will return the number of milliseconds
* spent waiting for the semaphore to be signaled; If the semaphore isn't signaled
* within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't
* wait for the semaphore, it will return zero
*/
u32_t
sys_arch_sem_wait
(
sys_sem_t
*
sem
,
u32_t
timeout
)
u32_t
sys_arch_sem_wait
(
sys_sem_t
*
sem
,
u32_t
timeout
)
{
{
rt_err_t
ret
;
rt_err_t
ret
;
...
@@ -354,6 +380,11 @@ void sys_mutex_set_invalid(sys_mutex_t *mutex)
...
@@ -354,6 +380,11 @@ void sys_mutex_set_invalid(sys_mutex_t *mutex)
/* ====================== Mailbox ====================== */
/* ====================== Mailbox ====================== */
/*
* Create an empty mailbox for maximum "size" elements
*
* @return the operation status, ERR_OK on OK; others on error
*/
err_t
sys_mbox_new
(
sys_mbox_t
*
mbox
,
int
size
)
err_t
sys_mbox_new
(
sys_mbox_t
*
mbox
,
int
size
)
{
{
static
unsigned
short
counter
=
0
;
static
unsigned
short
counter
=
0
;
...
@@ -376,6 +407,9 @@ err_t sys_mbox_new(sys_mbox_t *mbox, int size)
...
@@ -376,6 +407,9 @@ err_t sys_mbox_new(sys_mbox_t *mbox, int size)
return
ERR_MEM
;
return
ERR_MEM
;
}
}
/*
* Deallocate a mailbox
*/
void
sys_mbox_free
(
sys_mbox_t
*
mbox
)
void
sys_mbox_free
(
sys_mbox_t
*
mbox
)
{
{
RT_DEBUG_NOT_IN_INTERRUPT
;
RT_DEBUG_NOT_IN_INTERRUPT
;
...
@@ -399,6 +433,11 @@ void sys_mbox_post(sys_mbox_t *mbox, void *msg)
...
@@ -399,6 +433,11 @@ void sys_mbox_post(sys_mbox_t *mbox, void *msg)
return
;
return
;
}
}
/*
* Try to post the "msg" to the mailbox
*
* @return return ERR_OK if the "msg" is posted, ERR_MEM if the mailbox is full
*/
err_t
sys_mbox_trypost
(
sys_mbox_t
*
mbox
,
void
*
msg
)
err_t
sys_mbox_trypost
(
sys_mbox_t
*
mbox
,
void
*
msg
)
{
{
if
(
rt_mb_send
(
*
mbox
,
(
rt_uint32_t
)
msg
)
==
RT_EOK
)
if
(
rt_mb_send
(
*
mbox
,
(
rt_uint32_t
)
msg
)
==
RT_EOK
)
...
@@ -502,6 +541,11 @@ void sys_mbox_set_invalid(sys_mbox_t *mbox)
...
@@ -502,6 +541,11 @@ void sys_mbox_set_invalid(sys_mbox_t *mbox)
/* ====================== System ====================== */
/* ====================== System ====================== */
/*
* Start a new thread named "name" with priority "prio" that will begin
* its execution in the function "thread()". The "arg" argument will be
* passed as an argument to the thread() function
*/
sys_thread_t
sys_thread_new
(
const
char
*
name
,
sys_thread_t
sys_thread_new
(
const
char
*
name
,
lwip_thread_fn
thread
,
lwip_thread_fn
thread
,
void
*
arg
,
void
*
arg
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录