Ignore:
File:
1 edited

Legend:

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

    r77a69ea 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         /** Reference count */
    84         atomic_t refcnt;
    85        
    86         /**
    87          * Session to the parent device driver (if it is different from this
    88          * driver)
    89          */
    90         async_sess_t *parent_sess;
    91        
    92         /** Device name */
    93         const char *name;
    94        
    95         /** Driver-specific data associated with this device */
    96         void *driver_data;
    97        
    98         /** Link in the list of devices handled by the driver */
    99         link_t link;
    100 };
     78struct ddf_dev;
    10179
    10280/** Function structure */
    103 struct ddf_fun {
    104         /** True if bound to the device manager */
    105         bool bound;
    106         /** Function indentifier (asigned by device manager) */
    107         devman_handle_t handle;
    108         /** Reference count */
    109         atomic_t refcnt;
    110        
    111         /** Device which this function belogs to */
    112         ddf_dev_t *dev;
    113        
    114         /** Function type */
    115         fun_type_t ftype;
    116         /** Function name */
    117         const char *name;
    118         /** List of device ids for driver matching */
    119         match_id_list_t match_ids;
    120         /** Driver-specific data associated with this function */
    121         void *driver_data;
    122         /** Implementation of operations provided by this function */
    123         ddf_dev_ops_t *ops;
    124         /** Connection handler or @c NULL to use the DDF default handler. */
    125         async_client_conn_t conn_handler;
    126        
    127         /** Link in the list of functions handled by the driver */
    128         link_t link;
    129 };
     81struct ddf_fun;
    13082
    13183/*
     
    13789        /** Callback method for passing a new device to the device driver */
    13890        int (*dev_add)(ddf_dev_t *);
     91       
    13992        /** Ask driver to remove a device */
    14093        int (*dev_remove)(ddf_dev_t *);
     94       
    14195        /** Inform driver a device disappeared */
    14296        int (*dev_gone)(ddf_dev_t *);
     97       
    14398        /** Ask driver to online a specific function */
    14499        int (*fun_online)(ddf_fun_t *);
     100       
    145101        /** Ask driver to offline a specific function */
    146102        int (*fun_offline)(ddf_fun_t *);
     
    155111} driver_t;
    156112
     113/** XXX Only to transition USB */
     114#ifdef _DDF_DATA_IMPLANT
     115extern void ddf_fun_data_implant(ddf_fun_t *, void *);
     116#endif
     117
    157118extern int ddf_driver_main(driver_t *);
    158119
    159120extern 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 *);
    160126extern 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 *);
    161128extern void ddf_fun_destroy(ddf_fun_t *);
    162129extern 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 *);
    163134extern int ddf_fun_bind(ddf_fun_t *);
    164135extern int ddf_fun_unbind(ddf_fun_t *);
     
    166137extern int ddf_fun_offline(ddf_fun_t *);
    167138extern int ddf_fun_add_match_id(ddf_fun_t *, const char *, int);
    168 
     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);
    169141extern int ddf_fun_add_to_category(ddf_fun_t *, const char *);
    170142
Note: See TracChangeset for help on using the changeset viewer.