summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2023-06-22 14:16:03 +0800
committerGitHub <[email protected]>2023-06-22 14:16:03 +0800
commite3f068f05834d433e9748d031a02bc03266bdafd (patch)
tree96e55c65d0d19190d9f81c09179ab5f2e2cfa0a4
parentd1ed0f7ddb97cda805fd56714cc3fc93cc51599b (diff)
[DeviceDrivers] prepare for device driver v2.0 (#7697)
-rw-r--r--components/drivers/core/SConscript15
-rw-r--r--components/drivers/core/bus.c (renamed from components/drivers/misc/rt_dev_bus.c)0
-rw-r--r--components/drivers/core/device.c (renamed from src/device.c)0
-rw-r--r--components/drivers/core/driver.c (renamed from src/driver.c)14
-rw-r--r--components/drivers/misc/SConscript3
5 files changed, 22 insertions, 10 deletions
diff --git a/components/drivers/core/SConscript b/components/drivers/core/SConscript
new file mode 100644
index 0000000000..4aac2b7166
--- /dev/null
+++ b/components/drivers/core/SConscript
@@ -0,0 +1,15 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = ['device.c']
+CPPPATH = [cwd + '/../include']
+
+if GetDepend(['RT_USING_DEV_BUS']):
+ src = src + ['bus.c']
+
+if GetDepend(['RT_USING_DM']):
+ src = src + ['driver.c']
+
+group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_DEVICE'], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/components/drivers/misc/rt_dev_bus.c b/components/drivers/core/bus.c
index fd2fbb8e3e..fd2fbb8e3e 100644
--- a/components/drivers/misc/rt_dev_bus.c
+++ b/components/drivers/core/bus.c
diff --git a/src/device.c b/components/drivers/core/device.c
index 47482b50d3..47482b50d3 100644
--- a/src/device.c
+++ b/components/drivers/core/device.c
diff --git a/src/driver.c b/components/drivers/core/driver.c
index c402249720..fb7b08c4e4 100644
--- a/src/driver.c
+++ b/components/drivers/core/driver.c
@@ -1,16 +1,16 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <rtthread.h>
+
+#ifdef RT_USING_DM
+
#ifdef RT_USING_FDT
#include <dtb_node.h>
#endif
-#if defined(RT_USING_POSIX_DEVIO)
-#include <rtdevice.h> /* for wqueue_init */
-#endif
/**
* This function driver device match with id
@@ -45,7 +45,6 @@ rt_err_t rt_driver_match_with_id(const rt_driver_t drv,int device_id)
}
return ret;
}
-
RTM_EXPORT(rt_driver_match_with_id);
#ifdef RT_USING_FDT
@@ -107,7 +106,8 @@ rt_err_t rt_driver_match_with_dtb(const rt_driver_t drv,void *from_node,int max_
rt_free(node_list);
return ret;
}
-
RTM_EXPORT(rt_driver_match_with_dtb);
-#endif
+#endif /* RT_USING_FDT */
+
+#endif /* RT_USING_DM */
diff --git a/components/drivers/misc/SConscript b/components/drivers/misc/SConscript
index f9fd17689e..927e662b19 100644
--- a/components/drivers/misc/SConscript
+++ b/components/drivers/misc/SConscript
@@ -23,9 +23,6 @@ if GetDepend(['RT_USING_PULSE_ENCODER']):
if GetDepend(['RT_USING_INPUT_CAPTURE']):
src = src + ['rt_inputcapture.c']
-if GetDepend(['RT_USING_DEV_BUS']):
- src = src + ['rt_dev_bus.c']
-
if GetDepend(['RT_USING_NULL']):
src = src + ['rt_null.c']