Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小疯子为梦想时刻准备着
rt-thread
提交
79392bb0
R
rt-thread
项目概览
小疯子为梦想时刻准备着
/
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,发现更多精彩内容 >>
提交
79392bb0
编写于
6月 24, 2013
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Embedded GPLv2 license.
上级
b23dd159
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
338 addition
and
118 deletion
+338
-118
include/rtdebug.h
include/rtdebug.h
+14
-4
include/rtdef.h
include/rtdef.h
+21
-11
include/rthw.h
include/rthw.h
+13
-3
include/rtm.h
include/rtm.h
+14
-4
include/rtservice.h
include/rtservice.h
+13
-3
include/rtthread.h
include/rtthread.h
+14
-4
src/clock.c
src/clock.c
+13
-3
src/device.c
src/device.c
+16
-6
src/idle.c
src/idle.c
+13
-3
src/ipc.c
src/ipc.c
+17
-7
src/irq.c
src/irq.c
+15
-5
src/kservice.c
src/kservice.c
+22
-12
src/mem.c
src/mem.c
+17
-7
src/memheap.c
src/memheap.c
+13
-3
src/mempool.c
src/mempool.c
+14
-4
src/module.c
src/module.c
+15
-5
src/module.h
src/module.h
+15
-5
src/object.c
src/object.c
+17
-7
src/scheduler.c
src/scheduler.c
+17
-7
src/slab.c
src/slab.c
+16
-6
src/thread.c
src/thread.c
+14
-4
src/timer.c
src/timer.c
+15
-5
未找到文件。
include/rtdebug.h
浏览文件 @
79392bb0
...
...
@@ -3,11 +3,21 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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.
*/
#ifndef __RTDEBUG_H__
#define __RTDEBUG_H__
...
...
include/rtdef.h
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -14,13 +24,13 @@
* 2010-10-26 yi.qiu add module support
* 2010-11-10 Bernard add cleanup callback function in thread exit.
* 2011-05-09 Bernard use builtin va_arg in GCC 4.x
* 2012-11-16 Bernard change RT_NULL from ((void*)0) to 0.
* 2012-11-16 Bernard change RT_NULL from ((void*)0) to 0.
* 2012-12-29 Bernard change the RT_USING_MEMPOOL location and add
* RT_USING_MEMHEAP condition.
* 2012-12-30 Bernard add more control command for graphic.
* 2013-01-09 Bernard change version number.
*/
#ifndef __RT_DEF_H__
#define __RT_DEF_H__
...
...
@@ -141,7 +151,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define rt_inline static inline
#define RTT_API
#define RTT_API
#elif defined (_MSC_VER)
#include <stdarg.h>
#define SECTION(x)
...
...
@@ -170,7 +180,7 @@ typedef int (*init_fn_t)(void);
#define INIT_EXPORT(fn, level) \
const init_fn_t __rt_init_##fn SECTION(".rti_fn."level) = fn
#else
#define INIT_EXPORT(fn, level)
#define INIT_EXPORT(fn, level)
#endif
/* board init routines will be called in board_init() function */
...
...
@@ -235,7 +245,7 @@ typedef int (*init_fn_t)(void);
*
* @def RT_ALIGN_DOWN(size, align)
* Return the down number of aligned at specified width. RT_ALIGN_DOWN(13, 4)
* would return 12.
* would return 12.
*/
#define RT_ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
...
...
@@ -350,7 +360,7 @@ struct rt_object_information
#define RT_OBJECT_HOOK_CALL(func, argv) \
do { if ((func) != RT_NULL) func argv; } while (0)
#else
#define RT_OBJECT_HOOK_CALL(func, argv)
#define RT_OBJECT_HOOK_CALL(func, argv)
#endif
/*@}*/
...
...
@@ -433,7 +443,7 @@ struct rt_thread
char
name
[
RT_NAME_MAX
];
/**< the name of thread */
rt_uint8_t
type
;
/**< type of object */
rt_uint8_t
flags
;
/**< thread's flags */
#ifdef RT_USING_MODULE
void
*
module_id
;
/**< id of application module */
#endif
...
...
@@ -923,7 +933,7 @@ struct rt_module
struct
rt_module_symtab
*
symtab
;
/**< module symbol table */
rt_uint32_t
nref
;
/**< reference count */
/* object in this module, module object is the last basic object type */
struct
rt_object_information
module_object
[
RT_Object_Class_Unknown
];
};
...
...
include/rthw.h
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
include/rtm.h
浏览文件 @
79392bb0
...
...
@@ -3,11 +3,21 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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.
*/
#ifndef __RTM_H__
#define __RTM_H__
...
...
include/rtservice.h
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
include/rtthread.h
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -423,7 +433,7 @@ void rt_module_unload_sethook(void (*hook)(rt_module_t module));
/*@}*/
#endif
/*
* interrupt service
*/
...
...
src/clock.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
src/device.c
浏览文件 @
79392bb0
...
...
@@ -3,15 +3,25 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
* 2007-01-21 Bernard the first version
* 2010-05-04 Bernard add rt_device_init implementation
* 2012-10-20 Bernard add device check in register function,
* 2012-10-20 Bernard add device check in register function,
* provided by Rob <rdent@iinet.net.au>
* 2012-12-25 Bernard return RT_EOK if the device interface not exist.
*/
...
...
@@ -158,7 +168,7 @@ RTM_EXPORT(rt_device_find);
* This function will initialize the specified device
*
* @param dev the pointer of device driver structure
*
*
* @return the result
*/
rt_err_t
rt_device_init
(
rt_device_t
dev
)
...
...
@@ -377,7 +387,7 @@ rt_device_set_rx_indicate(rt_device_t dev,
RTM_EXPORT
(
rt_device_set_rx_indicate
);
/**
* This function will set the indication callback function when device has
* This function will set the indication callback function when device has
* written data to physical hardware.
*
* @param dev the pointer of device driver structure
...
...
src/idle.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
src/ipc.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -1214,7 +1224,7 @@ rt_err_t rt_event_control(rt_event_t event, rt_uint8_t cmd, void *arg)
return
-
RT_ERROR
;
}
RTM_EXPORT
(
rt_event_control
);
RTM_EXPORT
(
rt_event_control
);
#endif
/* end of RT_USING_EVENT */
#ifdef RT_USING_MAILBOX
...
...
@@ -1568,7 +1578,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_uint32_t *value, rt_int32_t timeout)
rt_hw_interrupt_enable
(
temp
);
thread
->
error
=
-
RT_ETIMEOUT
;
return
-
RT_ETIMEOUT
;
}
...
...
@@ -1693,7 +1703,7 @@ rt_err_t rt_mb_control(rt_mailbox_t mb, rt_uint8_t cmd, void *arg)
return
-
RT_ERROR
;
}
RTM_EXPORT
(
rt_mb_control
);
RTM_EXPORT
(
rt_mb_control
);
#endif
/* end of RT_USING_MAILBOX */
#ifdef RT_USING_MESSAGEQUEUE
...
...
@@ -2199,7 +2209,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
return
RT_EOK
;
}
RTM_EXPORT
(
rt_mq_recv
);
RTM_EXPORT
(
rt_mq_recv
);
/**
* This function can get or set some extra attributions of a message queue
...
...
src/irq.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -68,10 +78,10 @@ RTM_EXPORT(rt_interrupt_leave);
/**
* This function will return the nest of interrupt.
*
*
* User application can invoke this function to get whether current
* context is interrupt context.
*
*
* @return the number of nested interrupts.
*/
rt_uint8_t
rt_interrupt_get_nest
(
void
)
...
...
src/kservice.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -16,7 +26,7 @@
* fix gcc compiling issue.
* 2010-04-15 Bernard remove weak definition on ICCM16C compiler
* 2012-07-18 Arda add the alignment display for signed integer
* 2012-11-23 Bernard fix IAR compiler error.
* 2012-11-23 Bernard fix IAR compiler error.
* 2012-12-22 Bernard fix rt_kprintf issue, which found by Grissiom.
* 2013-06-24 Bernard remove rt_kprintf if RT_USING_CONSOLE is not defined.
*/
...
...
@@ -84,7 +94,7 @@ void rt_set_errno(rt_err_t error)
if
(
tid
==
RT_NULL
)
{
_errno
=
error
;
return
;
}
...
...
@@ -100,7 +110,7 @@ RTM_EXPORT(rt_set_errno);
int
*
_rt_errno
(
void
)
{
rt_thread_t
tid
;
if
(
rt_interrupt_get_nest
()
!=
0
)
return
(
int
*
)
&
_errno
;
...
...
@@ -1207,13 +1217,13 @@ const rt_uint8_t __lowest_bit_bitmap[] =
};
/**
* This function finds the first bit set (beginning with the least significant bit)
* This function finds the first bit set (beginning with the least significant bit)
* in value and return the index of that bit.
*
* Bits are numbered starting at 1 (the least significant bit). A return value of
* Bits are numbered starting at 1 (the least significant bit). A return value of
* zero from any of these functions means that the argument was zero.
*
* @return return the index of the first bit set. If value is 0, then this function
*
* @return return the index of the first bit set. If value is 0, then this function
* shall return 0.
*/
int
__rt_ffs
(
int
value
)
...
...
@@ -1225,10 +1235,10 @@ int __rt_ffs(int value)
if
(
value
&
0xff00
)
return
__lowest_bit_bitmap
[(
value
&
0xff00
)
>>
8
]
+
9
;
if
(
value
&
0xff0000
)
return
__lowest_bit_bitmap
[(
value
&
0xff0000
)
>>
16
]
+
17
;
return
__lowest_bit_bitmap
[(
value
&
0xff000000
)
>>
24
]
+
25
;
}
#endif
...
...
src/mem.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -346,7 +356,7 @@ void *rt_malloc(rt_size_t size)
RT_ASSERT
((((
rt_uint32_t
)
mem
)
&
(
RT_ALIGN_SIZE
-
1
))
==
0
);
RT_DEBUG_LOG
(
RT_DEBUG_MEM
,
(
"allocate memory at 0x%x, size: %d
\n
"
,
(
"allocate memory at 0x%x, size: %d
\n
"
,
(
rt_uint32_t
)((
rt_uint8_t
*
)
mem
+
SIZEOF_STRUCT_MEM
),
(
rt_uint32_t
)(
mem
->
next
-
((
rt_uint8_t
*
)
mem
-
heap_ptr
))));
...
...
@@ -448,7 +458,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
nmem
=
rt_malloc
(
newsize
);
if
(
nmem
!=
RT_NULL
)
/* check memory */
{
rt_memcpy
(
nmem
,
rmem
,
size
<
newsize
?
size
:
newsize
);
rt_memcpy
(
nmem
,
rmem
,
size
<
newsize
?
size
:
newsize
);
rt_free
(
rmem
);
}
...
...
@@ -517,8 +527,8 @@ void rt_free(void *rmem)
mem
=
(
struct
heap_mem
*
)((
rt_uint8_t
*
)
rmem
-
SIZEOF_STRUCT_MEM
);
RT_DEBUG_LOG
(
RT_DEBUG_MEM
,
(
"release memory 0x%x, size: %d
\n
"
,
(
rt_uint32_t
)
rmem
,
(
"release memory 0x%x, size: %d
\n
"
,
(
rt_uint32_t
)
rmem
,
(
rt_uint32_t
)(
mem
->
next
-
((
rt_uint8_t
*
)
mem
-
heap_ptr
))));
...
...
src/memheap.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
src/mempool.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -284,7 +294,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
#if defined(RT_USING_MODULE) && defined(RT_USING_SLAB)
/* the mp object belongs to an application module */
if
(
mp
->
parent
.
flag
&
RT_OBJECT_FLAG_MODULE
)
if
(
mp
->
parent
.
flag
&
RT_OBJECT_FLAG_MODULE
)
rt_module_free
(
mp
->
parent
.
module_id
,
mp
->
start_address
);
else
#endif
...
...
src/module.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -15,7 +25,7 @@
* 2011-05-25 yi.qiu implement module hook function
* 2011-06-23 yi.qiu rewrite module memory allocator
* 2012-11-23 Bernard using RT_DEBUG_LOG instead of rt_kprintf.
* 2012-11-28 Bernard remove rt_current_module and user
* 2012-11-28 Bernard remove rt_current_module and user
* can use rt_module_unload to remove a module.
*/
...
...
@@ -803,7 +813,7 @@ rt_module_t rt_module_load(const char *name, void *module_ptr)
module
->
mem_list
=
RT_NULL
;
/* create page array */
module
->
page_array
=
module
->
page_array
=
(
void
*
)
rt_malloc
(
PAGE_COUNT_MAX
*
sizeof
(
struct
rt_page_info
));
module
->
page_cnt
=
0
;
#endif
...
...
src/module.h
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -137,7 +147,7 @@ typedef struct elf32_sym
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_NUM 3
#define STB_LOPROC 13
/* processor specific range */
#define STB_HIPROC 15
...
...
@@ -153,7 +163,7 @@ typedef struct elf32_sym
#define STT_HIOS 12
#define STT_LOPROC 13
/* processor specific range */
#define STT_HIPROC 15
#define STN_UNDEF 0
/* undefined */
#define ELF_ST_BIND(info) ((info) >> 4)
...
...
src/object.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -172,7 +182,7 @@ void rt_system_object_init(void)
/**
* This function will return the specified type of object information.
*
*
* @param type the type of object
* @return the object type information or RT_NULL
*/
...
...
@@ -200,7 +210,7 @@ void rt_object_init(struct rt_object *object,
#ifdef RT_USING_MODULE
/* get module object information */
information
=
(
rt_module_self
()
!=
RT_NULL
)
?
information
=
(
rt_module_self
()
!=
RT_NULL
)
?
&
rt_module_self
()
->
module_object
[
type
]
:
&
rt_object_container
[
type
];
#else
/* get object information */
...
...
@@ -287,7 +297,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
/* no memory can be allocated */
return
RT_NULL
;
}
/* initialize object's parameters */
/* set object type */
...
...
@@ -347,7 +357,7 @@ void rt_object_delete(rt_object_t object)
rt_hw_interrupt_enable
(
temp
);
#if defined(RT_USING_MODULE) && defined(RT_USING_SLAB)
if
(
object
->
flag
&
RT_OBJECT_FLAG_MODULE
)
if
(
object
->
flag
&
RT_OBJECT_FLAG_MODULE
)
rt_module_free
((
rt_module_t
)
object
->
module_id
,
object
);
else
#endif
...
...
src/scheduler.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -269,11 +279,11 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
/* set priority mask */
#if RT_THREAD_PRIORITY_MAX <= 32
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
(
"insert thread[%s], the priority: %d
\n
"
,
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
(
"insert thread[%s], the priority: %d
\n
"
,
thread
->
name
,
thread
->
current_priority
));
#else
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
(
"insert thread[%s], the priority: %d 0x%x %d
\n
"
,
(
"insert thread[%s], the priority: %d 0x%x %d
\n
"
,
thread
->
name
,
thread
->
number
,
thread
->
number_mask
,
...
...
@@ -306,11 +316,11 @@ void rt_schedule_remove_thread(struct rt_thread *thread)
temp
=
rt_hw_interrupt_disable
();
#if RT_THREAD_PRIORITY_MAX <= 32
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
(
"remove thread[%s], the priority: %d
\n
"
,
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
(
"remove thread[%s], the priority: %d
\n
"
,
thread
->
name
,
thread
->
current_priority
));
#else
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
(
"remove thread[%s], the priority: %d 0x%x %d
\n
"
,
(
"remove thread[%s], the priority: %d 0x%x %d
\n
"
,
thread
->
name
,
thread
->
number
,
thread
->
number_mask
,
...
...
src/slab.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -210,7 +220,7 @@ static int zone_page_cnt;
#define PAGE_TYPE_FREE 0x00
#define PAGE_TYPE_SMALL 0x01
#define PAGE_TYPE_LARGE 0x02
struct
memusage
struct
memusage
{
rt_uint32_t
type
:
2
;
/* page type */
rt_uint32_t
size
:
30
;
/* pages allocated or offset from zone */
...
...
@@ -358,7 +368,7 @@ void rt_system_heap_init(void *begin_addr, void *end_addr)
return
;
}
limsize
=
heap_end
-
heap_start
;
npages
=
limsize
/
RT_MM_PAGE_SIZE
;
...
...
@@ -795,7 +805,7 @@ void rt_free(void *ptr)
#ifdef RT_USING_MODULE
if
(
rt_module_self
()
!=
RT_NULL
)
{
rt_module_free
(
rt_module_self
(),
ptr
);
rt_module_free
(
rt_module_self
(),
ptr
);
return
;
}
...
...
src/thread.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -555,7 +565,7 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
{
RT_DEBUG_LOG
(
RT_DEBUG_THREAD
,
(
"thread suspend: thread disorder, %d
\n
"
,
thread
->
stat
));
return
-
RT_ERROR
;
}
...
...
src/timer.c
浏览文件 @
79392bb0
...
...
@@ -3,9 +3,19 @@
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* 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
...
...
@@ -95,7 +105,7 @@ static rt_tick_t rt_timer_list_next_timeout(rt_list_t *timer_list)
if
(
rt_list_isempty
(
timer_list
))
return
RT_TICK_MAX
;
timer
=
rt_list_entry
(
timer_list
->
next
,
struct
rt_timer
,
list
);
return
timer
->
timeout_tick
;
...
...
@@ -528,7 +538,7 @@ void rt_soft_timer_check(void)
static
void
rt_thread_timer_entry
(
void
*
parameter
)
{
rt_tick_t
next_timeout
;
while
(
1
)
{
/* get the next timeout tick */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录