Changeset 1d758fc in mainline for uspace/lib/usbhost/include


Ignore:
Timestamp:
2018-02-12T10:11:47Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5fe3f954
Parents:
2f762a7
git-author:
Ondřej Hlavatý <aearsis@…> (2018-02-05 03:28:50)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-02-12 10:11:47)
Message:

usb: rethinking DMA buffers

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

Legend:

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

    r2f762a7 r1d758fc  
    153153int bus_device_offline(device_t *);
    154154
    155 int bus_device_send_batch(device_t *, usb_target_t,
    156     usb_direction_t direction, char *, size_t, uint64_t,
    157     usbhc_iface_transfer_callback_t, void *, const char *);
     155/**
     156 * A proforma to USB transfer batch. As opposed to transfer batch, which is
     157 * supposed to be a dynamic structrure, this one is static and descriptive only.
     158 * Its fields are copied to the final batch.
     159 */
     160typedef struct transfer_request {
     161        usb_target_t target;
     162        usb_direction_t dir;
     163
     164        dma_buffer_t buffer;
     165        size_t offset, size;
     166        uint64_t setup;
     167
     168        usbhc_iface_transfer_callback_t on_complete;
     169        void *arg;
     170
     171        const char *name;
     172} transfer_request_t;
     173
     174int bus_issue_transfer(device_t *, const transfer_request_t *);
    158175
    159176errno_t bus_device_send_batch_sync(device_t *, usb_target_t,
  • uspace/lib/usbhost/include/usb/host/endpoint.h

    r2f762a7 r1d758fc  
    5151typedef struct bus bus_t;
    5252typedef struct device device_t;
     53typedef struct transfer_request transfer_request_t;
    5354typedef struct usb_transfer_batch usb_transfer_batch_t;
    5455
     
    9899        /** Maximum size of one transfer */
    99100        size_t max_transfer_size;
    100         /** Policy for transfer buffers */
    101         dma_policy_t transfer_buffer_policy;
     101
     102        /* Policies for transfer buffers */
     103        dma_policy_t transfer_buffer_policy;            /**< A hint for optimal performance. */
     104        dma_policy_t required_transfer_buffer_policy;   /**< Enforced by the library. */
    102105
    103106        /**
     
    122125extern void endpoint_deactivate_locked(endpoint_t *);
    123126
    124 int endpoint_send_batch(endpoint_t *, usb_target_t, usb_direction_t,
    125     char *, size_t, uint64_t, usbhc_iface_transfer_callback_t, void *,
    126     const char *);
     127int endpoint_send_batch(endpoint_t *, const transfer_request_t *);
    127128
    128129static inline bus_t *endpoint_get_bus(endpoint_t *ep)
  • uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h

    r2f762a7 r1d758fc  
    7070        } setup;
    7171
     72        /** DMA buffer with enforced policy */
     73        dma_buffer_t dma_buffer;
     74        /** Size of memory buffer */
     75        size_t offset, size;
     76
    7277        /**
    7378         * In case a bounce buffer is allocated, the original buffer must to be
    7479         * stored to be filled after the IN transaction is finished.
    7580         */
    76         char *buffer;
    77         /** Size of memory buffer */
    78         size_t buffer_size;
    79 
    80         /** DMA buffer with enforced policy */
    81         dma_buffer_t dma_buffer;
     81        char *original_buffer;
    8282        bool is_bounced;
    8383
     
    107107        usb_str_transfer_type_short((batch).ep->transfer_type), \
    108108        usb_str_direction((batch).dir), \
    109         (batch).buffer_size, (batch).ep->max_packet_size
     109        (batch).size, (batch).ep->max_packet_size
    110110
    111111/** Wrapper for bus operation. */
     
    115115void usb_transfer_batch_init(usb_transfer_batch_t *, endpoint_t *);
    116116
     117/** Buffer handling */
     118bool usb_transfer_batch_bounce_required(usb_transfer_batch_t *);
    117119errno_t usb_transfer_batch_bounce(usb_transfer_batch_t *);
    118 /** Buffer preparation */
    119 errno_t usb_transfer_batch_prepare_buffer(usb_transfer_batch_t *, char *);
    120120
    121121/** Batch finalization. */
Note: See TracChangeset for help on using the changeset viewer.