Ignore:
Timestamp:
2017-12-14T23:01:57Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
837d53d
Parents:
bd05140
git-author:
Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:54)
git-committer:
Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:57)
Message:

usbhost bus: refactor the bus ops

This way, method names better represent the entity it is working with.
Their semantics was shifted a bit.

Regarding the tree of structures:

bus ← device ← endpoint ← batch

Previously, devices were kept in DDF function nodes, and endpoints had
pointer to the bus and device. Now, devices have pointer to bus,
endpoints don't.

Pointer to hcd_t in bus is WIP, and will be removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/endpoint.h

    rbd05140 r6832245  
    4545#include <stdbool.h>
    4646#include <usb/usb.h>
     47#include <usb/host/bus.h>
    4748
    4849typedef struct bus bus_t;
     
    5455        /** Part of linked list. */
    5556        link_t link;
    56         /** Managing bus */
    57         bus_t *bus;
     57        /** USB device */
     58        device_t *device;
    5859        /** Reference count. */
    5960        atomic_t refcnt;
    60         /** USB device */
    61         device_t *device;
    6261        /** Enpoint number */
    6362        usb_endpoint_t endpoint;
     
    8483} endpoint_t;
    8584
    86 extern void endpoint_init(endpoint_t *, bus_t *);
     85extern void endpoint_init(endpoint_t *, device_t *, const usb_endpoint_desc_t *);
    8786
    8887extern void endpoint_add_ref(endpoint_t *);
     
    103102void endpoint_abort(endpoint_t *);
    104103
     104/* Manage the toggle bit */
    105105extern int endpoint_toggle_get(endpoint_t *);
    106106extern void endpoint_toggle_set(endpoint_t *, bool);
     107
     108/* Calculate bandwidth */
     109ssize_t endpoint_count_bw(endpoint_t *, size_t);
     110
     111static inline bus_t *endpoint_get_bus(endpoint_t *ep)
     112{
     113        return ep->device->bus;
     114}
    107115
    108116/** list_get_instance wrapper.
Note: See TracChangeset for help on using the changeset viewer.