/* usb/buffer.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * Buffer function definitions
 *
 * $Id: buffer.h,v 1.11 2003/08/07 13:06:57 ben Exp $
 *
 * This Library file is part of the Simtec Electronics USB stack development
 *   suite.
 * Specific licence is granted to use this file by third parties for the
 *   development of USB device drivers.
 *
*/

#ifndef __USB_BUFFER_H
#define __USB_BUFFER_H "$Id: buffer.h,v 1.11 2003/08/07 13:06:57 ben Exp $"

/** Allocates a buffer apropriate for a usb transaction.
 All transactions must be performed using a usb_io_buffer this function is used
  to allocate one.
 @memo Allocates a buffer apropriate for a usb transaction.
 @param endpoint Endpoint
 @param size Size of buffer required
 @param external_storage Allows external allocation usually NULL
 @param result Pointer to variable to contain result value
 @return Allocated buffer
 @see SWI_USB_BufferMalloc
 */
extern usb_buffer_t *usb_buffer_malloc(struct usb_endpoint_s *endpoint,
				       unsigned long size,
				       void *external_storage,
				       int *result);

/** Frees a previously allocated buffer
 Use to free a buffer allocated with usb_buffer_malloc()
 @memo Frees a previously allocated buffer
 @param buffer Buffer to free
 @return result value
 @see SWI_USB_BufferFree
*/
extern int usb_buffer_free(usb_buffer_t *buffer);



#endif
