| [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>
|
|---|
| 40 | #include <ipc/devman.h>
|
|---|
| 41 | #include <ipc/dev_iface.h>
|
|---|
| 42 | #include "dev_iface.h"
|
|---|
| 43 |
|
|---|
| 44 | /** Device structure */
|
|---|
| 45 | struct ddf_dev {
|
|---|
| 46 | /**
|
|---|
| 47 | * Globally unique device identifier (assigned to the device by the
|
|---|
| 48 | * device manager).
|
|---|
| 49 | */
|
|---|
| 50 | devman_handle_t handle;
|
|---|
| 51 |
|
|---|
| 52 | /** Reference count */
|
|---|
| 53 | atomic_t refcnt;
|
|---|
| 54 |
|
|---|
| 55 | /** Session with the parent device driver */
|
|---|
| 56 | async_sess_t *parent_sess;
|
|---|
| 57 |
|
|---|
| 58 | /** Device name */
|
|---|
| 59 | const char *name;
|
|---|
| 60 |
|
|---|
| 61 | /** Driver-specific data associated with this device */
|
|---|
| 62 | void *driver_data;
|
|---|
| 63 |
|
|---|
| 64 | /** Link in the list of devices handled by the driver */
|
|---|
| 65 | link_t link;
|
|---|
| 66 | };
|
|---|
| 67 |
|
|---|
| 68 | /** Function structure */
|
|---|
| 69 | struct ddf_fun {
|
|---|
| 70 | /** True if bound to the device manager */
|
|---|
| 71 | bool bound;
|
|---|
| 72 |
|
|---|
| 73 | /** Function indentifier (asigned by device manager) */
|
|---|
| 74 | devman_handle_t handle;
|
|---|
| 75 |
|
|---|
| 76 | /** Reference count */
|
|---|
| 77 | atomic_t refcnt;
|
|---|
| 78 |
|
|---|
| 79 | /** Device which this function belogs to */
|
|---|
| 80 | struct ddf_dev *dev;
|
|---|
| 81 |
|
|---|
| 82 | /** Function type */
|
|---|
| 83 | fun_type_t ftype;
|
|---|
| 84 |
|
|---|
| 85 | /** Function name */
|
|---|
| 86 | const char *name;
|
|---|
| 87 |
|
|---|
| 88 | /** List of device ids for driver matching */
|
|---|
| 89 | match_id_list_t match_ids;
|
|---|
| 90 |
|
|---|
| 91 | /** Driver-specific data associated with this function */
|
|---|
| 92 | void *driver_data;
|
|---|
| 93 |
|
|---|
| 94 | /** Implementation of operations provided by this function */
|
|---|
| 95 | ddf_dev_ops_t *ops;
|
|---|
| 96 |
|
|---|
| 97 | /** Connection handler or @c NULL to use the DDF default handler. */
|
|---|
| 98 | async_client_conn_t conn_handler;
|
|---|
| 99 |
|
|---|
| 100 | /** Link in the list of functions handled by the driver */
|
|---|
| 101 | link_t link;
|
|---|
| 102 | };
|
|---|
| 103 |
|
|---|
| 104 | #endif
|
|---|
| 105 |
|
|---|
| 106 | /**
|
|---|
| 107 | * @}
|
|---|
| 108 | */
|
|---|