Changeset 57c8fc9 in mainline for uspace/lib/usbhost/src


Ignore:
Timestamp:
2013-09-21T02:17:14Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c898236
Parents:
ce33c10
Message:

libusbhost: Move interrupt enabling to library.

Reduce code duplication.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/ddf_helpers.c

    rce33c10 r57c8fc9  
    3939#include <usb/descriptor.h>
    4040#include <usb/request.h>
     41#include <devman.h>
    4142#include <errno.h>
    4243#include <str_error.h>
     
    640641                ddf_fun_destroy(hc->ctl_fun);
    641642}
     643
     644
     645//TODO: Move this to generic ddf?
     646/** Call the parent driver with a request to enable interrupts
     647 *
     648 * @param[in] device Device asking for interrupts
     649 * @return Error code.
     650 */
     651int hcd_ddf_enable_interrupts(ddf_dev_t *device)
     652{
     653        assert(device);
     654        async_sess_t *parent_sess =
     655            devman_parent_device_connect(EXCHANGE_SERIALIZE,
     656            ddf_dev_get_handle(device), IPC_FLAG_BLOCKING);
     657        const bool enabled = hw_res_enable_interrupt(parent_sess);
     658        async_hangup(parent_sess);
     659
     660        return enabled ? EOK : EIO;
     661}
     662
     663int hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res)
     664{
     665        assert(device);
     666        assert(hw_res);
     667
     668        async_sess_t *parent_sess =
     669            devman_parent_device_connect(EXCHANGE_SERIALIZE,
     670            ddf_dev_get_handle(device), IPC_FLAG_BLOCKING);
     671        hw_res_list_parsed_init(hw_res);
     672        const int ret = hw_res_get_list_parsed(parent_sess, hw_res, 0);
     673        async_hangup(parent_sess);
     674        return ret;
     675}
    642676/**
    643677 * @}
Note: See TracChangeset for help on using the changeset viewer.