From 0eaa757cffe21231ee6b57e0e2c9681f966e6f56 Mon Sep 17 00:00:00 2001 From: erikchan <1043490933@qq.com> Date: Tue, 25 Jul 2023 13:50:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90dd2.0=E3=80=91move=20the=20core=20head?= =?UTF-8?q?er=20files=20to=20include/drivers/core?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drivers/include/{ => drivers}/core/bus.h | 0 .../include/{ => drivers}/core/device.h | 0 .../drivers/include/{ => drivers}/core/dm.h | 0 .../include/{ => drivers}/core/driver.h | 0 .../drivers/include/drivers/core/rtdm.h | 50 ------------------- components/drivers/include/drivers/platform.h | 44 ++++++++++++++++ 6 files changed, 44 insertions(+), 50 deletions(-) rename components/drivers/include/{ => drivers}/core/bus.h (100%) rename components/drivers/include/{ => drivers}/core/device.h (100%) rename components/drivers/include/{ => drivers}/core/dm.h (100%) rename components/drivers/include/{ => drivers}/core/driver.h (100%) delete mode 100755 components/drivers/include/drivers/core/rtdm.h create mode 100644 components/drivers/include/drivers/platform.h diff --git a/components/drivers/include/core/bus.h b/components/drivers/include/drivers/core/bus.h similarity index 100% rename from components/drivers/include/core/bus.h rename to components/drivers/include/drivers/core/bus.h diff --git a/components/drivers/include/core/device.h b/components/drivers/include/drivers/core/device.h similarity index 100% rename from components/drivers/include/core/device.h rename to components/drivers/include/drivers/core/device.h diff --git a/components/drivers/include/core/dm.h b/components/drivers/include/drivers/core/dm.h similarity index 100% rename from components/drivers/include/core/dm.h rename to components/drivers/include/drivers/core/dm.h diff --git a/components/drivers/include/core/driver.h b/components/drivers/include/drivers/core/driver.h similarity index 100% rename from components/drivers/include/core/driver.h rename to components/drivers/include/drivers/core/driver.h diff --git a/components/drivers/include/drivers/core/rtdm.h b/components/drivers/include/drivers/core/rtdm.h deleted file mode 100755 index 95d3c259b8..0000000000 --- a/components/drivers/include/drivers/core/rtdm.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2023-04-20 ErikChan the first version - */ - -#ifndef __RT_DM_H__ -#define __RT_DM_H__ - -#include -#include -#include -#include - -#ifndef RT_CPUS_NR -#define RT_CPUS_NR 1 -#endif - -#ifndef RT_USING_SMP -extern int rt_hw_cpu_id(void); -#endif - -void rt_dm_secondary_cpu_init(void); - -int rt_dm_set_dev_name_auto(rt_device_t dev, const char *prefix); -int rt_dm_get_dev_name_id(rt_device_t dev); - -int rt_dm_set_dev_name(rt_device_t dev, const char *format, ...); -const char *rt_dm_get_dev_name(rt_device_t dev); - -/* init cpu, memory, interrupt-controller, bus... */ -#define INIT_CORE_EXPORT(fn) INIT_EXPORT(fn, "1.0") -/* init pci/pcie, usb platform driver... */ -#define INIT_FRAMEWORK_EXPORT(fn) INIT_EXPORT(fn, "1.1") -/* init platform, user code... */ -#define INIT_PLATFORM_EXPORT(fn) INIT_EXPORT(fn, "1.2") -/* init sys-timer, clk, pinctrl... */ -#define INIT_SUBSYS_EXPORT(fn) INIT_EXPORT(fn, "1.3") -/* init early drivers */ -#define INIT_DRIVER_EARLY_EXPORT(fn) INIT_EXPORT(fn, "1.4") -/* init in secondary_cpu_c_start */ -#define INIT_SECONDARY_CPU_EXPORT(fn) INIT_EXPORT(fn, "7") -/* init after mount fs */ -#define INIT_FS_EXPORT(fn) INIT_EXPORT(fn, "6.0") - -#endif /* __RT_DM_H__ */ diff --git a/components/drivers/include/drivers/platform.h b/components/drivers/include/drivers/platform.h new file mode 100644 index 0000000000..3caccabd2d --- /dev/null +++ b/components/drivers/include/drivers/platform.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-04-12 ErikChan the first version + */ + +#ifndef __PLATFORM_H__ +#define __PLATFORM_H__ + +#include +#include + +struct rt_platform_device +{ + struct rt_device parent; + + const char *name; + const struct rt_ofw_node_id *id; + + void *priv; +}; + +struct rt_platform_driver +{ + struct rt_driver parent; + + const char *name; + const struct rt_ofw_node_id *ids; + + rt_err_t (*probe)(struct rt_platform_device *pdev); +}; + +struct rt_platform_device *rt_platform_device_alloc(const char *name); + +rt_err_t rt_platform_driver_register(struct rt_platform_driver *pdrv); +rt_err_t rt_platform_device_register(struct rt_platform_device *pdev); + +#define RT_PLATFORM_DRIVER_EXPORT(driver) RT_DRIVER_EXPORT(driver, platform, BUILIN) + +#endif /* __PLATFORM_H__ */