Ignore:
File:
1 edited

Legend:

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

    r6edd494 r357a302  
    2727 */
    2828
    29 /** @addtogroup libdrv usb
     29/** @addtogroup libdrv
     30 * @addtogroup usb
    3031 * @{
    3132 */
     
    3940#include "driver.h"
    4041#include <usb/usb.h>
     42#include <bool.h>
    4143
    4244
     
    5153 *   - argument #1 is target address
    5254 *   - argument #2 is target endpoint
    53  *   - argument #3 is buffer size
     55 *   - argument #3 is max packet size of the endpoint
    5456 * - this call is immediately followed by IPC data write (from caller)
    5557 * - the initial call (and the whole transaction) is answer after the
     
    6466 *   - argument #1 is target address
    6567 *   - argument #2 is target endpoint
    66  *   - argument #3 is buffer size
     68 *   - argument #3 is max packet size of the endpoint
     69 * - this call is immediately followed by IPC data read (async version)
    6770 * - the call is not answered until the device returns some data (or until
    6871 *   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
    7172 *
    7273 * Some special methods (NO-DATA transactions) do not send any data. These
    7374 * might behave as both OUT or IN transactions because communication parts
    7475 * where actual buffers are exchanged are omitted.
    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  *
     76 **
    8477 * For all these methods, wrap functions exists. Important rule: functions
    8578 * for IN transactions have (as parameters) buffers where retrieved data
     
    9285 */
    9386typedef 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 
    11387        /** Reserve usage of default address.
    11488         * This call informs the host controller that the caller will be
     
    167141        IPC_M_USBHC_INTERRUPT_IN,
    168142
    169 
    170         /** Start WRITE control transfer.
     143        /** Send bulk data to device.
    171144         * See explanation at usb_iface_funcs_t (OUT transaction).
    172145         */
    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.
     146        IPC_M_USBHC_BULK_OUT,
     147
     148        /** Get bulk data from device.
    193149         * See explanation at usb_iface_funcs_t (IN transaction).
    194150         */
    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 
     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,
    202168
    203169        /* IPC_M_USB_ */
     
    206172/** Callback for outgoing transfer. */
    207173typedef void (*usbhc_iface_transfer_out_callback_t)(device_t *,
    208     usb_transaction_outcome_t, void *);
     174    int, void *);
    209175
    210176/** Callback for incoming transfer. */
    211177typedef void (*usbhc_iface_transfer_in_callback_t)(device_t *,
    212     usb_transaction_outcome_t, size_t, void *);
     178    int, size_t, void *);
    213179
    214180
    215181/** Out transfer processing function prototype. */
    216 typedef int (*usbhc_iface_transfer_out_t)(device_t *, usb_target_t,
     182typedef int (*usbhc_iface_transfer_out_t)(device_t *, usb_target_t, size_t,
    217183    void *, size_t,
    218184    usbhc_iface_transfer_out_callback_t, void *);
    219185
    220 /** Setup transfer processing function prototype. */
     186/** Setup transfer processing function prototype. @deprecated */
    221187typedef usbhc_iface_transfer_out_t usbhc_iface_transfer_setup_t;
    222188
    223189/** In transfer processing function prototype. */
    224 typedef int (*usbhc_iface_transfer_in_t)(device_t *, usb_target_t,
     190typedef int (*usbhc_iface_transfer_in_t)(device_t *, usb_target_t, size_t,
    225191    void *, size_t,
    226192    usbhc_iface_transfer_in_callback_t, void *);
     
    228194/** USB host controller communication interface. */
    229195typedef struct {
    230         int (*tell_address)(device_t *, devman_handle_t, usb_address_t *);
    231 
    232         int (*reserve_default_address)(device_t *);
     196        int (*reserve_default_address)(device_t *, usb_speed_t);
    233197        int (*release_default_address)(device_t *);
    234         int (*request_address)(device_t *, usb_address_t *);
     198        int (*request_address)(device_t *, usb_speed_t, usb_address_t *);
    235199        int (*bind_address)(device_t *, usb_address_t, devman_handle_t);
    236200        int (*release_address)(device_t *, usb_address_t);
     
    239203        usbhc_iface_transfer_in_t interrupt_in;
    240204
    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,
     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,
     211            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,
    244216            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,
    249             usbhc_iface_transfer_out_callback_t, void *);
    250217} usbhc_iface_t;
    251218
Note: See TracChangeset for help on using the changeset viewer.