Changeset 5cd136ab in mainline for uspace/lib


Ignore:
Timestamp:
2010-04-02T13:37:58Z (16 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9a66bc2e
Parents:
57937dd
Message:

device interfaces and driver cooperation - parts of code

Location:
uspace/lib
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/Makefile

    r57937dd r5cd136ab  
    5454        generic/devmap.c \
    5555        generic/devman.c \
     56        generic/device/hw_res.c \
    5657        generic/event.c \
    5758        generic/errno.c \
  • uspace/lib/libc/generic/devman.c

    r57937dd r5cd136ab  
    2828 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929 */
     30 
     31 /** @addtogroup libc
     32 * @{
     33 */
     34/** @file
     35 */
    3036
    3137#include <string.h>
     
    193199        }
    194200}
     201
     202int devman_device_connect(device_handle_t handle, unsigned int flags)
     203{
     204        int phone;
     205       
     206        if (flags & IPC_FLAG_BLOCKING) {
     207                phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN,
     208                    DEVMAN_CONNECT_TO_DEVICE, handle);
     209        } else {
     210                phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAN,
     211                    DEVMAN_CONNECT_TO_DEVICE, handle);
     212        }
     213       
     214        return phone;
     215}
     216
     217int devman_parent_device_connect(device_handle_t handle, unsigned int flags)
     218{
     219        int phone;
     220       
     221        if (flags & IPC_FLAG_BLOCKING) {
     222                phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN,
     223                    DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle);
     224        } else {
     225                phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAN,
     226                    DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle);
     227        }
     228       
     229        return phone;
     230}
     231
     232/** @}
     233 */
  • uspace/lib/libc/include/devman.h

    r57937dd r5cd136ab  
    4848int devman_child_device_register(const char *, match_id_list_t *, device_handle_t, device_handle_t *);
    4949
     50int devman_device_connect(device_handle_t handle, unsigned int flags);
     51int devman_parent_device_connect(device_handle_t handle, unsigned int flags);
     52
    5053
    5154#endif
  • uspace/lib/libc/include/ipc/dev_iface.h

    r57937dd r5cd136ab  
    7777                        int irq;                       
    7878                } intr;         
    79         };     
     79        } res
    8080} hw_resource_t;
    8181
    82 typedef struct {
     82typedef struct hw_resource_list {
    8383        size_t count;
    8484        hw_resource_t *resources;       
  • uspace/lib/libc/include/ipc/devman.h

    r57937dd r5cd136ab  
    116116        DEVMAN_DRIVER = 1,
    117117        DEVMAN_CLIENT,
    118         DEVMAN_CONNECT_TO_DEVICE
     118        DEVMAN_CONNECT_TO_DEVICE,
     119        DEVMAN_CONNECT_TO_PARENTS_DEVICE
    119120} devman_interface_t;
    120121
  • uspace/lib/libdrv/generic/driver.c

    r57937dd r5cd136ab  
    141141                return;
    142142        }
     143       
     144       
     145        // TODO - if the client is not a driver, check whether it is allowed to use the device
    143146
    144147        // TODO open the device (introduce some callbacks for opening and closing devices registered by the driver)
Note: See TracChangeset for help on using the changeset viewer.