Changeset fd07e526 in mainline for uspace/lib/usb/include/usb/usb.h


Ignore:
Timestamp:
2011-09-16T14:50:20Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
432a269, d1e18573
Parents:
47fecbb (diff), 82a31261 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge USB changes from bzr://krabicka.net/orome/helenos/usb/

  • Move common HC code from uhci/ohci drivers to libusbhost
  • Rewrite USB HC interface to have common read/write functions for all transfer types.
  • Restructure hc drivers to avoid some hooks and void* casts
  • Cleanup the code and remove unnecessary mallocs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/usb.h

    r47fecbb rfd07e526  
    3636#define LIBUSB_USB_H_
    3737
     38#include <bool.h>
    3839#include <sys/types.h>
    3940#include <byteorder.h>
     
    105106 * Negative values could be used to indicate error.
    106107 */
    107 typedef int usb_address_t;
     108typedef int16_t usb_address_t;
    108109
    109110/** Default USB address. */
     
    115116 * Negative values could be used to indicate error.
    116117 */
    117 typedef int usb_endpoint_t;
     118typedef int16_t usb_endpoint_t;
    118119
    119120/** Maximum endpoint number in USB 1.1.
     
    125126 * Pair address + endpoint is identification of transaction recipient.
    126127 */
    127 typedef struct {
    128         usb_address_t address;
    129         usb_endpoint_t endpoint;
     128typedef union {
     129        struct {
     130                usb_address_t address;
     131                usb_endpoint_t endpoint;
     132        } __attribute__((packed));
     133        uint32_t packed;
    130134} usb_target_t;
     135
     136/** Check USB target for allowed values (address and endpoint).
     137 *
     138 * @param target.
     139 * @return True, if values are wihtin limits, false otherwise.
     140 */
     141static inline bool usb_target_is_valid(usb_target_t target)
     142{
     143        return !(target.endpoint > 15 || target.endpoint < 0
     144            || target.address >= USB11_ADDRESS_MAX || target.address < 0);
     145}
    131146
    132147/** Compare USB targets (addresses and endpoints).
Note: See TracChangeset for help on using the changeset viewer.