Changeset b357377 in mainline for uspace/lib/usbhost/include


Ignore:
Timestamp:
2018-01-25T02:05:57Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d369b3b
Parents:
5f0b366
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-25 01:23:20)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-25 02:05:57)
Message:

usbhost: make bandwidth accounting a usb2_bus-thing

Location:
uspace/lib/usbhost/include/usb/host
Files:
3 edited

Legend:

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

    r5f0b366 rb357377  
    4141#include <stddef.h>
    4242
    43 /** Bytes per second in FULL SPEED */
    44 #define BANDWIDTH_TOTAL_USB11 (12000000 / 8)
    45 /** 90% of total bandwidth is available for periodic transfers */
    46 #define BANDWIDTH_AVAILABLE_USB11 ((BANDWIDTH_TOTAL_USB11 * 9) / 10)
    47 
    48 /** Number of nanoseconds in one microframe */
    49 #define BANDWIDTH_TOTAL_USB20 (125000)
    50 /** 90% of total bandwidth is available for periodic transfers */
    51 #define BANDWIDTH_AVAILABLE_USB20  ((BANDWIDTH_TOTAL_USB20 * 9) / 10)
    52 
    5343typedef struct endpoint endpoint_t;
    5444
    55 extern ssize_t bandwidth_count_usb11(endpoint_t *, size_t);
     45typedef size_t (*endpoint_count_bw_t)(endpoint_t *);
    5646
    57 extern ssize_t bandwidth_count_usb20(endpoint_t *, size_t);
     47typedef struct {
     48        size_t available_bandwidth;
     49        endpoint_count_bw_t count_bw;
     50} bandwidth_accounting_t;
     51
     52extern const bandwidth_accounting_t bandwidth_accounting_usb11;
     53extern const bandwidth_accounting_t bandwidth_accounting_usb2;
    5854
    5955#endif
  • uspace/lib/usbhost/include/usb/host/bus.h

    r5f0b366 rb357377  
    120120        void (*endpoint_unregister)(endpoint_t *);
    121121        void (*endpoint_destroy)(endpoint_t *);                 /**< Optional */
    122         ssize_t (*endpoint_count_bw) (endpoint_t *, size_t);    /**< Optional */
    123122        usb_transfer_batch_t *(*batch_create)(endpoint_t *);    /**< Optional */
    124123
  • uspace/lib/usbhost/include/usb/host/usb2_bus.h

    r5f0b366 rb357377  
    4242
    4343#include <usb/host/bus.h>
     44#include <usb/host/bandwidth.h>
    4445
    4546typedef struct usb2_bus usb2_bus_t;
     
    5758        /** Size of the bandwidth pool */
    5859        size_t free_bw;
     60
     61        /* Configured bandwidth accounting */
     62        const bandwidth_accounting_t *bw_accounting;
    5963} usb2_bus_t;
    6064
    6165extern const bus_ops_t usb2_bus_ops;
    6266
    63 extern void usb2_bus_init(usb2_bus_t *, size_t);
     67extern void usb2_bus_init(usb2_bus_t *, const bandwidth_accounting_t *);
    6468
    6569#endif
Note: See TracChangeset for help on using the changeset viewer.