【dd2.0】move the core header files to include/drivers/core

This commit is contained in:
erikchan 2023-07-25 13:50:50 +08:00 committed by guo
parent c1cc1332e9
commit 0eaa757cff
6 changed files with 44 additions and 50 deletions

View File

@ -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 <rthw.h>
#include <rtdef.h>
#include <drivers/misc.h>
#include <drivers/byteorder.h>
#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__ */

View File

@ -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 <drivers/ofw.h>
#include <drivers/core/driver.h>
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__ */