Changeset 7dfc06fa in mainline


Ignore:
Timestamp:
2011-04-08T18:08:46Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c6cb76d
Parents:
c1b1944
Message:

Do not send max packet size with each transfer

See ticket #177, #121 and partly #49.

Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ehci-hcd/hc_iface.c

    rc1b1944 r7dfc06fa  
    165165 * @param[in] fun Device function the action was invoked on.
    166166 * @param[in] target Target pipe (address and endpoint number) specification.
    167  * @param[in] max_packet_size Max packet size for the transfer.
    168167 * @param[in] data Data to be sent (in USB endianess, allocated and deallocated
    169168 *      by the caller).
     
    174173 */
    175174static int interrupt_out(ddf_fun_t *fun, usb_target_t target,
    176     size_t max_packet_size, void *data, size_t size,
     175    void *data, size_t size,
    177176    usbhc_iface_transfer_out_callback_t callback, void *arg)
    178177{
     
    191190 * @param[in] fun Device function the action was invoked on.
    192191 * @param[in] target Target pipe (address and endpoint number) specification.
    193  * @param[in] max_packet_size Max packet size for the transfer.
    194192 * @param[in] data Buffer where to store the data (in USB endianess,
    195193 *      allocated and deallocated by the caller).
     
    200198 */
    201199static int interrupt_in(ddf_fun_t *fun, usb_target_t target,
    202     size_t max_packet_size, void *data, size_t size,
     200    void *data, size_t size,
    203201    usbhc_iface_transfer_in_callback_t callback, void *arg)
    204202{
     
    217215 * @param[in] fun Device function the action was invoked on.
    218216 * @param[in] target Target pipe (address and endpoint number) specification.
    219  * @param[in] max_packet_size Max packet size for the transfer.
    220217 * @param[in] data Data to be sent (in USB endianess, allocated and deallocated
    221218 *      by the caller).
     
    226223 */
    227224static int bulk_out(ddf_fun_t *fun, usb_target_t target,
    228     size_t max_packet_size, void *data, size_t size,
     225    void *data, size_t size,
    229226    usbhc_iface_transfer_out_callback_t callback, void *arg)
    230227{
     
    243240 * @param[in] fun Device function the action was invoked on.
    244241 * @param[in] target Target pipe (address and endpoint number) specification.
    245  * @param[in] max_packet_size Max packet size for the transfer.
    246242 * @param[in] data Buffer where to store the data (in USB endianess,
    247243 *      allocated and deallocated by the caller).
     
    252248 */
    253249static int bulk_in(ddf_fun_t *fun, usb_target_t target,
    254     size_t max_packet_size, void *data, size_t size,
     250    void *data, size_t size,
    255251    usbhc_iface_transfer_in_callback_t callback, void *arg)
    256252{
     
    269265 * @param[in] fun Device function the action was invoked on.
    270266 * @param[in] target Target pipe (address and endpoint number) specification.
    271  * @param[in] max_packet_size Max packet size for the transfer.
    272267 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated
    273268 *      and deallocated by the caller).
     
    281276 */
    282277static int control_write(ddf_fun_t *fun, usb_target_t target,
    283     size_t max_packet_size,
    284278    void *setup_packet, size_t setup_packet_size,
    285279    void *data_buffer, size_t data_buffer_size,
     
    300294 * @param[in] fun Device function the action was invoked on.
    301295 * @param[in] target Target pipe (address and endpoint number) specification.
    302  * @param[in] max_packet_size Max packet size for the transfer.
    303296 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated
    304297 *      and deallocated by the caller).
     
    312305 */
    313306static int control_read(ddf_fun_t *fun, usb_target_t target,
    314     size_t max_packet_size,
    315307    void *setup_packet, size_t setup_packet_size,
    316308    void *data_buffer, size_t data_buffer_size,
  • uspace/drv/ohci/iface.c

    rc1b1944 r7dfc06fa  
    196196 * @param[in] fun Device function the action was invoked on.
    197197 * @param[in] target Target pipe (address and endpoint number) specification.
    198  * @param[in] max_packet_size Max packet size for the transfer.
    199198 * @param[in] data Data to be sent (in USB endianess, allocated and deallocated
    200199 *      by the caller).
     
    205204 */
    206205static int interrupt_out(
    207     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     206    ddf_fun_t *fun, usb_target_t target, void *data,
    208207    size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg)
    209208{
    210209        assert(fun);
     210
     211        // FIXME: get from endpoint manager
     212        size_t max_packet_size = 8;
     213
    211214        hc_t *hc = fun_to_hc(fun);
    212215        assert(hc);
     
    239242 * @param[in] fun Device function the action was invoked on.
    240243 * @param[in] target Target pipe (address and endpoint number) specification.
    241  * @param[in] max_packet_size Max packet size for the transfer.
    242244 * @param[in] data Buffer where to store the data (in USB endianess,
    243245 *      allocated and deallocated by the caller).
     
    248250 */
    249251static int interrupt_in(
    250     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     252    ddf_fun_t *fun, usb_target_t target, void *data,
    251253    size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg)
    252254{
    253255        assert(fun);
     256
     257        // FIXME: get from endpoint manager
     258        size_t max_packet_size = 8;
     259
    254260        hc_t *hc = fun_to_hc(fun);
    255261        assert(hc);
     
    281287 * @param[in] fun Device function the action was invoked on.
    282288 * @param[in] target Target pipe (address and endpoint number) specification.
    283  * @param[in] max_packet_size Max packet size for the transfer.
    284289 * @param[in] data Data to be sent (in USB endianess, allocated and deallocated
    285290 *      by the caller).
     
    290295 */
    291296static int bulk_out(
    292     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     297    ddf_fun_t *fun, usb_target_t target, void *data,
    293298    size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg)
    294299{
    295300        assert(fun);
     301
     302        // FIXME: get from endpoint manager
     303        size_t max_packet_size = 8;
     304
    296305        hc_t *hc = fun_to_hc(fun);
    297306        assert(hc);
     
    324333 * @param[in] fun Device function the action was invoked on.
    325334 * @param[in] target Target pipe (address and endpoint number) specification.
    326  * @param[in] max_packet_size Max packet size for the transfer.
    327335 * @param[in] data Buffer where to store the data (in USB endianess,
    328336 *      allocated and deallocated by the caller).
     
    333341 */
    334342static int bulk_in(
    335     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     343    ddf_fun_t *fun, usb_target_t target, void *data,
    336344    size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg)
    337345{
    338346        assert(fun);
     347
     348        // FIXME: get from endpoint manager
     349        size_t max_packet_size = 8;
     350
    339351        hc_t *hc = fun_to_hc(fun);
    340352        assert(hc);
     
    366378 * @param[in] fun Device function the action was invoked on.
    367379 * @param[in] target Target pipe (address and endpoint number) specification.
    368  * @param[in] max_packet_size Max packet size for the transfer.
    369380 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated
    370381 *      and deallocated by the caller).
     
    378389 */
    379390static int control_write(
    380     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,
     391    ddf_fun_t *fun, usb_target_t target,
    381392    void *setup_data, size_t setup_size, void *data, size_t size,
    382393    usbhc_iface_transfer_out_callback_t callback, void *arg)
    383394{
    384395        assert(fun);
     396
     397        // FIXME: get from endpoint manager
     398        size_t max_packet_size = 8;
     399
    385400        hc_t *hc = fun_to_hc(fun);
    386401        assert(hc);
     
    417432 * @param[in] fun Device function the action was invoked on.
    418433 * @param[in] target Target pipe (address and endpoint number) specification.
    419  * @param[in] max_packet_size Max packet size for the transfer.
    420434 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated
    421435 *      and deallocated by the caller).
     
    429443 */
    430444static int control_read(
    431     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,
     445    ddf_fun_t *fun, usb_target_t target,
    432446    void *setup_data, size_t setup_size, void *data, size_t size,
    433447    usbhc_iface_transfer_in_callback_t callback, void *arg)
    434448{
    435449        assert(fun);
     450
     451        // FIXME: get from endpoint manager
     452        size_t max_packet_size = 8;
     453
    436454        hc_t *hc = fun_to_hc(fun);
    437455        assert(hc);
  • uspace/drv/uhci-hcd/iface.c

    rc1b1944 r7dfc06fa  
    204204 * @param[in] fun DDF function that was called.
    205205 * @param[in] target USB device to write to.
    206  * @param[in] max_packet_size maximum size of data packet the device accepts
    207206 * @param[in] data Source of data.
    208207 * @param[in] size Size of data source.
     
    212211 */
    213212static int interrupt_out(
    214     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     213    ddf_fun_t *fun, usb_target_t target, void *data,
    215214    size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg)
    216215{
     
    219218        assert(hc);
    220219
    221         usb_log_debug("Interrupt OUT %d:%d %zu(%zu).\n",
    222             target.address, target.endpoint, size, max_packet_size);
     220        usb_log_debug("Interrupt OUT %d:%d %zu.\n",
     221            target.address, target.endpoint, size);
    223222
    224223        size_t res_bw;
     
    241240        assert(ep->speed ==
    242241            usb_device_keeper_get_speed(&hc->manager, target.address));
    243         assert(ep->max_packet_size == max_packet_size);
    244242        assert(ep->transfer_type == USB_TRANSFER_INTERRUPT);
    245243
     
    261259 * @param[in] fun DDF function that was called.
    262260 * @param[in] target USB device to write to.
    263  * @param[in] max_packet_size maximum size of data packet the device accepts
    264261 * @param[out] data Data destination.
    265262 * @param[in] size Size of data source.
     
    269266 */
    270267static int interrupt_in(
    271     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     268    ddf_fun_t *fun, usb_target_t target, void *data,
    272269    size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg)
    273270{
     
    276273        assert(hc);
    277274
    278         usb_log_debug("Interrupt IN %d:%d %zu(%zu).\n",
    279             target.address, target.endpoint, size, max_packet_size);
     275        usb_log_debug("Interrupt IN %d:%d %zu.\n",
     276            target.address, target.endpoint, size);
    280277
    281278        size_t res_bw;
     
    299296        assert(ep->speed ==
    300297            usb_device_keeper_get_speed(&hc->manager, target.address));
    301         assert(ep->max_packet_size == max_packet_size);
    302298        assert(ep->transfer_type == USB_TRANSFER_INTERRUPT);
    303299
     
    319315 * @param[in] fun DDF function that was called.
    320316 * @param[in] target USB device to write to.
    321  * @param[in] max_packet_size maximum size of data packet the device accepts
    322317 * @param[in] data Source of data.
    323318 * @param[in] size Size of data source.
     
    327322 */
    328323static int bulk_out(
    329     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     324    ddf_fun_t *fun, usb_target_t target, void *data,
    330325    size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg)
    331326{
     
    334329        assert(hc);
    335330
    336         usb_log_debug("Bulk OUT %d:%d %zu(%zu).\n",
    337             target.address, target.endpoint, size, max_packet_size);
     331        usb_log_debug("Bulk OUT %d:%d %zu.\n",
     332            target.address, target.endpoint, size);
    338333
    339334        endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager,
     
    346341        assert(ep->speed ==
    347342            usb_device_keeper_get_speed(&hc->manager, target.address));
    348         assert(ep->max_packet_size == max_packet_size);
    349343        assert(ep->transfer_type == USB_TRANSFER_BULK);
    350344
     
    366360 * @param[in] fun DDF function that was called.
    367361 * @param[in] target USB device to write to.
    368  * @param[in] max_packet_size maximum size of data packet the device accepts
    369362 * @param[out] data Data destination.
    370363 * @param[in] size Size of data source.
     
    374367 */
    375368static int bulk_in(
    376     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size, void *data,
     369    ddf_fun_t *fun, usb_target_t target, void *data,
    377370    size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg)
    378371{
     
    380373        hc_t *hc = fun_to_hc(fun);
    381374        assert(hc);
    382         usb_log_debug("Bulk IN %d:%d %zu(%zu).\n",
    383             target.address, target.endpoint, size, max_packet_size);
     375        usb_log_debug("Bulk IN %d:%d %zu.\n",
     376            target.address, target.endpoint, size);
    384377
    385378        endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager,
     
    392385        assert(ep->speed ==
    393386            usb_device_keeper_get_speed(&hc->manager, target.address));
    394         assert(ep->max_packet_size == max_packet_size);
    395387        assert(ep->transfer_type == USB_TRANSFER_BULK);
    396388
     
    412404 * @param[in] fun DDF function that was called.
    413405 * @param[in] target USB device to write to.
    414  * @param[in] max_packet_size maximum size of data packet the device accepts.
    415406 * @param[in] setup_data Data to send with SETUP transfer.
    416407 * @param[in] setup_size Size of data to send with SETUP transfer (always 8B).
     
    422413 */
    423414static int control_write(
    424     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,
     415    ddf_fun_t *fun, usb_target_t target,
    425416    void *setup_data, size_t setup_size, void *data, size_t size,
    426417    usbhc_iface_transfer_out_callback_t callback, void *arg)
     
    431422        usb_speed_t speed =
    432423            usb_device_keeper_get_speed(&hc->manager, target.address);
    433         usb_log_debug("Control WRITE (%d) %d:%d %zu(%zu).\n",
    434             speed, target.address, target.endpoint, size, max_packet_size);
     424        usb_log_debug("Control WRITE (%d) %d:%d %zu.\n",
     425            speed, target.address, target.endpoint, size);
    435426        endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager,
    436427            target.address, target.endpoint, USB_DIRECTION_BOTH, NULL);
     
    444435
    445436        usb_transfer_batch_t *batch =
    446             batch_get(fun, target, USB_TRANSFER_CONTROL, max_packet_size, speed,
     437            batch_get(fun, target, USB_TRANSFER_CONTROL, ep->max_packet_size, speed,
    447438                data, size, setup_data, setup_size, NULL, callback, arg, ep);
    448439        if (!batch)
     
    461452 * @param[in] fun DDF function that was called.
    462453 * @param[in] target USB device to write to.
    463  * @param[in] max_packet_size maximum size of data packet the device accepts.
    464454 * @param[in] setup_data Data to send with SETUP packet.
    465455 * @param[in] setup_size Size of data to send with SETUP packet (should be 8B).
     
    471461 */
    472462static int control_read(
    473     ddf_fun_t *fun, usb_target_t target, size_t max_packet_size,
     463    ddf_fun_t *fun, usb_target_t target,
    474464    void *setup_data, size_t setup_size, void *data, size_t size,
    475465    usbhc_iface_transfer_in_callback_t callback, void *arg)
     
    481471            usb_device_keeper_get_speed(&hc->manager, target.address);
    482472
    483         usb_log_debug("Control READ(%d) %d:%d %zu(%zu).\n",
    484             speed, target.address, target.endpoint, size, max_packet_size);
     473        usb_log_debug("Control READ(%d) %d:%d %zu.\n",
     474            speed, target.address, target.endpoint, size);
    485475        endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager,
    486476            target.address, target.endpoint, USB_DIRECTION_BOTH, NULL);
     
    490480        }
    491481        usb_transfer_batch_t *batch =
    492             batch_get(fun, target, USB_TRANSFER_CONTROL, max_packet_size, speed,
     482            batch_get(fun, target, USB_TRANSFER_CONTROL, ep->max_packet_size, speed,
    493483                data, size, setup_data, setup_size, callback, NULL, arg, ep);
    494484        if (!batch)
  • uspace/drv/vhc/connhost.c

    rc1b1944 r7dfc06fa  
    257257
    258258static int interrupt_out(ddf_fun_t *fun, usb_target_t target,
    259     size_t max_packet_size,
    260259    void *data, size_t size,
    261260    usbhc_iface_transfer_out_callback_t callback, void *arg)
     
    267266
    268267static int interrupt_in(ddf_fun_t *fun, usb_target_t target,
    269     size_t max_packet_size,
    270268    void *data, size_t size,
    271269    usbhc_iface_transfer_in_callback_t callback, void *arg)
     
    277275
    278276static int control_write(ddf_fun_t *fun, usb_target_t target,
    279     size_t max_packet_size,
    280277    void *setup_packet, size_t setup_packet_size,
    281278    void *data, size_t data_size,
     
    295292
    296293static int control_read(ddf_fun_t *fun, usb_target_t target,
    297     size_t max_packet_size,
    298294    void *setup_packet, size_t setup_packet_size,
    299295    void *data, size_t data_size,
  • uspace/lib/drv/generic/remote_usbhc.c

    rc1b1944 r7dfc06fa  
    270270        }
    271271
    272         size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    273272        usb_target_t target = {
    274273                .address = DEV_IPC_GET_ARG1(*call),
     
    300299        trans->size = len;
    301300
    302         rc = transfer_func(fun, target, max_packet_size,
     301        rc = transfer_func(fun, target,
    303302            buffer, len,
    304303            callback_out, trans);
     
    326325        }
    327326
    328         size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    329327        usb_target_t target = {
    330328                .address = DEV_IPC_GET_ARG1(*call),
     
    348346        trans->size = len;
    349347
    350         int rc = transfer_func(fun, target, max_packet_size,
     348        int rc = transfer_func(fun, target,
    351349            trans->buffer, len,
    352350            callback_in, trans);
     
    414412        };
    415413        size_t data_buffer_len = DEV_IPC_GET_ARG3(*call);
    416         size_t max_packet_size = DEV_IPC_GET_ARG4(*call);
    417414
    418415        int rc;
     
    450447        trans->size = data_buffer_len;
    451448
    452         rc = usb_iface->control_write(fun, target, max_packet_size,
     449        rc = usb_iface->control_write(fun, target,
    453450            setup_packet, setup_packet_len,
    454451            data_buffer, data_buffer_len,
     
    477474                .endpoint = DEV_IPC_GET_ARG2(*call)
    478475        };
    479         size_t max_packet_size = DEV_IPC_GET_ARG3(*call);
    480476
    481477        int rc;
     
    515511        }
    516512
    517         rc = usb_iface->control_read(fun, target, max_packet_size,
     513        rc = usb_iface->control_read(fun, target,
    518514            setup_packet, setup_packet_len,
    519515            trans->buffer, trans->size,
  • uspace/lib/drv/include/usbhc_iface.h

    rc1b1944 r7dfc06fa  
    6666 *   - argument #1 is target address
    6767 *   - argument #2 is target endpoint
    68  *   - argument #3 is max packet size of the endpoint
    6968 * - this call is immediately followed by IPC data read (async version)
    7069 * - the call is not answered until the device returns some data (or until
     
    202201
    203202/** Out transfer processing function prototype. */
    204 typedef int (*usbhc_iface_transfer_out_t)(ddf_fun_t *, usb_target_t, size_t,
     203typedef int (*usbhc_iface_transfer_out_t)(ddf_fun_t *, usb_target_t,
    205204    void *, size_t,
    206205    usbhc_iface_transfer_out_callback_t, void *);
     
    210209
    211210/** In transfer processing function prototype. */
    212 typedef int (*usbhc_iface_transfer_in_t)(ddf_fun_t *, usb_target_t, size_t,
     211typedef int (*usbhc_iface_transfer_in_t)(ddf_fun_t *, usb_target_t,
    213212    void *, size_t,
    214213    usbhc_iface_transfer_in_callback_t, void *);
     
    234233
    235234        int (*control_write)(ddf_fun_t *, usb_target_t,
    236             size_t,
    237235            void *, size_t, void *, size_t,
    238236            usbhc_iface_transfer_out_callback_t, void *);
    239237
    240238        int (*control_read)(ddf_fun_t *, usb_target_t,
    241             size_t,
    242239            void *, size_t, void *, size_t,
    243240            usbhc_iface_transfer_in_callback_t, void *);
Note: See TracChangeset for help on using the changeset viewer.