Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset be9cbec in mainline


Ignore:
Timestamp:
2010-12-04T22:50:26Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
f995350
Parents:
3f45993
Message:

Virtual HC uses provided address management

Location:
uspace/drv/vhc
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/Makefile

    r3f45993 rbe9cbec  
    3939
    4040SOURCES = \
    41         addrmgm.c \
    4241        conndev.c \
    4342        connhost.c \
  • uspace/drv/vhc/conn.h

    r3f45993 rbe9cbec  
    4848
    4949void address_init(void);
    50 int reserve_default_address(device_t *);
    51 int release_default_address(device_t *);
    52 int request_address(device_t *, usb_address_t *);
    53 int release_address(device_t *, usb_address_t);
    54 int bind_address(device_t *, usb_address_t, devman_handle_t);
    5550
    56 int tell_address(device_t *, devman_handle_t, usb_address_t *);
    5751
    5852void default_connection_handler(device_t *, ipc_callid_t, ipc_call_t *);
  • uspace/drv/vhc/connhost.c

    r3f45993 rbe9cbec  
    3636#include <errno.h>
    3737#include <usb/usb.h>
     38#include <usb/hcd.h>
    3839
    3940#include "vhcd.h"
     
    218219}
    219220
     221static usb_address_keeping_t addresses;
     222
     223
     224static int reserve_default_address(device_t *dev)
     225{
     226        usb_address_keeping_reserve_default(&addresses);
     227        return EOK;
     228}
     229
     230static int release_default_address(device_t *dev)
     231{
     232        usb_address_keeping_release_default(&addresses);
     233        return EOK;
     234}
     235
     236static int request_address(device_t *dev, usb_address_t *address)
     237{
     238        usb_address_t addr = usb_address_keeping_request(&addresses);
     239        if (addr < 0) {
     240                return (int)addr;
     241        }
     242
     243        *address = addr;
     244        return EOK;
     245}
     246
     247static int release_address(device_t *dev, usb_address_t address)
     248{
     249        return usb_address_keeping_release(&addresses, address);
     250}
     251
     252static int bind_address(device_t *dev, usb_address_t address,
     253    devman_handle_t handle)
     254{
     255        usb_address_keeping_devman_bind(&addresses, address, handle);
     256        return EOK;
     257}
     258
     259static int tell_address(device_t *dev, devman_handle_t handle,
     260    usb_address_t *address)
     261{
     262        usb_address_t addr = usb_address_keeping_find(&addresses, handle);
     263        if (addr < 0) {
     264                return addr;
     265        }
     266
     267        *address = addr;
     268        return EOK;
     269}
     270
     271void address_init(void)
     272{
     273        usb_address_keeping_init(&addresses, 50);
     274}
    220275
    221276usbhc_iface_t vhc_iface = {
Note: See TracChangeset for help on using the changeset viewer.