Changeset 47a9633 in mainline


Ignore:
Timestamp:
2017-12-20T13:57:14Z (6 years ago)
Author:
Petr Mánek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
02a7575
Parents:
9fd8f14
Message:

usbdiag: mapping endpoints for diagnostic devices the right way

Location:
uspace/drv/bus/usb/usbdiag
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbdiag/device.c

    r9fd8f14 r47a9633  
    4343
    4444#define NAME "usbdiag"
    45 
    46 #define EP_DIR_OUT    0
    47 #define EP_DIR_IN     0x80
    48 #define EP_INT_IN     (EP_DIR_IN | 0x01)
    49 #define EP_INT_OUT    (EP_DIR_OUT | 0x02)
    50 #define EP_BULK_IN    (EP_DIR_IN | 0x03)
    51 #define EP_BULK_OUT   (EP_DIR_OUT | 0x04)
    52 #define EP_ISOC_IN    (EP_DIR_IN | 0x05)
    53 #define EP_ISOC_OUT   (EP_DIR_OUT | 0x06)
    5445
    5546
     
    114105        dev->fun = fun;
    115106
    116         usb_endpoint_mapping_t *epm_out = usb_device_get_mapped_ep(dev->usb_dev, EP_BULK_OUT);
    117         usb_endpoint_mapping_t *epm_in = usb_device_get_mapped_ep(dev->usb_dev, EP_BULK_IN);
     107        usb_endpoint_mapping_t *epm_out = usb_device_get_mapped_ep(dev->usb_dev, USB_DIAG_EP_BULK_OUT);
     108        usb_endpoint_mapping_t *epm_in = usb_device_get_mapped_ep(dev->usb_dev, USB_DIAG_EP_BULK_IN);
    118109
    119110        if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) {
  • uspace/drv/bus/usb/usbdiag/device.h

    r9fd8f14 r47a9633  
    3939#include <usb/dev/device.h>
    4040
     41#define USB_DIAG_EP_INTR_IN    1
     42#define USB_DIAG_EP_INTR_OUT   2
     43#define USB_DIAG_EP_BULK_IN    3
     44#define USB_DIAG_EP_BULK_OUT   4
     45#define USB_DIAG_EP_ISOCH_IN   5
     46#define USB_DIAG_EP_ISOCH_OUT  6
     47
    4148/**
    4249 * USB diagnostic device.
  • uspace/drv/bus/usb/usbdiag/main.c

    r9fd8f14 r47a9633  
    3636#include <errno.h>
    3737#include <usb/debug.h>
     38#include <usb/classes/classes.h>
    3839#include <usb/dev/driver.h>
    3940#include <usbdiag_iface.h>
     
    123124        return ddf_fun_offline(fun);
    124125}
     126
     127static const usb_endpoint_description_t intr_in_ep = {
     128        .transfer_type = USB_TRANSFER_INTERRUPT,
     129        .direction = USB_DIRECTION_IN,
     130        .interface_class = USB_CLASS_DIAGNOSTIC,
     131        .flags = 0
     132};
     133static const usb_endpoint_description_t intr_out_ep = {
     134        .transfer_type = USB_TRANSFER_INTERRUPT,
     135        .direction = USB_DIRECTION_OUT,
     136        .interface_class = USB_CLASS_DIAGNOSTIC,
     137        .flags = 0
     138};
     139static const usb_endpoint_description_t bulk_in_ep = {
     140        .transfer_type = USB_TRANSFER_BULK,
     141        .direction = USB_DIRECTION_IN,
     142        .interface_class = USB_CLASS_DIAGNOSTIC,
     143        .flags = 0
     144};
     145static const usb_endpoint_description_t bulk_out_ep = {
     146        .transfer_type = USB_TRANSFER_BULK,
     147        .direction = USB_DIRECTION_OUT,
     148        .interface_class = USB_CLASS_DIAGNOSTIC,
     149        .flags = 0
     150};
     151static const usb_endpoint_description_t isoch_in_ep = {
     152        .transfer_type = USB_TRANSFER_ISOCHRONOUS,
     153        .direction = USB_DIRECTION_IN,
     154        .interface_class = USB_CLASS_DIAGNOSTIC,
     155        .flags = 0
     156};
     157static const usb_endpoint_description_t isoch_out_ep = {
     158        .transfer_type = USB_TRANSFER_ISOCHRONOUS,
     159        .direction = USB_DIRECTION_OUT,
     160        .interface_class = USB_CLASS_DIAGNOSTIC,
     161        .flags = 0
     162};
     163
     164static const usb_endpoint_description_t *diag_endpoints[] = {
     165        &intr_in_ep,
     166        &intr_out_ep,
     167        &bulk_in_ep,
     168        &bulk_out_ep,
     169        &isoch_in_ep,
     170        &isoch_out_ep,
     171        NULL
     172};
    125173
    126174/** USB diagnostic driver ops. */
     
    137185        .name = NAME,
    138186        .ops = &diag_driver_ops,
    139         .endpoints = NULL
     187        .endpoints = diag_endpoints
    140188};
    141189
Note: See TracChangeset for help on using the changeset viewer.