summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2020-12-31 10:16:27 +0800
committerGitHub <[email protected]>2020-12-31 10:16:27 +0800
commite165f896b76f22a07a54af1f53e69c597cd1377f (patch)
tree1a9bede41d7950ed890a75565703fb8bb97e36b8
parenta129257624e6591da2bf2355ec679396859b3ff4 (diff)
parentf8d7f347282f85f2ecf2cc54bbaebe381b79c13a (diff)
Merge pull request #4208 from BernardXiong/master
Use object_find to implement thread_find/device_find
-rw-r--r--bsp/qemu-vexpress-a9/SConscript7
-rw-r--r--bsp/qemu-vexpress-a9/applications/SConscript4
-rw-r--r--bsp/qemu-vexpress-a9/applications/lcd_init.c10
-rw-r--r--bsp/qemu-vexpress-a9/applications/main.c11
-rw-r--r--bsp/qemu-vexpress-a9/applications/mnt.c11
-rw-r--r--bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c18
-rw-r--r--bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h18
-rw-r--r--bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c18
-rw-r--r--bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h18
-rw-r--r--bsp/qemu-vexpress-a9/drivers/automac.h6
-rw-r--r--bsp/qemu-vexpress-a9/drivers/board.h8
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_clcd.c9
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_clcd.h9
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_keyboard.c9
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_keyboard.h9
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_mouse.c9
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_mouse.h9
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_sdio.c9
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_sdio.h10
-rw-r--r--bsp/qemu-vexpress-a9/drivers/drv_smc911x.c10
-rw-r--r--bsp/qemu-vexpress-a9/drivers/realview.h13
-rw-r--r--bsp/qemu-vexpress-a9/drivers/serial.c23
-rw-r--r--bsp/qemu-vexpress-a9/drivers/serial.h23
-rwxr-xr-xbsp/qemu-vexpress-a9/qemu-nographic.sh2
-rw-r--r--src/device.c33
-rw-r--r--src/thread.c33
26 files changed, 148 insertions, 191 deletions
diff --git a/bsp/qemu-vexpress-a9/SConscript b/bsp/qemu-vexpress-a9/SConscript
index fe0ae941ae..4c815c49b8 100644
--- a/bsp/qemu-vexpress-a9/SConscript
+++ b/bsp/qemu-vexpress-a9/SConscript
@@ -1,8 +1,9 @@
-# for module compiling
+# RT-Thread building script for bridge
+
import os
-Import('RTT_ROOT')
+from building import *
-cwd = str(Dir('#'))
+cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
diff --git a/bsp/qemu-vexpress-a9/applications/SConscript b/bsp/qemu-vexpress-a9/applications/SConscript
index 2ec6848e1d..c583d3016e 100644
--- a/bsp/qemu-vexpress-a9/applications/SConscript
+++ b/bsp/qemu-vexpress-a9/applications/SConscript
@@ -1,10 +1,8 @@
-Import('RTT_ROOT')
-Import('rtconfig')
from building import *
cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
-CPPPATH = [cwd, str(Dir('#'))]
+CPPPATH = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
diff --git a/bsp/qemu-vexpress-a9/applications/lcd_init.c b/bsp/qemu-vexpress-a9/applications/lcd_init.c
index 6a870440a8..ad4ad9f8ef 100644
--- a/bsp/qemu-vexpress-a9/applications/lcd_init.c
+++ b/bsp/qemu-vexpress-a9/applications/lcd_init.c
@@ -1,3 +1,13 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
+
#include <rtthread.h>
#if defined(RT_USING_RTGUI) || defined(PKG_USING_GUIENGINE)
diff --git a/bsp/qemu-vexpress-a9/applications/main.c b/bsp/qemu-vexpress-a9/applications/main.c
index d59513bce8..e8ef51657e 100644
--- a/bsp/qemu-vexpress-a9/applications/main.c
+++ b/bsp/qemu-vexpress-a9/applications/main.c
@@ -1,3 +1,13 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
+
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -8,4 +18,3 @@ int main(void)
return 0;
}
-
diff --git a/bsp/qemu-vexpress-a9/applications/mnt.c b/bsp/qemu-vexpress-a9/applications/mnt.c
index de2cd0b87c..524c495f2f 100644
--- a/bsp/qemu-vexpress-a9/applications/mnt.c
+++ b/bsp/qemu-vexpress-a9/applications/mnt.c
@@ -1,3 +1,13 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
+
#include <rtthread.h>
#ifdef RT_USING_DFS
@@ -16,4 +26,3 @@ int mnt_init(void)
}
INIT_ENV_EXPORT(mnt_init);
#endif
-
diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c
index 46ea2e0fea..cf88ebed5e 100644
--- a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c
+++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c
@@ -1,21 +1,7 @@
/*
- * File : drv_ac97.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
+ * Copyright (c) 2006-2020, RT-Thread Development Team
*
- * 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.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h
index 31d496024d..0d783adef2 100644
--- a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h
+++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h
@@ -1,21 +1,7 @@
/*
- * File : drv_ac97.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
+ * Copyright (c) 2006-2020, RT-Thread Development Team
*
- * 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.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c
index 334e22f701..3498031d7b 100644
--- a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c
+++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c
@@ -1,21 +1,7 @@
/*
- * File : drv_pl041.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
+ * Copyright (c) 2006-2020, RT-Thread Development Team
*
- * 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.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h
index cd972b5bdd..0edda3d6ea 100644
--- a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h
+++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h
@@ -1,21 +1,7 @@
/*
- * File : drv_pl041.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2017, RT-Thread Development Team
+ * Copyright (c) 2006-2020, RT-Thread Development Team
*
- * 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.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/qemu-vexpress-a9/drivers/automac.h b/bsp/qemu-vexpress-a9/drivers/automac.h
index 5f08b79a41..7c4ca08fbc 100644
--- a/bsp/qemu-vexpress-a9/drivers/automac.h
+++ b/bsp/qemu-vexpress-a9/drivers/automac.h
@@ -8,8 +8,8 @@
#define AUTOMAC0 0x52
#define AUTOMAC1 0x54
#define AUTOMAC2 0x00
-#define AUTOMAC3 0x28
-#define AUTOMAC4 0xae
-#define AUTOMAC5 0xeb
+#define AUTOMAC3 0xa0
+#define AUTOMAC4 0x0e
+#define AUTOMAC5 0xe4
#endif
diff --git a/bsp/qemu-vexpress-a9/drivers/board.h b/bsp/qemu-vexpress-a9/drivers/board.h
index ccbe0f8c9e..0c37d67864 100644
--- a/bsp/qemu-vexpress-a9/drivers/board.h
+++ b/bsp/qemu-vexpress-a9/drivers/board.h
@@ -1,11 +1,7 @@
/*
- * File : board.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2013, RT-Thread Development Team
+ * Copyright (c) 2006-2020, 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
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_clcd.c b/bsp/qemu-vexpress-a9/drivers/drv_clcd.c
index 62b5aa772d..c56dc6a230 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_clcd.c
+++ b/bsp/qemu-vexpress-a9/drivers/drv_clcd.c
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_clcd.h b/bsp/qemu-vexpress-a9/drivers/drv_clcd.h
index 4ed3136981..b419217a87 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_clcd.h
+++ b/bsp/qemu-vexpress-a9/drivers/drv_clcd.h
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#ifndef DRV_CLCD_H__
#define DRV_CLCD_H__
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_keyboard.c b/bsp/qemu-vexpress-a9/drivers/drv_keyboard.c
index 246e053a60..ca44c16ae3 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_keyboard.c
+++ b/bsp/qemu-vexpress-a9/drivers/drv_keyboard.c
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_keyboard.h b/bsp/qemu-vexpress-a9/drivers/drv_keyboard.h
index 6d5acb7427..da866d6eca 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_keyboard.h
+++ b/bsp/qemu-vexpress-a9/drivers/drv_keyboard.h
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#ifndef __DEV_KEYBOARD_H__
#define __DEV_KEYBOARD_H__
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_mouse.c b/bsp/qemu-vexpress-a9/drivers/drv_mouse.c
index 07e3ed16f6..67c3a89554 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_mouse.c
+++ b/bsp/qemu-vexpress-a9/drivers/drv_mouse.c
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_mouse.h b/bsp/qemu-vexpress-a9/drivers/drv_mouse.h
index c5d190950a..28ee48b56c 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_mouse.h
+++ b/bsp/qemu-vexpress-a9/drivers/drv_mouse.h
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#ifndef __DRV_MOUSE_H__
#define __DRV_MOUSE_H__
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_sdio.c b/bsp/qemu-vexpress-a9/drivers/drv_sdio.c
index 2628222627..ad1f7e7f06 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_sdio.c
+++ b/bsp/qemu-vexpress-a9/drivers/drv_sdio.c
@@ -1,3 +1,12 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_sdio.h b/bsp/qemu-vexpress-a9/drivers/drv_sdio.h
index 8b7adfec59..5b47d2f4cd 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_sdio.h
+++ b/bsp/qemu-vexpress-a9/drivers/drv_sdio.h
@@ -1,7 +1,15 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
#ifndef __DRV_SDIO_H__
#define __DRV_SDIO_H__
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c b/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c
index 91a9311255..4f4be6baa9 100644
--- a/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c
+++ b/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c
@@ -1,3 +1,13 @@
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
+
#include <board.h>
#include <rtthread.h>
#include <netif/ethernetif.h>
diff --git a/bsp/qemu-vexpress-a9/drivers/realview.h b/bsp/qemu-vexpress-a9/drivers/realview.h
index 1a369dbdd0..b60b05f704 100644
--- a/bsp/qemu-vexpress-a9/drivers/realview.h
+++ b/bsp/qemu-vexpress-a9/drivers/realview.h
@@ -1,5 +1,14 @@
-#ifndef __AM33XX_H__
-#define __AM33XX_H__
+/*
+ * Copyright (c) 2006-2020, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2020/12/31 Bernard Add license info
+ */
+#ifndef __REALVIEW_H__
+#define __REALVIEW_H__
#define __REG32(x) (*((volatile unsigned int *)(x)))
#define __REG16(x) (*((volatile unsigned short *)(x)))
diff --git a/bsp/qemu-vexpress-a9/drivers/serial.c b/bsp/qemu-vexpress-a9/drivers/serial.c
index 786a26a4ba..2f55f9e4b0 100644
--- a/bsp/qemu-vexpress-a9/drivers/serial.c
+++ b/bsp/qemu-vexpress-a9/drivers/serial.c
@@ -1,26 +1,7 @@
/*
- * serial.c UART driver
+ * Copyright (c) 2006-2020, RT-Thread Development Team
*
- * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd
- *
- * This file is part of RT-Thread (http://www.rt-thread.org)
- * Maintainer: bernard.xiong <bernard.xiong at gmail.com>
- *
- * All rights reserved.
- *
- * 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.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/qemu-vexpress-a9/drivers/serial.h b/bsp/qemu-vexpress-a9/drivers/serial.h
index 52e6f07ea3..3896f3187a 100644
--- a/bsp/qemu-vexpress-a9/drivers/serial.h
+++ b/bsp/qemu-vexpress-a9/drivers/serial.h
@@ -1,26 +1,7 @@
/*
- * UART driver
+ * Copyright (c) 2006-2020, RT-Thread Development Team
*
- * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd
- *
- * This file is part of RT-Thread (http://www.rt-thread.org)
- * Maintainer: bernard.xiong <bernard.xiong at gmail.com>
- *
- * All rights reserved.
- *
- * 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.
+ * SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
diff --git a/bsp/qemu-vexpress-a9/qemu-nographic.sh b/bsp/qemu-vexpress-a9/qemu-nographic.sh
index b4168b8d5c..20a44f4aae 100755
--- a/bsp/qemu-vexpress-a9/qemu-nographic.sh
+++ b/bsp/qemu-vexpress-a9/qemu-nographic.sh
@@ -2,5 +2,5 @@ if [ ! -f "sd.bin" ]; then
dd if=/dev/zero of=sd.bin bs=1024 count=65536
fi
-qemu-system-arm -M vexpress-a9 -smp cpus=2 -kernel rtthread.bin -nographic -sd sd.bin -net nic -net tap
+qemu-system-arm -M vexpress-a9 -smp cpus=2 -kernel rtthread.bin -nographic -sd sd.bin
diff --git a/src/device.c b/src/device.c
index 32c06b380c..a4f004fb69 100644
--- a/src/device.c
+++ b/src/device.c
@@ -111,38 +111,7 @@ rt_err_t rt_device_init_all(void)
*/
rt_device_t rt_device_find(const char *name)
{
- struct rt_object *object;
- struct rt_list_node *node;
- struct rt_object_information *information;
-
- /* enter critical */
- if (rt_thread_self() != RT_NULL)
- rt_enter_critical();
-
- /* try to find device object */
- information = rt_object_get_information(RT_Object_Class_Device);
- RT_ASSERT(information != RT_NULL);
- for (node = information->object_list.next;
- node != &(information->object_list);
- node = node->next)
- {
- object = rt_list_entry(node, struct rt_object, list);
- if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0)
- {
- /* leave critical */
- if (rt_thread_self() != RT_NULL)
- rt_exit_critical();
-
- return (rt_device_t)object;
- }
- }
-
- /* leave critical */
- if (rt_thread_self() != RT_NULL)
- rt_exit_critical();
-
- /* not found */
- return RT_NULL;
+ return (rt_device_t)rt_object_find(name, RT_Object_Class_Device);
}
RTM_EXPORT(rt_device_find);
diff --git a/src/thread.c b/src/thread.c
index 49e2022bf7..ce03ae25e9 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -862,38 +862,7 @@ RTM_EXPORT(rt_thread_timeout);
*/
rt_thread_t rt_thread_find(char *name)
{
- struct rt_object_information *information;
- struct rt_object *object;
- struct rt_list_node *node;
-
- /* enter critical */
- if (rt_thread_self() != RT_NULL)
- rt_enter_critical();
-
- /* try to find device object */
- information = rt_object_get_information(RT_Object_Class_Thread);
- RT_ASSERT(information != RT_NULL);
- for (node = information->object_list.next;
- node != &(information->object_list);
- node = node->next)
- {
- object = rt_list_entry(node, struct rt_object, list);
- if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0)
- {
- /* leave critical */
- if (rt_thread_self() != RT_NULL)
- rt_exit_critical();
-
- return (rt_thread_t)object;
- }
- }
-
- /* leave critical */
- if (rt_thread_self() != RT_NULL)
- rt_exit_critical();
-
- /* not found */
- return RT_NULL;
+ return (rt_thread_t)rt_object_find(name, RT_Object_Class_Thread);
}
RTM_EXPORT(rt_thread_find);