/*
  Date Created:	1/12/2007
  File Name:		metro-usb.h
  Description:	metro-usb.h is the drivers header file. The driver is a USB to Serial converter.
		The driver takes USB data and sends it to a virtual ttyUSB# serial port.
		The driver interfaces with the usbserial.ko driver supplied by Linux. 

		NOTES: 
		To install the driver:
		1. Install the usbserial.ko module supplied by Linux with: # insmod usbserial.ko
		2. Install the metro-usb.ko module with: # insmod metro-usb.ko vender=0x#### product=0x#### debug=1
		   The vendor, product and debug parameters are optional.

  Copyright:	2007 Metrologic Instruments. All rights reserved.
  Requirements: Notepad.exe
 Kernel Support: Fedora Linux 2.6.16.15 
 
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 
  Revision History:

  Date:			Developer:			Revisions:		
  ------------------------------------------------------------------------------
  3/19/2007		Philip Nicastro		Initial release. (v1.0.0.0)
  12/3/2007		Philip Nicastro		Added the needed comments for the GNU General Public License.
  12/3/2007		Philip Nicastro		Released. (v1.1.0.0)
  1/11/2008			Philip Nicastro		Added support for the low speed uni-directional scanners with product number 0x0700.
  1/11/2008			Philip Nicastro		Released. (v1.2.0.0)
  
  
*/

#ifndef __LINUX_USB_SERIAL_METRO
#define __LINUX_USB_SERIAL_METRO

/* Product information. */
#define METROLOGIC_VENDOR_ID		0x0C2E
#define UNI_DIRECTIONAL_PRODUCT_ID	0x0700 
#define BI_DIRECTIONAL_PRODUCT_ID	0x0720

#define METROUSB_SET_REQUEST_TYPE	0x40
#define METROUSB_SET_MODEM_CTRL_REQUEST	10
#define METROUSB_SET_BREAK_REQUEST	0x40 
#define METROUSB_MCR_NONE               0x8     /* Deactivate DTR and RTS. */
#define METROUSB_MCR_RTS                0xa     /* Activate RTS. */
#define METROUSB_MCR_DTR                0x9     /* Activate DTR. */
#define WDR_TIMEOUT 			5000 	/* Default urb timeout. */
#define METROUSB_BUF_SIZE        	512
#define URB_UPPER_LIMIT			42	/* Number of outstanding urbs to prevent userspace DoS from happening. 
						 * Don't know why 42, credited to the visor.c file from Linux. */
#define METROUSB_START_CHAR		0x80  	/* Character for uni-directional (0x700) devices to start sending data. */	
#define METROUSB_STOP_CHAR		0xFF  	/* Character for uni-directional (0x700) devices to stop sending data. */	

/* Private data structure. */
struct metrousb_private {
	spinlock_t lock;
	int bytes_in;	
	int bytes_out; 	
	int outstanding_urbs;
	int throttled;
	unsigned long control_state;
};

#endif
