Changeset 63b4f90 in mainline for uspace/drv/root/root.c


Ignore:
Timestamp:
2010-11-19T18:36:29Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
91db50ac
Parents:
3f0a7971
Message:

First step to make virtual HC aware of DDF

Also, devman is automatically started on vt7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/root/root.c

    r3f0a7971 r63b4f90  
    119119}
    120120
     121/** Create virtual USB host controller device.
     122 * Note that the virtual HC is actually device and driver in one
     123 * task.
     124 *
     125 * @param parent Parent device.
     126 * @return Error code.
     127 */
     128static int add_virtual_usb_host_controller(device_t *parent)
     129{
     130        printf(NAME ": adding virtual host contoller.\n");
     131
     132        int rc;
     133        device_t *vhc = NULL;
     134        match_id_t *match_id = NULL;
     135
     136        vhc = create_device();
     137        if (vhc == NULL) {
     138                rc = ENOMEM;
     139                goto failure;
     140        }
     141
     142        vhc->name = "vhc";
     143        printf(NAME ": the new device's name is %s.\n", vhc->name);
     144
     145        /* Initialize match id list. */
     146        match_id = create_match_id();
     147        if (match_id == NULL) {
     148                rc = ENOMEM;
     149                goto failure;
     150        }
     151
     152        match_id->id = "usb&hc=vhc";
     153        match_id->score = 100;
     154        add_match_id(&vhc->match_ids, match_id);
     155
     156        /* Register child device. */
     157        rc = child_device_register(vhc, parent);
     158        if (rc != EOK)
     159                goto failure;
     160
     161        return EOK;
     162
     163failure:
     164        if (match_id != NULL)
     165                match_id->id = NULL;
     166
     167        if (vhc != NULL) {
     168                vhc->name = NULL;
     169                delete_device(vhc);
     170        }
     171
     172        return rc;
     173}
     174
    121175/** Get the root device.
    122176 *
     
    133187                printf(NAME ": failed to add child device for platform.\n");
    134188       
     189        /* Register virtual USB host controller. */
     190        int rc = add_virtual_usb_host_controller(dev);
     191        if (EOK != rc) {
     192                printf(NAME ": failed to add child device - virtual USB HC.\n");
     193        }
     194
    135195        return res;
    136196}
Note: See TracChangeset for help on using the changeset viewer.