fixed rt_device_init issues.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1882 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
8634deeb73
commit
85ceda00da
|
@ -2,19 +2,7 @@ Import('RTT_ROOT')
|
||||||
Import('rtconfig')
|
Import('rtconfig')
|
||||||
from building import *
|
from building import *
|
||||||
|
|
||||||
src = Split('''
|
src = Glob('*.c')
|
||||||
device.c
|
|
||||||
thread.c
|
|
||||||
scheduler.c
|
|
||||||
timer.c
|
|
||||||
irq.c
|
|
||||||
kservice.c
|
|
||||||
clock.c
|
|
||||||
object.c
|
|
||||||
mempool.c
|
|
||||||
ipc.c
|
|
||||||
idle.c
|
|
||||||
''')
|
|
||||||
|
|
||||||
CPPPATH = [RTT_ROOT + '/include']
|
CPPPATH = [RTT_ROOT + '/include']
|
||||||
if rtconfig.CROSS_TOOL == 'keil' and GetDepend('RT_USING_MODULE') == True:
|
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:
|
else:
|
||||||
LINKFLAGS = ''
|
LINKFLAGS = ''
|
||||||
|
|
||||||
if GetDepend('RT_USING_MODULE'):
|
if GetDepend('RT_USING_MODULE') == False:
|
||||||
src += Split('rtm.c')
|
SrcRemove(src, ['rtm.c', 'module.c'])
|
||||||
src += Split('module.c')
|
|
||||||
|
|
||||||
if GetDepend('RT_USING_SLAB'):
|
if GetDepend('RT_USING_HEAP') == False or GetDepend('RT_USING_SMALL_MEM') == False:
|
||||||
src += Split('slab.c')
|
SrcRemove(src, ['mem.c'])
|
||||||
else:
|
|
||||||
src += Split('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)
|
group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -146,14 +146,16 @@ rt_device_t rt_device_find(const char *name)
|
||||||
*/
|
*/
|
||||||
rt_err_t rt_device_init(rt_device_t dev)
|
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_err_t (*init)(rt_device_t dev);
|
||||||
|
|
||||||
RT_ASSERT(dev != RT_NULL);
|
RT_ASSERT(dev != RT_NULL);
|
||||||
|
|
||||||
/* get device init handler */
|
/* get device init handler */
|
||||||
init = dev->init;
|
init = dev->init;
|
||||||
if (init != RT_NULL && !(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
|
if (init != RT_NULL)
|
||||||
|
{
|
||||||
|
if(!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
|
||||||
{
|
{
|
||||||
result = init(dev);
|
result = init(dev);
|
||||||
if (result != RT_EOK)
|
if (result != RT_EOK)
|
||||||
|
@ -166,6 +168,7 @@ rt_err_t rt_device_init(rt_device_t dev)
|
||||||
dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
|
dev->flag |= RT_DEVICE_FLAG_ACTIVATED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else result = -RT_ENOSYS;
|
else result = -RT_ENOSYS;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue