Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/include/usbhc_iface.h

    r357a302 r6edd494  
    2727 */
    2828
    29 /** @addtogroup libdrv
    30  * @addtogroup usb
     29/** @addtogroup libdrv usb
    3130 * @{
    3231 */
     
    4039#include "driver.h"
    4140#include <usb/usb.h>
    42 #include <bool.h>
    4341
    4442
     
    5351 *   - argument #1 is target address
    5452 *   - argument #2 is target endpoint
    55  *   - argument #3 is max packet size of the endpoint
     53 *   - argument #3 is buffer size
    5654 * - this call is immediately followed by IPC data write (from caller)
    5755 * - the initial call (and the whole transaction) is answer after the
     
    6664 *   - argument #1 is target address
    6765 *   - argument #2 is target endpoint
    68  *   - argument #3 is max packet size of the endpoint
    69  * - this call is immediately followed by IPC data read (async version)
     66 *   - argument #3 is buffer size
    7067 * - the call is not answered until the device returns some data (or until
    7168 *   error occurs)
     69 * - if the call is answered with EOK, first argument of the answer is buffer
     70 *   hash that could be used to retrieve the actual data
    7271 *
    7372 * Some special methods (NO-DATA transactions) do not send any data. These
    7473 * might behave as both OUT or IN transactions because communication parts
    7574 * where actual buffers are exchanged are omitted.
    76  **
     75 *
     76 * The mentioned data retrieval can be done any time after receiving EOK
     77 * answer to IN method.
     78 * This retrieval is done using the IPC_M_USBHC_GET_BUFFER where
     79 * the first argument is buffer hash from call answer.
     80 * This call must be immediately followed by data read-in and after the
     81 * data are transferred, the initial call (IPC_M_USBHC_GET_BUFFER)
     82 * is answered. Each buffer can be retrieved only once.
     83 *
    7784 * For all these methods, wrap functions exists. Important rule: functions
    7885 * for IN transactions have (as parameters) buffers where retrieved data
     
    8592 */
    8693typedef enum {
     94        /** Tell USB address assigned to device.
     95         * Parameters:
     96         * - devman handle id
     97         * Answer:
     98         * - EINVAL - unknown handle or handle not managed by this driver
     99         * - ENOTSUP - operation not supported by HC (shall not happen)
     100         * - arbitrary error code if returned by remote implementation
     101         * - EOK - handle found, first parameter contains the USB address
     102         */
     103        IPC_M_USBHC_GET_ADDRESS,
     104
     105        /** Asks for data buffer.
     106         * See explanation at usb_iface_funcs_t.
     107         * This function does not have counter part in functional interface
     108         * as it is handled by the remote part itself.
     109         */
     110        IPC_M_USBHC_GET_BUFFER,
     111
     112
    87113        /** Reserve usage of default address.
    88114         * This call informs the host controller that the caller will be
     
    141167        IPC_M_USBHC_INTERRUPT_IN,
    142168
    143         /** Send bulk data to device.
    144          * See explanation at usb_iface_funcs_t (OUT transaction).
    145          */
    146         IPC_M_USBHC_BULK_OUT,
    147 
    148         /** Get bulk data from device.
     169
     170        /** Start WRITE control transfer.
     171         * See explanation at usb_iface_funcs_t (OUT transaction).
     172         */
     173        IPC_M_USBHC_CONTROL_WRITE_SETUP,
     174
     175        /** Send control-transfer data to device.
     176         * See explanation at usb_iface_funcs_t (OUT transaction).
     177         */
     178        IPC_M_USBHC_CONTROL_WRITE_DATA,
     179
     180        /** Terminate WRITE control transfer.
     181         * See explanation at usb_iface_funcs_t (NO-DATA transaction).
     182         */
     183        IPC_M_USBHC_CONTROL_WRITE_STATUS,
     184
     185
     186
     187        /** Start READ control transfer.
     188         * See explanation at usb_iface_funcs_t (OUT transaction).
     189         */
     190        IPC_M_USBHC_CONTROL_READ_SETUP,
     191
     192        /** Get control-transfer data from device.
    149193         * See explanation at usb_iface_funcs_t (IN transaction).
    150194         */
    151         IPC_M_USBHC_BULK_IN,
    152 
    153         /** Issue control WRITE transfer.
    154          * See explanation at usb_iface_funcs_t (OUT transaction) for
    155          * call parameters.
    156          * This call is immediately followed by two IPC data writes
    157          * from the caller (setup packet and actual data).
    158          */
    159         IPC_M_USBHC_CONTROL_WRITE,
    160 
    161         /** Issue control READ transfer.
    162          * See explanation at usb_iface_funcs_t (IN transaction) for
    163          * call parameters.
    164          * This call is immediately followed by IPC data write from the caller
    165          * (setup packet) and IPC data read (buffer that was read).
    166          */
    167         IPC_M_USBHC_CONTROL_READ,
     195        IPC_M_USBHC_CONTROL_READ_DATA,
     196
     197        /** Terminate READ control transfer.
     198         * See explanation at usb_iface_funcs_t (NO-DATA transaction).
     199         */
     200        IPC_M_USBHC_CONTROL_READ_STATUS,
     201
    168202
    169203        /* IPC_M_USB_ */
     
    172206/** Callback for outgoing transfer. */
    173207typedef void (*usbhc_iface_transfer_out_callback_t)(device_t *,
    174     int, void *);
     208    usb_transaction_outcome_t, void *);
    175209
    176210/** Callback for incoming transfer. */
    177211typedef void (*usbhc_iface_transfer_in_callback_t)(device_t *,
    178     int, size_t, void *);
     212    usb_transaction_outcome_t, size_t, void *);
    179213
    180214
    181215/** Out transfer processing function prototype. */
    182 typedef int (*usbhc_iface_transfer_out_t)(device_t *, usb_target_t, size_t,
     216typedef int (*usbhc_iface_transfer_out_t)(device_t *, usb_target_t,
    183217    void *, size_t,
    184218    usbhc_iface_transfer_out_callback_t, void *);
    185219
    186 /** Setup transfer processing function prototype. @deprecated */
     220/** Setup transfer processing function prototype. */
    187221typedef usbhc_iface_transfer_out_t usbhc_iface_transfer_setup_t;
    188222
    189223/** In transfer processing function prototype. */
    190 typedef int (*usbhc_iface_transfer_in_t)(device_t *, usb_target_t, size_t,
     224typedef int (*usbhc_iface_transfer_in_t)(device_t *, usb_target_t,
    191225    void *, size_t,
    192226    usbhc_iface_transfer_in_callback_t, void *);
     
    194228/** USB host controller communication interface. */
    195229typedef struct {
    196         int (*reserve_default_address)(device_t *, usb_speed_t);
     230        int (*tell_address)(device_t *, devman_handle_t, usb_address_t *);
     231
     232        int (*reserve_default_address)(device_t *);
    197233        int (*release_default_address)(device_t *);
    198         int (*request_address)(device_t *, usb_speed_t, usb_address_t *);
     234        int (*request_address)(device_t *, usb_address_t *);
    199235        int (*bind_address)(device_t *, usb_address_t, devman_handle_t);
    200236        int (*release_address)(device_t *, usb_address_t);
     
    203239        usbhc_iface_transfer_in_t interrupt_in;
    204240
    205         usbhc_iface_transfer_out_t bulk_out;
    206         usbhc_iface_transfer_in_t bulk_in;
    207 
    208         int (*control_write)(device_t *, usb_target_t,
    209             size_t,
    210             void *, size_t, void *, size_t,
     241        usbhc_iface_transfer_setup_t control_write_setup;
     242        usbhc_iface_transfer_out_t control_write_data;
     243        int (*control_write_status)(device_t *, usb_target_t,
     244            usbhc_iface_transfer_in_callback_t, void *);
     245
     246        usbhc_iface_transfer_setup_t control_read_setup;
     247        usbhc_iface_transfer_in_t control_read_data;
     248        int (*control_read_status)(device_t *, usb_target_t,
    211249            usbhc_iface_transfer_out_callback_t, void *);
    212 
    213         int (*control_read)(device_t *, usb_target_t,
    214             size_t,
    215             void *, size_t, void *, size_t,
    216             usbhc_iface_transfer_in_callback_t, void *);
    217250} usbhc_iface_t;
    218251
Note: See TracChangeset for help on using the changeset viewer.