Changeset b39eb79 in mainline for uspace/drv/bus/usb/uhci/uhci_batch.c


Ignore:
Timestamp:
2011-12-26T17:21:21Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b56a8dd
Parents:
cf5c05c0 (diff), 7e1b130 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/uhci_batch.c

    rcf5c05c0 rb39eb79  
    3434#include <errno.h>
    3535#include <str_error.h>
     36#include <macros.h>
    3637
    3738#include <usb/usb.h>
     
    4546#define DEFAULT_ERROR_COUNT 3
    4647
     48/** Safely destructs uhci_transfer_batch_t structure.
     49 *
     50 * @param[in] uhci_batch Instance to destroy.
     51 */
    4752static void uhci_transfer_batch_dispose(uhci_transfer_batch_t *uhci_batch)
    4853{
     
    5459}
    5560/*----------------------------------------------------------------------------*/
    56 /** Safely destructs uhci_transfer_batch_t structure
    57  *
    58  * @param[in] uhci_batch Instance to destroy.
    59  */
    60 void uhci_transfer_batch_call_dispose(uhci_transfer_batch_t *uhci_batch)
     61/** Finishes usb_transfer_batch and destroys the structure.
     62 *
     63 * @param[in] uhci_batch Instance to finish and destroy.
     64 */
     65void uhci_transfer_batch_finish_dispose(uhci_transfer_batch_t *uhci_batch)
    6166{
    6267        assert(uhci_batch);
    6368        assert(uhci_batch->usb_batch);
    6469        usb_transfer_batch_finish(uhci_batch->usb_batch,
    65             uhci_transfer_batch_data_buffer(uhci_batch),
    66             uhci_batch->usb_batch->buffer_size);
     70            uhci_transfer_batch_data_buffer(uhci_batch));
    6771        uhci_transfer_batch_dispose(uhci_batch);
    6872}
    6973/*----------------------------------------------------------------------------*/
     74/** Transfer batch setup table. */
    7075static void (*const batch_setup[])(uhci_transfer_batch_t*, usb_direction_t);
    7176/*----------------------------------------------------------------------------*/
    7277/** Allocate memory and initialize internal data structure.
    7378 *
    74  * @param[in] fun DDF function to pass to callback.
    75  * @param[in] ep Communication target
    76  * @param[in] buffer Data source/destination.
    77  * @param[in] buffer_size Size of the buffer.
    78  * @param[in] setup_buffer Setup data source (if not NULL)
    79  * @param[in] setup_size Size of setup_buffer (should be always 8)
    80  * @param[in] func_in function to call on inbound transfer completion
    81  * @param[in] func_out function to call on outbound transfer completion
    82  * @param[in] arg additional parameter to func_in or func_out
     79 * @param[in] usb_batch Pointer to generic USB batch structure.
    8380 * @return Valid pointer if all structures were successfully created,
    8481 * NULL otherwise.
     
    156153 * is reached.
    157154 */
    158 bool uhci_transfer_batch_is_complete(uhci_transfer_batch_t *uhci_batch)
     155bool uhci_transfer_batch_is_complete(const uhci_transfer_batch_t *uhci_batch)
    159156{
    160157        assert(uhci_batch);
     
    200197}
    201198/*----------------------------------------------------------------------------*/
     199/** Direction to pid conversion table */
    202200static const usb_packet_id direction_pids[] = {
    203201        [USB_DIRECTION_IN] = USB_PID_IN,
     
    237235
    238236        while (remain_size > 0) {
    239                 const size_t packet_size =
    240                     (remain_size < mps) ? remain_size : mps;
     237                const size_t packet_size = min(remain_size, mps);
    241238
    242239                const td_t *next_td = (td + 1 < uhci_batch->td_count)
     
    309306
    310307        while (remain_size > 0) {
    311                 const size_t packet_size =
    312                     (remain_size < mps) ? remain_size : mps;
     308                const size_t packet_size = min(remain_size, mps);
    313309
    314310                td_init(
Note: See TracChangeset for help on using the changeset viewer.