/* usb/request.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * Request routine definitions
 *
 * $Id: request.h,v 1.11 2003/10/07 09:51:36 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_REQUEST_H
#define __USB_REQUEST_H "$Id: request.h,v 1.11 2003/10/07 09:51:36 ben Exp $"

/* need usb/pipe.h for this file to work */

#ifndef __USB_PIPE_H
#include "usb/pipe.h"
#endif /* __USB_PIPE_H */

/** start a request
@param pipe Pipe for the request
@param transaction_information
@param first_frame_to_send 0, or USB frame number to start sending
@param buffer
@param additional_buffer
@param request_waiting_mode
@param result Pointer to result code
@return A waiting structure
@see SWI_USB_RequestStart
*/
extern usb_wait_t * usb_request_start(usb_pipe_t *pipe,
				      unsigned long transaction_information,
				      long first_frame_to_send,
				      usb_buffer_t *buffer,
				      usb_buffer_t *additional_buffer,
				      usb_wait_t   *request_waiting_mode,
				      int *result);

/** start a request with timeout
@param pipe Pipe for the request
@param transaction_information
@param first_frame_to_send 0, or USB frame number to start sending
@param buffer
@param additional_buffer
@param request_waiting_mode
@param timeout timeout value in centi-seconds for request (only taken notice of if the relevant bit is set in transaction_information
@param result Pointer to result code
@return A waiting structure
@see SWI_USB_RequestStart
*/
extern usb_wait_t * usb_request_start2(usb_pipe_t *pipe,
				       unsigned long transaction_information,
				       long first_frame_to_send,
				       usb_buffer_t *buffer,
				       usb_buffer_t *additional_buffer,
				       usb_wait_t   *request_waiting_mode,
				       unsigned long timeout,
				       int *result);

/** get a request state on a given waiting structure
@param waiting_mode
@param result Pointer to result for call
@see SWI_USB_RequestGetState
*/
extern int usb_request_get_state(usb_wait_t *waiting_mode,
				 int *result);

#endif /* __USB_REQUEST_H */
