Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 rf527f58  
    4949 * @return Error code.
    5050 */
    51 static errno_t register_helper(endpoint_t *ep, void *arg)
     51static int register_helper(endpoint_t *ep, void *arg)
    5252{
    5353        hcd_t *hcd = arg;
     
    102102}
    103103
    104 errno_t hcd_request_address(hcd_t *hcd, usb_speed_t speed, usb_address_t *address)
    105 {
    106         assert(hcd);
    107         return usb_bus_request_address(&hcd->bus, address, false, speed);
    108 }
    109 
    110 errno_t hcd_release_address(hcd_t *hcd, usb_address_t address)
     104usb_address_t hcd_request_address(hcd_t *hcd, usb_speed_t speed)
     105{
     106        assert(hcd);
     107        usb_address_t address = 0;
     108        const int ret = usb_bus_request_address(
     109            &hcd->bus, &address, false, speed);
     110        if (ret != EOK)
     111                return ret;
     112        return address;
     113}
     114
     115int hcd_release_address(hcd_t *hcd, usb_address_t address)
    111116{
    112117        assert(hcd);
     
    115120}
    116121
    117 errno_t hcd_reserve_default_address(hcd_t *hcd, usb_speed_t speed)
     122int hcd_reserve_default_address(hcd_t *hcd, usb_speed_t speed)
    118123{
    119124        assert(hcd);
     
    122127}
    123128
    124 errno_t hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir,
     129int hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir,
    125130    usb_transfer_type_t type, size_t max_packet_size, unsigned packets,
    126131    size_t size, usb_address_t tt_address, unsigned tt_port)
     
    132137}
    133138
    134 errno_t hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir)
     139int hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir)
    135140{
    136141        assert(hcd);
     
    147152} toggle_t;
    148153
    149 static void toggle_reset_callback(errno_t retval, void *arg)
     154static void toggle_reset_callback(int retval, void *arg)
    150155{
    151156        assert(arg);
     
    172177 * @return Error code.
    173178 */
    174 errno_t hcd_send_batch(
     179int hcd_send_batch(
    175180    hcd_t *hcd, usb_target_t target, usb_direction_t direction,
    176181    void *data, size_t size, uint64_t setup_data,
     
    232237        }
    233238
    234         const errno_t ret = hcd->ops.schedule(hcd, batch);
     239        const int ret = hcd->ops.schedule(hcd, batch);
    235240        if (ret != EOK)
    236241                usb_transfer_batch_destroy(batch);
     
    244249typedef struct {
    245250        volatile unsigned done;
    246         errno_t ret;
     251        int ret;
    247252        size_t size;
    248253} sync_data_t;
    249254
    250 static void transfer_in_cb(errno_t ret, size_t size, void* data)
     255static void transfer_in_cb(int ret, size_t size, void* data)
    251256{
    252257        sync_data_t *d = data;
     
    257262}
    258263
    259 static void transfer_out_cb(errno_t ret, void* data)
     264static void transfer_out_cb(int ret, void* data)
    260265{
    261266        sync_data_t *d = data;
     
    266271
    267272/** this is really ugly version of sync usb communication */
    268 errno_t hcd_send_batch_sync(
     273ssize_t hcd_send_batch_sync(
    269274    hcd_t *hcd, usb_target_t target, usb_direction_t dir,
    270     void *data, size_t size, uint64_t setup_data, const char* name, size_t *out_size)
     275    void *data, size_t size, uint64_t setup_data, const char* name)
    271276{
    272277        assert(hcd);
    273278        sync_data_t sd = { .done = 0, .ret = EBUSY, .size = size };
    274279
    275         const errno_t ret = hcd_send_batch(hcd, target, dir, data, size, setup_data,
     280        const int ret = hcd_send_batch(hcd, target, dir, data, size, setup_data,
    276281            dir == USB_DIRECTION_IN ? transfer_in_cb : NULL,
    277282            dir == USB_DIRECTION_OUT ? transfer_out_cb : NULL, &sd, name);
     
    284289
    285290        if (sd.ret == EOK)
    286                 *out_size = sd.size;
     291                return sd.size;
    287292        return sd.ret;
    288293}
Note: See TracChangeset for help on using the changeset viewer.