[56fd7cf] | 1 | /*
|
---|
| 2 | * Copyright (c) 2010 Lenka Trochtova
|
---|
| 3 | * Copyright (c) 2012 Jiri Svoboda
|
---|
| 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup libdrv
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 | /** @file
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | #ifndef DDF_PRIVATE_DRIVER_H_
|
---|
| 37 | #define DDF_PRIVATE_DRIVER_H_
|
---|
| 38 |
|
---|
| 39 | #include <async.h>
|
---|
[498ced1] | 40 | #include <refcount.h>
|
---|
[56fd7cf] | 41 | #include <ipc/devman.h>
|
---|
| 42 | #include <ipc/dev_iface.h>
|
---|
| 43 | #include "dev_iface.h"
|
---|
| 44 |
|
---|
| 45 | /** Device structure */
|
---|
| 46 | struct ddf_dev {
|
---|
| 47 | /**
|
---|
| 48 | * Globally unique device identifier (assigned to the device by the
|
---|
| 49 | * device manager).
|
---|
| 50 | */
|
---|
| 51 | devman_handle_t handle;
|
---|
[a35b458] | 52 |
|
---|
[56fd7cf] | 53 | /** Reference count */
|
---|
[498ced1] | 54 | atomic_refcount_t refcnt;
|
---|
[a35b458] | 55 |
|
---|
[56fd7cf] | 56 | /** Session with the parent device driver */
|
---|
| 57 | async_sess_t *parent_sess;
|
---|
[a35b458] | 58 |
|
---|
[56fd7cf] | 59 | /** Device name */
|
---|
[33b8d024] | 60 | char *name;
|
---|
[a35b458] | 61 |
|
---|
[56fd7cf] | 62 | /** Driver-specific data associated with this device */
|
---|
| 63 | void *driver_data;
|
---|
[a35b458] | 64 |
|
---|
[56fd7cf] | 65 | /** Link in the list of devices handled by the driver */
|
---|
| 66 | link_t link;
|
---|
| 67 | };
|
---|
| 68 |
|
---|
| 69 | /** Function structure */
|
---|
| 70 | struct ddf_fun {
|
---|
| 71 | /** True if bound to the device manager */
|
---|
| 72 | bool bound;
|
---|
[a35b458] | 73 |
|
---|
[56fd7cf] | 74 | /** Function indentifier (asigned by device manager) */
|
---|
| 75 | devman_handle_t handle;
|
---|
[a35b458] | 76 |
|
---|
[56fd7cf] | 77 | /** Reference count */
|
---|
[498ced1] | 78 | atomic_refcount_t refcnt;
|
---|
[a35b458] | 79 |
|
---|
[56fd7cf] | 80 | /** Device which this function belogs to */
|
---|
| 81 | struct ddf_dev *dev;
|
---|
[a35b458] | 82 |
|
---|
[56fd7cf] | 83 | /** Function type */
|
---|
| 84 | fun_type_t ftype;
|
---|
[a35b458] | 85 |
|
---|
[56fd7cf] | 86 | /** Function name */
|
---|
[33b8d024] | 87 | char *name;
|
---|
[a35b458] | 88 |
|
---|
[56fd7cf] | 89 | /** List of device ids for driver matching */
|
---|
| 90 | match_id_list_t match_ids;
|
---|
[a35b458] | 91 |
|
---|
[56fd7cf] | 92 | /** Driver-specific data associated with this function */
|
---|
| 93 | void *driver_data;
|
---|
[a35b458] | 94 |
|
---|
[56fd7cf] | 95 | /** Implementation of operations provided by this function */
|
---|
[facc34d] | 96 | const ddf_dev_ops_t *ops;
|
---|
[a35b458] | 97 |
|
---|
[56fd7cf] | 98 | /** Connection handler or @c NULL to use the DDF default handler. */
|
---|
[b688fd8] | 99 | async_port_handler_t conn_handler;
|
---|
[a35b458] | 100 |
|
---|
[56fd7cf] | 101 | /** Link in the list of functions handled by the driver */
|
---|
| 102 | link_t link;
|
---|
| 103 | };
|
---|
| 104 |
|
---|
| 105 | #endif
|
---|
| 106 |
|
---|
| 107 | /**
|
---|
| 108 | * @}
|
---|
| 109 | */
|
---|