summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwuyangyong <[email protected]>2011-12-27 05:41:04 +0000
committerwuyangyong <[email protected]>2011-12-27 05:41:04 +0000
commit85ceda00dacffd235156bc811cc42d21267c48f2 (patch)
tree3a7c7dee169b8d217637972b033106e4b7d4b426 /src
parent8634deeb7307407e542adb797f432e8c8e1d8791 (diff)
fixed rt_device_init issues.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1882 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src')
-rw-r--r--src/SConscript28
-rw-r--r--src/device.c31
2 files changed, 25 insertions, 34 deletions
diff --git a/src/SConscript b/src/SConscript
index 6f56c29ca6..afc784f75a 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -2,19 +2,7 @@ Import('RTT_ROOT')
Import('rtconfig')
from building import *
-src = Split('''
-device.c
-thread.c
-scheduler.c
-timer.c
-irq.c
-kservice.c
-clock.c
-object.c
-mempool.c
-ipc.c
-idle.c
-''')
+src = Glob('*.c')
CPPPATH = [RTT_ROOT + '/include']
if rtconfig.CROSS_TOOL == 'keil' and GetDepend('RT_USING_MODULE') == True:
@@ -22,14 +10,14 @@ if rtconfig.CROSS_TOOL == 'keil' and GetDepend('RT_USING_MODULE') == True:
else:
LINKFLAGS = ''
-if GetDepend('RT_USING_MODULE'):
- src += Split('rtm.c')
- src += Split('module.c')
+if GetDepend('RT_USING_MODULE') == False:
+ SrcRemove(src, ['rtm.c', 'module.c'])
-if GetDepend('RT_USING_SLAB'):
- src += Split('slab.c')
-else:
- src += Split('mem.c')
+if GetDepend('RT_USING_HEAP') == False or GetDepend('RT_USING_SMALL_MEM') == False:
+ SrcRemove(src, ['mem.c'])
+
+if GetDepend('RT_USING_HEAP') == False or GetDepend('RT_USING_SLAB') == False:
+ SrcRemove(src, ['slab.c'])
group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
diff --git a/src/device.c b/src/device.c
index f164b17852..7f44227af0 100644
--- a/src/device.c
+++ b/src/device.c
@@ -146,26 +146,29 @@ rt_device_t rt_device_find(const char *name)
*/
rt_err_t rt_device_init(rt_device_t dev)
{
- rt_err_t result;
+ rt_err_t result = RT_EOK;
rt_err_t (*init)(rt_device_t dev);
RT_ASSERT(dev != RT_NULL);
/* get device init handler */
init = dev->init;
- if (init != RT_NULL && !(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
- {
- result = init(dev);
- if (result != RT_EOK)
- {
- rt_kprintf("To initialize device:%s failed. The error code is %d\n",
- dev->parent.name, result);
- }
- else
- {
- dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
- }
- }
+ if (init != RT_NULL)
+ {
+ if(!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
+ {
+ result = init(dev);
+ if (result != RT_EOK)
+ {
+ rt_kprintf("To initialize device:%s failed. The error code is %d\n",
+ dev->parent.name, result);
+ }
+ else
+ {
+ dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
+ }
+ }
+ }
else result = -RT_ENOSYS;
return result;