宋超 3 лет назад
Родитель
Сommit
ae41ff6d08
3 измененных файлов с 32 добавлено и 40 удалено
  1. 0 33
      include/rt_driver.h
  2. 27 1
      include/rtdef.h
  3. 5 6
      include/rtthread.h

+ 0 - 33
include/rt_driver.h

@@ -1,33 +0,0 @@
-#ifndef __RT_DRIVER_H__
-#define __RT_DRIVER_H__
-
-#include <rtdef.h>
-
-#define RT_DRIVER_MATCH_DTS (1<<0)
-
-struct rt_device_id 
-{
-	const char *compatible;
-	void *data;
-};
-
-struct rt_driver
-{
-#ifdef RT_USING_DEVICE_OPS    
-    const struct rt_device_ops *dev_ops;
-#endif    
-    const struct filesystem_ops *fops;
-    const char *name;
-    enum rt_device_class_type dev_type;
-    int device_priv_data_size;
-    int device_size;
-    int flag;
-    const struct rt_device_id *dev_match;
-	int (*probe)(struct rt_device *dev);
-    int (*init)(struct rt_device *dev);
-    int (*remove)(struct rt_device *dev);
-	const void *ops;	/* driver-specific operations */
-};
-typedef struct rt_driver *rt_driver_t;
-
-#endif

+ 27 - 1
include/rtdef.h

@@ -1093,7 +1093,7 @@ typedef struct rt_wqueue rt_wqueue_t;
 struct rt_device
 {
     struct rt_object          parent;                   /**< inherit from rt_object */
-#ifdef RT_USING_DDM    
+#ifdef RT_USING_DM    
     const struct rt_driver    *drv;
     void *dtb_node; 
 #endif    
@@ -1128,6 +1128,32 @@ struct rt_device
     void                     *user_data;                /**< device private data */
 };
 
+#define RT_DRIVER_MATCH_DTS (1<<0)
+struct rt_device_id 
+{
+	const char *compatible;
+	void *data;
+};
+
+struct rt_driver
+{
+#ifdef RT_USING_DEVICE_OPS    
+    const struct rt_device_ops *dev_ops;
+#endif    
+    const struct filesystem_ops *fops;
+    const char *name;
+    enum rt_device_class_type dev_type;
+    int device_priv_data_size;
+    int device_size;
+    int flag;
+    const struct rt_device_id *dev_match;
+	int (*probe)(struct rt_device *dev);
+    int (*probe_init)(struct rt_device *dev);
+    int (*remove)(struct rt_device *dev);
+	const void *ops;	/* driver-specific operations */
+};
+typedef struct rt_driver *rt_driver_t;
+
 /**
  * Notify structure
  */

+ 5 - 6
include/rtthread.h

@@ -24,7 +24,6 @@
 #include <rtdef.h>
 #include <rtservice.h>
 #include <rtm.h>
-#include <rt_driver.h>
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -517,13 +516,13 @@ rt_size_t rt_device_write(rt_device_t dev,
                           const void *buffer,
                           rt_size_t   size);
 rt_err_t  rt_device_control(rt_device_t dev, int cmd, void *arg);
-#ifdef RT_USING_DDM
-rt_err_t rt_device_driver_bind(rt_device_t device, rt_driver_t driver, void *node);
+#ifdef RT_USING_DM
+rt_err_t rt_device_bind_driver(rt_device_t device, rt_driver_t driver, void *node);
 rt_device_t rt_device_create_since_driver(rt_driver_t drv,int device_id);
 rt_err_t rt_device_probe_and_init(rt_device_t device);
-rt_err_t rt_driver_device_match_with_id(const rt_driver_t drv,int device_id);
-rt_err_t rt_driver_device_match_with_dtb(const rt_driver_t drv,void *from_node,int max_dev_num);
-rt_err_t rt_driver_unregister(const rt_driver_t drv);
+
+rt_err_t rt_driver_match_with_id(const rt_driver_t drv,int device_id);
+rt_err_t rt_driver_match_with_dtb(const rt_driver_t drv,void *from_node,int max_dev_num);
 #endif
 /**@}*/
 #endif