Changeset 084ff99 in mainline for uspace/srv/devman/devman.h


Ignore:
Timestamp:
2010-03-14T09:14:50Z (15 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7707954
Parents:
67ba309
Message:

passing device to driver (parts of code)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/devman.h

    r67ba309 r084ff99  
    4141#include <ipc/ipc.h>
    4242#include <fibril_synch.h>
     43#include <atomic.h>
    4344
    4445#include "util.h"
     
    115116/** Representation of a node in the device tree.*/
    116117struct node {
     118        /** The global unique identifier of the device.*/
     119        long handle;
    117120        /** The node of the parent device. */
    118121        node_t *parent;
     
    137140        /** Root device node. */
    138141        node_t *root_node;
     142        atomic_t current_handle;
    139143} dev_tree_t;
    140144
     
    191195void add_driver(driver_list_t *drivers_list, driver_t *drv);
    192196void attach_driver(node_t *node, driver_t *drv);
    193 void add_device(driver_t *drv, node_t *node);
     197void add_device(int phone, driver_t *drv, node_t *node);
    194198bool start_driver(driver_t *drv);
    195199
     
    230234
    231235// Device nodes
    232 node_t * create_root_node();
    233236
    234237static inline node_t * create_dev_node()
     
    238241                memset(res, 0, sizeof(node_t));
    239242        }
     243       
     244        list_initialize(&res->children);
     245        list_initialize(&res->match_ids.ids);
     246       
    240247        return res;
    241248}
    242249
    243 static inline void init_dev_node(node_t *node, node_t *parent)
    244 {
    245         assert(NULL != node);
     250static inline void insert_dev_node(dev_tree_t *tree, node_t *node, node_t *parent)
     251{
     252        assert(NULL != node && NULL != tree);
     253       
     254        node->handle = atomic_postinc(&tree->current_handle);
    246255
    247256        node->parent = parent;
    248257        if (NULL != parent) {
     258                fibril_mutex_lock(&parent->children_mutex);
    249259                list_append(&node->sibling, &parent->children);
     260                fibril_mutex_unlock(&parent->children_mutex);
    250261        }
    251 
    252         list_initialize(&node->children);
    253 
    254         list_initialize(&node->match_ids.ids);
    255262}
    256263
     
    259266
    260267bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list);
     268bool create_root_node(dev_tree_t *tree);
    261269
    262270
Note: See TracChangeset for help on using the changeset viewer.