/* usb/lib/ctrlmsg.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * USB Library: Header file for sending ctrl messages
 *
 * $Id: ctrlmsg.h,v 1.5 2003/08/13 14:09:28 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_LIB_CTRLMSG_H
#define __USB_LIB_CTRLMSG_H "$Id: ctrlmsg.h,v 1.5 2003/08/13 14:09:28 ben Exp $"

/** Sends a USB control message
The function sends a control message to the specified pipe, filling
the msg buffer specified with the values, and calling usb_request_start
to start the transaction.

@see usb_request_start
@memo Sends an USB standard contrl message
@param ep endpoint of the control pipe
@param data data buffer, or NULL for no data
@param msg  buffer to place message data into (not NULL)
@param wait waiting mode to use
@param reqtype data for request-type field
@param req data for request field
@param val data for the value field
@param index data for the index feild
*/
extern usb_wait_t *
usblib_ctrl_msg(usb_pipe_t *pipe,
                usb_buffer_t *data,
                usb_buffer_t *msg,
                usb_wait_t *wait,
                int reqtype,
                int req,
                int val,
                int index);

/** flag for USBLIB_CTRLMSG to alter size field in message
This flag changes the size field of the usb message to be
calculated from the data->used_size instead of data->size
*/

#define USBLIB_CTRLMSG_SIZEFROMUSED  (0x10000000)

#endif /* __USB_LIB_CTRLMSG_H */
