/* usb/pipe.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * Pipe routines
 *
 * $Id: pipe.h,v 1.12 2003/09/26 01:39:10 vince 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_PIPE_H
#define __USB_PIPE_H "$Id: pipe.h,v 1.12 2003/09/26 01:39:10 vince Exp $"

struct usb_endpoint_s;

/** Type definition for a pipe
 *
 * This type is defined for future use when the USB pipe and USB endpoint
 * types diverge.
 *
 * @memo USB Pipe type
 */
typedef struct usb_endpoint_s usb_pipe_t;

/** Opens a pipe on a given endpoint
@param act_endpoint Endpoint to open the pipe on
@param behaviour_control behaviour flags for pipe
@param result Pointer to result
@return Opened pipe
@see SWI_USB_PipeOpen
@see USB_PIPE_OPEN_SHARED
@see USB_PIPE_OPEN_EXCLUSIVE
@see USB_PIPE_CLEAR_TOGGLE
*/
extern usb_pipe_t* usb_pipe_open(struct usb_endpoint_s* act_endpoint,
				 unsigned long behaviour_control,
				 int *result);


/** Closes a pipe on a given endpoint.
@param act_endpoint Endpoint to close
@return result
@see SWI_USB_PipeClose
*/
extern int usb_pipe_close(usb_pipe_t *pipe);

/** Clears all transactions from a given endpoint
 @param act_endpoint Endpoint to clear
 @param behaviour_control control how the endpoint is cleared
 @return result
 @see SWI_USB_PipeClear
 @see USB_PIPE_CLEAR_ACTIVATE
*/

extern int usb_pipe_clear(usb_pipe_t *pipe, unsigned long behaviour_control);

/** Stops transaction processing on an endpoint
@param act_endpoint Endpoint to halt transactions on
@return result
@see SWI_USB_PipeHalt
*/
extern int usb_pipe_halt(usb_pipe_t *act_endpoint);

#endif /* __USB_PIPE_H */
