Ignore:
Timestamp:
2011-10-30T15:35:36Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20a3465, 3ce78580
Parents:
1737bfb (diff), e978ada (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:

Merge from USB branch.

Cleanup libusbhost interfaces.
Fix few possible memory corruption/crashes and memory leaks.
Add device_remove hooks for usbflbk, usbhid.

File:
1 edited

Legend:

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

    r1737bfb r45bf63c  
    4343#define USB_SETUP_PACKET_SIZE 8
    4444
    45 typedef struct usb_transfer_batch usb_transfer_batch_t;
    4645/** Structure stores additional data needed for communication with EP */
    47 struct usb_transfer_batch {
     46typedef struct usb_transfer_batch {
    4847        /** Endpoint used for communication */
    4948        endpoint_t *ep;
     
    7776        /** Callback to properly remove driver data during destruction */
    7877        void (*private_data_dtor)(void *p_data);
    79 };
     78} usb_transfer_batch_t;
    8079
    8180/** Printf formatting string for dumping usb_transfer_batch_t. */
     
    9392
    9493
    95 usb_transfer_batch_t * usb_transfer_batch_get(
     94usb_transfer_batch_t * usb_transfer_batch_create(
    9695    endpoint_t *ep,
    9796    char *buffer,
     
    105104    void (*private_data_dtor)(void *p_data)
    106105);
     106void usb_transfer_batch_destroy(const usb_transfer_batch_t *instance);
    107107
    108 void usb_transfer_batch_finish(usb_transfer_batch_t *instance,
     108void usb_transfer_batch_finish(const usb_transfer_batch_t *instance,
    109109    const void* data, size_t size);
    110 void usb_transfer_batch_call_in(usb_transfer_batch_t *instance);
    111 void usb_transfer_batch_call_out(usb_transfer_batch_t *instance);
    112 void usb_transfer_batch_dispose(usb_transfer_batch_t *instance);
    113 
    114 /** Helper function, calls callback and correctly destroys batch structure.
    115  *
    116  * @param[in] instance Batch structure to use.
    117  */
    118 static inline void usb_transfer_batch_call_in_and_dispose(
    119     usb_transfer_batch_t *instance)
    120 {
    121         assert(instance);
    122         usb_transfer_batch_call_in(instance);
    123         usb_transfer_batch_dispose(instance);
    124 }
    125110/*----------------------------------------------------------------------------*/
    126 /** Helper function calls callback and correctly destroys batch structure.
    127  *
    128  * @param[in] instance Batch structure to use.
    129  */
    130 static inline void usb_transfer_batch_call_out_and_dispose(
    131     usb_transfer_batch_t *instance)
    132 {
    133         assert(instance);
    134         usb_transfer_batch_call_out(instance);
    135         usb_transfer_batch_dispose(instance);
    136 }
    137 /*----------------------------------------------------------------------------*/
    138 /** Helper function, sets error value and finishes transfer.
     111/** Override error value and finishes transfer.
    139112 *
    140113 * @param[in] instance Batch structure to use.
     
    151124}
    152125/*----------------------------------------------------------------------------*/
    153 /** Helper function, determines batch direction absed on the present callbacks
    154  * @param[in] instance Batch structure to use.
     126/** Determine batch direction based on the callbacks present
     127 * @param[in] instance Batch structure to use, non-null.
    155128 * @return USB_DIRECTION_IN, or USB_DIRECTION_OUT.
    156129 */
Note: See TracChangeset for help on using the changeset viewer.