Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/include/ddf/driver.h

    r77ad86c r56fd7cf  
    4242#include "../dev_iface.h"
    4343
    44 typedef struct ddf_dev ddf_dev_t;
    45 typedef struct ddf_fun ddf_fun_t;
    4644
    4745/*
    4846 * Device
    4947 */
     48
     49typedef struct ddf_dev ddf_dev_t;
     50typedef struct ddf_fun ddf_fun_t;
    5051
    5152/** Devices operations */
     
    7576
    7677/** Device structure */
    77 struct ddf_dev {
    78         /**
    79          * Globally unique device identifier (assigned to the device by the
    80          * device manager).
    81          */
    82         devman_handle_t handle;
    83        
    84         /** Reference count */
    85         atomic_t refcnt;
    86        
    87         /**
    88          * Session to the parent device driver (if it is different from this
    89          * driver)
    90          */
    91         async_sess_t *parent_sess;
    92        
    93         /** Device name */
    94         const char *name;
    95        
    96         /** Driver-specific data associated with this device */
    97         void *driver_data;
    98        
    99         /** Link in the list of devices handled by the driver */
    100         link_t link;
    101 };
     78struct ddf_dev;
    10279
    10380/** Function structure */
    104 struct ddf_fun {
    105         /** True if bound to the device manager */
    106         bool bound;
    107        
    108         /** Function indentifier (asigned by device manager) */
    109         devman_handle_t handle;
    110        
    111         /** Reference count */
    112         atomic_t refcnt;
    113        
    114         /** Device which this function belogs to */
    115         ddf_dev_t *dev;
    116        
    117         /** Function type */
    118         fun_type_t ftype;
    119        
    120         /** Function name */
    121         const char *name;
    122        
    123         /** List of device ids for driver matching */
    124         match_id_list_t match_ids;
    125        
    126         /** Driver-specific data associated with this function */
    127         void *driver_data;
    128        
    129         /** Implementation of operations provided by this function */
    130         ddf_dev_ops_t *ops;
    131        
    132         /** Connection handler or @c NULL to use the DDF default handler. */
    133         async_client_conn_t conn_handler;
    134        
    135         /** Link in the list of functions handled by the driver */
    136         link_t link;
    137 };
     81struct ddf_fun;
    13882
    13983/*
     
    167111} driver_t;
    168112
     113/** XXX Only to transition USB */
     114#ifdef _DDF_DATA_IMPLANT
     115extern void ddf_fun_data_implant(ddf_fun_t *, void *);
     116#endif
     117
    169118extern int ddf_driver_main(driver_t *);
    170119
    171120extern void *ddf_dev_data_alloc(ddf_dev_t *, size_t);
     121extern void *ddf_dev_data_get(ddf_dev_t *);
     122extern devman_handle_t ddf_dev_get_handle(ddf_dev_t *);
     123extern const char *ddf_dev_get_name(ddf_dev_t *);
     124extern async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *, exch_mgmt_t);
     125extern async_sess_t *ddf_dev_parent_sess_get(ddf_dev_t *);
    172126extern ddf_fun_t *ddf_fun_create(ddf_dev_t *, fun_type_t, const char *);
     127extern devman_handle_t ddf_fun_get_handle(ddf_fun_t *);
    173128extern void ddf_fun_destroy(ddf_fun_t *);
    174129extern void *ddf_fun_data_alloc(ddf_fun_t *, size_t);
     130extern void *ddf_fun_data_get(ddf_fun_t *);
     131extern const char *ddf_fun_get_name(ddf_fun_t *);
     132extern int ddf_fun_set_name(ddf_fun_t *, const char *);
     133extern ddf_dev_t *ddf_fun_get_dev(ddf_fun_t *);
    175134extern int ddf_fun_bind(ddf_fun_t *);
    176135extern int ddf_fun_unbind(ddf_fun_t *);
     
    178137extern int ddf_fun_offline(ddf_fun_t *);
    179138extern int ddf_fun_add_match_id(ddf_fun_t *, const char *, int);
    180 
     139extern void ddf_fun_set_ops(ddf_fun_t *, ddf_dev_ops_t *);
     140extern void ddf_fun_set_conn_handler(ddf_fun_t *, async_client_conn_t);
    181141extern int ddf_fun_add_to_category(ddf_fun_t *, const char *);
    182142
Note: See TracChangeset for help on using the changeset viewer.